aboutsummaryrefslogtreecommitdiff
path: root/system/x86_64/start.S
diff options
context:
space:
mode:
authorKlaatu <[email protected]>2015-05-17 15:33:21 +1200
committerKlaatu <[email protected]>2015-05-17 15:33:21 +1200
commitb0de699679e8f1e39af847ed172d1ba605b4370c (patch)
tree01dac00471d61f727394e508c613b29cff0ceae5 /system/x86_64/start.S
bulk upload of source
Diffstat (limited to 'system/x86_64/start.S')
-rw-r--r--system/x86_64/start.S17
1 files changed, 17 insertions, 0 deletions
diff --git a/system/x86_64/start.S b/system/x86_64/start.S
new file mode 100644
index 0000000..b31b9b1
--- /dev/null
+++ b/system/x86_64/start.S
@@ -0,0 +1,17 @@
+.text
+.global _start
+_start:
+ popq %rdi /* %rdi = argc */
+ movq %rsp,%rsi /* %rsi = argv */
+ pushq %rdi
+
+ leaq 8(%rsi,%rdi,8),%rdx /* %rdx = envp = (8*rdi)+%rsi+8 */
+
+ movq %rdx, environ(%rip)
+ call main
+ movq %rax, %rdi /* return value */
+ call exit
+ hlt
+.Lstart:
+ .size _start,.Lstart-_start
+