csb.s 898 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #
  2. ! $Source$
  3. ! $State$
  4. ! $Revision$
  5. #include "powerpc.h"
  6. .sect .text
  7. ! this is not a subroutine, but just a
  8. ! piece of code that computes the jump-
  9. ! address and jumps to it.
  10. ! traps if resulting address is zero
  11. !
  12. ! On entry: r3 = address of CSB table
  13. ! r4 = value
  14. .define .csb
  15. .csb:
  16. lwz r5, 0(r3) ! load default
  17. mtspr ctr, r5
  18. lwz r6, 4(r3) ! fetch count
  19. 1:
  20. or. r6, r6, r6 ! test count
  21. bcctr IFTRUE, EQ, 0 ! exit if zero
  22. addi r6, r6, -1 ! otherwise decrement
  23. lwzu r7, 8(r3) ! fetch target index, increment pointer
  24. cmp cr0, 0, r4, r7 ! compare with value
  25. bc IFFALSE, EQ, 1b ! if not equal, go again
  26. lwz r7, 4(r3) ! fetch target address
  27. mtspr ctr, r7
  28. or. r7, r7, r7 ! test it
  29. bcctr IFFALSE, EQ, 0 ! jump to target if non-zero
  30. b .trap_ecase ! otherwise trap