Re: intercepting an exception handler.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 5 Sep 2002 19:41:22 +0200
Angelo Dell'Aera <buffer@users.sourceforge.net> wrote:


>        pushl %esi 		# push the error code
>        pushl %edx 		# push the pt_regs pointer
>        movl $(__KERNEL_DS),%edx
>        movl %edx,%ds
>        movl %edx,%es
>        GET_CURRENT(%ebx) <- current process descriptor stored in %ebx
>
>        call *%edi <- here handler (whose address is in %esi) is called  
>			but  look  at  the stack!
>			In the  stack handler finds :
>			-return address of the instruction to be
>			 executed after C handler
>			-error hardware code
>			-SYMBOL_NAME
>			-registers saved
>			-the  stack address  of the saved User Mode
>                         registers
>			-error hardware code
>					<---%esp points here

That's completely wrong!
The correct stack layout at this moment is this one :

-registers saved by CPU control unit (%eflags, %cs and %eip)
-error hardware code
-SYMBOL_NAME
-registers saved (in error_code)
-error hardware code
-the stack address of the saved User Mode registers
-return address of the instruction to be executed after C handler
			<- %esp points here

Now everything should appear clear!

Regards,

Angelo Dell'Aera 'buffer' 
<buffer@users.sourceforge.net>
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux