* same with xv6
[mascara-docs.git] / i386 / standford / 2004 / src / lab4 / kern / env.h
blob739994f16634d426c35bd5d4849932aad8c0a2a4
1 /* See COPYRIGHT for copyright information. */
3 #ifndef _KERN_ENV_H_
4 #define _KERN_ENV_H_
6 #include <inc/env.h>
8 LIST_HEAD(Env_list, Env);
9 extern struct Env *envs; // All environments
10 extern struct Env *curenv; // the current env
12 void env_init(void);
13 int env_alloc(struct Env **e, u_int parent_id);
14 void env_free(struct Env *);
15 void env_create(u_char *binary, int size);
16 void env_destroy(struct Env *e);
18 int envid2env(u_int envid, struct Env **penv, int checkperm);
19 void env_run(struct Env *e);
20 void env_pop_tf(struct Trapframe *tf);
22 // for the grading script
23 #define ENV_CREATE2(x, y) \
24 { \
25 extern u_char x[], y[]; \
26 env_create(x, (int)y); \
29 #define ENV_CREATE(x) \
30 { \
31 extern u_char _binary_obj_##x##_start[], \
32 _binary_obj_##x##_size[]; \
33 env_create(_binary_obj_##x##_start, \
34 (int)_binary_obj_##x##_size); \
37 #endif // !_KERN_ENV_H_