From 2363ceebafdf3a5d75f350b94f6e699874b143cd Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Mon, 27 Jan 2020 02:23:31 -0800 Subject: 5932 --- html/mu-init.subx.html | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 html/mu-init.subx.html (limited to 'html/mu-init.subx.html') diff --git a/html/mu-init.subx.html b/html/mu-init.subx.html new file mode 100644 index 00000000..e9fa6bab --- /dev/null +++ b/html/mu-init.subx.html @@ -0,0 +1,83 @@ + + + + +Mu - mu-init.subx + + + + + + + + + + +https://github.com/akkartik/mu/blob/master/mu-init.subx +
+ 1 # Initialize the minimal runtime for Mu programs.
+ 2 #
+ 3 # See translate_mu for how this file is used.
+ 4 #
+ 5 # Mu programs start at a function called 'main' with this signature:
+ 6 #   fn main args: (address array kernel-string) -> exit_status/ebx: int
+ 7 # If your program doesn't need commandline arguments you can drop it:
+ 8 #   fn main -> exit_status/ebx: int
+ 9 #
+10 # Notice that the output must be in ebx, so that the exit() syscall can pick
+11 # it up.
+12 
+13 == code
+14 
+15 Entry:
+16     # we don't use ebp in Entry; just initialize it
+17     bd/copy-to-ebp 0/imm32
+18     # var args/eax: (address array kernel-string)
+19     89/<- %eax 4/r32/esp
+20     # initialize the heap
+21     (new-segment *Heap-size Heap)
+22     # run Mu program
+23     (main %eax)
+24     # exit
+25     (syscall_exit)
+
+ + + -- cgit 1.4.1-2-gfad0