sh: Kill off sh64's hand-rolled syscall tracer.
authorPaul Mundt <lethal@linux-sh.org>
Fri, 8 May 2009 08:25:35 +0000 (17:25 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Fri, 8 May 2009 08:25:35 +0000 (17:25 +0900)
This is no longer necessary, as there are now sufficient generic
alternatives available.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
arch/sh/Kconfig.debug
arch/sh/Makefile
arch/sh/kernel/cpu/sh5/entry.S
arch/sh/lib64/.gitignore [deleted file]
arch/sh/lib64/dbg.c

index fafa907..44627ef 100644 (file)
@@ -137,12 +137,4 @@ config SH64_SR_WATCH
        bool "Debug: set SR.WATCH to enable hardware watchpoints and trace"
        depends on SUPERH64
 
-config POOR_MANS_STRACE
-       bool "Debug: enable rudimentary strace facility"
-       depends on SUPERH64
-       help
-         This option allows system calls to be traced to the console.  It also
-         aids in detecting kernel stack underflow.  It is useful for debugging
-         early-userland problems (e.g. init incurring fatal exceptions.)
-
 endmenu
index bece1f7..493da97 100644 (file)
@@ -193,7 +193,7 @@ zImage uImage uImage.srec vmlinux.srec: vmlinux
 
 compressed: zImage
 
-archprepare: maketools arch/sh/lib64/syscalltab.h
+archprepare: maketools
 
 archclean:
        $(Q)$(MAKE) $(clean)=$(boot)
@@ -205,34 +205,4 @@ define archhelp
        @echo '  uImage.srec               - Create an S-record for U-Boot'
 endef
 
-define filechk_gen-syscalltab
-       (set -e; \
-       echo "/*"; \
-       echo " * DO NOT MODIFY."; \
-       echo " *"; \
-       echo " * This file was generated by arch/sh/Makefile"; \
-       echo " * Any changes will be reverted at build time."; \
-       echo " */"; \
-       echo ""; \
-       echo "#ifndef __SYSCALLTAB_H"; \
-       echo "#define __SYSCALLTAB_H"; \
-       echo ""; \
-       echo "#include <linux/kernel.h>"; \
-       echo ""; \
-       echo "struct syscall_info {"; \
-       echo "  const char *name;"; \
-       echo "} syscall_info_table[] = {"; \
-       sed -e '/^.*\.long /!d;s//      { "/;s/\(\([^/]*\)\/\)\{1\}.*/\2/; \
-               s/[ \t]*$$//g;s/$$/" },/;s/\("\)sys_/\1/g'; \
-       echo "};"; \
-       echo ""; \
-       echo "#define NUM_SYSCALL_INFO_ENTRIES ARRAY_SIZE(syscall_info_table)";\
-       echo ""; \
-       echo "#endif /* __SYSCALLTAB_H */" )
-endef
-
-arch/sh/lib64/syscalltab.h: arch/sh/kernel/syscalls_64.S
-       $(call filechk,gen-syscalltab)
-
-CLEAN_FILES += arch/sh/lib64/syscalltab.h \
-              include/asm-sh/machtypes.h
+CLEAN_FILES += include/asm-sh/machtypes.h
index 5162975..b0aacf6 100644 (file)
@@ -812,27 +812,6 @@ no_underflow:
        ! exceptions
        add     SP, ZERO, r14
 
-#ifdef CONFIG_POOR_MANS_STRACE
-       /* We've pushed all the registers now, so only r2-r4 hold anything
-        * useful. Move them into callee save registers */
-       or      r2, ZERO, r28
-       or      r3, ZERO, r29
-       or      r4, ZERO, r30
-
-       /* Preserve r2 as the event code */
-       movi    evt_debug, r3
-       ori     r3, 1, r3
-       ptabs   r3, tr0
-
-       or      SP, ZERO, r6
-       getcon  TRA, r5
-       blink   tr0, LINK
-
-       or      r28, ZERO, r2
-       or      r29, ZERO, r3
-       or      r30, ZERO, r4
-#endif
-
        /* For syscall and debug race condition, get TRA now */
        getcon  TRA, r5
 
@@ -887,11 +866,6 @@ no_underflow:
  */
        .global ret_from_irq
 ret_from_irq:
-#ifdef CONFIG_POOR_MANS_STRACE
-       pta     evt_debug_ret_from_irq, tr0
-       ori     SP, 0, r2
-       blink   tr0, LINK
-#endif
        ld.q    SP, FRAME_S(FSSR), r6
        shlri   r6, 30, r6
        andi    r6, 1, r6
@@ -905,12 +879,6 @@ ret_from_irq:
 ret_from_exception:
        preempt_stop()
 
-#ifdef CONFIG_POOR_MANS_STRACE
-       pta     evt_debug_ret_from_exc, tr0
-       ori     SP, 0, r2
-       blink   tr0, LINK
-#endif
-
        ld.q    SP, FRAME_S(FSSR), r6
        shlri   r6, 30, r6
        andi    r6, 1, r6
@@ -1236,18 +1204,6 @@ syscall_bad:
        .global syscall_ret
 syscall_ret:
        st.q    SP, FRAME_R(9), r2      /* Expecting SP back to BASIC frame */
-
-#ifdef CONFIG_POOR_MANS_STRACE
-       /* nothing useful in registers at this point */
-
-       movi    evt_debug2, r5
-       ori     r5, 1, r5
-       ptabs   r5, tr0
-       ld.q    SP, FRAME_R(9), r2
-       or      SP, ZERO, r3
-       blink   tr0, LINK
-#endif
-
        ld.q    SP, FRAME_S(FSPC), r2
        addi    r2, 4, r2               /* Move PC, being pre-execution event */
        st.q    SP, FRAME_S(FSPC), r2
@@ -1268,25 +1224,12 @@ ret_from_fork:
        ptabs   r5, tr0
        blink   tr0, LINK
 
-#ifdef CONFIG_POOR_MANS_STRACE
-       /* nothing useful in registers at this point */
-
-       movi    evt_debug2, r5
-       ori     r5, 1, r5
-       ptabs   r5, tr0
-       ld.q    SP, FRAME_R(9), r2
-       or      SP, ZERO, r3
-       blink   tr0, LINK
-#endif
-
        ld.q    SP, FRAME_S(FSPC), r2
        addi    r2, 4, r2               /* Move PC, being pre-execution event */
        st.q    SP, FRAME_S(FSPC), r2
        pta     ret_from_syscall, tr0
        blink   tr0, ZERO
 
-
-
 syscall_allowed:
        /* Use LINK to deflect the exit point, default is syscall_ret */
        pta     syscall_ret, tr0
diff --git a/arch/sh/lib64/.gitignore b/arch/sh/lib64/.gitignore
deleted file mode 100644 (file)
index 3508c2c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-syscalltab.h
index 2fb8eaf..25f2481 100644 (file)
@@ -135,140 +135,6 @@ void print_itlb(void)
            (" =============================================================\n");
 }
 
