addrspace.h 1.7 KB

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