my solution to lab 6

This commit is contained in:
winPond
2019-07-17 16:08:06 +08:00
parent 8147d99448
commit c62da1c86d
534 changed files with 60875 additions and 6513 deletions

View File

@@ -274,7 +274,8 @@ 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;
}
@@ -416,6 +417,7 @@ 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) {
@@ -426,6 +428,7 @@ env_create(uint8_t *binary, enum EnvType type)
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.
}
@@ -447,7 +450,8 @@ 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);