Skip to content

Commit 8f5036a

Browse files
Informacion mensaje de obtencion de mapa de memoria agregado.
1 parent 8b042eb commit 8f5036a

File tree

3 files changed

+32
-82
lines changed

3 files changed

+32
-82
lines changed

asm/boot/uefi.asm

Lines changed: 32 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,6 @@ acpi_get:
314314
.err:
315315
mov rsi, msg_acpi_err
316316
je error_fatal ;; Sin ACPI no se continua.
317-
318317

319318
;; Configurar pantalla. Algunas definiciones:
320319
;; https://www.intel.com/content/dam/doc/guide/uefi-driver-graphics-controller-g
@@ -497,48 +496,29 @@ locate_gop_protocol:
497496
cmp rax, EFI_SUCCESS
498497
jne .next
499498

500-
501499
;; Se acaba de resetear el buffer de video, se blanquea la pantalla. Antes se ve
502500
;; ia baja resolucion, ahora se setea la nueva seleccionada resolucion. Voy a vo
503501
;; lver a mostrar en pantalla los datos de resolucion configurados.
504502
;; Buscar info pantalla actual (modo 0), de modo de ya tener config video falle
505503
;; o no el intento de cambio.
506504

507-
;;mov rax, 0x00000000
508-
;;call memsetFramebuffer ;; Se asegura de borrar los mensajes anteriores en c
509-
;; aso de no lograr cambiar de modo.
510-
511505
.video_mode_success:
512506

513-
;; SIMPLE_TEXT_OUTPUT.ClearScreen(). Clears display. Cursor position (0, 0).
514-
;;mov rcx, [TXT_OUT_INTERFACE]
515-
;;call [rcx + EFI_OUT_CLEAR_SCREEN]
516-
517507
mov rax, 0x00000000
518508
call memsetFramebuffer
519509

520-
;;mov rsi, [vid_index]
521-
;;mov rdx, msg_graphics_success
522-
;;call efi_print
523-
524-
;;mov rax, [FB]
525-
;;mov [print_cursor], rax ;; Inicializacion del cursor.
526-
;;mov r9, msg_graphics_success
527-
;;mov rsi, [vid_index]
528-
;;call print
529-
530-
mov qword [print_pending_msg], msg_graphics_success
510+
mov qword [print_pending_msg], msg_graphics_success ;; Prepara mensaje para
511+
;; mostrar luego.
531512
mov rsi, [vid_index]
532513
mov [print_pending_msg + 8], rsi
533514
jmp get_video
534515

535516
;; Ha probado todos los modos y no encuentra match ni con un EDID encontrado, ni
536517
;; con la resolucion por defecto. Lo que hace es no cambiar el actual modo.
537518
skip_set_video:
538-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mov rdx, msg_gop_no_mode_matches
539-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;call efi_print
540519

541-
mov qword [print_pending_msg], msg_gop_no_mode_matches
520+
mov qword [print_pending_msg], msg_gop_no_mode_matches ;; Mensaje para mos
521+
;; trar luego.
542522

543523
;; Haya encontrado match en un video mode y logrado setearlo, o no, continua. us
544524
;; a la resolucion que actualmente tiene seteada, por lo que si al arranque teni
@@ -585,26 +565,9 @@ get_video:
585565
mov qword [print_pending_msg + 8], 0
586566
call print
587567

588-
589-
;; Info en pantalla del modo seleccionado y valores que quedaron. Estos son
590-
;; los seteos que le va a pasar al siguiente bootloader y SO.
568+
;; Info en pantalla del modo seleccionado y valores que quedaron. Estos son los
569+
;; seteos que le va a pasar al siguiente bootloader y SO.
591570
print_video_information:
592-
;;mov rsi, [HR]
593-
;;mov rdx, fmt_resolution_horizontal
594-
;;call efi_print
595-
;;mov rsi, [VR]
596-
;;mov rdx, fmt_resolution_vertical
597-
;;call efi_print
598-
;;mov rsi, [PPSL]
599-
;;mov rdx, fmt_ppsl
600-
;;call efi_print
601-
;;mov rsi, [FB_SIZE]
602-
;;mov rdx, fmt_fb_size
603-
;;call efi_print
604-
;;mov rsi, [FB]
605-
;;mov rdx, fmt_fb_address
606-
;;call efi_print
607-
608571
mov rsi, [HR]
609572
mov r9, fmt_resolution_horizontal
610573
call print
@@ -621,9 +584,6 @@ print_video_information:
621584
mov r9, fmt_fb_address
622585
call print
623586

624-
625-
;;call prompt_step_mode ;; Parada modo step.
626-
627587
verifica_payload:
628588
mov rsi, PAYLOAD + 6
629589
mov rax, [rsi]
@@ -646,7 +606,7 @@ get_memmap:
646606
mov rsi, txt_err_memmap ;; Detalle del error, si resulta no se success.
647607
cmp rax, EFI_SUCCESS
648608
jne error_fatal8
649-
jmp exit_uefi_services
609+
jmp .print_info_memmap
650610

651611
.notify_change:
652612
mov r9, msg_notify_memmap_change
@@ -682,28 +642,21 @@ get_memmap:
682642

