@@ -164,40 +164,40 @@ set_pit_initial_freq:
164164
165165;; Aqui se comienzan a armar tablas de sistema. Breve resumen de lo que finalmen
166166;; te va a quedar:
167- ;; | | | if |if |mapped| | table(s) total
168- ;; |4KiB | | 1Mib |1GiB |per | | initilized
169- ;; |blocks| | pages |pages|entry | | mem mapping
170- ;; -----------+------+-----------+--------+ -------+--------------+---------------
171- ;; 0x00000000 | 1 | idt | | | |
172- ;; 0x00000FFF | | | | | |
173- ;; ----------------------------------------------------- ------------------------
174- ;; 0x00001000 | 1 | gdt | | | |
175- ;; 0x00001FFF | | | | | |
176- ;; ----------------------------------------------------- ------------------------
177- ;; 0x00002000 | 1 | pml4 | | | |
178- ;; 0x00002FFF | | | | | | | |
179- ;; ----------------------------------------------------- ------------------------
180- ;; 0x00003000 | 1 | pdpt cano | 16 |512 | 1GiB |
181- ;; 0x00003FFF | | nical low | entr. |entr.| |
182- ;; ----------------------------------------------------- ------------------------
183- ;; 0x00004000 | 1 | pdpt cano | | | |
184- ;; 0x00004FFF | | nical hig | | | |
185- ;; ----------------------------------------------------- -----------------------
186- ;; 0x00005000 | 3 | system | | | | |
187- ;; 0x00007FFF | | data | | | |
188- ;; ----------------------------------------------------- ------------------------
189- ;; 0x00008000 | 8 | dispo | | | |
190- ;; 0x0000FFFF | | nible | | | |
191- ;; -----------------------------------------------------------------------------
192- ;; 0x00010000 | 16 | pd low |16 pag *| sin |2MiB |
193- ;; 0x0001FFFF | | |512 entr| uso | |
194- ;; -----------------------------------------------------------------------------
195- ;; 0x00020000 | 64 | pd high | | sin | |
196- ;; 0x0005FFFF | | | | uso | |
197- ;; ----------------------------------------------------------------------------
198- ;; 0x00060000 | 64 | dispo | | | | |
199- ;; 0x0009FFFF | | nible | | | | |
200- ;; -----------------------------------------------------------------------------
167+ ;; | | | if |if |mapped| | table(s) total
168+ ;; |4KiB | | 1Mib |1GiB |per | | initilized
169+ ;; |blocks| | pages |pages|entry | | mem mapping
170+ ;; -----------+------+-----------+-----------+ ----- +------+ --------+---------------
171+ ;; 0x00000000 | 1 | idt | | | |
172+ ;; 0x00000FFF | | | | | |
173+ ;; -----------+ ------+ -----------+ -----------+ -----+ ------+ ------------------------
174+ ;; 0x00001000 | 1 | gdt | | | |
175+ ;; 0x00001FFF | | | | | |
176+ ;; -----------+ ------+ -----------+ -----------+ -----+ ------+ ------------------------
177+ ;; 0x00002000 | 1 | pml4 | | | |
178+ ;; 0x00002FFF | | | | | | | |
179+ ;; -----------+ ------+ -----------+ -----------+ -----+ ------+ ------------------------
180+ ;; 0x00003000 | 1 | pdpt cano | 16 |512 | 1GiB |
181+ ;; 0x00003FFF | | nical low | entr. |entr.| |
182+ ;; -----------+ ------+ -----------+ -----------+ -----+ ------+ ------------------------
183+ ;; 0x00004000 | 1 | pdpt cano | | | |
184+ ;; 0x00004FFF | | nical hig | | | |
185+ ;; -----------+ ------+ -----------+ -----------+ -----+ ------+ -----------------------
186+ ;; 0x00005000 | 3 | system | | | | |
187+ ;; 0x00007FFF | | data | | | |
188+ ;; -----------+ ------+ -----------+ -----------+ -----+ ------+ ------------------------
189+ ;; 0x00008000 | 8 | dispo | | | |
190+ ;; 0x0000FFFF | | nible | | | |
191+ ;; -----------+ ------+ -----------+ -----------+ -----+ ------+ ---------------------------
192+ ;; 0x00010000 | 16 | pd low |16 pag * | sin |2MiB |
193+ ;; 0x0001FFFF | | |512 entr | uso | |
194+ ;; -----------+ ------+ -----------+ -----------+ -----+ ------+ ---------------------------
195+ ;; 0x00020000 | 64 | pd high | | sin | |
196+ ;; 0x0005FFFF | | | | uso | |
197+ ;; -----------+ ------+ -----------+ -----------+ -----+ ------+ --------------------------
198+ ;; 0x00060000 | 64 |disponible |pd fb si | | | |
199+ ;; 0x0009FFFF | |condicion |*fb<16*2^30 | | | |
200+ ;; -----------+ ------+ -----------+ -----------+ -----+ ------+ ---------------------------
201201 mov r9 , msg_gdt
202202 call print
203203
@@ -228,7 +228,7 @@ pml4:
228228 call print
229229
230230pse:
231- mov eax , 0x01
231+ mov rax , 0x01
232232 cpuid
233233 mov rax , rdx
234234 bt rax , 3
240240 call print
241241
242242pae:
243- mov eax , 0x01
243+ mov rax , 0x01
244244 cpuid
245245 mov rax , rdx
246246 bt rax , 6
252252 call print
253253
254254pse36:
255- mov eax , 0x01
255+ mov rax , 0x01
256256 cpuid
257257 mov rax , rdx
258258 bt rax , 17
@@ -263,6 +263,26 @@ pse36:
263263 mov r9 , fmt_pse36
264264 call print
265265
266+ physical_address_size:
267+ mov rax , 0x80000008
268+ cpuid
269+ push rax ;; Para recuperarlo luego del print.
270+ and rax , 0xFF
271+ mov rsi , rax
272+ mov r9 , fmt_physical_addr
273+ call print
274+
275+
276+ logical_address_size:
277+ pop rax
278+ mov al , ah
279+ and rax , 0xFF
280+ mov rsi , rax
281+ mov r9 , fmt_logical_addr
282+ call print
283+
284+
285+
266286
267287pag_1gb_support:
268288 mov r9 , msg_support_1g_pages ;; Comienza aviso de soporte.
@@ -591,6 +611,9 @@ load_gdt:
591611;;hlt
592612
593613
614+ ;; TODO: continuar limpiando la carga de tablas. Agregar ver direccion fb y agre
615+ ;; gar mapeo si no entra dentro del tamano actualmente mapeado.
616+
594617;; Point cr3 at PML4
595618cr3_load:
596619 mov rax , 0x00002008 ;;; Write-thru enabled (Bit 3).
@@ -1225,7 +1248,7 @@ clear_regs:
12251248 mov r9 , msg_system_setup_ready
12261249 call print
12271250
1228- ;; call keyboard_get_key
1251+ call keyboard_get_key
12291252
12301253 jmp 0x00100000 ;; Jump to kernel.
12311254
@@ -1873,13 +1896,13 @@ fmt_mm_info_siz equ $ - fmt_mm_info_efi_pal_code
18731896msg_pae_off_will_set: db "PAE off. Enabling... " , 0
18741897mag_pae_already_set: db "PAE enabled" , 0x0A , 0
18751898
1876-
18771899msg_cpuid_info: db "Processor features:" , 0
18781900fmt_pse: db " | PSE = %d" , 0
18791901fmt_pae: db " | PAE = %d" , 0
1880-
18811902fmt_pse36: db " | PSE-36 = %d" , 0x0A , 0
18821903
1904+ fmt_physical_addr db "Physical address size [bits] = %d" , 0
1905+ fmt_logical_addr db " | Logical address size [bits] = %d" , 0x0A , 0
18831906
18841907
18851908msg_test_hex: db "Value = 0x%h" , 0x0A , 0
0 commit comments