Skip to content

Commit

Permalink
mach
Browse files Browse the repository at this point in the history
  • Loading branch information
ArivoliR committed Aug 18, 2024
1 parent 9626f95 commit 7cb1839
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
5 changes: 5 additions & 0 deletions machtousermode/link.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SECTIONS
{
. = 0x80000000;
}

Binary file added machtousermode/mach.elf
Binary file not shown.
30 changes: 30 additions & 0 deletions machtousermode/mach2user.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.section .text
.global main

main :
la t0, mtrap_handler
csrw mtvec, t0
csrr t0, mstatus
csrw mstatus, t0

csrr t2, mcause
csrr t3, mepc
csrr t4, mstatus
csrr t5, mtvec

la t0, ucode
csrw mepc, t0
mret

mtrap_handler :
csrr t2, mcause
csrr t3, mepc
csrr t4, mstatus
csrr t5, mtvec

la t1, ucode
csrw mepc, t1
mret

ucode :
ecall

0 comments on commit 7cb1839

Please sign in to comment.