Skip to contentSkip to conversation

loader/efi: Update comment

PATCH In review Frediano Ziglio via Grub-devel 3 participants 8 messages Sep 3, 2024 – Sep 5, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 loader/efi: Update comment

The function called is grub_utf8_to_utf16.

---
 grub-core/loader/efi/linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/loader/efi/linux.c +1 -1
index bfbd95aee..803d2541d 100644
@@ -216,7 +216,7 @@ grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args)
 
   grub_dprintf ("linux", "linux command line: '%s'\n", args);
 
-  /* Convert command line to UCS-2 */
+  /* Convert command line to UTF-16 */
   loaded_image = grub_efi_get_loaded_image (image_handle);
   if (loaded_image == NULL)
     {
Signature · 7 lines
2.46.0


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#1 lore raw

PATCH 1/1 relocator: Fix comment in code

The instruction uses a 64 bit immediate.

---
 grub-core/lib/x86_64/relocator_asm.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/lib/x86_64/relocator_asm.S +1 -1
index 2ab6d8cb7..fd9b2b44e 100644
@@ -22,7 +22,7 @@
 	.p2align	2
 
 VARIABLE(grub_relocator_backward_start)
-	/* mov imm32, %rax */
+	/* mov imm64, %rax */
 	.byte	0x48
 	.byte	0xb8
 VARIABLE(grub_relocator_backward_dest)
Signature · 7 lines
2.46.0


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#2 lore raw

PATCH 1/1 loader/efi: Reuse len variable

In reply to Frediano Ziglio via Grub-devel
---
 grub-core/loader/efi/linux.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
grub-core/loader/efi/linux.c +3 -2
index 803d2541d..1ffbcf9ce 100644
@@ -226,7 +226,7 @@ grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args)
   loaded_image->load_options_size = len =
     (grub_strlen (args) + 1) * sizeof (grub_efi_char16_t);
   loaded_image->load_options =
-    grub_efi_allocate_any_pages (GRUB_EFI_BYTES_TO_PAGES (loaded_image->load_options_size));
+    grub_efi_allocate_any_pages (GRUB_EFI_BYTES_TO_PAGES (len));
   if (!loaded_image->load_options)
     return grub_errno;
 
@@ -240,7 +240,8 @@ grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args)
   /* When successful, not reached */
   grub_error (GRUB_ERR_BAD_OS, "start_image() returned 0x%" PRIxGRUB_EFI_UINTN_T, status);
   grub_efi_free_pages ((grub_addr_t) loaded_image->load_options,
-		       GRUB_EFI_BYTES_TO_PAGES (loaded_image->load_options_size));
+		       GRUB_EFI_BYTES_TO_PAGES (len));
+  loaded_image->load_options = NULL;
 unload:
   b->unload_image (image_handle);
 
Signature · 7 lines
2.46.0


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#3 lore raw

Re: [PATCH] loader/efi: Reuse len variable

This also sets a variable at it's end. Can you adjust the commit message? Or even split it?

Quoted 33 lines · Frediano Ziglio via Grub-devel
---
 grub-core/loader/efi/linux.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
grub-core/loader/efi/linux.c +1 -1
index 803d2541d..1ffbcf9ce 100644
@@ -226,7 +226,7 @@ grub_arch_efi_linux_boot_image (grub_addr_t addr,
 grub_size_t size, char *args)
   loaded_image->load_options_size = len =
     (grub_strlen (args) + 1) * sizeof (grub_efi_char16_t);
   loaded_image->load_options =
-    grub_efi_allocate_any_pages (GRUB_EFI_BYTES_TO_PAGES
 (loaded_image->load_options_size));
+    grub_efi_allocate_any_pages (GRUB_EFI_BYTES_TO_PAGES (len));
   if (!loaded_image->load_options)
     return grub_errno;
grub-core/loader/efi/linux.c +2 -1
@@ -240,7 +240,8 @@ grub_arch_efi_linux_boot_image (grub_addr_t addr,
 grub_size_t size, char *args)
   /* When successful, not reached */
   grub_error (GRUB_ERR_BAD_OS, "start_image() returned 0x%"
 PRIxGRUB_EFI_UINTN_T, status);
   grub_efi_free_pages ((grub_addr_t) loaded_image->load_options,
-                      GRUB_EFI_BYTES_TO_PAGES
 (loaded_image->load_options_size));
+                      GRUB_EFI_BYTES_TO_PAGES (len));
+  loaded_image->load_options = NULL;

unload:

   b->unload_image (image_handle);
Quoted 9 lines

--
2.46.0

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#4 lore raw

PATCH 1/1 relocator: Use .quad instead of .long

In reply to Frediano Ziglio via Grub-devel

