Program startup details | Pintos Documentation
The Pintos C library for user programs designates _start(), in lib/user/entry.c, as the entry point for user programs. This function is a wrapper around main() that calls exit() if main() returns: The kernel must put the arguments for the initial function on the stack before it allows the user program to begin executing. The arguments are passed in the same way as the normal calling convention (see 80x86 Calling Convention). Consider how to handle arguments for the following example command: /bin/ls -l foo bar. First, break the command into words: /bin/ls, -l, foo, bar. Place the words at the top of the stack. Order doesn’t matter, because they will be referenced through pointers. Then, push the address of each string plus a null pointer sentinel, on the stack, in right-to-left order. These are the elements of argv. The null pointer sentinel ensures that argv[argc] is a null pointer, as required by the C standard. The order ensures that argv[0] is at the lowest virtual address. The x86
Program startup details | Pintos Documentation Skip to main content Menu Expand (external link) Document Search Copy Copied Pintos Documentation Program startup details The Pintos C library for user programs designates _start() , in lib/user/entry.c , as the entry point for user programs. This function is a wrapper around main() that calls exit() if main() returns: void _start (int argc, char *argv[]) { exit (main (argc, argv)); } The kernel must put the arguments for the initial function on the stack before it allows the user program to begin executing. The arguments are passed in the same wa
Explore this link on the map →related reading
- The "Basics" | Putting the "You" in CPUcpu.land
- Process Control Syscalls | CS 162 Project 1cs162.org
- Command Line Interface Guidelinesclig.dev
- how I think when I think about programming - alice mazalicemaz.com
- Syscalls | Pintos Documentationcs162.org
- Syscall implementation | CS 162 HW 4cs162.org
- Thread functions | Pintos Documentationcs162.org
- x86 Assembly and Call Stack | Computer Securitytextbook.cs161.org
- Implementation requirements | CS 162 Project 2cs162.org
- CS107 Lab 6: Runtime Stackweb.stanford.edu
- The little book about OS developmentlittleosbook.github.io
- Virtual memory layout | Pintos Documentationcs162.org