RISC-V machine code monitor. Contribute to krakenlake/vmon development by creating an account on GitHub.
GitHub is where people build software. More than 100 million people use GitHub to discover, fork, and contribute to over 420 million projects.
AUIPC(add upper immediate to pc)用于构造相对pc地址(pc-relative address),格式也为U-type。 AUIPC首先会生成一个32bit的偏移量(offset),其低12bits用0填充,然后将该偏移量与该指令的地址相加,所得结果放至寄存器rd。 lui和auipc的汇编语法并不会表示U-immediate的低12bits,它们总为0。基于AUIPC,可通过1个2...
When MODE=Direct, all traps into machine mode cause the pc to be set to the address in the BASE field. When MODE=Vectored, all synchronous exceptions into machine mode cause the pc to be set to the address in the BASE field, whereas interrupts cause the pc to be set to the address i...
// scratch area for timer interrupt, one per CPU.//存放每个hart对应的时钟中断上下文环境---中断上下文环境占用32*uint64大小uint64 mscratch0[NCPU*32];// assembly code in kernelvec.S for machine-mode timer interrupt.externvoidtimervec();// set up to receive timer interrupts in machine mode,...
然而对于类Unix的操作系统来说,异常都是由操作系统来处理。而操着系统运行的模式是S-Mode,所以RISCV也可以选择将异常重新导向到S-Mode,也支持异常委托机制(Machine Interrupt Delegaintion)将异常直接通过S-Mode进行处理,这样可以大大的增加操作系统的灵活性。
(sometimes, also the RISC-V machine emulated by using Spike, or an FPGA board with a soft RISC-V core); 2) follow the code from the given application to the OS kernel based on the understanding; 3) complete the proxy OS kernel to make the application (or the system) to execute ...
STORE x31, 31* REGBYTES(sp) //call C code handler call software_handler //finished interrupt handling, ready to return LOAD x1, 1* REGBYTES(sp) LOAD x2, 2* REGBYTES(sp) ... LOAD x31, 31* REGBYTES(sp) addi sp, sp, 32*REGBYTES mret 在以上的代码中,中断例程将首先对通用寄存器...
The following example shows how to load an absolute address: .section .text .globl _start _start: lui a1, %hi(msg) # load msg(hi) addi a1, a1, %lo(msg) # load msg(lo) jalr ra, puts 2: j 2b .section .rodata msg: .string "Hello World\n" ...
machine_trap_init();//msoftint_make();//timer_set(timer_get() + TIMER_CLK_RATE);machine_switchto_supervisor(); } 将“mstatus”中的MPP位域设置为s模式,这样当执行“mret”指令后就可以切换到s模式。 将“mepc”设置为main函数的地址,表示,切换到s模式时执行main函数的代码。