segment.h 879 B

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