* same with xv6
[mascara-docs.git] / i386 / ucla / src / lab3 / lib / entry.S
blob9027b05215b388971864162b7bf59436a89536f9
1 #include <inc/mmu.h>
2 #include <inc/memlayout.h>
4 .data
7 // Define the global symbols 'envs', 'pages', 'vpt', and 'vpd'
8 // so that they can be used in C as if they were ordinary global arrays.
9         .globl envs
10         .set envs, UENVS
11         .globl pages
12         .set pages, UPAGES
13         .globl vpt
14         .set vpt, UVPT
15         .globl vpd
16         .set vpd, (UVPT+(UVPT>>12)*4)
19 // Entrypoint - this is where the kernel (or our parent environment)
20 // starts us running when we are initially loaded into a new environment.
21 .text
22 .globl _start
23 _start:
24         // See if we were started with arguments on the stack
25         cmpl $USTACKTOP, %esp
26         jne args_exist
28         // If not, push dummy argc/argv arguments.
29         // This happens when we are loaded by the kernel,
30         // because the kernel does not know about passing arguments.
31         pushl $0
32         pushl $0
34 args_exist:
35         call libmain
36 1:      jmp 1b