📄 head.s
字号:
;***********************************************************;; 重设 32 bit 环境,以便内核能够访问idt gdt tss;;*************************************************************global Start_OSextern cStart_OS: mov ax,cs ; right, forgot this at first. didn't work :-) mov ds,ax lidt [idt_descr] ; reload idt with kernel idt lgdt [gdt_descr] ; reload gdt with kernel gdt mov ax,0x10 mov ds,ax mov es,ax mov ss,ax mov esp,0x1000 mov ax,0 call c;*********************全局变量**************************************** ;;align 2 dw 0idt_descr: dw 256*8-1 ; idt contains 256 entries dd _idtalign 2 dw 0gdt_descr: dw 256*8-1 ; so does gdt (not that that's any dd _gdt ; magic number, but it works for me :^) align 3_idt: times 256*8 db 0 ; idt is uninitialized_gdt: dw 0,0,0,0 ; dummy dw 0x07FF ; 8Mb - limit=2047 (2048*4096=8Mb) dw 0x0000 ; base address=0 dw 0x9A00 ; code read/exec dw 0x00C0 ; granularity=4096, 386 dw 0x07FF ; 8Mb - limit=2047 (2048*4096=8Mb) dw 0x0000 ; base address=0 dw 0x9200 ; data read/write dw 0x00C0 ; granularity=4096, 386 dw 0,0,0,0 ;/* TEMPORARY - don't use */ times 252*8 db 0 ;/* space for LDT's and TSS's etc */ ;*******************************Sub*********************************; This routine checks that the keyboard command queue is empty; No timeout is used - if this hangs there is something wrong with; the machine, and we probably couldn't proceed anyway.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -