Skip to content

Commit c035985

Browse files
ref added
1 parent 31c52d9 commit c035985

9 files changed

Lines changed: 57 additions & 61 deletions

File tree

.gdb_history

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
b *0x7ce5
2-
continue
3-
quit
4-
b *0x7c00
5-
continue
6-
dashboard
7-
si
8-
si
9-
b *0x7cd7
10-
continue
11-
dashboard memory watch $rip 2
12-
si
13-
dashboard memory unwatch $rip
14-
dashboard memory watch ($rip-1) 2
15-
si
16-
b (int)*($rip-1)
171
print/x (int)*($rip-1)
182
print/x *($rip-1)
193
print/x ($rip-1)
@@ -254,3 +238,19 @@ continnue
254238
continue
255239
si
256240
quit
241+
b *0x7e00
242+
continue
243+
si
244+
b *0x7e08
245+
continue
246+
quit
247+
b *0x7e08
248+
continue
249+
si
250+
quit
251+
b *0x7e08
252+
continue
253+
quit
254+
b *0x7e08
255+
continue
256+
quit

asm/bios/mbr.asm

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,6 @@ print_bios:
246246
ret
247247

248248

249-
250-
251-
252-
253-
254-
255249
;;==============================================================================
256250
;; a20_check | Check the status of a20 line
257251
;;==============================================================================

asm/bios/start16.asm

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
;;==============================================================================
22
;; Real mode swich to protected mode | @file /asm/bios/start16.asm
3+
;;
4+
;; Para bios boot primero real mode a protected mode. Uefi saltea esta parte, ya
5+
;; bootea en 64.
6+
;;
7+
;; https://wiki.osdev.org/Detecting_Memory_(x86)#BIOS_Function:_INT_0x15,_EAX_=_0xE820
8+
;; https://wiki.osdev.org/Detecting_Memory_(x86)#Getting_an_E820_Memory_Map
39
;;==============================================================================
410

511

@@ -11,44 +17,48 @@
1117
;;extern print_bios
1218
;;extern failure
1319
print_bios equ 0x00de + 0x7c00 ;; print_bios en 0x7cde
14-
;;failure equ 0x0067 + 0x7c00
15-
;;vesa equ 0x0111 + 0x7c00
1620

21+
;; tsl.asm
22+
extern start64
1723

1824
;; tsl_ap.asm
1925
extern GDTR32
2026
extern tmpGDTR64 ;; Only for bios boot. See tsl.asm 1178 TO-DO.
2127
extern SYS64_CODE_SEL
2228

23-
extern start64
24-
25-
26-
;; Primera parte: pasa real mode a protected mode.
2729

2830
BITS 16
31+
2932
start16:
3033
mov ax, print_bios
3134
mov si, msg_e820
32-
call ax
33-
34-
; Get the BIOS E820 Memory Map
35-
; https://wiki.osdev.org/Detecting_Memory_(x86)#BIOS_Function:_INT_0x15,_EAX_=_0xE820
36-
; The code below is from https://wiki.osdev.org/Detecting_Memory_(x86)#Getting_an_E820_Memory_Map
37-
; inputs: es:di -> destination buffer for 24 byte entries
38-
; outputs: bp = entry count, trashes all registers except esi
39-
; The function below creates a memory map at address 0x6000 and the records are:
40-
; 64-bit Base
41-
; 64-bit Length
42-
; 32-bit Type (1 = normal, 2 reserved, ACPI reclaimable)
43-
; 32-bit ACPI
44-
; 64-bit Padding
45-
do_e820:
46-
mov edi, 0x00006000 ; location that memory map will be stored to
47-
xor ebx, ebx ; ebx must be 0 to start
48-
xor bp, bp ; keep an entry count in bp
49-
mov edx, 0x0534D4150 ; Place "SMAP" into edx
35+
call ax ;; Calling using pointer works with directly defining functio addr.
36+
37+
38+
;;==============================================================================
39+
;;e820 | builds memmap
40+
;; Arguments:
41+
;; -- {es:di} = destination buffer for 24 byte entries.
42+
;; Returns:
43+
;; -- bp = entry count
44+
;;
45+
;; trashes all registers except esi
46+
;; Creates memory map at 0x6000.
47+
;; and the records are:
48+
;; 64 bit Base
49+
;; 64 bit Length
50+
;; 32 bit Type (1 = normal, 2 reserved, ACPI reclaimable)
51+
;; 32 bit ACPI
52+
;; 64 bit Padding
53+
;;==============================================================================
54+
55+
e820:
56+
mov edi, 0x00006000 ;; Addrr to place memmap.
57+
xor ebx, ebx
58+
xor bp, bp ;; Entry count.
59+
mov edx, 0x0534D4150 ;; SMAP.
5060
mov eax, 0xe820
51-
mov [es:di + 20], dword 1 ; force a valid ACPI 3.X entry
61+
mov dword [es:di + 20], 1 ;; force a valid ACPI 3.X entry
5262
mov ecx, 24 ; ask for 24 bytes
5363
int 0x15
5464
jc nomemmap ; carry set on first call means "unsupported function"
@@ -103,7 +113,6 @@ memmapend:
103113
mov eax, cr0
104114
or al, 0x01 ; Set protected mode bit
105115
mov cr0, eax
106-
;;jmp 8:0x8000 ; Jump to 32-bit protected mode
107116

108117
;;;;;;;;;;;;;; esto tiene que ser a start32
109118
;;jmp 8:0x8000

asm/uefi.asm

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -308,20 +308,13 @@ entryPoint:
308308
mov rdx, fmt_curr_txt_mode
309309
call efi_print ;; Current video settings del modo texto con el q inicia.
310310

311-
;; Ventana en la que se puede activar modo step presionando 's'.
312-
call ventana_modo_step
311+
;; Ventana en la que se puede activar modo step presionando 's'.
312+
call ventana_modo_step
313313

314-
;;jmp $
315-
;;nop
316-
;;nop
317-
;;nop
318-
319-
320-
321-
;; Copio en la section data de la payload el flag cuyo valor es seteado en linke
322-
;; dicion para que este disponible cuando se pase a tsl.sys
323-
mov al, [STEP_MODE_FLAG]
324-
mov [DATA_HI_START_LOAD], al
314+
;; Copio en la section data de la payload el flag cuyo valor es seteado en l
315+
;; inkedicion para que este disponible cuando se pase a tsl.sys
316+
mov al, [STEP_MODE_FLAG]
317+
mov [DATA_HI_START_LOAD], al
325318

326319

327320
;; Buscar info ACPI.

elf/tsl_lo.elf

-8 Bytes
Binary file not shown.

elf/uefi.elf

-8 Bytes
Binary file not shown.

obj/mbr.o

0 Bytes
Binary file not shown.

obj/start16.o

-16 Bytes
Binary file not shown.

obj/uefi.o

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)