diff mbox series

[kvm-unit-tests,02/32] powerpc: Fix pseries getchar return value

Message ID 20240226101218.1472843-3-npiggin@gmail.com (mailing list archive)
State New, archived
Headers show
Series powerpc improvements | expand

Commit Message

Nicholas Piggin Feb. 26, 2024, 10:11 a.m. UTC
getchar() didn't get the shift value correct and never returned the
first character. This never really mattered since it was only ever
used for press-a-key-to-continue prompts. but it tripped me up when
debugging a QEMU console output problem.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 lib/powerpc/hcall.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Thomas Huth Feb. 26, 2024, 11:35 a.m. UTC | #1
On 26/02/2024 11.11, Nicholas Piggin wrote:
> getchar() didn't get the shift value correct and never returned the
> first character. This never really mattered since it was only ever
> used for press-a-key-to-continue prompts. but it tripped me up when
> debugging a QEMU console output problem.
> 
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
>   lib/powerpc/hcall.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/powerpc/hcall.c b/lib/powerpc/hcall.c
> index 711cb1b0f..b4d39ac65 100644
> --- a/lib/powerpc/hcall.c
> +++ b/lib/powerpc/hcall.c
> @@ -43,5 +43,5 @@ int __getchar(void)
>   	asm volatile (" sc 1 "  : "+r"(r3), "+r"(r4), "=r"(r5)
>   				: "r"(r3),  "r"(r4));
>   
> -	return r3 == H_SUCCESS && r4 > 0 ? r5 >> 48 : -1;
> +	return r3 == H_SUCCESS && r4 > 0 ? r5 >> 56 : -1;
>   }

Reviewed-by: Thomas Huth <thuth@redhat.com>
diff mbox series

Patch

diff --git a/lib/powerpc/hcall.c b/lib/powerpc/hcall.c
index 711cb1b0f..b4d39ac65 100644
--- a/lib/powerpc/hcall.c
+++ b/lib/powerpc/hcall.c
@@ -43,5 +43,5 @@  int __getchar(void)
 	asm volatile (" sc 1 "  : "+r"(r3), "+r"(r4), "=r"(r5)
 				: "r"(r3),  "r"(r4));
 
-	return r3 == H_SUCCESS && r4 > 0 ? r5 >> 48 : -1;
+	return r3 == H_SUCCESS && r4 > 0 ? r5 >> 56 : -1;
 }