Pārlūkot izejas kodu

Also print out stack pointer (with optional stack dump)

tags/v0.9.3
Michael Brown 18 gadus atpakaļ
vecāks
revīzija
c650c8c84a
1 mainītis faili ar 5 papildinājumiem un 2 dzēšanām
  1. 5
    2
      src/arch/i386/core/nulltrap.c

+ 5
- 2
src/arch/i386/core/nulltrap.c Parādīt failu

@@ -3,6 +3,7 @@
3 3
 
4 4
 __attribute__ (( noreturn, section ( ".text.null_trap" ) ))
5 5
 void null_function_trap ( void ) {
6
+	void *stack;
6 7
 
7 8
 	/* 128 bytes of NOPs; the idea of this is that if something
8 9
 	 * dereferences a NULL pointer and overwrites us, we at least
@@ -42,7 +43,9 @@ void null_function_trap ( void ) {
42 43
 	__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
43 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 50
 	while ( 1 ) {}
48 51
 }

Notiek ielāde…
Atcelt
Saglabāt