The Intel Developer Manual suggests that after switching to protected mode, we immediately perform the JMP or CALL instruction immediately after the MOV CR0 instruction changes the flow of execution and serializes the processor. The purpose is for invalidating the prefetch queue, as suggested by the code example in chapter 9, section 9.10.2, START.ASM Listing
, line 174-186:
174 ; enter protected mode
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
Why should we need to perform such operation? Isn't the code remain the same in the queue, since a short jump like that does not change any flag or segment at all, except for invalidating the current data in the prefetch queue to reload the same thing again?
So, I found the purpose: According to the table 9-5 that describes the main initialization steps in STARTUP.ASM:
Jump near to clear real mode instruction queue
Effectively, only for reloading the instruction queue, so earlier reala mode instructions are replaced with protected mode instructions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With