From de7d9a1b71452f9300c1cc10d300deb7d269e1ab Mon Sep 17 00:00:00 2001 From: WangRunji Date: Thu, 5 Jul 2018 01:13:52 +0800 Subject: [PATCH] Fix asm, can use pseudo ops. --- Makefile | 5 +++++ src/arch/riscv32/boot/{entry.S => entry.asm} | 9 ++------- src/arch/riscv32/mod.rs | 2 -- 3 files changed, 7 insertions(+), 9 deletions(-) rename src/arch/riscv32/boot/{entry.S => entry.asm} (54%) diff --git a/Makefile b/Makefile index be1d263..9f54ade 100644 --- a/Makefile +++ b/Makefile @@ -79,6 +79,7 @@ endif ld := $(prefix)ld objdump := $(prefix)objdump cc := $(prefix)gcc +as := $(prefix)as .PHONY: all clean run iso build asm doc justrun kernel @@ -137,6 +138,10 @@ build/arch/x86_64/boot/%.o: $(boot_src)/%.asm @mkdir -p $(shell dirname $@) @nasm -felf64 $< -o $@ +build/arch/riscv32/boot/%.o: $(boot_src)/%.asm + @mkdir -p $(shell dirname $@) + @$(as) -march=rv32i $< -o $@ + # make .o from .img file build/user/%.o: user/%.img @mkdir -p $(shell dirname $@) diff --git a/src/arch/riscv32/boot/entry.S b/src/arch/riscv32/boot/entry.asm similarity index 54% rename from src/arch/riscv32/boot/entry.S rename to src/arch/riscv32/boot/entry.asm index 55da8e4..3079c9f 100644 --- a/src/arch/riscv32/boot/entry.S +++ b/src/arch/riscv32/boot/entry.asm @@ -1,13 +1,8 @@ .section .text,"ax",%progbits .globl kern_entry kern_entry: - # la sp, bootstacktop - auipc sp, %hi(bootstacktop) - addi sp, sp, %lo(bootstacktop) - - # tail rust_main - auipc t1, %hi(rust_main) - jalr zero, t1, %lo(rust_main) + la sp, bootstacktop + tail rust_main .section .data .align 12 #PGSHIFT diff --git a/src/arch/riscv32/mod.rs b/src/arch/riscv32/mod.rs index cda4be9..de9e012 100644 --- a/src/arch/riscv32/mod.rs +++ b/src/arch/riscv32/mod.rs @@ -1,5 +1,3 @@ -global_asm!(include_str!("boot/entry.S")); - extern crate riscv; extern crate bbl;