m68k: Avoid pointless recursion in debug console rendering

The recursive call to console_putc to effect a carriage return is
needlessly slow and complicated. Instead, just clear the column counter
directly. Setup %a0 earlier to avoid a repeated comparison.

Signed-off-by: Finn Thain <fthain@linux-m68k.org>
Tested-by: Stan Johnson <userm57@yahoo.com>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://lore.kernel.org/a6104f41918bed4fd17f92c45df94ac7a5d30e40.1743115195.git.fthain@linux-m68k.org
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
This commit is contained in:
Finn Thain 2025-03-28 09:39:55 +11:00 committed by Geert Uytterhoeven
parent 210a1ce8ed
commit 0da6458417

View File

@ -3533,19 +3533,16 @@ func_start console_putc,%a0/%a1/%d0-%d7
tstl %pc@(L(console_font))
jeq L(console_exit)
lea %pc@(L(console_globals)),%a0
/* Output character in d7 on console.
*/
movel ARG1,%d7
cmpib #'\n',%d7
jbne 1f
/* A little safe recursion is good for the soul */
console_putc #'\r'
1:
lea %pc@(L(console_globals)),%a0
cmpib #10,%d7
jne L(console_not_lf)
clrl %a0@(Lconsole_struct_cur_column) /* implicit \r */
movel %a0@(Lconsole_struct_cur_row),%d0
movel %a0@(Lconsole_struct_num_rows),%d1
cmpl %d1,%d0