-/* ======================================================================= */
-
-#ifdef CONFIG_POOR_MANS_STRACE
-
-#include "syscalltab.h"
-
-struct ring_node {
-       int evt;
-       int ret_addr;
-       int event;
-       int tra;
-       int pid;
-       unsigned long sp;
-       unsigned long pc;
-};
-
-static struct ring_node event_ring[16];
-static int event_ptr = 0;
-
-struct stored_syscall_data {
-       int pid;
-       int syscall_number;
-};
-
-#define N_STORED_SYSCALLS 16
-
-static struct stored_syscall_data stored_syscalls[N_STORED_SYSCALLS];
-static int syscall_next=0;
-static int syscall_next_print=0;
-
-void evt_debug(int evt, int ret_addr, int event, int tra, struct pt_regs *regs)
-{
-       int syscallno = tra & 0xff;
-       unsigned long sp;
-       unsigned long stack_bottom;
-       int pid;
-       struct ring_node *rr;
-
-       pid = current->pid;
-       stack_bottom = (unsigned long) task_stack_page(current);
-       asm volatile("ori r15, 0, %0" : "=r" (sp));
-       rr = event_ring + event_ptr;
-       rr->evt = evt;
-       rr->ret_addr = ret_addr;
-       rr->event = event;
-       rr->tra = tra;
-       rr->pid = pid;
-       rr->sp = sp;
-       rr->pc = regs->pc;
-
-       if (sp < stack_bottom + 3092) {
-               int i, j;
-               printk("evt_debug : stack underflow report\n");
-               for (j=0, i = event_ptr; j<16; j++) {
-                       rr = event_ring + i;
-                       printk("evt=%08x event=%08x tra=%08x pid=%5d sp=%08lx pc=%08lx\n",
-                               rr->evt, rr->event, rr->tra, rr->pid, rr->sp, rr->pc);
-                       i--;
-                       i &= 15;
-               }
-               panic("STACK UNDERFLOW\n");
-       }
-
-       event_ptr = (event_ptr + 1) & 15;
-
-       if ((event == 2) && (evt == 0x160)) {
-               if (syscallno < NUM_SYSCALL_INFO_ENTRIES) {
-                       /* Store the syscall information to print later.  We
-                        * can't print this now - currently we're running with
-                        * SR.BL=1, so we can't take a tlbmiss (which could occur
-                        * in the console drivers under printk).
-                        *
-                        * Just overwrite old entries on ring overflow - this
-                        * is only for last-hope debugging. */
-                       stored_syscalls[syscall_next].pid = current->pid;
-                       stored_syscalls[syscall_next].syscall_number = syscallno;
-                       syscall_next++;
-                       syscall_next &= (N_STORED_SYSCALLS - 1);
-               }
-       }
-}
-
-static void drain_syscalls(void) {
-       while (syscall_next_print != syscall_next) {
-               printk("Task %d: %s()\n",
-                       stored_syscalls[syscall_next_print].pid,
-                       syscall_info_table[stored_syscalls[syscall_next_print].syscall_number].name);
-                       syscall_next_print++;
-                       syscall_next_print &= (N_STORED_SYSCALLS - 1);
-       }
-}
-
-void evt_debug2(unsigned int ret)
-{
-       drain_syscalls();
-       printk("Task %d: syscall returns %08x\n", current->pid, ret);
-}
-
-void evt_debug_ret_from_irq(struct pt_regs *regs)
-{
-       int pid;
-       struct ring_node *rr;
-
-       pid = current->pid;
-       rr = event_ring + event_ptr;
-       rr->evt = 0xffff;
-       rr->ret_addr = 0;
-       rr->event = 0;
-       rr->tra = 0;
-       rr->pid = pid;
-       rr->pc = regs->pc;
-       event_ptr = (event_ptr + 1) & 15;
-}
-
-void evt_debug_ret_from_exc(struct pt_regs *regs)
-{
-       int pid;
-       struct ring_node *rr;
-
-       pid = current->pid;
-       rr = event_ring + event_ptr;
-       rr->evt = 0xfffe;
-       rr->ret_addr = 0;
-       rr->event = 0;
-       rr->tra = 0;
-       rr->pid = pid;
-       rr->pc = regs->pc;
-       event_ptr = (event_ptr + 1) & 15;
-}
-
-#endif /* CONFIG_POOR_MANS_STRACE */
-
-/* ======================================================================= */
-
 void show_excp_regs(char *from, int trapnr, int signr, struct pt_regs *regs)
 {