Skip to content

Commit 15a8b39

Browse files
start16 creo que andando pero falta corregir el load address en ld script
1 parent 3f89df3 commit 15a8b39

11 files changed

Lines changed: 94 additions & 49 deletions

File tree

.gdb_history

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
1-
siquit
2-
quit
3-
b *0x8000
4-
continue
5-
quit
6-
b *0x8000
7-
dashboard memory watch 0x60000 20
8-
dashboard memory watch 0x8000 20
9-
continue
10-
quir
11-
qut
12-
quit
13-
b *0x8000
14-
continue
15-
si
161
quit
172
b *0x8000
183
continue
@@ -254,3 +239,18 @@ b *0x7c40
254239
continue
255240
b *0x7c40quit
256241
quit
242+
b *0x7e00
243+
continue
244+
quit
245+
b *0x7e00
246+
continue
247+
quit
248+
b *0x7e00
249+
continue
250+
b *0x8000
251+
continue
252+
quit
253+
b *0x7e00
254+
continue
255+
si
256+
quit

TO-DO.rm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Integracion uefi + bios
22

3+
-- corregir que start16 se carga en 0x7e00 y no en 8000 (ver tsl.ld).
4+
35
-- veo que tengo que ajustar ubicacion de tables de mapeo, revisar. Quiza no. Dejar en suspenso esto.
46

57
-- lo que se va a hacer es: levanta mbr todo tsl que tiene 1ero que nada start16. Si. Ahora ya incorporado el start16 debo ajustar tanto uefi como bios para asegurar que cada uno comience en el lugar correcto.

asm/bios/mbr.asm

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616

1717
%include "./asm/include/mbr.inc"
18+
%include "./asm/include/sysvar.inc"
1819

1920

2021
global print ;; Export symbol so to use this print function in start16.asm.
@@ -278,6 +279,55 @@ a20_check:
278279
ret
279280

280281

282+
283+
284+
;;==============================================================================
285+
;; vesa |
286+
;;==============================================================================
287+
;; No me gusta esta fun definida aqui y llamada en start. Luego veo que hacer.
288+
;; Esto es transitorio por cuestiones de espacio.
289+
;;==============================================================================
290+
291+
292+
293+
vesa:
294+
295+
mov cx, 0x4000 - 1 ; Start looking from here
296+
VBESearch:
297+
inc cx
298+
mov bx, cx ; Mode is saved to BX for the set command later
299+
cmp cx, 0x5000
300+
301+
;;TO-DO: falta load mensaje error.
302+
je failure
303+
304+
mov edi, VBEModeInfoBlock ; VBE data will be stored at this address
305+
mov ax, 0x4F01 ; VESA SuperVGA BIOS - GET SuperVGA MODE INFORMATION - http://www.ctyme.com/intr/rb-0274.htm
306+
int 0x10
307+
cmp ax, 0x004F ; Return value in AX should equal 0x004F if command supported and successful
308+
jne VBESearch ; Try next mode
309+
cmp byte [VBEModeInfoBlock.BitsPerPixel], 32 ; Desired bit depth
310+
jne VBESearch ; If not equal, try next mode
311+
cmp word [VBEModeInfoBlock.XResolution], Horizontal_Resolution ; Desired XRes here
312+
jne VBESearch
313+
cmp word [VBEModeInfoBlock.YResolution], Vertical_Resolution ; Desired YRes here
314+
jne VBESearch
315+
or bx, 0x4000 ; Use linear/flat frame buffer model (set bit 14)
316+
mov ax, 0x4F02 ; VESA SuperVGA BIOS - SET SuperVGA VIDEO MODE - http://www.ctyme.com/intr/rb-0275.htm
317+
int 0x10
318+
cmp ax, 0x004F ; Return value in AX should equal 0x004F if supported and successful
319+
320+
;;TO-DO: falta load mensaje error.
321+
jne failure
322+
323+
324+
ret
325+
326+
327+
328+
329+
330+
281331
;;==============================================================================
282332
;; section .data
283333
;;==============================================================================

