atom.s 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. TEXT ainc(SB),$0 /* long ainc(long *); */
  2. MOVW R3, R4
  3. xincloop:
  4. LWAR (R4), R3
  5. ADD $1, R3
  6. DCBT (R4) /* fix 405 errata cpu_210 */
  7. STWCCC R3, (R4)
  8. BNE xincloop
  9. RETURN
  10. TEXT adec(SB),$0 /* long adec(long *); */
  11. MOVW R3, R4
  12. xdecloop:
  13. LWAR (R4), R3
  14. ADD $-1, R3
  15. DCBT (R4) /* fix 405 errata cpu_210 */
  16. STWCCC R3, (R4)
  17. BNE xdecloop
  18. RETURN
  19. TEXT loadlink(SB), $0
  20. LWAR (R3), R3
  21. RETURN
  22. TEXT storecond(SB), $0
  23. MOVW val+4(FP), R4
  24. DCBT (R3) /* fix 405 errata cpu_210 */
  25. STWCCC R4, (R3)
  26. BNE storecondfail
  27. MOVW $1, R3
  28. RETURN
  29. storecondfail:
  30. MOVW $0, R3
  31. RETURN
  32. /*
  33. * int cas32(u32int *p, u32int ov, u32int nv);
  34. * int cas(uint *p, int ov, int nv);
  35. * int casp(void **p, void *ov, void *nv);
  36. * int casl(ulong *p, ulong ov, ulong nv);
  37. */
  38. TEXT cas32+0(SB),0,$0
  39. TEXT cas+0(SB),0,$0
  40. TEXT casp+0(SB),0,$0
  41. TEXT casl+0(SB),0,$0
  42. MOVW ov+4(FP),R4
  43. MOVW nv+8(FP),R8
  44. LWAR (R3),R5
  45. CMP R5,R4
  46. BNE fail
  47. DCBT (R3) /* fix 405 errata cpu_210 */
  48. STWCCC R8,(R3)
  49. BNE fail1
  50. MOVW $1,R3
  51. RETURN
  52. fail:
  53. DCBT (R3) /* fix 405 errata cpu_210 */
  54. STWCCC R5,(R3) /* give up exclusive access */
  55. fail1:
  56. MOVW R0,R3
  57. RETURN
  58. END