mirror of
https://github.com/plctlab/riscv-operating-system-mooc.git
synced 2025-11-16 12:34:47 +00:00
@@ -1,6 +1,12 @@
|
||||
#ifdef CONFIG_RV64
|
||||
#define LOAD ld
|
||||
#define STORE sd
|
||||
#define SIZE_REG 8
|
||||
#else
|
||||
#define LOAD lw
|
||||
#define STORE sw
|
||||
#define SIZE_REG 4
|
||||
#endif
|
||||
|
||||
# Save all General-Purpose(GP) registers to context.
|
||||
# struct context *base = &ctx_task;
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
#ifdef CONFIG_RV64
|
||||
#define SIZE_PTR .dword
|
||||
#else
|
||||
#define SIZE_PTR .word
|
||||
#endif
|
||||
|
||||
.section .rodata
|
||||
.global HEAP_START
|
||||
|
||||
@@ -93,8 +93,13 @@ static inline void w_mie(reg_t x)
|
||||
}
|
||||
|
||||
/* Machine-mode Cause Masks */
|
||||
#ifdef CONFIG_RV64
|
||||
#define MCAUSE_MASK_INTERRUPT (reg_t)0x8000000000000000
|
||||
#define MCAUSE_MASK_ECODE (reg_t)0x7FFFFFFFFFFFFFFF
|
||||
#else
|
||||
#define MCAUSE_MASK_INTERRUPT (reg_t)0x80000000
|
||||
#define MCAUSE_MASK_ECODE (reg_t)0x7FFFFFFF
|
||||
#endif
|
||||
|
||||
static inline reg_t r_mcause()
|
||||
{
|
||||
|
||||
@@ -9,7 +9,12 @@ typedef unsigned long long uint64_t;
|
||||
/*
|
||||
* Register Width
|
||||
*/
|
||||
#ifdef CONFIG_RV64
|
||||
typedef uint64_t reg_t;
|
||||
typedef uint64_t ptr_t;
|
||||
#else
|
||||
typedef uint32_t reg_t;
|
||||
typedef uint32_t ptr_t;
|
||||
#endif
|
||||
|
||||
#endif /* __TYPES_H__ */
|
||||
|
||||
@@ -2,15 +2,25 @@
|
||||
# This file will be included by the Makefile of each project.
|
||||
|
||||
# Custom Macro Definition (Common part)
|
||||
ARCH = RV64
|
||||
|
||||
include ../defines.mk
|
||||
DEFS +=
|
||||
|
||||
CROSS_COMPILE = riscv64-unknown-elf-
|
||||
CFLAGS += -nostdlib -fno-builtin -g -Wall
|
||||
ifeq (${ARCH}, RV64)
|
||||
CFLAGS += -march=rv64g -mabi=lp64 -mcmodel=medany
|
||||
else
|
||||
CFLAGS += -march=rv32g -mabi=ilp32
|
||||
endif
|
||||
|
||||
ifeq (${ARCH}, RV64)
|
||||
QEMU = qemu-system-riscv64
|
||||
else
|
||||
QEMU = qemu-system-riscv32
|
||||
endif
|
||||
|
||||
QFLAGS = -nographic -smp 1 -machine virt -bios none
|
||||
|
||||
GDB = gdb-multiarch
|
||||
|
||||
@@ -2,6 +2,13 @@
|
||||
# Support customization in the Makefile files for each project separately.
|
||||
# And also support customization in common.mk
|
||||
|
||||
ifeq (${ARCH}, RV64)
|
||||
DEFS += -DCONFIG_RV64
|
||||
else
|
||||
# RV32 or default is 32bit
|
||||
DEFS += -DCONFIG_RV32
|
||||
endif
|
||||
|
||||
ifeq (${SYSCALL}, y)
|
||||
DEFS += -DCONFIG_SYSCALL
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user