lkml.org 
[lkml]   [2002]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Stepping through entry.S
On Wed, 3 Apr 2002, Randy.Dunlap wrote:

| On Wed, 3 Apr 2002, Sridhar N wrote:
|
| | Hello (recycled)
|
| | I was trying to trace the handling of the system calls, and to step through
| | the entry.S on i386 machine. I basically used this:
| |
| | srin_entryS_debug_mesg: #My addition
| | .asciz "some relevant message\n"
| | ALIGN
| | tracesys: #haven't changed anything here..
| | .
| | .
| | .
| | jae tracesys_exit
| | pushl $srin_entryS_debug_mesg #just this
| | call SYMBOL_NAME(printk) # and this
| | call *SYMBOL_NAME(sys_call_table)(,%eax,4)
| | movl %eax,EAX(%esp) # save the return value
| | tracesys_exit:
| |
| | Shouldn't this call printk everytime a system call is made or atleast crash
| | the kernel if something is dead wrong ? ( It isn't .. everything seems normal
| | as though the printk isn't there ) Also, how can i know the values in the
| | specific registers in that file ? Specifically, whenever a system call is
| | made, what registers store what values ? I'm using kernel 2.4.7 on a K6-2.
|
| The tracesys: label (code) is only used if ptrace is enabled for
| the task. Is it enabled? If not, you aren't executing this code
| at all.
|
| testb $0x02,tsk_ptrace(%ebx) # PT_TRACESYS
| jne tracesys
|
| For the register interface, AFAIK, see the gcc docs, such as
| Extensions to the C Language Family:
| http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_4.html
| and search for /regparm/ .
| <quote>
| regparm (number)
| On the Intel 386, the regparm attribute causes the compiler to pass up
| to number integer arguments in registers EAX, EDX, and ECX instead of
| on the stack. Functions that take a variable number of arguments will
| continue to be passed all of their arguments on the stack.
| </quote>
| Someone please correct or add to this. :)

actually for x86, linux/include/asm-i386/unistd.h defines
_syscall0() ... thru _syscall6(), which load N registers as appropriate
and then execute int $0x80.

--
~Randy

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:22    [from the cache]
©2003-2011 Jasper Spaans