misaligned2.ms 901 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # Test LDR instructions with offsets misaligned by 2 bytes.
  2. # mach(): all
  3. .macro invalid
  4. # This is "undefined" but it's not properly decoded yet.
  5. .word 0x07ffffff
  6. # This is stc which isn't recognized yet.
  7. stc 0,cr0,[r0]
  8. .endm
  9. .global _start
  10. _start:
  11. # Run some simple insns to confirm the engine is at least working.
  12. nop
  13. # Skip over output text.
  14. bl do_test
  15. pass:
  16. .asciz "pass\n"
  17. .p2align 2
  18. do_test:
  19. mov r4, r14
  20. bl continue
  21. word1:
  22. .word 0x5555
  23. continue:
  24. ldr r6, [r14, #2]
  25. ldr r7, word2
  26. cmp r6, r7
  27. # Failed.
  28. bne done
  29. output_next:
  30. # Output a character (in arm mode).
  31. mov r0,#3
  32. mov r1,r4
  33. swi #0x123456
  34. # Load next character, see if done.
  35. add r4,r4,#1
  36. sub r3,r3,r3
  37. ldrb r5,[r4,r3]
  38. teq r5,#0
  39. bne output_next
  40. done:
  41. mov r0,#0x18
  42. ldr r1,exit_code
  43. swi #0x123456
  44. # If that fails, try to die with an invalid insn.
  45. invalid
  46. exit_code:
  47. .word 0x20026
  48. word2:
  49. .word 0x55550000