Subject: afs/net/rxrpc main.c,1.3,1.4 Makefile,1.7,1.8

From: [email-masked]
Date: Fri, 04 Jul 2003 16:23:54 +0100

Update of /home/cvs/afs/net/rxrpc
In directory phoenix.infradead.org:/tmp/cvs-serv10524/net/rxrpc

Modified Files:
	main.c Makefile 
Log Message:
add under-stack greasing to help make backtraces more sane

Index: main.c
===================================================================
RCS file: /home/cvs/afs/net/rxrpc/main.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- main.c	4 Feb 2003 16:12:04 -0000	1.3
+++ main.c	4 Jul 2003 15:23:51 -0000	1.4
@@ -125,3 +125,48 @@
 
 	kleave("");
 } /* end rxrpc_cleanup() */
+
+/*****************************************************************************/
+/*
+ * clear the dead space between task_struct and kernel stack
+ * - called by supplying -finstrument-functions to gcc
+ */
+#if 1
+void __cyg_profile_func_enter (void *this_fn, void *call_site)
+__attribute__((no_instrument_function));
+
+void __cyg_profile_func_enter (void *this_fn, void *call_site)
+{
+       asm volatile("  movl    %%esp,%%edi     \n"
+                    "  andl    %0,%%edi        \n"
+                    "  addl    %1,%%edi        \n"
+                    "  movl    %%esp,%%ecx     \n"
+                    "  subl    %%edi,%%ecx     \n"
+                    "  shrl    $2,%%ecx        \n"
+                    "  movl    $0xedededed,%%eax     \n"
+                    "  rep stosl               \n"
+                    :
+                    : "i"(~(THREAD_SIZE-1)), "i"(sizeof(struct thread_info))
+                    : "eax", "ecx", "edi", "memory", "cc"
+                    );
+}
+
+void __cyg_profile_func_exit(void *this_fn, void *call_site)
+__attribute__((no_instrument_function));
+
+void __cyg_profile_func_exit(void *this_fn, void *call_site)
+{
+       asm volatile("  movl    %%esp,%%edi     \n"
+                    "  andl    %0,%%edi        \n"
+                    "  addl    %1,%%edi        \n"
+                    "  movl    %%esp,%%ecx     \n"
+                    "  subl    %%edi,%%ecx     \n"
+                    "  shrl    $2,%%ecx        \n"
+                    "  movl    $0xdadadada,%%eax     \n"
+                    "  rep stosl               \n"
+                    :
+                    : "i"(~(THREAD_SIZE-1)), "i"(sizeof(struct thread_info))
+                    : "eax", "ecx", "edi", "memory", "cc"
+                    );
+}
+#endif

Index: Makefile
===================================================================
RCS file: /home/cvs/afs/net/rxrpc/Makefile,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Makefile	2 Mar 2003 18:56:14 -0000	1.7
+++ Makefile	4 Jul 2003 15:23:51 -0000	1.8
@@ -2,6 +2,8 @@
 # Makefile for Linux kernel Rx RPC
 #
 
+CFLAGS += -finstrument-functions
+
 rxrpc-objs := \
 	call.o \
 	connection.o \