test/loader/machine.ras 711 B raw
1
//! Run the loader fixture after all harts complete production initialization.
2
.text;
3
    call @kernel::boot::initialize;
4
    beqz %a0 @wait;
5
    call @kernel::loadcheck::run;
6
    li %t0 0x10001000;
7
    li %t1 0x5555;
8
    sw %t1 0(%t0);
9
@wait
10
    wfi;
11
    j @wait;
12
13
.export @kernel::loadcheck::memory;
14
.export @kernel::loadcheck::invoke;
15
16
// The caller supplies an address within its validated source Page.
17
@kernel::loadcheck::memory
18
    ret;
19
20
// Preserve kernel state while calling one private instance of shared code.
21
@kernel::loadcheck::invoke
22
    addi %sp %sp -16;
23
    sd %ra 8(%sp);
24
    sd %gp 0(%sp);
25
    mv %gp %a1;
26
    jalr %ra %a0 0;
27
    ld %gp 0(%sp);
28
    ld %ra 8(%sp);
29
    addi %sp %sp 16;
30
    ret;