system.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef _ASM_CRIS_ARCH_SYSTEM_H
  2. #define _ASM_CRIS_ARCH_SYSTEM_H
  3. /* Read the CPU version register. */
  4. static inline unsigned long rdvr(void)
  5. {
  6. unsigned char vr;
  7. __asm__ __volatile__ ("move $vr, %0" : "=rm" (vr));
  8. return vr;
  9. }
  10. #define cris_machine_name "crisv32"
  11. /* Read the user-mode stack pointer. */
  12. static inline unsigned long rdusp(void)
  13. {
  14. unsigned long usp;
  15. __asm__ __volatile__ ("move $usp, %0" : "=rm" (usp));
  16. return usp;
  17. }
  18. /* Read the current stack pointer. */
  19. static inline unsigned long rdsp(void)
  20. {
  21. unsigned long sp;
  22. __asm__ __volatile__ ("move.d $sp, %0" : "=rm" (sp));
  23. return sp;
  24. }
  25. /* Write the user-mode stack pointer. */
  26. #define wrusp(usp) __asm__ __volatile__ ("move %0, $usp" : : "rm" (usp))
  27. #define nop() __asm__ __volatile__ ("nop");
  28. #define xchg(ptr,x) \
  29. ((__typeof__(*(ptr)))__xchg((unsigned long) (x),(ptr),sizeof(*(ptr))))
  30. #define tas(ptr) (xchg((ptr),1))
  31. struct __xchg_dummy { unsigned long a[100]; };
  32. #define __xg(x) ((struct __xchg_dummy *)(x))
  33. #endif /* _ASM_CRIS_ARCH_SYSTEM_H */