endmem1.ms 942 B

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