Not able to push arguments to a function from entry_32.S
Hi All,
I am trying to customize linux 2.6.37 on x86. I have a function written in C which need to be called from entry_32.S. This function takes 2 arguments and return an integer. Prototype for function is - unsigned int some_fn(int *addr,int length); I am invoking this function before sys_call_table is invoked. But kernel panic is coming. Error message says "Kernel panic BAD EIP". If I am invoking a function that has no parameters it works fine. Please help me out of this issue. See the relevant modification I done. arch/x86/kernel/entry_32.S: sysenter_do_call: cmpl $(nr_syscalls), %eax jae syscall_badsys /* start of my modification */ pushl %eax /* Save system call no: in stack*/ pushl $(length) /* pushing second argument*/ pushl addr /* pushing first argument.*/ call some_fn /* calling my own c function*/ popl %eax /* restoring system call no to eax*/ /* end of my modification */ call *sys_call_table(,%eax,4) |
I guess one possible reason is the stack is not ready yet, so the original code is written in assembly which, unlike C, does not need a stack.
One workaround is try to use some registers to pass the arguments. |
All times are GMT -5. The time now is 01:16 PM. |