From 8a19547957a86bed3f58c9abc1ac218d04698faf Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Tue, 8 Apr 2025 10:39:48 -0400 Subject: break apart c libaray --- user/lib/entry.S | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 user/lib/entry.S (limited to 'user/lib/entry.S') diff --git a/user/lib/entry.S b/user/lib/entry.S new file mode 100644 index 0000000..87ad9c7 --- /dev/null +++ b/user/lib/entry.S @@ -0,0 +1,25 @@ +// +// user-level startup routine +// + .text + .globl _start + .globl main + .globl exit + +// entry point - this is where the kernel starts us running +_start: + // we immediately call main() + call main + + // if we come back from that, it means the user + // program didn't call exit(), in which case the + // value returned from main() is the exit status + + // push that value onto the stack and call exit() + subl $12, %esp + pushl %eax + call exit + + // if we come back from that, something bad has + // happened, so we just lock up +1: jmp 1b -- cgit v1.2.3-freya