Linux 2.6.25.3
[linux/fpc-iii.git] / include / asm-m32r / addrspace.h
blob81782c122da451b16fa2b650f8fbfc99d68ac3a2
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.
6 * Copyright (C) 2001 by Hiroyuki Kondo
8 * Defitions for the address spaces of the M32R CPUs.
9 */
10 #ifndef __ASM_M32R_ADDRSPACE_H
11 #define __ASM_M32R_ADDRSPACE_H
14 * Memory segments (32bit kernel mode addresses)
16 #define KUSEG 0x00000000
17 #define KSEG0 0x80000000
18 #define KSEG1 0xa0000000
19 #define KSEG2 0xc0000000
20 #define KSEG3 0xe0000000
22 #define K0BASE KSEG0
25 * Returns the kernel segment base of a given address
27 #ifndef __ASSEMBLY__
28 #define KSEGX(a) (((unsigned long)(a)) & 0xe0000000)
29 #else
30 #define KSEGX(a) ((a) & 0xe0000000)
31 #endif
34 * Returns the physical address of a KSEG0/KSEG1 address
36 #ifndef __ASSEMBLY__
37 #define PHYSADDR(a) (((unsigned long)(a)) & 0x1fffffff)
38 #else
39 #define PHYSADDR(a) ((a) & 0x1fffffff)
40 #endif
43 * Map an address to a certain kernel segment
45 #ifndef __ASSEMBLY__
46 #define KSEG0ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG0))
47 #define KSEG1ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG1))
48 #define KSEG2ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG2))
49 #define KSEG3ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG3))
50 #else
51 #define KSEG0ADDR(a) (((a) & 0x1fffffff) | KSEG0)
52 #define KSEG1ADDR(a) (((a) & 0x1fffffff) | KSEG1)
53 #define KSEG2ADDR(a) (((a) & 0x1fffffff) | KSEG2)
54 #define KSEG3ADDR(a) (((a) & 0x1fffffff) | KSEG3)
55 #endif
57 #endif /* __ASM_M32R_ADDRSPACE_H */