segment.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* segment.h: MMU segment settings
  2. *
  3. * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the License, or (at your option) any later version.
  10. */
  11. #ifndef _ASM_SEGMENT_H
  12. #define _ASM_SEGMENT_H
  13. #ifndef __ASSEMBLY__
  14. typedef struct {
  15. unsigned long seg;
  16. } mm_segment_t;
  17. #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
  18. #ifdef CONFIG_MMU
  19. #define USER_DS MAKE_MM_SEG(TASK_SIZE - 1)
  20. #define KERNEL_DS MAKE_MM_SEG(0xdfffffffUL)
  21. #else
  22. #define USER_DS MAKE_MM_SEG(memory_end)
  23. #define KERNEL_DS MAKE_MM_SEG(0xe0000000UL)
  24. #endif
  25. #define get_ds() (KERNEL_DS)
  26. #define get_fs() (__current_thread_info->addr_limit)
  27. #define segment_eq(a, b) ((a).seg == (b).seg)
  28. #define __kernel_ds_p() segment_eq(get_fs(), KERNEL_DS)
  29. #define get_addr_limit() (get_fs().seg)
  30. #define set_fs(_x) \
  31. do { \
  32. __current_thread_info->addr_limit = (_x); \
  33. } while(0)
  34. #endif /* __ASSEMBLY__ */
  35. #endif /* _ASM_SEGMENT_H */