Compare commits
2 commits
3e27882a75
...
c9ad69a32d
Author | SHA1 | Date | |
---|---|---|---|
c9ad69a32d | |||
385d448746 |
3 changed files with 9 additions and 3 deletions
|
@ -2,6 +2,7 @@
|
|||
#include <am.h>
|
||||
#include <klib.h>
|
||||
#include <riscv/riscv.h>
|
||||
#include <stdint.h>
|
||||
|
||||
static Context *(*user_handler)(Event, Context *) = NULL;
|
||||
|
||||
|
@ -37,7 +38,10 @@ bool cte_init(Context *(*handler)(Event, Context *)) {
|
|||
}
|
||||
|
||||
Context *kcontext(Area kstack, void (*entry)(void *), void *arg) {
|
||||
return NULL;
|
||||
Context *c = kstack.end - sizeof(Context);
|
||||
c->mepc = (uintptr_t)entry;
|
||||
c->gpr[10] = (uintptr_t)arg;
|
||||
return c;
|
||||
}
|
||||
|
||||
void yield() {
|
||||
|
|
|
@ -60,6 +60,8 @@ __am_asm_trap:
|
|||
mv a0, sp
|
||||
jal __am_irq_handle
|
||||
|
||||
mv sp, a0
|
||||
|
||||
LOAD t1, OFFSET_STATUS(sp)
|
||||
LOAD t2, OFFSET_EPC(sp)
|
||||
csrw mstatus, t1
|
||||
|
|
|
@ -158,8 +158,6 @@ breakpoint_t *cpu_exec_with_bp(uint64_t n, breakpoint_t *bp, size_t len) {
|
|||
static Decode s;
|
||||
nemu_state.state = NEMU_RUNNING;
|
||||
do {
|
||||
exec_once(&s, cpu.pc);
|
||||
g_nr_guest_inst++;
|
||||
for (int i = 0; i < len; i++) {
|
||||
size_t addr = bp[i].addr;
|
||||
bp_type_t bptype = bp[i].type;
|
||||
|
@ -176,6 +174,8 @@ breakpoint_t *cpu_exec_with_bp(uint64_t n, breakpoint_t *bp, size_t len) {
|
|||
return bp + i;
|
||||
}
|
||||
}
|
||||
exec_once(&s, cpu.pc);
|
||||
g_nr_guest_inst++;
|
||||
if (nemu_state.state != NEMU_RUNNING)
|
||||
return NULL;
|
||||
} while (--n);
|
||||
|
|
Loading…
Reference in a new issue