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