Browse Source

Also print out stack pointer (with optional stack dump)

tags/v0.9.3
Michael Brown 18 years ago
parent
commit
c650c8c84a
1 changed files with 5 additions and 2 deletions
  1. 5
    2
      src/arch/i386/core/nulltrap.c

+ 5
- 2
src/arch/i386/core/nulltrap.c View File

3
 
3
 
4
 __attribute__ (( noreturn, section ( ".text.null_trap" ) ))
4
 __attribute__ (( noreturn, section ( ".text.null_trap" ) ))
5
 void null_function_trap ( void ) {
5
 void null_function_trap ( void ) {
6
+	void *stack;
6
 
7
 
7
 	/* 128 bytes of NOPs; the idea of this is that if something
8
 	/* 128 bytes of NOPs; the idea of this is that if something
8
 	 * dereferences a NULL pointer and overwrites us, we at least
9
 	 * dereferences a NULL pointer and overwrites us, we at least
42
 	__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
43
 	__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
43
 	__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
44
 	__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
44
 
45
 
45
-	printf ( "NULL method called from %p\n", 
46
-		 __builtin_return_address ( 0 ) );
46
+	__asm__ __volatile__ ( "movl %%esp, %0" : "=r" ( stack ) );
47
+	printf ( "NULL method called from %p (stack %p)\n", 
48
+		 __builtin_return_address ( 0 ), stack );
49
+	DBG_HD ( stack, 256 );
47
 	while ( 1 ) {}
50
 	while ( 1 ) {}
48
 }
51
 }

Loading…
Cancel
Save