Skip to content

Commit 2043ebe

Browse files
tarea++
1 parent 1dc18bb commit 2043ebe

19 files changed

Lines changed: 40 additions & 55 deletions

File tree

TO-DO.rm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# Integracion uefi + bios
2+
3+
-- pasar todo lo que se pueda de start32 a /lib/bios.asm
4+
25
-- no le estoy apuntando vien a pasar el flag de step mode al inicio de uefi.
36

47
-- corregir que start16 se carga en 0x7e00 y no en 8000 (ver tsl.ld).

asm/bios/mbr.asm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
BITS 16
2525

26+
2627
entryPoint:
2728
cli
2829
cld
@@ -42,7 +43,7 @@ entryPoint:
4243
call extensionTest
4344

4445

45-
load:
46+
load_start16_tsl_hi:
4647
mov si, msg_reading
4748
call print_bios
4849

asm/bios/start16.asm

Lines changed: 28 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
;;==============================================================================
22
;; Real mode swich to protected mode | @file /asm/bios/start16.asm
3-
;;
3+
;;==============================================================================
44
;; Para bios boot primero real mode a protected mode. Uefi saltea esta parte, ya
55
;; bootea en 64.
66
;;
@@ -19,6 +19,9 @@
1919
;;extern failure
2020
print_bios: equ 0x00de + 0x7c00 ;; print_bios en 0x7cde
2121
vesa: equ 0x011d + 0x7c00 ;; print_bios en 0x011d
22+
diskcpy: equ 0x0 + 0x7c00 ;; print_bios en 0x011d
23+
24+
msg_ok: equ 0x00
2225

2326

2427
;; tsl.asm
@@ -205,66 +208,32 @@ start32:
205208

206209

207210

208-
;;;;;;;;;;;;;;;; importante, aqui toma lo que le ha pasado desde bios, esto esta dentro de ifdef
209-
;;;; por eso lo que le pasa difiere de uefi
210-
;;;; leer info de video de VBEModeInfoBlock esta bien. Tener en cuenta que aqui es solo la asignacion para bios
211-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
212211

213-
; Save the frame buffer address, size (after its calculated), and the screen x,y
214-
xor eax, eax
215-
xor ebx, ebx
212+
load_tsl_hi:
213+
mov ax, print_bios
214+
mov si, msg_read_tsl_hi
215+
call ax ;; Calling using pointer works with directly defining functio addr.
216216

217-
mov ax, [0x5F00 + 16] ; BytesPerScanLine (modo vesa)
218-
push eax
219-
220-
mov bx, [0x5F00 + 16 + 2 * 2] ; YResolution (vesa)
221-
push ebx
217+
mov ax, (512 + 1) ;; Cant sectors. Load 512 = 262144 bytes = 256 KiB + 1 (
218+
;; start16.asm). TO-DO: en realidad solo 240 que es el t
219+
;; amano completo de la payload. Ya incluye a start16. R
220+
;; evisar tamanos.
221+
mov bx, 6117 ;; Offset = 8192.
222+
mov cx, 0x7E00 ;; Destination.
223+
call diskcpy ;; Copia payload completo. En este momento no tengo acce
224+
;; so a 0x800000 donde luego de activar modo progegido,
225+
;; copiare tsl.
222226

223-
mov ax, [0x5F00 + 16 + 2] ; XResolution (vesa)
224-
push eax
225-
226-
mul ebx
227-
mov ecx, eax
228-
shl ecx, 2 ; Quick multiply by 4
229-
230-
231-
;; aqui en bios, deja las cosas en el mismo orden que uefi
232-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
233-
;;;[0x00005F00] ; Frame buffer base
234-
;;;[0x00005F08] ; Frame buffer size (bytes)
235-
;;;[0x00005F10] ; Screen X
236-
;;;;[0x00005F12] ; Screen Y
237-
;;;;[0x00005F14] ; PixelsPerScanLine
238-
;;;;; recontramega importante (para bios, no uefi), aqui va a colocar
239-
240-
mov edi, 0x5F00
241-
mov eax, [0x5F00 + 40];;;; ya que para bios, el vbeinfoblock tiene esta estructura (framebuffer en +40)
242-
stosd ; 64-bit Frame Buffer Base (low)
243-
;;;;;;;; y pasandolo aqui 0x5f00 esta unificando un vbeInfoblock con estructura nueva tanto
244-
;;;;;;;; para efi como para bios
245-
246-
xor eax, eax
247-
stosd ; 64-bit Frame Buffer Base (high) completa qword
248-
249-
mov eax, ecx
250-
stosd ; 64-bit Frame Buffer Size in bytes (low)
251-
xor eax, eax
252-
stosd ; 64-bit Frame Buffer Size in bytes (high)
253-
254-
pop eax
255-
stosw ; 16-bit Screen X
227+
mov si, msg_ok
228+
call print_bios
256229

257-
pop eax
258-
stosw ; 16-bit Screen Y
259230

260-
pop eax
261-
shr eax, 2 ; 4 bytes / px => bpsl/4
262-
stosw ; PixelsPerScanLine
263-
mov eax, 32
264-
stosw ; BitsPerPixel
265231

266232

267233

234+
call buildVideoData
235+
236+
268237
;;;;;;;;;;;;;;;;; 7f23
269238
;;;;;;;;;;;;;;;;;;;;;;;;; este salto lo hace bien
270239

@@ -436,4 +405,9 @@ mov al, [0x8000]
436405

437406
;; TO-DO: agregar section data.
438407

439-
msg_e820: db "Performing e820..", 0
408+
msg_e820: db "Performing e820..", 0
409+
msg_read_tsl_hi: db "Reading tsl hi..", 0
410+
411+
412+
;; Zero fill.
413+
times 512 - $ + $$ db 0

asm/lib/bios.asm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
;;==============================================================================
2+
;; Lib for bios boot | @file /asm/lib/bios.asm
3+
;;==============================================================================
4+
5+
6+
7+

build/tsl.sys

-14.3 KB
Binary file not shown.

build/uefi.sys

-1 MB
Binary file not shown.

elf/tsl_hi.elf

-35.1 KB
Binary file not shown.

elf/tsl_lo.elf

-49.3 KB
Binary file not shown.

elf/uefi.elf

-1.02 MB
Binary file not shown.

obj/efi.o

-8.03 KB
Binary file not shown.

0 commit comments

Comments
 (0)