Skip to content

Commit

Permalink
split machine/supervisor entry points for tamago/riscv64
Browse files Browse the repository at this point in the history
  • Loading branch information
abarisani committed Sep 12, 2022
1 parent e43fb18 commit 7ef5f11
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/runtime/rt0_tamago_riscv64.s
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,33 @@
#include "funcdata.h"
#include "textflag.h"

#define s0 8
#define uie 0x004
#define t0 5

#define sie 0x104
#define hie 0x204
#define mstatus 0x300
#define mie 0x304

#define CSRC(RS,CSR) WORD $(0x3073 + RS<<15 + CSR<<20)
#define CSRS(RS,CSR) WORD $(0x2073 + RS<<15 + CSR<<20)
#define CSRW(RS,CSR) WORD $(0x1073 + RS<<15 + CSR<<20)

// entry point for M privilege level instances
TEXT _rt0_riscv64_tamago(SB),NOSPLIT|NOFRAME,$0
// Disable interrupts
MOV $0, S0
CSRW (s0, sie)
CSRW (s0, mie)
MOV $0x7FFF, S0
CSRC (s0, mstatus)
MOV $0, T0
CSRW (t0, sie)
CSRW (t0, mie)
MOV $0x7FFF, T0
CSRC (t0, mstatus)

// Enable FPU
MOV $(1<<13), S0
CSRS (s0, mstatus)
MOV $(1<<13), T0
CSRS (t0, mstatus)

JMP _rt0_riscv64_tamago_start(SB)

runtime_start:
// entry point for S/U privilege level instances
TEXT _rt0_riscv64_tamago_start(SB),NOSPLIT|NOFRAME,$0
MOV runtime·ramStart(SB), X2
MOV runtime·ramSize(SB), T1
MOV runtime·ramStackOffset(SB), T2
Expand Down

0 comments on commit 7ef5f11

Please sign in to comment.