Skip to content

Commit 1dc18bb

Browse files
antes de etiq load a fun
1 parent b2fe5e9 commit 1dc18bb

9 files changed

Lines changed: 243 additions & 157 deletions

File tree

.gdb_history

Lines changed: 151 additions & 151 deletions
Large diffs are not rendered by default.

asm/bios/mbr.asm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ load:
5252
;; evisar tamanos.
5353
mov bx, 6117 ;; Offset = 8192.
5454
mov cx, 0x7E00 ;; Destination.
55-
call diskcpy ;; Copia payload completo.
55+
call diskcpy ;; Copia payload completo. En este momento no tengo acce
56+
;; so a 0x800000 donde luego de activar modo progegido,
57+
;; copiare tsl.
5658

5759
mov si, msg_ok
5860
call print_bios

asm/bios/start16.asm

Lines changed: 87 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,16 @@ e820:
134134

135135
; At this point we are done with real mode and BIOS interrupts. Jump to 32-bit mode.
136136
cli ; No more interrupts
137+
138+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 0x7ea0
137139
lgdt [cs:GDTR32] ; Load GDT register
138140
mov eax, cr0
139141
or al, 0x01 ; Set protected mode bit
140142
mov cr0, eax
141143

142144
;;;;;;;;;;;;;; esto tiene que ser a start32
143145
;;jmp 8:0x8000
144-
jmp 8:start32
146+
jmp 0x08:start32
145147
;;;;;;;;;;;;;;; here ends mbr completion
146148

147149

@@ -175,9 +177,15 @@ BITS 32
175177

176178
;;;Pasaje 32 to 64 bits
177179
start32:
180+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mov eax, tmpGDTR64
181+
182+
183+
184+
185+
178186
mov [p_BootDisk], bh ;; Save disk from where system was booted from
179187

180-
mov eax, 16 ;; Set the correct segment registers
188+
mov eax, 0x10 ;; Set the correct segment registers
181189
mov ds, ax
182190
mov es, ax
183191
mov ss, ax
@@ -191,7 +199,10 @@ start32:
191199
xor esi, esi
192200
xor edi, edi
193201
xor ebp, ebp
194-
mov esp, 0x8000 ; Set a known free location for the stack
202+
;;;;;;;;;;;;;;;;;;;;;mov esp, 0x8000 ; Set a known free location for the stack
203+
mov esp, 0x7000 ; Set a known free location for the stack
204+
205+
195206

196207

197208
;;;;;;;;;;;;;;;; importante, aqui toma lo que le ha pasado desde bios, esto esta dentro de ifdef
@@ -252,6 +263,15 @@ start32:
252263
mov eax, 32
253264
stosw ; BitsPerPixel
254265

266+
267+
268+
;;;;;;;;;;;;;;;;; 7f23
269+
;;;;;;;;;;;;;;;;;;;;;;;;; este salto lo hace bien
270+
271+
272+
273+
274+
255275
; Clear memory for the Page Descriptor Entries (0x10000 - 0x5FFFF)
256276
mov edi, 0x00210000
257277
mov ecx, 81920
@@ -304,9 +324,47 @@ pde_low_32: ; Create a 2 MiB page
304324
cmp ecx, 2048
305325
jne pde_low_32 ; Create 2048 2 MiB page maps.
306326

327+
328+
329+
330+
;;;;;;;;;;;;;;;;;;;;;;;;hasta aqui oka 7f7e
331+
332+
333+
334+
mov eax, tmpGDTR64
335+
307336
; Load the GDT
308337
lgdt [tmpGDTR64]
309338

339+
340+
341+
342+
mov al, [0x8000]
343+
jmp 8:salto
344+
nop
345+
nop
346+
nop
347+
nop
348+
nop
349+
nop
350+
nop
351+
nop
352+
nop
353+
nop
354+
nop
355+
nop
356+
nop
357+
nop
358+
nop
359+
nop
360+
nop
361+
nop
362+
salto:
363+
364+
365+
366+
367+
310368
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; aqui estamos en 0x7f7e
311369
; Enable extended properties
312370
mov eax, cr4
@@ -327,15 +385,41 @@ pde_low_32: ; Create a 2 MiB page
327385

328386

329387
;;;;;;;;;;;;;;;;;;;; hasta aqui oka 0x7fa6
388+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
389+
;;mov al, [0x8000]
390+
;;jmp 8:salto
391+
;;nop
392+
;;nop
393+
;;nop
394+
;;nop
395+
;;nop
396+
;;nop
397+
;;nop
398+
;;nop
399+
;;nop
400+
;;nop
401+
;;nop
402+
;;nop
403+
;;nop
404+
;;nop
405+
;;nop
406+
;;nop
407+
;;nop
408+
;;nop
409+
;;salto:
410+
330411
mov bl, 'B'
331412
mov bh, byte [p_BootDisk]
332413

414+
333415
;; hasta aqui llega. 0x7fae
334416
; Enable paging to activate long mode
335417
mov eax, cr0
336418
or eax, 0x80000000 ; PG (Bit 31)
337419
mov cr0, eax
338420

421+
;;;;;;;;;; hasta aqui 0x7fb9
422+
mov al, [0x8000]
339423
jmp SYS64_CODE_SEL:start64 ; Jump to 64-bit mode
340424

341425

asm/tsl_ap.asm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ startap64:
193193
xor r14, r14
194194
xor r15, r15
195195

196-
mov ax, 0x10 ;; TODO: is this needed?
197-
mov ds, ax ;; Clear the legacy segment registers.
196+
mov ax, 0x10
197+
mov ds, ax
198198
mov es, ax
199199
mov ss, ax
200200
mov fs, ax

build/tsl.sys

0 Bytes
Binary file not shown.

elf/tsl_lo.elf

56 Bytes
Binary file not shown.

obj/start16.o

160 Bytes
Binary file not shown.

out/BOOTX64.EFI

0 Bytes
Binary file not shown.

out/payload.sys

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)