addrspace.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* $Id$ */
  2. /*
  3. * This file is subject to the terms and conditions of the GNU General Public
  4. * License. See the file "COPYING" in the main directory of this archive
  5. * for more details.
  6. *
  7. * Copyright (C) 2001 by Hiroyuki Kondo
  8. *
  9. * Defitions for the address spaces of the M32R CPUs.
  10. */
  11. #ifndef __ASM_M32R_ADDRSPACE_H
  12. #define __ASM_M32R_ADDRSPACE_H
  13. /*
  14. * Memory segments (32bit kernel mode addresses)
  15. */
  16. #define KUSEG 0x00000000
  17. #define KSEG0 0x80000000
  18. #define KSEG1 0xa0000000
  19. #define KSEG2 0xc0000000
  20. #define KSEG3 0xe0000000
  21. #define K0BASE KSEG0
  22. /*
  23. * Returns the kernel segment base of a given address
  24. */
  25. #ifndef __ASSEMBLY__
  26. #define KSEGX(a) (((unsigned long)(a)) & 0xe0000000)
  27. #else
  28. #define KSEGX(a) ((a) & 0xe0000000)
  29. #endif
  30. /*
  31. * Returns the physical address of a KSEG0/KSEG1 address
  32. */
  33. #ifndef __ASSEMBLY__
  34. #define PHYSADDR(a) (((unsigned long)(a)) & 0x1fffffff)
  35. #else
  36. #define PHYSADDR(a) ((a) & 0x1fffffff)
  37. #endif
  38. /*
  39. * Map an address to a certain kernel segment
  40. */
  41. #ifndef __ASSEMBLY__
  42. #define KSEG0ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG0))
  43. #define KSEG1ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG1))
  44. #define KSEG2ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG2))
  45. #define KSEG3ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG3))
  46. #else
  47. #define KSEG0ADDR(a) (((a) & 0x1fffffff) | KSEG0)
  48. #define KSEG1ADDR(a) (((a) & 0x1fffffff) | KSEG1)
  49. #define KSEG2ADDR(a) (((a) & 0x1fffffff) | KSEG2)
  50. #define KSEG3ADDR(a) (((a) & 0x1fffffff) | KSEG3)
  51. #endif
  52. #endif /* __ASM_M32R_ADDRSPACE_H */