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