[Modified] change toolchain to la32r
This commit is contained in:
@@ -2,53 +2,37 @@ K=kernel
|
||||
U=user
|
||||
|
||||
OBJS = \
|
||||
$K/entry.o \
|
||||
$K/start.o \
|
||||
$K/console.o \
|
||||
$K/printf.o \
|
||||
$K/uart.o \
|
||||
$K/kalloc.o \
|
||||
$K/spinlock.o \
|
||||
$K/string.o \
|
||||
$K/main.o \
|
||||
$K/vm.o \
|
||||
$K/proc.o \
|
||||
$K/swtch.o \
|
||||
$K/trampoline.o \
|
||||
$K/trap.o \
|
||||
$K/syscall.o \
|
||||
$K/sysproc.o \
|
||||
$K/bio.o \
|
||||
$K/fs.o \
|
||||
$K/log.o \
|
||||
$K/sleeplock.o \
|
||||
$K/file.o \
|
||||
$K/pipe.o \
|
||||
$K/exec.o \
|
||||
$K/sysfile.o \
|
||||
$K/kernelvec.o \
|
||||
$K/plic.o \
|
||||
$K/virtio_disk.o
|
||||
$K/entry.o \
|
||||
$K/start.o \
|
||||
$K/console.o \
|
||||
$K/printf.o \
|
||||
$K/uart.o \
|
||||
$K/kalloc.o \
|
||||
$K/spinlock.o \
|
||||
$K/string.o \
|
||||
$K/main.o \
|
||||
$K/vm.o \
|
||||
$K/proc.o \
|
||||
$K/swtch.o \
|
||||
$K/trampoline.o \
|
||||
$K/trap.o \
|
||||
$K/syscall.o \
|
||||
$K/sysproc.o \
|
||||
$K/bio.o \
|
||||
$K/fs.o \
|
||||
$K/log.o \
|
||||
$K/sleeplock.o \
|
||||
$K/file.o \
|
||||
$K/pipe.o \
|
||||
$K/exec.o \
|
||||
$K/sysfile.o \
|
||||
$K/kernelvec.o \
|
||||
$K/plic.o \
|
||||
$K/virtio_disk.o
|
||||
|
||||
# riscv64-unknown-elf- or riscv64-linux-gnu-
|
||||
# perhaps in /opt/riscv/bin
|
||||
#TOOLPREFIX =
|
||||
|
||||
# Try to infer the correct TOOLPREFIX if not set
|
||||
ifndef TOOLPREFIX
|
||||
TOOLPREFIX := $(shell if riscv64-unknown-elf-objdump -i 2>&1 | grep 'elf64-big' >/dev/null 2>&1; \
|
||||
then echo 'riscv64-unknown-elf-'; \
|
||||
elif riscv64-linux-gnu-objdump -i 2>&1 | grep 'elf64-big' >/dev/null 2>&1; \
|
||||
then echo 'riscv64-linux-gnu-'; \
|
||||
elif riscv64-unknown-linux-gnu-objdump -i 2>&1 | grep 'elf64-big' >/dev/null 2>&1; \
|
||||
then echo 'riscv64-unknown-linux-gnu-'; \
|
||||
else echo "***" 1>&2; \
|
||||
echo "*** Error: Couldn't find a riscv64 version of GCC/binutils." 1>&2; \
|
||||
echo "*** To turn off this error, run 'gmake TOOLPREFIX= ...'." 1>&2; \
|
||||
echo "***" 1>&2; exit 1; fi)
|
||||
endif
|
||||
|
||||
QEMU = qemu-system-riscv64
|
||||
TOOLPREFIX ?=
|
||||
|
||||
CC = $(TOOLPREFIX)gcc
|
||||
AS = $(TOOLPREFIX)gas
|
||||
@@ -146,30 +130,5 @@ clean:
|
||||
$U/usys.S \
|
||||
$(UPROGS)
|
||||
|
||||
# try to generate a unique GDB port
|
||||
GDBPORT = $(shell expr `id -u` % 5000 + 25000)
|
||||
# QEMU's gdb stub command line changed in 0.11
|
||||
QEMUGDB = $(shell if $(QEMU) -help | grep -q '^-gdb'; \
|
||||
then echo "-gdb tcp::$(GDBPORT)"; \
|
||||
else echo "-s -p $(GDBPORT)"; fi)
|
||||
ifndef CPUS
|
||||
CPUS := 3
|
||||
endif
|
||||
|
||||
QEMUOPTS = -machine virt -bios none -kernel $K/kernel -m 128M -smp $(CPUS) -nographic
|
||||
QEMUOPTS += -global virtio-mmio.force-legacy=false
|
||||
QEMUOPTS += -drive file=fs.img,if=none,format=raw,id=x0
|
||||
QEMUOPTS += -device virtio-blk-device,drive=x0,bus=virtio-mmio-bus.0
|
||||
|
||||
build: $K/kernel fs.img
|
||||
|
||||
qemu: $K/kernel fs.img
|
||||
$(QEMU) $(QEMUOPTS)
|
||||
|
||||
.gdbinit: .gdbinit.tmpl-riscv
|
||||
sed "s/:1234/:$(GDBPORT)/" < $^ > $@
|
||||
|
||||
qemu-gdb: $K/kernel .gdbinit fs.img
|
||||
@echo "*** Now run 'gdb' in another window." 1>&2
|
||||
$(QEMU) $(QEMUOPTS) -S $(QEMUGDB)
|
||||
|
||||
|
||||
0
lasoft/xv6-la/kernel/la32r.h
Normal file
0
lasoft/xv6-la/kernel/la32r.h
Normal file
@@ -51,7 +51,7 @@ start()
|
||||
w_tp(id);
|
||||
|
||||
// switch to supervisor mode and jump to main().
|
||||
asm volatile("mret");
|
||||
asm volatile("ertn");
|
||||
}
|
||||
|
||||
// arrange to receive timer interrupts.
|
||||
|
||||
Reference in New Issue
Block a user