pintos/src/userprog/process.c File Reference

#include "userprog/process.h"
#include <debug.h>
#include <inttypes.h>
#include <round.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "userprog/gdt.h"
#include "userprog/pagedir.h"
#include "userprog/tss.h"
#include "filesys/directory.h"
#include "filesys/file.h"
#include "filesys/filesys.h"
#include "threads/flags.h"
#include "threads/init.h"
#include "threads/interrupt.h"
#include "threads/palloc.h"
#include "threads/thread.h"
#include "threads/vaddr.h"

Go to the source code of this file.

Data Structures

struct  Elf32_Ehdr
struct  Elf32_Phdr

Defines

#define PE32Wx   PRIx32
#define PE32Ax   PRIx32
#define PE32Ox   PRIx32
#define PE32Hx   PRIx16
#define PT_NULL   0
#define PT_LOAD   1
#define PT_DYNAMIC   2
#define PT_INTERP   3
#define PT_NOTE   4
#define PT_SHLIB   5
#define PT_PHDR   6
#define PT_STACK   0x6474e551
#define PF_X   1
#define PF_W   2
#define PF_R   4

Typedefs

typedef uint32_t Elf32_Word
typedef uint32_t Elf32_Addr
typedef uint32_t Elf32_Off
typedef uint16_t Elf32_Half

Functions

static bool load (const char *cmdline, void(**eip)(void), void **esp)
tid_t process_execute (const char *file_name)
static void start_process (void *file_name_)
int process_wait (tid_t child_tid UNUSED)
void process_exit (void)
void process_activate (void)
static bool setup_stack (void **esp)
static bool validate_segment (const struct Elf32_Phdr *, struct file *)
static bool load_segment (struct file *file, off_t ofs, uint8_t *upage, uint32_t read_bytes, uint32_t zero_bytes, bool writable)
static bool install_page (void *upage, void *kpage, bool writable)

Variables

static thread_func start_process NO_RETURN


Define Documentation

#define PE32Ax   PRIx32

Definition at line 145 of file process.c.

#define PE32Hx   PRIx16

Definition at line 147 of file process.c.

#define PE32Ox   PRIx32

Definition at line 146 of file process.c.

#define PE32Wx   PRIx32

Definition at line 144 of file process.c.

#define PF_R   4

Definition at line 197 of file process.c.

#define PF_W   2

Definition at line 196 of file process.c.

#define PF_X   1

Definition at line 195 of file process.c.

#define PT_DYNAMIC   2

Definition at line 187 of file process.c.

Referenced by load().

#define PT_INTERP   3

Definition at line 188 of file process.c.

Referenced by load().

#define PT_LOAD   1

Definition at line 186 of file process.c.

Referenced by load().

#define PT_NOTE   4

Definition at line 189 of file process.c.

Referenced by load().

#define PT_NULL   0

Definition at line 185 of file process.c.

Referenced by load().

#define PT_PHDR   6

Definition at line 191 of file process.c.

Referenced by load().

#define PT_SHLIB   5

Definition at line 190 of file process.c.

Referenced by load().

#define PT_STACK   0x6474e551

Definition at line 192 of file process.c.

Referenced by load().


Typedef Documentation

Definition at line 140 of file process.c.

Definition at line 141 of file process.c.

Definition at line 140 of file process.c.

Definition at line 140 of file process.c.


Function Documentation

static bool install_page ( void *  upage,
void *  kpage,
bool  writable 
) [static]

Definition at line 458 of file process.c.

References NULL, pagedir_get_page(), pagedir_set_page(), and thread_current().

Referenced by load_segment(), and setup_stack().

bool load ( const char *  cmdline,
void(**)(void)  eip,
void **  esp 
) [static]

static bool load_segment ( struct file file,
off_t  ofs,
uint8_t upage,
uint32_t  read_bytes,
uint32_t  zero_bytes,
bool  writable 
) [static]

void process_activate ( void   ) 

Definition at line 124 of file process.c.

References pagedir_activate(), thread_current(), and tss_update().

Referenced by load(), and schedule_tail().

tid_t process_execute ( const char *  file_name  ) 

void process_exit ( void   ) 

Definition at line 97 of file process.c.

References NULL, pagedir_activate(), pagedir_destroy(), and thread_current().

Referenced by thread_exit().

int process_wait ( tid_t child_tid  UNUSED  ) 

Definition at line 90 of file process.c.

Referenced by run_task().

static bool setup_stack ( void **  esp  )  [static]

Definition at line 431 of file process.c.

References install_page(), NULL, PAL_USER, PAL_ZERO, palloc_free_page(), palloc_get_page(), PGSIZE, and PHYS_BASE.

Referenced by load().

static void start_process ( void *  file_name_  )  [static]

static bool validate_segment ( const struct Elf32_Phdr phdr,
struct file file 
) [static]


Variable Documentation

thread_func start_process NO_RETURN [static]

Definition at line 22 of file process.c.


Generated on Mon Jan 10 16:43:58 2011 for Pintos by  doxygen 1.5.6