Import backup from 2005-11-01

This commit is contained in:
Josh Holtrop 2005-11-01 22:00:00 -05:00
parent 79ca453f66
commit 7daa1c5336
3 changed files with 37 additions and 18 deletions

View File

@ -89,10 +89,7 @@ segmented_start:
mov ecx, _rm_params ; put real mode params here (video mode etc...) mov ecx, _rm_params ; put real mode params here (video mode etc...)
sub ecx, VIRT_OFFSET sub ecx, VIRT_OFFSET
mov eax, cr0 jmp 0xC0005010 ; jump to rmmod
and eax, 0x7FFFFFFE ; leave PM
mov cr0, eax
jmp 0x0:0x5010 ; jump to rmmod
;Next we enable paging with the first 4mb mapped 1:1 virtual:physical ;Next we enable paging with the first 4mb mapped 1:1 virtual:physical
; and with the 4mb starting at 0xC000_0000 mapped to the first 4mb physical. ; and with the 4mb starting at 0xC000_0000 mapped to the first 4mb physical.
@ -191,12 +188,12 @@ idle_loop: ; system idle loop
gdtrbs32: gdtrbs32:
dw gdt_endbs32-gdtbs32-1 dw gdt_endbs32-gdtbs32-1
dd gdtbs32-VIRT_OFFSET dd gdtbs32-VIRT_OFFSET
gdtbs32: ;null descriptor gdtbs32: ; 0 = null descriptor
dd 0 dd 0
dd 0 dd 0
;a base of 0x4000_0000, when added to 0xC000_0000 will produce 0x0000_0000 physical before paging in effect ;a base of 0x4000_0000, when added to 0xC000_0000 will produce 0x0000_0000 physical before paging in effect
KERNEL_CODE_BS32 equ $-gdtbs32 KERNEL_CODE_BS32 equ $-gdtbs32 ; 8
db 0xff ;limit 7:0 db 0xff ;limit 7:0
db 0xff ;limit 15:8 db 0xff ;limit 15:8
db 0x00 ;base 7:0 db 0x00 ;base 7:0
@ -206,7 +203,7 @@ KERNEL_CODE_BS32 equ $-gdtbs32
db 0xcf ;flags / limit 19:16 db 0xcf ;flags / limit 19:16
db 0x40 ;base 31:24 db 0x40 ;base 31:24
KERNEL_DATA_BS32 equ $-gdtbs32 KERNEL_DATA_BS32 equ $-gdtbs32 ; 16
db 0xff ;limit 7:0 db 0xff ;limit 7:0
db 0xff ;limit 15:8 db 0xff ;limit 15:8
db 0x00 ;base 7:0 db 0x00 ;base 7:0
@ -216,6 +213,22 @@ KERNEL_DATA_BS32 equ $-gdtbs32
db 0xcf ;flags / limit 19:16 db 0xcf ;flags / limit 19:16
db 0x40 ;base 31:24 db 0x40 ;base 31:24
KERNEL_CODE_BS6_ equ $-gdtbs32 ; 24
dw 0xffff ;limit 15:0
dw 0x0000 ;base 15:0
db 0x00 ;base 23:16
db 0x9A ;access ([P][DPL][1][Executable][Direction/Conforming][Writable/Readable][A])
db 0x00 ;flags ([G][D/B][0][0]) / limit 19:16
db 0x00 ;base 31:24
KERNEL_DATA_BS16 equ $-gdtbs32 ; 32
dw 0xffff ;limit 15:0
dw 0x0000 ;base 15:0
db 0x00 ;base 23:16
db 0x92 ;access ([P][DPL][1][Executable][Direction/Conforming][Writable/Readable][A])
db 0x00 ;flags ([G][D/B][0][0]) / limit 19:16
db 0x00 ;base 31:24
gdt_endbs32: gdt_endbs32:
%include "gdt.inc" %include "gdt.inc"

View File

