AntonLydike / riscemu

RISC-V emulator in python
MIT License
48 stars 14 forks source link

[priv] triggering a timer interrupt directly after returning from kernel decrements the PC by 4 #9

Open AntonLydike opened 2 years ago

AntonLydike commented 2 years ago

See the attached screenshot for an example: grafik

The kernel returns to user mode at _start (0x34e8) + 0x10. A timer interrupt is taken immediately (all user mode instructions are printed), the kernel then reschedules the thread (as it is the only active one), but resumes at _start (0x34e8) + 0xc, 4 bytes (or one instruction) before the previous return.