1 // Called from entry.S to get us going.
2 // entry.S already took care of defining envs, pages, vpd, and vpt.
6 asmlinkage
void umain(int argc
, char **argv
);
8 const volatile struct Env
*thisenv
;
9 // Make "env" (which you used in the last lab) a synonym for "thisenv"
10 // (which you will use in future labs).
11 static const volatile struct Env
*env
__attribute__((alias("thisenv")));
12 const char *binaryname
= "<unknown>";
15 libmain(int argc
, char **argv
)
17 extern uintptr_t sctors
[], ectors
[];
20 // set env to point at our env structure in envs[].
21 thisenv
= 0; /* Really? */
23 // save the name of the program so that panic() can use it
27 // Call any global constructors (e.g., defined by C++).
28 // This relies on linker script magic to define the 'sctors' and
29 // 'ectors' symbols; see user/user.ld.
30 for (ctorva
= ectors
; ctorva
> sctors
; )
31 ((void(*)()) *--ctorva
)();
33 // call user main routine