asm/bios/start16.asm

Lines changed: 27 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
;;==============================================================================
2-
;;
2+
;; pick real mode swich to protected mode | @file /asm/bios/start16.asm
33
;;==============================================================================
44

55

66
%include "./asm/include/sysvar.inc"
77

88

9+
;; TO-DO: poner esto como un simbolo definido en donde mbr.ld hara el load de la
10+
;; funcion.
911
;;extern print
12+
print equ 0xde + 0x7c00
13+
failure equ 0x67 + 0x7c00
14+
vesa equ 0x117 + 0x7c00
15+
1016

1117
;; tsl_ap.asm
1218
extern GDTR32
@@ -26,7 +32,8 @@ BITS 16
2632

2733
start16:
2834

29-
35+
mov si, msg_e820
36+
call print
3037

3138
; Get the BIOS E820 Memory Map
3239
; https://wiki.osdev.org/Detecting_Memory_(x86)#BIOS_Function:_INT_0x15,_EAX_=_0xE820
@@ -88,29 +95,6 @@ memmapend:
8895

8996

9097

91-
mov cx, 0x4000 - 1 ; Start looking from here
92-
VBESearch:
93-
inc cx
94-
mov bx, cx ; Mode is saved to BX for the set command later
95-
cmp cx, 0x5000
96-
je halt
97-
mov edi, VBEModeInfoBlock ; VBE data will be stored at this address
98-
mov ax, 0x4F01 ; VESA SuperVGA BIOS - GET SuperVGA MODE INFORMATION - http://www.ctyme.com/intr/rb-0274.htm
99-
int 0x10
100-
cmp ax, 0x004F ; Return value in AX should equal 0x004F if command supported and successful
101-
jne VBESearch ; Try next mode
102-
cmp byte [VBEModeInfoBlock.BitsPerPixel], 32 ; Desired bit depth
103-
jne VBESearch ; If not equal, try next mode
104-
cmp word [VBEModeInfoBlock.XResolution], Horizontal_Resolution ; Desired XRes here
105-
jne VBESearch
106-
cmp word [VBEModeInfoBlock.YResolution], Vertical_Resolution ; Desired YRes here
107-
jne VBESearch
108-
or bx, 0x4000 ; Use linear/flat frame buffer model (set bit 14)
109-
mov ax, 0x4F02 ; VESA SuperVGA BIOS - SET SuperVGA VIDEO MODE - http://www.ctyme.com/intr/rb-0275.htm
110-
int 0x10
111-
cmp ax, 0x004F ; Return value in AX should equal 0x004F if supported and successful
112-
jne halt
113-
11498

11599

116100

@@ -138,14 +122,16 @@ jmp 8:start32
138122
;; -- si: string.
139123
;;==============================================================================
140124

141-
failure:
142-
call print
143-
halt:
125+
;; no se usa, puesto que reutiliza el del mbr.
126+
127+
;;failure:
128+
;; call print
129+
;;halt:
144130
;;.halt:
145-
;;mov si, msg_halt
146-
call print
147-
hlt
148-
jmp $
131+
;; mov si, msg_halt
132+
;; call print
133+
;; hlt
134+
;; jmp $
149135

150136

151137
;;msg_halt: db "System halted", 0
@@ -320,5 +306,12 @@ pde_low_32: ; Create a 2 MiB page
320306

321307

322308
;;;;;;;;;;;;;;;;;;;; delete this
323-
print:
324-
nop
309+
;;print:
310+
;;nop
311+
312+
313+
;;==============================================================================
314+
;; section .data
315+
;;==============================================================================
316+
317+
msg_e820: db "Performing e820..", 0

build/tsl.sys

0 Bytes
Binary file not shown.

elf/tsl_lo.elf

-24 Bytes
Binary file not shown.

obj/mbr.o

3.3 KB
Binary file not shown.

obj/start16.o

-144 Bytes
Binary file not shown.

out/BOOTX64.EFI

0 Bytes
Binary file not shown.

out/mbr.sys

70 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)