]>
Commit | Line | Data |
---|---|---|
c5f1f439 | 1 | TTL C:\pocket\test\asm.cpp |
2 | ||
3 | AREA |.drectve|, DRECTVE | |
4 | DCB "-defaultlib:coredll.lib " | |
5 | DCB "-defaultlib:corelibc.lib " | |
6 | ||
7 | EXPORT |?do_it@@YAXXZ| ; do_it | |
8 | AREA |.pdata|, PDATA | |
9 | |$T222| DCD |?do_it@@YAXXZ| | |
10 | DCD 0x40000100 | |
11 | AREA |.text|, CODE | |
12 | |?do_it@@YAXXZ| PROC ; do_it | |
13 | |$M220| | |
14 | ||
15 | ||
16 | mcr p15, 0, r0, c7, c5, 0 ;/* invalidate i cache & BTB */ | |
17 | mrc p15, 0, r0, c2, c0, 0 | |
18 | mov r0, r0 | |
19 | sub pc, pc, #4 | |
20 | ||
21 | ||
22 | ; turn off LCD controller... | |
23 | ; I couldn't figure out how to use armasm.exe conditional with variables | |
24 | ; #if xscale | |
25 | ; ldr r9, =0x44000000 | |
26 | ; ldr r8, [r9] | |
27 | ; orr r8, r8, #0x400 | |
28 | ; str r8, [r9] | |
29 | ||
30 | ; #elif strongarm | |
31 | ldr r9, =0xb0100000 | |
32 | ldr r8, [r9] | |
33 | bic r8, r8, #1 | |
34 | str r8, [r9] | |
35 | ||
36 | ; turn off unused serial ports | |
37 | ||
38 | mov r8, #0 | |
39 | ldr r9, =0x80010000 | |
40 | str r8, [r9, #0xC] | |
41 | ldr r9, =0x80050000 | |
42 | str r8, [r9, #0xC] | |
43 | ||
44 | ; #endif | |
45 | ||
46 | add r9, r1, #0x100 | |
47 | ||
48 | ; #if xscale | |
49 | ; ldr r5, =0xa0000100 | |
50 | ; ldr r7, =0xa0400000 | |
51 | ||
52 | ; #elif strongarm | |
53 | ldr r5, =0xc0000100 | |
54 | ldr r7, =0xc0400000 | |
55 | ; #endif | |
56 | ||
57 | ||
58 | label ldr r8, [r9] | |
59 | str r8, [r5] | |
60 | add r9, r9, #4 | |
61 | add r5, r5, #4 | |
62 | cmp r5, r7 | |
63 | blt label | |
64 | ||
65 | ; #if xscale | |
66 | ; MOV r4, #0xA0000000 | |
67 | ||
68 | ; #elif strongarm | |
69 | MOV r4, #0xc0000000 | |
70 | ; #endif | |
71 | ||
72 | add r11,r4,#0x8000 | |
73 | ||
74 | mov r10,r2 ;machine number passed from DRAMloader | |
75 | ||
76 | mcr p15, 0, r0, c8, c7, 0x00 ;/* invalidate I+D TLB */ | |
77 | mrc p15, 0, r0, c2, c0, 0 | |
78 | mov r0, r0 | |
79 | sub pc, pc, #4 | |
80 | ||
81 | ; they skipped this, unnecessary? seems like we need to do this | |
82 | ||
83 | mcr p15, 0, r0, c7, c5, 0 ;/* invalidate i cache & BTB */ | |
84 | ||
85 | mov r0, #0 | |
86 | mcr p15, 0, r0, c13, c0, 0 | |
87 | mrc p15, 0, r0, c2, c0, 0 | |
88 | mov r0, r0 | |
89 | sub pc, pc, #4 | |
90 | ||
939a9730 | 91 | ; This is needed to get Linux 2.6 booting |
92 | mov r0, #0 | |
93 | mcr p15, 0, r0, c7, c10, 4 ; Drain write buffer | |
94 | mcr p15, 0, r0, c7, c7, 0 ; invalidate I+D & BTB | |
95 | ||
96 | mrc p15, 0, r0, c1, c0, 0 | |
97 | bic r0, r0, #5 ; MMU & Dcache off | |
98 | bic r0, r0, #0x1000 ; Icache off | |
99 | mcr p15, 0, r0, c1, c0, 0 ; disable the MMU & caches | |
100 | mrc p15, 0, r0, c2, c0, 0 | |
101 | mov r0, r0 | |
102 | sub pc, pc, #4 | |
103 | ||
104 | ||
105 | mov r0, #0 | |
106 | mcr p15, 0, r0, c13, c0, 0 ; clear PID | |
107 | mcr p15, 0, r0, c8, c7, 0 ; invalidate I+D TLB | |
108 | mrc p15, 0, r0, c2, c0, 0 | |
109 | mov r0, r0 | |
110 | sub pc, pc, #4 | |
111 | ||
112 | ;Set parameters for kernel | |
c5f1f439 | 113 | mov r0, #0 |
114 | mov r1, r10 | |
115 | ldr r2, [r2, #0] | |
116 | mov r2, #0 | |
117 | ||
118 | ; Jump into the kernel: | |
119 | mov pc, r11 | |
120 | ||
121 | ||
122 | |$M221| | |
123 | ENDP ; |?do_it@@YAXXZ|, do_it | |
124 | END | |
125 |