my solution to lab5

This commit is contained in:
winPond
2019-07-11 19:40:12 +08:00
parent 1f043fb694
commit f78713349c
364 changed files with 8775 additions and 3249 deletions

View File

@@ -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);