diff options
Diffstat (limited to 'boot')
| -rw-r--r-- | boot/disk_load_16.asm | 6 | ||||
| -rw-r--r-- | boot/kernel_entry.asm | 1 | ||||
| -rw-r--r-- | boot/stage2.asm | 63 |
3 files changed, 47 insertions, 23 deletions
diff --git a/boot/disk_load_16.asm b/boot/disk_load_16.asm index 78aa22b..5eb43a9 100644 --- a/boot/disk_load_16.asm +++ b/boot/disk_load_16.asm @@ -15,6 +15,8 @@ STR_SPACE: STR_OK: db "Kernel Loaded",0 +STR_PROGRESS: + db ".",0 bpbSectorsPerTrack: dw 18 @@ -189,9 +191,9 @@ disk_read_error: disk_load_finish: - mov bx, STR_OK + mov bx, STR_PROGRESS call print_string - call print_nextline +; call print_nextline popa ret diff --git a/boot/kernel_entry.asm b/boot/kernel_entry.asm index 3b1fb26..53f63ad 100644 --- a/boot/kernel_entry.asm +++ b/boot/kernel_entry.asm @@ -9,7 +9,6 @@ [bits 32] [extern kernel_main] - push 0x1 cmp eax,1 diff --git a/boot/stage2.asm b/boot/stage2.asm index 3fde5c1..9dd00bc 100644 --- a/boot/stage2.asm +++ b/boot/stage2.asm @@ -47,8 +47,15 @@ VESA_MODE_SELECT equ 0x4114 jmp boot_16 ;start boot process ;;SOME Global Data, mainly info/error strings +FILL: + times 32 db 0x66 + BOOT_DRIVE: db 0xff + +LOADER_TARGET: + dd 0x100000 ;here we will put our image + KERNEL_CHUNK: dw 0x1 STR_VERSION: @@ -124,13 +131,21 @@ boot_16: call BiosGetMemoryMap ; this will also put the number of entries ; of the memory map at MEMMAP_SIZE_OFFSET -kernel_load: ; Load the KERNEL Image mov bx, STR_LOAD call print_string call print_nextline + +kernel_load: + call disk_load_16 + ; init vesa on last iteration! + mov ax,[KERNEL_CHUNK] + cmp ax,0x5 + jne skip_vesa_init + call VesaSetup + skip_vesa_init: call switch_to_pm ; @@ -140,53 +155,61 @@ boot_32_pm: ;Fast A20 Gate: ;http://wiki.osdev.org/A20_Line - in al, 0x92 or al, 2 out 0x92, al - ; tell the world we are protected - mov ebx,STR_PM - mov ecx,2*23*80 - call print_string_pm + ;mov ebx,STR_PM + ;mov ecx,2*23*80 + ;call print_string_pm + + ;increment chunk number + mov ax,[KERNEL_CHUNK] + add ax,1 + mov [KERNEL_CHUNK],ax - push edx ; persist edx for some reason!? + ;check if all chunkgs loaded (hardcoded to 0x6 for a start) + cmp ax,0x6 + je finish_load + ; show KERNEL CHUNK value + push edx ; persist edx for some reason!? mov edx,0 mov dx,[KERNEL_CHUNK] mov ecx,2*24*80 call print_hex_pm + pop edx + ; here we actually do copy the chunk into ext mem! + mov eax,[LOADER_TARGET] + mov ebx,0x18000 - ; here we should move the chunk away or stop the loop if everything loaded. - mov ax,[KERNEL_CHUNK] - add ax,1 - mov [KERNEL_CHUNK],ax + copy_next_byte: - ; here we should copy the chunk into ext mem! + mov ecx,[ebx] + mov [eax],ecx + inc eax + inc ebx + cmp ebx, 0x90000 + jne copy_next_byte + mov [LOADER_TARGET],eax ;persist next target address ; and now go back to real! (first 16bit protected!) - cmp edx,0x20 - je finish_load - pop edx - - - jmp CODE16_SEG:reinit_16 + finish_load: ; - call VesaSetup ; call kernel! mov eax,0 ;tell the kernel ; we are the booting processor - call 0x18000 ;jump into our Kernel! + call 0x100000 ;jump into our Kernel! [bits 16] |
