Skip to content

Commit 29d8f1b

Browse files
committed
load bug
1 parent add93db commit 29d8f1b

File tree

1 file changed

+109
-7
lines changed

1 file changed

+109
-7
lines changed

src/kernel/boot/boot2.asm

Lines changed: 109 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ jmp start
1515
%define ISOGUI 0 ; default text input
1616
%endif
1717

18-
%define CHUNK_SECTORS 127 ; 127*512 = 65024 (passt in 64 KiB)
18+
%define CHUNK_SECTORS 15
1919

20-
%define LOAD_SEG 0x8000 ; ES=9000, BX=0000 => phys 0x00090000
20+
%define LOAD_SEG 0x8000 ; ES=9000, BX=0000 => phys 0x00080000
2121
%define LOAD_OFF 0x0000
2222
%define LOAD_BUF_PHYS 0x00080000
2323

24-
%define KERNEL_DST_BASE 0x00400000 ; 4 MiB Zieladresse
24+
%define KERNEL_DST_BASE 0x00400000 ; 4 MiB Zieladresse
2525

2626
%define SCREEN_COLS 80
2727
%define SCREEN_ROWS 25
@@ -121,6 +121,25 @@ load_kernel_chunks_to_4mb:
121121
mov word [sectors_done], 0
122122

123123
.next_chunk:
124+
; -------->
125+
push cx
126+
push bx
127+
push ax
128+
push si
129+
push di
130+
push ds
131+
push es
132+
mov si, dotstr1 ; <--- load status
133+
call print_string
134+
pop es
135+
pop ds
136+
pop di
137+
pop si
138+
pop ax
139+
pop bx
140+
pop cx
141+
; <--------
142+
124143
mov ax, [sectors_left]
125144
test ax, ax
126145
jz .done
@@ -132,6 +151,25 @@ load_kernel_chunks_to_4mb:
132151
mov ax, cx
133152
.use_ax:
134153
; AX = chunk sectors
154+
155+
; -------->
156+
push cx
157+
push bx
158+
push ax
159+
push si
160+
push di
161+
push ds
162+
push es
163+
mov si, dotstr2 ; <--- load status
164+
call print_string
165+
pop es
166+
pop ds
167+
pop di
168+
pop si
169+
pop ax
170+
pop bx
171+
pop cx
172+
; <--------
135173

136174
; DAP füllen
137175
mov word [dap_sectors], ax
@@ -144,6 +182,25 @@ load_kernel_chunks_to_4mb:
144182
mov dword [dap_lba_low], eax
145183
mov dword [dap_lba_high], 0
146184

185+
; -------->
186+
push cx
187+
push bx
188+
push ax
189+
push si
190+
push di
191+
push ds
192+
push es
193+
mov si, dotstr3 ; <--- load status
194+
call print_string
195+
pop es
196+
pop ds
197+
pop di
198+
pop si
199+
pop ax
200+
pop bx
201+
pop cx
202+
; <--------
203+
147204
; BIOS Read (EDD)
148205
push cs
149206
pop ds
@@ -153,6 +210,25 @@ load_kernel_chunks_to_4mb:
153210
int 0x13
154211
jc disk_error
155212

213+
; -------->
214+
push cx
215+
push bx
216+
push ax
217+
push si
218+
push di
219+
push ds
220+
push es
221+
mov si, dotstr4 ; <--- load status
222+
call print_string
223+
pop es
224+
pop ds
225+
pop di
226+
pop si
227+
pop ax
228+
pop bx
229+
pop cx
230+
; <--------
231+
156232
; Chunk im PM kopieren (kommt garantiert in RM zurück!)
157233
call pm_copy_chunk_thunk
158234

@@ -217,7 +293,7 @@ pm_copy_do:
217293
mov eax, cr0
218294
and eax, 0xFFFFFFFE
219295
mov cr0, eax
220-
296+
221297
jmp 0x0000:rm_after_pm_copy
222298

223299
; ------------------------------------------------------------
@@ -274,8 +350,8 @@ print_error_from_table:
274350

275351
.next:
276352
mov bl, [di] ; BL = code (db)
277-
; cmp bl, 0xFF
278-
; je .not_found
353+
cmp bl, 0xFF
354+
je .not_found
279355

280356
cmp bl, al
281357
je .found
@@ -382,7 +458,27 @@ rm_after_pm_copy:
382458
; Stack wiederherstellen (oder deinen echten RM-Stack)
383459
mov sp, 0x7C00
384460

385-
sti
461+
sti ;
462+
; -------->
463+
push cx
464+
push bx
465+
push ax
466+
push si
467+
push di
468+
push ds
469+
push es
470+
mov si, dotstr5 ; <--- load status
471+
call print_string
472+
pop es
473+
pop ds
474+
pop di
475+
pop si
476+
pop ax
477+
pop bx
478+
pop cx
479+
; <--------
480+
cli
481+
386482
ret
387483

388484
; Zurück nach Real Mode (für nächsten BIOS-Read)
@@ -1355,6 +1451,12 @@ dap_segment dw 0
13551451
dap_lba_low dd 0
13561452
dap_lba_high dd 0
13571453

1454+
dotstr1 db '1',0
1455+
dotstr2 db '2',0
1456+
dotstr3 db '3',0
1457+
dotstr4 db '4',0
1458+
dotstr5 db '5',0
1459+
13581460
; ------------------------------------------------------------
13591461
; boot menu
13601462
; ------------------------------------------------------------

0 commit comments

Comments
 (0)