683643
;; TODO: print_memmpap_info, pero aqui no la puedo hacer ya que luego de obtener
684644
;; mapa de mem, inmediatamente debo hacer el exit.
685-
;;mov rdx, 0
686-
;;mov rax, [memmapsize]
687-
;;mov rcx, [memmapdescsize]
688-
;;div rcx
689-
;;mov rsi, rax
690-
;;mov rsi, 8
691-
;;mov rdx, fmt_memmap_cant_descriptors
692-
;;mov rdx, msg_test
693-
;;all print
645+
.print_info_memmap
646+
mov rdx, 0
647+
mov rax, [memmapsize]
648+
mov rcx, [memmapdescsize]
649+
div rcx
650+
mov rsi, rax
651+
mov r9, fmt_memmap_cant_descriptors
652+
call print
694653

695654
exit_uefi_services:
696655

697-
;;mov rax, 0x00000000
698-
;;call memsetFramebuffer
699-
700-
;; Notificar a punto de salir, pero aqui no la puedo hacer ya que lueg
701-
;; o de obtener mapa de mem, inmediatamente debo hacer el exit.
702-
;;mov rax, [FB]
703-
;;mov [print_cursor], rax ;; Inicializacion del cursor.
656+
;; Notificar a punto de salir, pero aqui no la puedo hacer con efi_print ya
657+
;; que luego de obtener mapa de mem, inmediatamente debo hacer el exit.
704658
mov r9, msg_boot_services_exit
705659
call print
706-
;;;;;;;;;;;;;;;;;;;;;;;;;;;call prompt_step_mode ;; Ultima parada step usando boot services.
707660

708661
mov rcx, [EFI_IMAGE_HANDLE] ;; IN EFI_HANDLE ImageHandle
709662
mov rdx, [memmapkey] ;; IN UINTN MapKey
@@ -814,9 +767,9 @@ error_fatal8:
814767

815768

816769
payloadSignatureFail:
817-
mov rcx, [TXT_OUT_INTERFACE]
818-
lea rdx, [msg_badPayloadSignature]
819-
call [rcx + EFI_OUT_OUTPUTSTRING]
770+
mov r9, msg_badPayloadSignature
771+
call print
772+
820773
halt:
821774
hlt
822775
jmp halt
@@ -1148,8 +1101,6 @@ division_init:
11481101
ret
11491102

11501103

1151-
1152-
11531104
;;==============================================================================
11541105
;; num2str - convierte un entero en un string null terminated
11551106
;;==============================================================================
@@ -1347,6 +1298,7 @@ print:
13471298
jmp .avance_next_char
13481299

13491300
.character:
1301+
;; No necesario por el momento.
13501302

13511303
.string:
13521304
push rdi
@@ -1383,7 +1335,6 @@ memsetFramebuffer:
13831335
ret
13841336

13851337

1386-
13871338
;;==============================================================================
13881339
;;
13891340
;;==============================================================================
@@ -1408,9 +1359,12 @@ getKey:
14081359
ret
14091360

14101361

1411-
1412-
1413-
1362+
;;==============================================================================
1363+
;;
1364+
;;==============================================================================
1365+
;; Argumentos:
1366+
;;
1367+
;;==============================================================================
14141368

14151369
emptyKbBuffer:
14161370
push rbp
@@ -1434,11 +1388,6 @@ emptyKbBuffer:
14341388

14351389

14361390

1437-
1438-
1439-
1440-
1441-
14421391
times 4 * 1024 - ($ - $$) db 0 ;; Zero padding resto de .text
14431392
CODE_END:
14441393

@@ -1475,8 +1424,7 @@ vid_orig: dq 0
14751424
vid_index: dq 0
14761425
vid_max: dq 0
14771426
vid_size: dq 0
1478-
vid_info: dq 0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;msg_graphics_success: dw utf16("Cambio de modo de video ok | Nuevo modo = %d"), 13, 0xA, 0
1479-
1427+
vid_info: dq 0
14801428

14811429
;; typedef struct {
14821430
;; UINT16 ScanCode;
@@ -1517,7 +1465,9 @@ db 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a
15171465
;; UTF16 strings para bootservices.
15181466
msg_uefi_boot: dw utf16("UEFI boot"), 13, 0xA, 0
15191467
msg_error: dw utf16("Error"), 0
1520-
msg_badPayloadSignature: dw utf16("Bad payload signature."), 0
1468+
1469+
msg_badPayloadSignature: db "Payload signature check failed.", 0
1470+
15211471
Hex: db "0123456789ABCDEF"
15221472
Num: dw 0, 0
15231473
newline: dw 13, 10, 0
@@ -1561,7 +1511,7 @@ txt_err_memmap: dw utf16("get memmap feilure"), 0
15611511
msg_test16: dw utf16("Test"), 13, 0xA, 0
15621512
msg_test8: db "Test", 0
15631513

1564-
fmt_memmap_cant_descriptors: dw utf16("Uefi returned memmap | Cant descriptors = %d"), 13, 0xA, 0
1514+
fmt_memmap_cant_descriptors: db "Uefi returned a memory map | Cant descriptors = %d", 13, 0xA, 0
15651515

15661516

15671517

build/uefi.elf

0 Bytes
Binary file not shown.

build/uefi.sys

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)