endmem1.ms revision 1.1.1.1 1 # mach: crisv3 crisv8 crisv10 crisv32
2
3 ; Check that the simulator and the program agrees on the
4 ; value of endmem; the base point for further allocations.
5
6 .include "testutils.inc"
7 start
8
9 ; First, get the end of memory by calling brk with 0 to get
10 ; the current value.
11 clear.d $r10
12 movu.w 0x2d,$r9
13 break 13
14
15 ; Get one more 8192-byte page.
16 addu.w 8192,$r10
17
18 ; Save it in a (call- and) syscall-saved register.
19 move.d $r10,$r0
20
21 ; Call brk again to raise the value.
22 movu.w 0x2d,$r9
23 break 13
24
25 ; If the simulator messed up internally, it'd have exited
26 ; with an error at the brk call. But, let's sanity-check
27 ; the return-value: it should be the same as the input and
28 ; the allocated memory should be accessible.
29 cmp.d $r10,$r0
30 beq 0f
31 nop
32
33 1:
34 fail
35
36 0:
37 ; Check that we can write and read the last address on that
38 ; page.
39 subq 4,$r10
40 move.d 0xbad1d101,$r12
41 move.d $r12,[$r10]
42 move.d [$r10],$r11
43 cmp.d $r11,$r12
44 bne 1b
45 nop
46
47 pass
48