segment.h 847 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef _H8300_SEGMENT_H
  2. #define _H8300_SEGMENT_H
  3. /* define constants */
  4. #define USER_DATA (1)
  5. #ifndef __USER_DS
  6. #define __USER_DS (USER_DATA)
  7. #endif
  8. #define USER_PROGRAM (2)
  9. #define SUPER_DATA (3)
  10. #ifndef __KERNEL_DS
  11. #define __KERNEL_DS (SUPER_DATA)
  12. #endif
  13. #define SUPER_PROGRAM (4)
  14. #ifndef __ASSEMBLY__
  15. typedef struct {
  16. unsigned long seg;
  17. } mm_segment_t;
  18. #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
  19. #define USER_DS MAKE_MM_SEG(__USER_DS)
  20. #define KERNEL_DS MAKE_MM_SEG(__KERNEL_DS)
  21. /*
  22. * Get/set the SFC/DFC registers for MOVES instructions
  23. */
  24. static inline mm_segment_t get_fs(void)
  25. {
  26. return USER_DS;
  27. }
  28. static inline mm_segment_t get_ds(void)
  29. {
  30. /* return the supervisor data space code */
  31. return KERNEL_DS;
  32. }
  33. #define segment_eq(a, b) ((a).seg == (b).seg)
  34. #endif /* __ASSEMBLY__ */
  35. #endif /* _H8300_SEGMENT_H */