ejemplos modo protegido.pdf

Vista previa de texto
shl edi,2
add edi,[PTE]
mov eax,gdt_basep
or eax,7
mov ecx,(modo_prot_32_end-modo_prot_32+4095)/4096+2+1
init_PTE3:
mov [edi],eax
add eax,1000h
add edi,4
dec ecx
jnz init_PTE3
;
; Se flushea la TLB.
;
mov eax,cr3
mov cr3,eax
;
; Dejando el mapa de memoria:
;
; <bochs:3> show "tab"
; cr3: 00112000
; 00000000 - 00000000:
110000 110000
; 00011000
:
111000 ( 111000) in TLB
; 00012000 - 00013000:
112000 113000
; 00110000 - 00113000:
110000 113000
; 3ffff000 - 3ffff000:
115000 115000
;
; Se carga nuevamente el GDTR.
;
push gdt_basep
sub esp,2
mov word [esp],gdt_end-gdt-1
lgdt [esp]
add esp,6
;
; Se vuelve a las direcciones físicas y lineales equivalentes.
;
jmp cs_sel_32:subiendo-modo_prot_32+os_basep
subiendo:
;
; Se resetea el bit PE, inhabilitando así la paginación.
;
mov eax,cr0
and eax,7fffffffh
mov cr0,eax
;
; Y se salta al procedimiento de retorno a modo real.
;
jmp cs_sel_16:return_modo_real_16
modo_prot_32_end:
