From d84f21465c97dbcdbc998be72f3431de3b077fb0 Mon Sep 17 00:00:00 2001 From: WangRunji Date: Thu, 21 Feb 2019 19:54:04 +0800 Subject: [PATCH] biscuit: fix argc, argv --- biscuit/c/libs/litc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/biscuit/c/libs/litc.c b/biscuit/c/libs/litc.c index 5a71d94..24d9d5e 100644 --- a/biscuit/c/libs/litc.c +++ b/biscuit/c/libs/litc.c @@ -3519,7 +3519,7 @@ char __progname[64]; char **environ = _environ; void -_start(int argc, char **argv, struct kinfo_t *k) +__start(int argc, char **argv, struct kinfo_t *k) { kinfo = k; @@ -3532,15 +3532,17 @@ _start(int argc, char **argv, struct kinfo_t *k) } void -_entry(void) +_start(void) { // make sure that the stack is 16-byte aligned, as gcc assumes, after // _start's function prologue. gcc emits SSE instructions that require // 16-byte alignment (misalignment generates #GP). asm( + "movq (%%rsp), %%rdi\n" // argc + "leaq 8(%%rsp), %%rsi\n" // argv "andq $0xfffffffffffffff0, %%rsp\n" "subq $8, %%rsp\n" - "movabs $_start, %%rax\n" + "movabs $__start, %%rax\n" "jmpq *%%rax\n" ::: "memory", "cc"); }