disable lcd controller when booting linux, this prevents ghost-lines while
[linexec-j720] / asm / asm.asm
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 mov r8, #0
37 ldr r9, =0x48000000
38 str r8, [r9, #0x1FC]
39
40
41 ; turn off unused serial ports
42
43 mov r8, #0
44 ldr r9, =0x80010000
45 str r8, [r9, #0xC]
46 ldr r9, =0x80050000
47 str r8, [r9, #0xC]
48
49 ; #endif
50
51 add r9, r1, #0x100
52
53 ; #if xscale
54 ; ldr r5, =0xa0000100
55 ; ldr r7, =0xa0400000
56
57 ; #elif strongarm
58 ldr r5, =0xc0000100
59 ldr r7, =0xc0400000
60 ; #endif
61
62
63 label ldr r8, [r9]
64 str r8, [r5]
65 add r9, r9, #4
66 add r5, r5, #4
67 cmp r5, r7
68 blt label
69
70 ; #if xscale
71 ; MOV r4, #0xA0000000
72
73 ; #elif strongarm
74 MOV r4, #0xc0000000
75 ; #endif
76
77 add r11,r4,#0x8000
78
79 mov r10,r2 ;machine number passed from DRAMloader
80
81 mcr p15, 0, r0, c8, c7, 0x00 ;/* invalidate I+D TLB */
82 mrc p15, 0, r0, c2, c0, 0
83 mov r0, r0
84 sub pc, pc, #4
85
86 ; they skipped this, unnecessary? seems like we need to do this
87
88 mcr p15, 0, r0, c7, c5, 0 ;/* invalidate i cache & BTB */
89
90 mov r0, #0
91 mcr p15, 0, r0, c13, c0, 0
92 mrc p15, 0, r0, c2, c0, 0
93 mov r0, r0
94 sub pc, pc, #4
95
96 ; This is needed to get Linux 2.6 booting
97 mov r0, #0
98 mcr p15, 0, r0, c7, c10, 4 ; Drain write buffer
99 mcr p15, 0, r0, c7, c7, 0 ; invalidate I+D & BTB
100
101 mrc p15, 0, r0, c1, c0, 0
102 bic r0, r0, #5 ; MMU & Dcache off
103 bic r0, r0, #0x1000 ; Icache off
104 mcr p15, 0, r0, c1, c0, 0 ; disable the MMU & caches
105 mrc p15, 0, r0, c2, c0, 0
106 mov r0, r0
107 sub pc, pc, #4
108
109
110 mov r0, #0
111 mcr p15, 0, r0, c13, c0, 0 ; clear PID
112 mcr p15, 0, r0, c8, c7, 0 ; invalidate I+D TLB
113 mrc p15, 0, r0, c2, c0, 0
114 mov r0, r0
115 sub pc, pc, #4
116
117 ;Set parameters for kernel
118 mov r0, #0
119 mov r1, r10
120 ldr r2, [r2, #0]
121 mov r2, #0
122
123 ; Jump into the kernel:
124 mov pc, r11
125
126
127 |$M221|
128 ENDP ; |?do_it@@YAXXZ|, do_it
129 END
130
Impressum, Datenschutz