Import backup from 2004-12-20

This commit is contained in:
josh committed 2017-07-25 22:23:48 -04:00
1 parent 3c531f3b7b
commit 2445034e43
15 files changed
+409 -75

No files matched your search

+41 -2
View File
@@ -3,6 +3,8 @@
; Author: Josh Holtrop
; Date: 09/20/04
%define VIRT_OFFSET 0xC0000000
; the bootstrap process will jump us to 0x0:0x5010 so we'd better be ready for it
[org 0x5000]
[bits 16]
@@ -25,16 +27,22 @@ start_refreshed:
mov [dat_rmadd], ecx
mov [dat_retn], ebx
; begin real-mode code initialization, etc...
; get ready to go back to pmode and return to kernel initialization
mov ebx, [dat_retn]
lgdt [gdtrbs32]
lgdt [gdtrlin32]
mov eax, cr0
or eax, 0x01
mov cr0, eax
jmp KERNEL_CODE_BS32:segmented_start
jmp KERNEL_CODE_LIN32:segmented_start
[bits 32]
segmented_start:
lgdt [gdtrbs32]
jmp KERNEL_CODE_BS32:offset_continue+VIRT_OFFSET
offset_continue:
mov cx, KERNEL_DATA_BS32
mov ss, cx
mov ds, cx
@@ -83,6 +91,37 @@ putString_loop_done:
pop bp
ret
;-------------------------------------------------------
gdtrlin32:
dw gdt_endlin32-gdtlin32-1
dd gdtlin32
gdtlin32: ;null descriptor
dd 0
dd 0
KERNEL_CODE_LIN32 equ $-gdtlin32
db 0xff ;limit 7:0
db 0xff ;limit 15:8
db 0x00 ;base 7:0
db 0x00 ;base 15:8
db 0x00 ;base 23:16
db 0x9a ;access
db 0xcf ;flags / limit 19:16
db 0x00 ;base 31:24
KERNEL_DATA_LIN32 equ $-gdtlin32
db 0xff ;limit 7:0
db 0xff ;limit 15:8
db 0x00 ;base 7:0
db 0x00 ;base 15:8
db 0x00 ;base 23:16
db 0x92 ;access
db 0xcf ;flags / limit 19:16
db 0x00 ;base 31:24
gdt_endlin32:
;-------------------------------------------------------
gdtrbs32:
dw gdt_endbs32-gdtbs32-1