Import backup from 2004-12-17

This commit is contained in:
josh committed 2017-07-25 22:23:48 -04:00
1 parent 11cc0c87f3
commit 3c531f3b7b
7 files changed
+80 -194

No files matched your search

+48 -71
View File
@@ -14,7 +14,6 @@
; ebx = return address
; ecx = where to store real mode parameter table
; edx = initrd, where to put ram disk
start:
jmp 0:start_refreshed
start_refreshed:
@@ -24,81 +23,28 @@ start_refreshed:
mov ss, ax
mov esp, 0x7000
mov [dat_rmadd], ecx
mov [dat_initrd], edx
mov [dat_retn], ebx
sti
mov ah, 0 ;reset floppy controller
mov dl, 0
int 0x13
; xor ax, ax
; int 0x16
; push txt_loading_initrd ;print loading initrd string
; push 23*80
; call putString
; add sp, 4
mov ebx, [dat_retn]
lgdt [gdtrbs32]
mov eax, cr0
or eax, 0x01
mov cr0, eax
jmp KERNEL_CODE_BS32:segmented_start
[bits 32]
segmented_start:
mov cx, KERNEL_DATA_BS32
mov ss, cx
mov ds, cx
mov es, cx
mov gs, cx
mov fs, cx
jmp ebx
; push es ; draw a red bar to fill in
; mov ax, 0xb800
; mov es, ax
; mov di, 24*160
; mov cx, 80
; mov ax, 0x04B0
; rep stosw
; pop es
mov cx, 80 ;80 cylinders to read
xor si, si ;start at cylinder 0
mov edi, [dat_initrd] ;ram disk address
read_cylinder:
push cx
mov bx, 0x1000 ;read sectors from head 0
mov es, bx
xor bx, bx ;es:bx = data buffer for read
mov ax, 0x0212 ;ah = int 0x13 function 2, al = number of sectors to read
mov cx, si ;what cyl. we are on is now in cx
mov ch, cl ;ch = cyl. number
mov cl, 1 ;cl = sector number 1-63
xor dx, dx ;dh = head number
; mov dl, 0 ;dl = drive number
int 0x13
mov bx, 0x1000 ;now read sectors from head 1
mov es, bx
mov bx, 9216 ;es:bx = data buffer for read
mov ax, 0x0212 ;ah = int 0x13 function 2, al = number of sectors to read
mov cx, si ;what cyl. we are on is now in cx
mov ch, cl ;ch = cyl. number
mov cl, 1 ;cl = sector number 1-63
; mov dh, 1 ;dh = head number
; mov dl, 0 ;dl = drive number
mov dx, 0x0100
int 0x13
mov ebx, 0xb8000 ;draw a green block
add bx, si
shl bl, 1
mov word [ds:ebx+160*24], 0x0200+219
push si
mov esi, 0x10000 ;now copy the disk up to where we will keep it
mov cx, 0x2400
; rep o32 movsb
pop si ;what cylinder# we are on...
inc si
pop cx
; loop read_cylinder
xor ax, ax
int 0x16
mov al, 0xfe
out 0x64, al ;reboot
[bits 16]
; putString(int position, char *str)
putString:
push bp
@@ -137,7 +83,38 @@ putString_loop_done:
pop bp
ret
txt_loading_initrd: db "Loading initrd... ", 0
;-------------------------------------------------------
gdtrbs32:
dw gdt_endbs32-gdtbs32-1
dd gdtbs32
gdtbs32: ;null descriptor
dd 0
dd 0
;a base of 0x4000_0000, when added to 0xC000_0000 will produce 0x0000_0000 physical before paging in effect
KERNEL_CODE_BS32 equ $-gdtbs32
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 0x40 ;base 31:24
KERNEL_DATA_BS32 equ $-gdtbs32
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 0x40 ;base 31:24
gdt_endbs32:
dat_rmadd dd 0
dat_initrd dd 0
dat_retn dd 0