beautypg.com

Intel IA-32 User Manual

Page 401

background image

Vol. 3A 9-27

PROCESSOR MANAGEMENT AND INITIALIZATION

175 MOV EBX,CR0

176 OR EBX,PE_BIT

177 MOV CR0,EBX

178

179 ; clear prefetch queue

180 JMP CLEAR_LABEL

181 CLEAR_LABEL:

182

183 ; make DS and ES address 4G of linear memory

184 MOV CX,LINEAR_SEL

185 MOV DS,CX

186 MOV ES,CX

187

188 ; do board specific initialization

189 ;

190 ;

191 ; ......

192 ;

193

194

195 ; See Figure 9-5

196 ; copy EPROM GDT to ram at:

197 ; RAM_START + size (STARTUP_DATA)

198 MOV EAX,RAM_START

199 ADD EAX,OFFSET (end_data)

200 MOV EBX,RAM_START

201 MOV ECX, CS_BASE

202 ADD ECX, OFFSET (GDT_EPROM)

203 MOV ESI, [ECX].table_linear

204 MOV EDI,EAX

205 MOVZX ECX, [ECX].table_lim

206 MOV APP_GDT_ram[EBX].table_lim,CX

207 INC ECX

208 MOV EDX,EAX

209 MOV APP_GDT_ram[EBX].table_linear,EAX

210 ADD EAX,ECX

211 REP MOVS BYTE PTR ES:[EDI],BYTE PTR DS:[ESI]

212

213 ; fixup GDT base in descriptor

214 MOV ECX,EDX

215 MOV [EDX].bas_0_15+GDT_DESC_OFF,CX

216 ROR ECX,16

217 MOV [EDX].bas_16_23+GDT_DESC_OFF,CL

218 MOV [EDX].bas_24_31+GDT_DESC_OFF,CH

219

220 ; copy EPROM IDT to ram at:

221 ; RAM_START+size(STARTUP_DATA)+SIZE (EPROM GDT)