segment.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu>
  3. * Copyright (C) 2008-2009 PetaLogix
  4. * Copyright (C) 2006 Atmark Techno, Inc.
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. */
  10. #ifndef _ASM_MICROBLAZE_SEGMENT_H
  11. #define _ASM_MICROBLAZE_SEGMENT_H
  12. # ifndef __ASSEMBLY__
  13. typedef struct {
  14. unsigned long seg;
  15. } mm_segment_t;
  16. /*
  17. * On Microblaze the fs value is actually the top of the corresponding
  18. * address space.
  19. *
  20. * The fs value determines whether argument validity checking should be
  21. * performed or not. If get_fs() == USER_DS, checking is performed, with
  22. * get_fs() == KERNEL_DS, checking is bypassed.
  23. *
  24. * For historical reasons, these macros are grossly misnamed.
  25. *
  26. * For non-MMU arch like Microblaze, KERNEL_DS and USER_DS is equal.
  27. */
  28. # define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
  29. # ifndef CONFIG_MMU
  30. # define KERNEL_DS MAKE_MM_SEG(0)
  31. # define USER_DS KERNEL_DS
  32. # else
  33. # define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF)
  34. # define USER_DS MAKE_MM_SEG(TASK_SIZE - 1)
  35. # endif
  36. # define get_ds() (KERNEL_DS)
  37. # define get_fs() (current_thread_info()->addr_limit)
  38. # define set_fs(val) (current_thread_info()->addr_limit = (val))
  39. # define segment_eq(a, b) ((a).seg == (b).seg)
  40. # endif /* __ASSEMBLY__ */
  41. #endif /* _ASM_MICROBLAZE_SEGMENT_H */