diff options
author | David Howells <dhowells@redhat.com> | 2008-02-08 07:19:31 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-08 12:22:30 -0500 |
commit | b920de1b77b72ca9432ac3f97edb26541e65e5dd (patch) | |
tree | 40fa9be1470e929c47927dea7eddf184c0204229 /Documentation/mn10300 | |
parent | ef3d534754f31fed9c3b976fee1ece1b3bc38282 (diff) |
mn10300: add the MN10300/AM33 architecture to the kernel
Add architecture support for the MN10300/AM33 CPUs produced by MEI to the
kernel.
This patch also adds board support for the ASB2303 with the ASB2308 daughter
board, and the ASB2305. The only processor supported is the MN103E010, which
is an AM33v2 core plus on-chip devices.
[akpm@linux-foundation.org: nuke cvs control strings]
Signed-off-by: Masakazu Urade <urade.masakazu@jp.panasonic.com>
Signed-off-by: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/mn10300')
-rw-r--r-- | Documentation/mn10300/ABI.txt | 149 | ||||
-rw-r--r-- | Documentation/mn10300/compartmentalisation.txt | 60 |
2 files changed, 209 insertions, 0 deletions
diff --git a/Documentation/mn10300/ABI.txt b/Documentation/mn10300/ABI.txt new file mode 100644 index 00000000000..1fef1f06dfd --- /dev/null +++ b/Documentation/mn10300/ABI.txt | |||
@@ -0,0 +1,149 @@ | |||
1 | ========================= | ||
2 | MN10300 FUNCTION CALL ABI | ||
3 | ========================= | ||
4 | |||
5 | ======= | ||
6 | GENERAL | ||
7 | ======= | ||
8 | |||
9 | The MN10300/AM33 kernel runs in little-endian mode; big-endian mode is not | ||
10 | supported. | ||
11 | |||
12 | The stack grows downwards, and should always be 32-bit aligned. There are | ||
13 | separate stack pointer registers for userspace and the kernel. | ||
14 | |||
15 | |||
16 | ================ | ||
17 | ARGUMENT PASSING | ||
18 | ================ | ||
19 | |||
20 | The first two arguments (assuming up to 32-bits per argument) to a function are | ||
21 | passed in the D0 and D1 registers respectively; all other arguments are passed | ||
22 | on the stack. | ||
23 | |||
24 | If 64-bit arguments are being passed, then they are never split between | ||
25 | registers and the stack. If the first argument is a 64-bit value, it will be | ||
26 | passed in D0:D1. If the first argument is not a 64-bit value, but the second | ||
27 | is, the second will be passed entirely on the stack and D1 will be unused. | ||
28 | |||
29 | Arguments smaller than 32-bits are not coelesced within a register or a stack | ||
30 | word. For example, two byte-sized arguments will always be passed in separate | ||
31 | registers or word-sized stack slots. | ||
32 | |||
33 | |||
34 | ================= | ||
35 | CALLING FUNCTIONS | ||
36 | ================= | ||
37 | |||
38 | The caller must allocate twelve bytes on the stack for the callee's use before | ||
39 | it inserts a CALL instruction. The CALL instruction will write into the TOS | ||
40 | word, but won't actually modify the stack pointer; similarly, the RET | ||
41 | instruction reads from the TOS word of the stack, but doesn't move the stack | ||
42 | pointer beyond it. | ||
43 | |||
44 | |||
45 | Stack: | ||
46 | | | | ||
47 | | | | ||
48 | |---------------| SP+20 | ||
49 | | 4th Arg | | ||
50 | |---------------| SP+16 | ||
51 | | 3rd Arg | | ||
52 | |---------------| SP+12 | ||
53 | | D1 Save Slot | | ||
54 | |---------------| SP+8 | ||
55 | | D0 Save Slot | | ||
56 | |---------------| SP+4 | ||
57 | | Return Addr | | ||
58 | |---------------| SP | ||
59 | | | | ||
60 | | | | ||
61 | |||
62 | |||
63 | The caller must leave space on the stack (hence an allocation of twelve bytes) | ||
64 | in which the callee may store the first two arguments. | ||
65 | |||
66 | |||
67 | ============ | ||
68 | RETURN VALUE | ||
69 | ============ | ||
70 | |||
71 | The return value is passed in D0 for an integer (or D0:D1 for a 64-bit value), | ||
72 | or A0 for a pointer. | ||
73 | |||
74 | If the return value is a value larger than 64-bits, or is a structure or an | ||
75 | array, then a hidden first argument will be passed to the callee by the caller: | ||
76 | this will point to a piece of memory large enough to hold the result of the | ||
77 | function. In this case, the callee will return the value in that piece of | ||
78 | memory, and no value will be returned in D0 or A0. | ||
79 | |||
80 | |||
81 | =================== | ||
82 | REGISTER CLOBBERING | ||
83 | =================== | ||
84 | |||
85 | The values in certain registers may be clobbered by the callee, and other | ||
86 | values must be saved: | ||
87 | |||
88 | Clobber: D0-D1, A0-A1, E0-E3 | ||
89 | Save: D2-D3, A2-A3, E4-E7, SP | ||
90 | |||
91 | All other non-supervisor-only registers are clobberable (such as MDR, MCRL, | ||
92 | MCRH). | ||
93 | |||
94 | |||
95 | ================= | ||
96 | SPECIAL REGISTERS | ||
97 | ================= | ||
98 | |||
99 | Certain ordinary registers may carry special usage for the compiler: | ||
100 | |||
101 | A3: Frame pointer | ||
102 | E2: TLS pointer | ||
103 | |||
104 | |||
105 | ========== | ||
106 | KERNEL ABI | ||
107 | ========== | ||
108 | |||
109 | The kernel may use a slightly different ABI internally. | ||
110 | |||
111 | (*) E2 | ||
112 | |||
113 | If CONFIG_MN10300_CURRENT_IN_E2 is defined, then the current task pointer | ||
114 | will be kept in the E2 register, and that register will be marked | ||
115 | unavailable for the compiler to use as a scratch register. | ||
116 | |||
117 | Normally the kernel uses something like: | ||
118 | |||
119 | MOV SP,An | ||
120 | AND 0xFFFFE000,An | ||
121 | MOV (An),Rm // Rm holds current | ||
122 | MOV (yyy,Rm) // Access current->yyy | ||
123 | |||
124 | To find the address of current; but since this option permits current to | ||
125 | be carried globally in an register, it can use: | ||
126 | |||
127 | MOV (yyy,E2) // Access current->yyy | ||
128 | |||
129 | instead. | ||
130 | |||
131 | |||
132 | =============== | ||
133 | SYSTEM CALL ABI | ||
134 | =============== | ||
135 | |||
136 | System calls are called with the following convention: | ||
137 | |||
138 | REGISTER ENTRY EXIT | ||
139 | =============== ======================= ======================= | ||
140 | D0 Syscall number Return value | ||
141 | A0 1st syscall argument Saved | ||
142 | D1 2nd syscall argument Saved | ||
143 | A3 3rd syscall argument Saved | ||
144 | A2 4th syscall argument Saved | ||
145 | D3 5th syscall argument Saved | ||
146 | D2 6th syscall argument Saved | ||
147 | |||
148 | All other registers are saved. The layout is a consequence of the way the MOVM | ||
149 | instruction stores registers onto the stack. | ||
diff --git a/Documentation/mn10300/compartmentalisation.txt b/Documentation/mn10300/compartmentalisation.txt new file mode 100644 index 00000000000..8958b51dac4 --- /dev/null +++ b/Documentation/mn10300/compartmentalisation.txt | |||
@@ -0,0 +1,60 @@ | |||
1 | ========================================= | ||
2 | PART-SPECIFIC SOURCE COMPARTMENTALISATION | ||
3 | ========================================= | ||
4 | |||
5 | The sources for various parts are compartmentalised at two different levels: | ||
6 | |||
7 | (1) Processor level | ||
8 | |||
9 | The "processor level" is a CPU core plus the other on-silicon | ||
10 | peripherals. | ||
11 | |||
12 | Processor-specific header files are divided among directories in a similar | ||
13 | way to the CPU level: | ||
14 | |||
15 | (*) include/asm-mn10300/proc-mn103e010/ | ||
16 | |||
17 | Support for the AM33v2 CPU core. | ||
18 | |||
19 | The appropriate processor is selected by a CONFIG_MN10300_PROC_YYYY option | ||
20 | from the "Processor support" choice menu in the arch/mn10300/Kconfig file. | ||
21 | |||
22 | |||
23 | (2) Unit level | ||
24 | |||
25 | The "unit level" is a processor plus all the external peripherals | ||
26 | controlled by that processor. | ||
27 | |||
28 | Unit-specific header files are divided among directories in a similar way | ||
29 | to the CPU level; not only that, but specific sources may also be | ||
30 | segregated into separate directories under the arch directory: | ||
31 | |||
32 | (*) include/asm-mn10300/unit-asb2303/ | ||
33 | (*) arch/mn10300/unit-asb2303/ | ||
34 | |||
35 | Support for the ASB2303 board with an ASB2308 daughter board. | ||
36 | |||
37 | (*) include/asm-mn10300/unit-asb2305/ | ||
38 | (*) arch/mn10300/unit-asb2305/ | ||
39 | |||
40 | Support for the ASB2305 board. | ||
41 | |||
42 | The appropriate processor is selected by a CONFIG_MN10300_UNIT_ZZZZ option | ||
43 | from the "Unit type" choice menu in the arch/mn10300/Kconfig file. | ||
44 | |||
45 | |||
46 | ============ | ||
47 | COMPILE TIME | ||
48 | ============ | ||
49 | |||
50 | When the kernel is compiled, symbolic links will be made in the asm header file | ||
51 | directory for this arch: | ||
52 | |||
53 | include/asm-mn10300/proc => include/asm-mn10300/proc-YYYY/ | ||
54 | include/asm-mn10300/unit => include/asm-mn10300/unit-ZZZZ/ | ||
55 | |||
56 | So that the header files contained in those directories can be accessed without | ||
57 | lots of #ifdef-age. | ||
58 | |||
59 | The appropriate arch/mn10300/unit-ZZZZ directory will also be entered by the | ||
60 | compilation process; all other unit-specific directories will be ignored. | ||