|
第一个段为代码段,
第二个为数据段。已成功到保护模式,并能输出Protect Mode
能进入intr,但返回时,iret后就重启
不返回就没事,不知为什么。
entry start
IDT_Base=512
start:
.org 0x00
mov ax,#0x10
mov ds,ax
mov ax,#0xff00
mov [0x000000],ax
cmp [0x100000],ax
je L6
mov edi,#0x0b8000
mov esi,#msg
mov ah,0x0c
mov ecx,#(msg_end-msg)
print_str:
mov al,[esi]
mov [edi] ,ax
inc esi
inc edi
inc edi
loop print_str
lea edx,[intr_svr]
mov eax,#0x00080000
mov ax,dx
mov dx,#0x8e00
mov edi,#IDT_Base
;point to the end of this program.'s next word
mov ecx,#256
rp_sidt:
mov [edi],eax
mov 4[edi],edx
add edi,#8
loop rp_sidt
lidt [idt_attr]
Set_up_Stack:
mov esp,#0x1000
mov ax,#0x10
mov ss,ax
;mov ax,#0x0d40
sti
L6: jmp L6
.align 8
intr_svr:
cli
mov ax,#0x0d41
mov [0x0b8320],ax
mov al,#0x20
out #0x20,al
sti
iret
.align 8
idt_attr:
.word 256*8-1
.long IDT_Base
.org 320
msg:
.ascii "rocted Mode"
msg_end:
.org 510
IDT_1:
.word 0x3040 |
|