mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] m68k: Fix lost column on framebuffer debug console
@ 2025-03-07  9:08 Finn Thain
  2025-03-17 22:48 ` Finn Thain
  0 siblings, 1 reply; 2+ messages in thread
From: Finn Thain @ 2025-03-07  9:08 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: stable, linux-m68k, linux-kernel

When long lines are sent to the debug console on the framebuffer, the
right-most column is lost. Fix this by subtracting 1 from the column
count before comparing it with console_struct_cur_column, as the latter
counts from zero.

Linewrap is handled with a recursive call to console_putc, but this
alters the console_struct_cur_row global. Store the old value before
calling console_putc, so the right-most character gets rendered on the
correct line.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Finn Thain <fthain@linux-m68k.org>
---
 arch/m68k/kernel/head.S | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/m68k/kernel/head.S b/arch/m68k/kernel/head.S
index 852255cf60de..9c60047764d0 100644
--- a/arch/m68k/kernel/head.S
+++ b/arch/m68k/kernel/head.S
@@ -3583,11 +3583,16 @@ L(console_not_home):
 	movel	%a0@(Lconsole_struct_cur_column),%d0
 	addql	#1,%a0@(Lconsole_struct_cur_column)
 	movel	%a0@(Lconsole_struct_num_columns),%d1
+	subil	#1,%d1
 	cmpl	%d1,%d0
 	jcs	1f
-	console_putc	#'\n'	/* recursion is OK! */
+	/*	recursion will alter console_struct so load d1 register first */
+	movel	%a0@(Lconsole_struct_cur_row),%d1
+	console_putc	#'\n'
+	jmp	2f
 1:
 	movel	%a0@(Lconsole_struct_cur_row),%d1
+2:
 
 	/*
 	 *	At this point we make a shift in register usage
-- 
2.45.3


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] m68k: Fix lost column on framebuffer debug console
  2025-03-07  9:08 [PATCH] m68k: Fix lost column on framebuffer debug console Finn Thain
@ 2025-03-17 22:48 ` Finn Thain
  0 siblings, 0 replies; 2+ messages in thread
From: Finn Thain @ 2025-03-17 22:48 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: stable, linux-m68k, linux-kernel


Please disregard the patch below. Further testing shows that it does not 
completely solve the problem. In particular, when line-wrap also produces 
vertical scrolling. I think the recursive console_putc call may have to 
go.

On Fri, 7 Mar 2025, Finn Thain wrote:

> When long lines are sent to the debug console on the framebuffer, the
> right-most column is lost. Fix this by subtracting 1 from the column
> count before comparing it with console_struct_cur_column, as the latter
> counts from zero.
> 
> Linewrap is handled with a recursive call to console_putc, but this
> alters the console_struct_cur_row global. Store the old value before
> calling console_putc, so the right-most character gets rendered on the
> correct line.
> 
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Cc: stable@vger.kernel.org
> Signed-off-by: Finn Thain <fthain@linux-m68k.org>
> ---
>  arch/m68k/kernel/head.S | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/m68k/kernel/head.S b/arch/m68k/kernel/head.S
> index 852255cf60de..9c60047764d0 100644
> --- a/arch/m68k/kernel/head.S
> +++ b/arch/m68k/kernel/head.S
> @@ -3583,11 +3583,16 @@ L(console_not_home):
>  	movel	%a0@(Lconsole_struct_cur_column),%d0
>  	addql	#1,%a0@(Lconsole_struct_cur_column)
>  	movel	%a0@(Lconsole_struct_num_columns),%d1
> +	subil	#1,%d1
>  	cmpl	%d1,%d0
>  	jcs	1f
> -	console_putc	#'\n'	/* recursion is OK! */
> +	/*	recursion will alter console_struct so load d1 register first */
> +	movel	%a0@(Lconsole_struct_cur_row),%d1
> +	console_putc	#'\n'
> +	jmp	2f
>  1:
>  	movel	%a0@(Lconsole_struct_cur_row),%d1
> +2:
>  
>  	/*
>  	 *	At this point we make a shift in register usage
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-03-17 22:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-07  9:08 [PATCH] m68k: Fix lost column on framebuffer debug console Finn Thain
2025-03-17 22:48 ` Finn Thain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®