segment.h 840 B

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef __ASM_SH_SEGMENT_H
  2. #define __ASM_SH_SEGMENT_H
  3. #ifndef __ASSEMBLY__
  4. typedef struct {
  5. unsigned long seg;
  6. } mm_segment_t;
  7. #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
  8. /*
  9. * The fs value determines whether argument validity checking should be
  10. * performed or not. If get_fs() == USER_DS, checking is performed, with
  11. * get_fs() == KERNEL_DS, checking is bypassed.
  12. *
  13. * For historical reasons, these macros are grossly misnamed.
  14. */
  15. #define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFFUL)
  16. #ifdef CONFIG_MMU
  17. #define USER_DS MAKE_MM_SEG(PAGE_OFFSET)
  18. #else
  19. #define USER_DS KERNEL_DS
  20. #endif
  21. #define segment_eq(a, b) ((a).seg == (b).seg)
  22. #define get_ds() (KERNEL_DS)
  23. #define get_fs() (current_thread_info()->addr_limit)
  24. #define set_fs(x) (current_thread_info()->addr_limit = (x))
  25. #endif /* __ASSEMBLY__ */
  26. #endif /* __ASM_SH_SEGMENT_H */