* [PATCH] Reduce boot header size with 1 byte
@ 2018-09-27 13:41 xyproto
2018-09-27 16:07 ` Randy Dunlap
2018-09-27 18:22 ` Brian Gerst
0 siblings, 2 replies; 3+ messages in thread
From: xyproto @ 2018-09-27 13:41 UTC (permalink / raw)
To: linux-kernel; +Cc: Alexander F. Rødseth
From: Alexander F. Rødseth <xyproto@archlinux.org>
Only ah needs to be set to 0 before calling interrupt 0x16 for waiting
for a keypress.
This patch changes the line that uses xor so that it only zeroes "ah" instead of "ax".
This saves a byte.
Signed-off-by: Alexander F. Rødseth <xyproto@archlinux.org>
---
| 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
--git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
index 850b8762e889..905cb96f43d4 100644
--- a/arch/x86/boot/header.S
+++ b/arch/x86/boot/header.S
@@ -71,14 +71,15 @@ msg_loop:
jmp msg_loop
bs_die:
- # Allow the user to press a key, then reboot
- xorw %ax, %ax
+ # Allow the user to press a key
+ xorb %ah, %ah
int $0x16
+
+ # Boostrap by reading sector 1, head 0, track 0 from drive
int $0x19
- # int 0x19 should never return. In case it does anyway,
- # invoke the BIOS reset code...
- ljmp $0xf000,$0xfff0
+ # If boostrap somehow did not work, invoke the BIOS reset code
+ ljmp $0xf000, $0xfff0
#ifdef CONFIG_EFI_STUB
.org 0x3c
--
2.19.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Reduce boot header size with 1 byte
2018-09-27 13:41 [PATCH] Reduce boot header size with 1 byte xyproto
@ 2018-09-27 16:07 ` Randy Dunlap
2018-09-27 18:22 ` Brian Gerst
1 sibling, 0 replies; 3+ messages in thread
From: Randy Dunlap @ 2018-09-27 16:07 UTC (permalink / raw)
To: xyproto, linux-kernel
On 9/27/18 6:41 AM, xyproto@archlinux.org wrote:
> From: Alexander F. Rødseth <xyproto@archlinux.org>
>
> Only ah needs to be set to 0 before calling interrupt 0x16 for waiting
> for a keypress.
>
> This patch changes the line that uses xor so that it only zeroes "ah" instead of "ax".
> This saves a byte.
>
> Signed-off-by: Alexander F. Rødseth <xyproto@archlinux.org>
Hi,
You should Cc: the X86 maintainers on this patch.
Otherwise it will just be lost in the ether.
thanks.
> ---
> arch/x86/boot/header.S | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
> index 850b8762e889..905cb96f43d4 100644
> --- a/arch/x86/boot/header.S
> +++ b/arch/x86/boot/header.S
> @@ -71,14 +71,15 @@ msg_loop:
> jmp msg_loop
>
> bs_die:
> - # Allow the user to press a key, then reboot
> - xorw %ax, %ax
> + # Allow the user to press a key
> + xorb %ah, %ah
> int $0x16
> +
> + # Boostrap by reading sector 1, head 0, track 0 from drive
> int $0x19
>
> - # int 0x19 should never return. In case it does anyway,
> - # invoke the BIOS reset code...
> - ljmp $0xf000,$0xfff0
> + # If boostrap somehow did not work, invoke the BIOS reset code
> + ljmp $0xf000, $0xfff0
>
> #ifdef CONFIG_EFI_STUB
> .org 0x3c
>
--
~Randy
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Reduce boot header size with 1 byte
2018-09-27 13:41 [PATCH] Reduce boot header size with 1 byte xyproto
2018-09-27 16:07 ` Randy Dunlap
@ 2018-09-27 18:22 ` Brian Gerst
1 sibling, 0 replies; 3+ messages in thread
From: Brian Gerst @ 2018-09-27 18:22 UTC (permalink / raw)
To: xyproto; +Cc: Linux Kernel Mailing List
On Thu, Sep 27, 2018 at 9:42 AM <xyproto@archlinux.org> wrote:
>
> From: Alexander F. Rødseth <xyproto@archlinux.org>
>
> Only ah needs to be set to 0 before calling interrupt 0x16 for waiting
> for a keypress.
>
> This patch changes the line that uses xor so that it only zeroes "ah" instead of "ax".
> This saves a byte.
>
> Signed-off-by: Alexander F. Rødseth <xyproto@archlinux.org>
> ---
> arch/x86/boot/header.S | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
> index 850b8762e889..905cb96f43d4 100644
> --- a/arch/x86/boot/header.S
> +++ b/arch/x86/boot/header.S
> @@ -71,14 +71,15 @@ msg_loop:
> jmp msg_loop
>
> bs_die:
> - # Allow the user to press a key, then reboot
> - xorw %ax, %ax
> + # Allow the user to press a key
> + xorb %ah, %ah
Because this is code running in 16-bit real mode, xorw does not need a
16-bit prefix and only uses 2 bytes. You save nothing by using xorb.
--
Brian Gerst
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-09-27 18:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-27 13:41 [PATCH] Reduce boot header size with 1 byte xyproto
2018-09-27 16:07 ` Randy Dunlap
2018-09-27 18:22 ` Brian Gerst
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).