test/pages/machine.ras 698 B raw
1
//! Physical page zeroing with canaries immediately outside the allocation.
2
.text;
3
    li %s0 0x40010000;
4
    slli %s0 %s0 1;
5
    li %t0 4096;
6
    add %s1 %s0 %t0;
7
    li %t0 91;
8
    sd %t0 -8(%s0);
9
    sd %t0 0(%s1);
10
    mv %t1 %s0;
11
@fill
12
    sd %t0 0(%t1);
13
    addi %t1 %t1 8;
14
    bne %t1 %s1 @fill;
15
    mv %a0 %s0;
16
    li %a1 1;
17
    call @kernel::pages::zero;
18
    mv %t1 %s0;
19
@check
20
    ld %t0 0(%t1);
21
    bnez %t0 @fail;
22
    addi %t1 %t1 8;
23
    bne %t1 %s1 @check;
24
    li %t0 91;
25
    ld %t1 -8(%s0);
26
    bne %t0 %t1 @fail;
27
    ld %t1 0(%s1);
28
    bne %t0 %t1 @fail;
29
    li %t0 0x10001000;
30
    li %t1 0x5555;
31
    sw %t1 0(%t0);
32
@fail
33
    li %t0 0x10001000;
34
    li %t1 0x13333;
35
    sw %t1 0(%t0);