Skip to content

Commit 0da6458

Browse files
fthaingeertu
authored andcommitted
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 <[email protected]> Tested-by: Stan Johnson <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/a6104f41918bed4fd17f92c45df94ac7a5d30e40.1743115195.git.fthain@linux-m68k.org Signed-off-by: Geert Uytterhoeven <[email protected]>
1 parent 210a1ce commit 0da6458

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

arch/m68k/kernel/head.S

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3533,19 +3533,16 @@ func_start console_putc,%a0/%a1/%d0-%d7
35333533
tstl %pc@(L(console_font))
35343534
jeq L(console_exit)
35353535

3536+
lea %pc@(L(console_globals)),%a0
3537+
35363538
/* Output character in d7 on console.
35373539
*/
35383540
movel ARG1,%d7
35393541
cmpib #'\n',%d7
3540-
jbne 1f
3542+
jne L(console_not_lf)
35413543

3542-
/* A little safe recursion is good for the soul */
3543-
console_putc #'\r'
3544-
1:
3545-
lea %pc@(L(console_globals)),%a0
3544+
clrl %a0@(Lconsole_struct_cur_column) /* implicit \r */
35463545

3547-
cmpib #10,%d7
3548-
jne L(console_not_lf)
35493546
movel %a0@(Lconsole_struct_cur_row),%d0
35503547
movel %a0@(Lconsole_struct_num_rows),%d1
35513548
cmpl %d1,%d0

0 commit comments

Comments
 (0)