From a1d9dcc78cce58418ad0e022206a7e93fa393105 Mon Sep 17 00:00:00 2001 From: Harry Chen Date: Thu, 4 Apr 2019 14:47:02 +0800 Subject: [PATCH] Fix ucore user app compiling on x86_64 Signed-off-by: Harry Chen --- Makefile | 2 -- README.md | 2 +- ucore/src/arch/{i386 => x86_64}/arch.h | 0 ucore/src/arch/{i386 => x86_64}/atomic.h | 0 ucore/src/arch/{i386 => x86_64}/initcode.S | 12 ++---------- 5 files changed, 3 insertions(+), 13 deletions(-) rename ucore/src/arch/{i386 => x86_64}/arch.h (100%) rename ucore/src/arch/{i386 => x86_64}/atomic.h (100%) rename ucore/src/arch/{i386 => x86_64}/initcode.S (61%) diff --git a/Makefile b/Makefile index 5626ef5..1a94164 100644 --- a/Makefile +++ b/Makefile @@ -37,13 +37,11 @@ rust: @cp $(rust_bins) $(out_dir)/rust ucore: -ifneq ($(arch), x86_64) @echo Building ucore programs @mkdir -p ucore/build @cd ucore/build && cmake $(cmake_build_args) .. && make @rm -rf $(out_dir)/ucore && mkdir -p $(out_dir)/ucore @cp $(ucore_bin_path)/* $(out_dir)/ucore -endif biscuit: ifneq ($(shell uname)-$(arch), Darwin-riscv64) diff --git a/README.md b/README.md index cb59801..ad90504 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ A rootfs is created at `build/$(arch)` and converted to `qcow2`. | | x86_64 | aarch64 | riscv32 | riscv64 | mipsel | | ------------------ | ------ | ------- | ------- | ------- | ------ | -| ucore | ❌ | ✅ | ✅ | ✅ | ✅ | +| ucore | ✅ | ✅ | ✅ | ✅ | ✅ | | rust | ✅ | ✅ | ✅ | ✅ | ✅ | | biscuit | ✅ | ✅ | ✅ | ✅ | ✅ | | nginx (linux only) | ✅ | ✅ | ✅ | ✅ | ✅ | diff --git a/ucore/src/arch/i386/arch.h b/ucore/src/arch/x86_64/arch.h similarity index 100% rename from ucore/src/arch/i386/arch.h rename to ucore/src/arch/x86_64/arch.h diff --git a/ucore/src/arch/i386/atomic.h b/ucore/src/arch/x86_64/atomic.h similarity index 100% rename from ucore/src/arch/i386/atomic.h rename to ucore/src/arch/x86_64/atomic.h diff --git a/ucore/src/arch/i386/initcode.S b/ucore/src/arch/x86_64/initcode.S similarity index 61% rename from ucore/src/arch/i386/initcode.S rename to ucore/src/arch/x86_64/initcode.S index e6b4936..40e6ff4 100644 --- a/ucore/src/arch/i386/initcode.S +++ b/ucore/src/arch/x86_64/initcode.S @@ -4,21 +4,13 @@ _start: # set ebp for backtrace movl $0x0, %ebp - # load argc and argv - movl (%esp), %ebx - lea 0x4(%esp), %ecx - - # move down the esp register # since it may cause page fault in backtrace subl $0x20, %esp - # save argc and argv on stack - pushl %ecx - pushl %ebx - # call user-program function + # according to fastcall ABI, the first 6 parameters are in registes + # so we do not need to copy (argc, argv) as on i386 call umain -1: jmp 1b