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 get_addr_limit() (get_fs().seg)
  29. #define set_fs(_x) \
  30. do { \
  31. __current_thread_info->addr_limit = (_x); \
  32. } while(0)
  33. #endif /* __ASSEMBLY__ */
  34. #endif /* _ASM_SEGMENT_H */