Used also in other assembly files.
They are single 64-bit values.

---
 grub-core/lib/x86_64/relocator_asm.S | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
grub-core/lib/x86_64/relocator_asm.S +6 -6
index fd9b2b44e..12728d8e1 100644
@@ -26,21 +26,21 @@ VARIABLE(grub_relocator_backward_start)
 	.byte	0x48
 	.byte	0xb8
 VARIABLE(grub_relocator_backward_dest)
-	.long	0, 0
+	.quad	0
 	movq	%rax, %rdi
 
 	/* mov imm64, %rax */
 	.byte	0x48
 	.byte	0xb8
 VARIABLE(grub_relocator_backward_src)
-	.long	0, 0
+	.quad	0
 	movq	%rax, %rsi
 
 	/* mov imm64, %rcx */
 	.byte	0x48
 	.byte	0xb9
 VARIABLE(grub_relocator_backward_chunk_size)
-	.long	0, 0
+	.quad	0
 
 	add	%rcx, %rsi
 	add	%rcx, %rdi
@@ -62,21 +62,21 @@ VARIABLE(grub_relocator_forward_start)
 	.byte	0x48
 	.byte	0xb8
 VARIABLE(grub_relocator_forward_dest)
-	.long	0, 0
+	.quad	0
 	movq	%rax, %rdi
 
 	/* mov imm64, %rax */
 	.byte	0x48
 	.byte	0xb8
 VARIABLE(grub_relocator_forward_src)
-	.long	0, 0
+	.quad	0
 	movq	%rax, %rsi
 
 	/* mov imm64, %rcx */
 	.byte	0x48
 	.byte	0xb9
 VARIABLE(grub_relocator_forward_chunk_size)
-	.long	0, 0
+	.quad	0
 
 	/* Forward copy.  */
 	cld
Signature · 7 lines
2.46.0


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Reviewed-by on v1 1/1
#5 lore raw

Re: [PATCH] relocator: Use .quad instead of .long

Reviewed-by [email protected]
Quoted 67 lines · Frediano Ziglio via Grub-devel

Used also in other assembly files.
They are single 64-bit values.

---
 grub-core/lib/x86_64/relocator_asm.S | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
grub-core/lib/x86_64/relocator_asm.S +6 -7
index fd9b2b44e..12728d8e1 100644
@@ -26,21 +26,21 @@ VARIABLE(grub_relocator_backward_start)
        .byte   0x48
        .byte   0xb8
 VARIABLE(grub_relocator_backward_dest)
-       .long   0, 0
+       .quad   0
        movq    %rax, %rdi
 
        /* mov imm64, %rax */
        .byte   0x48
        .byte   0xb8
 VARIABLE(grub_relocator_backward_src)
-       .long   0, 0
+       .quad   0
        movq    %rax, %rsi
 
        /* mov imm64, %rcx */
        .byte   0x48
        .byte   0xb9
 VARIABLE(grub_relocator_backward_chunk_size)
-       .long   0, 0
+       .quad   0
 
        add     %rcx, %rsi
        add     %rcx, %rdi
@@ -62,21 +62,21 @@ VARIABLE(grub_relocator_forward_start)
        .byte   0x48
        .byte   0xb8
 VARIABLE(grub_relocator_forward_dest)
-       .long   0, 0
+       .quad   0
        movq    %rax, %rdi
 
        /* mov imm64, %rax */
        .byte   0x48
        .byte   0xb8
 VARIABLE(grub_relocator_forward_src)
-       .long   0, 0
+       .quad   0
        movq    %rax, %rsi
 
        /* mov imm64, %rcx */
        .byte   0x48
        .byte   0xb9
 VARIABLE(grub_relocator_forward_chunk_size)
-       .long   0, 0
+       .quad   0
 
        /* Forward copy.  */
        cld
--

2.46.0

Quoted 5 lines

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

Reviewed-by on v1 1/1
#6 lore raw
In reply to Frediano Ziglio via Grub-devel
Reviewed-by [email protected]
Quoted 21 lines · Frediano Ziglio via Grub-devel

The function called is grub_utf8_to_utf16.

---
 grub-core/loader/efi/linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/loader/efi/linux.c +1 -1
index bfbd95aee..803d2541d 100644
@@ -216,7 +216,7 @@ grub_arch_efi_linux_boot_image (grub_addr_t addr,
 grub_size_t size, char *args)
 
   grub_dprintf ("linux", "linux command line: '%s'\n", args);
 
-  /* Convert command line to UCS-2 */
+  /* Convert command line to UTF-16 */
   loaded_image = grub_efi_get_loaded_image (image_handle);
   if (loaded_image == NULL)
     {
Quoted 9 lines

--
2.46.0

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel