Skip to content

Commit a0a94bc

Browse files
committed
openrisc: Add syscall details to emergency syscall debugging
When bringing linux on the or1k Marocchino we ran into issues starting init. This patch adds the syscall number and return address to assist tracing syscalls even before strace is able to be used. By default this is all disabled but a developer could adjust the ifdef to enable debugging. Cc: Andrey Bacherov <[email protected]> Signed-off-by: Stafford Horne <[email protected]>
1 parent 29bbb2a commit a0a94bc

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

arch/openrisc/kernel/entry.S

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ UNHANDLED_EXCEPTION(_vector_0xb00,0xb00)
601601
*/
602602

603603
_string_syscall_return:
604-
.string "syscall return %ld \n\r\0"
604+
.string "syscall r9:0x%08x -> syscall(%ld) return %ld\0"
605605
.align 4
606606

607607
ENTRY(_sys_call_handler)
@@ -679,15 +679,25 @@ _syscall_return:
679679
_syscall_debug:
680680
l.movhi r3,hi(_string_syscall_return)
681681
l.ori r3,r3,lo(_string_syscall_return)
682-
l.ori r27,r0,1
682+
l.ori r27,r0,2
683683
l.sw -4(r1),r27
684684
l.sw -8(r1),r11
685-
l.addi r1,r1,-8
685+
l.lwz r29,PT_ORIG_GPR11(r1)
686+
l.sw -12(r1),r29
687+
l.lwz r29,PT_GPR9(r1)
688+
l.sw -16(r1),r29
686689
l.movhi r27,hi(_printk)
687690
l.ori r27,r27,lo(_printk)
688691
l.jalr r27
689-
l.nop
690-
l.addi r1,r1,8
692+
l.addi r1,r1,-16
693+
l.addi r1,r1,16
694+
#endif
695+
#if 0
696+
_syscall_show_regs:
697+
l.movhi r27,hi(show_registers)
698+
l.ori r27,r27,lo(show_registers)
699+
l.jalr r27
700+
l.or r3,r1,r1
691701
#endif
692702

693703
_syscall_check_trace_leave:

0 commit comments

Comments
 (0)