mirror of
https://github.com/SmallPond/MIT6.828_OS.git
synced 2026-04-30 05:41:08 +08:00
my solution to lab5
This commit is contained in:
@@ -274,7 +274,7 @@ env_alloc(struct Env **newenv_store, envid_t parent_id)
|
||||
env_free_list = e->env_link;
|
||||
*newenv_store = e;
|
||||
|
||||
cprintf("[%08x] new env %08x\n", curenv ? curenv->env_id : 0, e->env_id);
|
||||
cprintf(".%08x. new env %08x\n", curenv ? curenv->env_id : 0, e->env_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -415,14 +415,19 @@ void
|
||||
env_create(uint8_t *binary, enum EnvType type)
|
||||
{
|
||||
// LAB 3: Your code here.
|
||||
|
||||
struct Env *newenv;
|
||||
int ret = 0;
|
||||
if ((ret = env_alloc(&newenv, 0)) < 0) {
|
||||
panic("env_create: %e\n", ret);
|
||||
}
|
||||
newenv->env_type = type;
|
||||
if (type == ENV_TYPE_FS) {
|
||||
newenv->env_tf.tf_eflags |= FL_IOPL_MASK;
|
||||
}
|
||||
load_icode(newenv, binary);
|
||||
|
||||
// If this is the file server (type == ENV_TYPE_FS) give it I/O privileges.
|
||||
// LAB 5: Your code here.
|
||||
}
|
||||
|
||||
//
|
||||
@@ -442,7 +447,7 @@ env_free(struct Env *e)
|
||||
lcr3(PADDR(kern_pgdir));
|
||||
|
||||
// Note the environment's demise.
|
||||
cprintf("[%08x] free env %08x\n", curenv ? curenv->env_id : 0, e->env_id);
|
||||
cprintf(".%08x. free env %08x\n", curenv ? curenv->env_id : 0, e->env_id);
|
||||
|
||||
// Flush all mapped pages in the user portion of the address space
|
||||
static_assert(UTOP % PTSIZE == 0);
|
||||
|
||||
Reference in New Issue
Block a user