sts.s 805 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #
  2. ! $Source$
  3. ! $State$
  4. ! $Revision$
  5. #include "powerpc.h"
  6. .sect .text
  7. ! Stores a variable-sized structure from the stack.
  8. !
  9. ! r3 = size
  10. ! r4 = address
  11. .define .sts
  12. .sts:
  13. ! These sizes are handled specially.
  14. lwz r5, 0(sp)
  15. cmpi cr0, 0, r3, 1
  16. bc IFFALSE, GT, size1
  17. cmpi cr0, 0, r3, 2
  18. bc IFFALSE, GT, size2
  19. cmpi cr0, 0, r3, 4
  20. bc IFFALSE, GT, size4
  21. ! Variable-sized structure.
  22. addi r3, r3, 3
  23. andi. r3, r3, ~3 ! align size
  24. srawi r3, r3, 2 ! convert size to the number of words
  25. mtspr ctr, r3
  26. 1:
  27. lwz r5, 0(sp)
  28. addi sp, sp, 4
  29. stw r5, 0(r4)
  30. addi r4, r4, 4
  31. bc DNZ, 0, 1b ! decrement CTR, jump if non-zero
  32. bclr ALWAYS, 0, 0
  33. size1:
  34. stb r5, 0(r4)
  35. b 1f
  36. size2:
  37. sth r5, 0(r4)
  38. b 1f
  39. size4:
  40. stw r5, 0(r4)
  41. 1:
  42. addi sp, sp, 4
  43. bclr ALWAYS, 0, 0