@ -6,11 +6,11 @@
gdtr: gdtr:
dw gdt_end-gdt-1 dw gdt_end-gdt-1
dd GDT_V dd GDT_V
gdt: gdt: ; 0
dd 0 dd 0
dd 0 dd 0
KERNEL_CODE equ $-gdt KERNEL_CODE equ $-gdt ; 8
dw 0xffff ;limit 15:0 dw 0xffff ;limit 15:0
dw 0x0000 ;base 15:0 dw 0x0000 ;base 15:0
db 0x00 ;base 23:16 db 0x00 ;base 23:16
@ -18,7 +18,7 @@ KERNEL_CODE equ $-gdt
db 0xCF ;flags ([G][D/B][0][0]) / limit 19:16 db 0xCF ;flags ([G][D/B][0][0]) / limit 19:16
db 0x00 ;base 31:24 db 0x00 ;base 31:24
KERNEL_DATA equ $-gdt KERNEL_DATA equ $-gdt ; 16
dw 0xffff ;limit 15:0 dw 0xffff ;limit 15:0
dw 0x0000 ;base 15:0 dw 0x0000 ;base 15:0
db 0x00 ;base 23:16 db 0x00 ;base 23:16
@ -27,7 +27,7 @@ KERNEL_DATA equ $-gdt
db 0x00 ;base 31:24 db 0x00 ;base 31:24
USER_CODE equ $-gdt USER_CODE equ $-gdt ; 24
dw 0xffff ;limit 15:0 dw 0xffff ;limit 15:0
dw 0x0000 ;base 15:0 dw 0x0000 ;base 15:0
db 0x00 ;base 23:16 db 0x00 ;base 23:16
@ -35,7 +35,7 @@ USER_CODE equ $-gdt
db 0xCF ;flags ([G][D/B][0][0]) / limit 19:16 db 0xCF ;flags ([G][D/B][0][0]) / limit 19:16
db 0x00 ;base 31:24 db 0x00 ;base 31:24
USER_DATA equ $-gdt USER_DATA equ $-gdt ; 32
dw 0xffff ;limit 15:0 dw 0xffff ;limit 15:0
dw 0x0000 ;base 15:0 dw 0x0000 ;base 15:0
db 0x00 ;base 23:16 db 0x00 ;base 23:16
@ -43,7 +43,7 @@ USER_DATA equ $-gdt
db 0xCF ;flags ([G][D/B][0][0]) / limit 19:16 db 0xCF ;flags ([G][D/B][0][0]) / limit 19:16
db 0x00 ;base 31:24 db 0x00 ;base 31:24
TSS0_SEG equ $-gdt TSS0_SEG equ $-gdt ; 40
dw 0x67 ;limit 15:0 dw 0x67 ;limit 15:0
dw 0 ;base 15:0 dw 0 ;base 15:0
db 0 ;base 23:16 db 0 ;base 23:16

View File

@ -10,7 +10,7 @@
; the bootstrap process will jump us to 0x0:0x5010 so we'd better be ready for it ; the bootstrap process will jump us to 0x0:0x5010 so we'd better be ready for it
[org 0x5000] [org 0x5000]
[bits 16] [bits 32]
;HOS module header, better be 16 bytes! ;HOS module header, better be 16 bytes!
dd 0x4D534F48 ; magic identifier "HOSM" dd 0x4D534F48 ; magic identifier "HOSM"
dd 1 ; real mode module dd 1 ; real mode module
@ -20,10 +20,16 @@
; ebx = return address ; ebx = return address
; ecx = where to store real mode parameter table ; ecx = where to store real mode parameter table
start: start:
jmp blah jmp 24:start_pm16
blah: [bits 16]
jmp $ start_pm16: ; in 16-bit protected mode
jmp 0:start_refreshed mov ax, 32
mov ss, ax
mov eax, cr0
and eax, 0x7FFFFFFE
mov cr0, eax ; leave PM
jmp 0:start_refreshed ; enter RM
%include "conio.inc" %include "conio.inc"
%include "vesa.inc" %include "vesa.inc"