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