X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fgeekos%2Ffd_boot.asm;h=2fbfd35d9f65230ca31e33dd60da1e00c9e2cd87;hb=dd37e2c1fabd6d6856c7a2cdbd2f3f73fb034393;hp=0c0e5ec8e38859fc4c857c7a8a0a0e87a1fe79d7;hpb=3d293c0d07537b122d249e035b6c85ed54baf406;p=palacios.releases.git diff --git a/palacios/src/geekos/fd_boot.asm b/palacios/src/geekos/fd_boot.asm index 0c0e5ec..2fbfd35 100644 --- a/palacios/src/geekos/fd_boot.asm +++ b/palacios/src/geekos/fd_boot.asm @@ -1,7 +1,7 @@ ; Boot sector for GeekOS ; Copyright (c) 2001,2004 David H. Hovemeyer ; Copyright (c) 2003, Jeffrey K. Hollingsworth -; $Revision: 1.3 $ +; $Revision: 1.6 $ ; This is free software. You are permitted to use, ; redistribute, and modify it as specified in the file "COPYING". @@ -89,6 +89,8 @@ load_setup: cmp word [sec_count], bx jl .again + + load_kernel: ; Load the kernel image from sectors KERN_START_SEC..n of the ; floppy into memory at KERNSEG. Note that there are 128 sectors @@ -102,82 +104,43 @@ load_kernel: mov word [sec_count], ax add ax, word [kernelSize] mov word [max_sector], ax -.again: - mov ax, [sec_count] ; logical sector on the floppy -; mov dx, ax -; call PrintHex -; call PrintNL - push ax ; 1st param to ReadSector (log sec num) - sub ax, [kernelStart] ; convert to 0-indexed - mov cx, ax ; save in cx - shr ax, 7 ; divide by 128 - shl ax, 12 ; ...and multiply by 0x1000 - add ax, KERNSEG ; ...to get base relative to KERNSEG -; mov dx, ax -; call PrintHex -; call PrintNL - push ax ; 2nd param to ReadSector (seg base) - and cx, 0x7f ; mod sector by 128 - shl cx, 9 ; ...and multiply by 512 - push cx ; to get offset in segment (3rd parm) -; mov dx, cx -; call PrintHex -; call PrintNL - - - ; read the sector from the floppy - call ReadSector - add sp, 6 ; clear 3 word params - - - ; on to next sector - inc word [sec_count] - - ; have we loaded all of the sectors? - mov bx, word [max_sector] - cmp word [sec_count], bx - jl .again - -load_vm: - ; Load the guest image starting at 1MB - ; floppy into memory at KERNSEG. Note that there are 128 sectors - ; per 64K segment. So, when figuring out which segment to - ; load the sector into, we shift right by 7 bits (which is - ; equivalent to dividing by 128). - ; Figure out start sector and max sector - mov ax, word [vmStart] - mov word [sec_count], ax - add ax, word [vmSize] - mov word [max_sector], ax + .again2: mov ax, [sec_count] ; logical sector on the floppy push ax ; 1st param to ReadSector (log sec num) - mov dx, ax - call PrintHex - call PrintNL +; mov dx, ax +; call PrintHex +; call PrintNL mov ax, VMSEG ; ...to get base relative to VMSEG push ax ; 2nd param to ReadSector (seg base) - mov dx, ax - call PrintHex - call PrintNL +; mov dx, ax ; +; call PrintHex +; call PrintNL mov ax, 2000h ; Always write at the start of the segment push ax ; 3rd parameter - mov dx, ax - call PrintHex - call PrintNL +; mov dx, ax +; call PrintHex +; call PrintNL ; read the sector from the floppy call ReadSector add sp, 6 ; clear 3 word params + push VMSEG + pop es +; mov dx, word [es:2000h] ; +; call PrintHex +; call PrintNL + + ; execute bios call @@ -189,12 +152,19 @@ load_vm: push cs pop es mov si, bootsect_gdt - mov ax, 0x8700 ; + mov ah, 87h + + mov cx, 100h + int 0x15 + + adc ax, 0 + +; mov dx, ax +; call PrintHex +; call PrintNL + - mov dx, ax - call PrintHex - call PrintNL pop es ; pop bx @@ -222,8 +192,13 @@ load_vm: mov bx, word [max_sector] cmp word [sec_count], bx + + +.stall +; jmp .skip jl .again2 +.skip ; Now we've loaded the setup code and the kernel image. ; Jump to setup code. jmp SETUPSEG:0 @@ -305,11 +280,9 @@ ReadSector: xor dl, dl ; hard code drive=0 mov bx, [bp+4] ; offset goes in bx ; (es:bx points to buffer) - - ; Call the BIOS Read Diskette Sectors service int 0x13 - + ; If the carry flag is NOT set, then there was no error ; and we're done. jnc .done @@ -383,13 +356,13 @@ bootsect_gdt: dw 0,0,0,0 dw 0,0,0,0 bootsect_src: - dw 0x200-1 + dw 0xffff bootsect_src_base: - db 0,02,9 ; ! base = 0x092000 + db 0,0x20,0x08 ; ! base = 0x082000 db 0x93 ; ! typbyte dw 0 ; ! limit16,base24 =0 bootsect_dst: - dw 0x200-1 + dw 0xffff bootsect_dst_base: db 0,0,0x10 ; ! base = 0x100000 db 0x93 ; ! typbyte @@ -439,13 +412,7 @@ kernelStart: kernelSize: dw NUM_KERN_SECTORS - ;; part of pfat boot record -vmStart: - dw 1+NUM_SETUP_SECTORS+NUM_KERN_SECTORS - ;; part of pfat boot record -vmSize: - dw NUM_VM_KERNEL_SECTORS ; Finish by writing the BIOS signature to mark this as