summaryrefslogtreecommitdiff
path: root/website-kernel/fs/exec.S
blob: c16e73fb44b36ced07c0af25b07bd0c7e72fb958 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
.section .text
.global __userspace_invoke
.type __userspace_invoke, @function

# __userspace_invoke(fn exec *entry)
__userspace_invoke:
    csrw mscratch, sp
    csrw mepc, a0
    csrw mie, zero

    csrr t0, mstatus
    li t1, (3 << 11)
    not t1, t1
    and t0, t0, t1

    li t1, (1 << 7)
    not t1, t1
    and t0, t0, t1

    li t1, (1 << 3)
    not t1, t1
    and t0, t0, t1

    csrw mstatus, t0

    mret