Hi list,
I'm writing a simple profiler implemented as a module. I use oprofile and vtune sources as reference.
The fact is that when I tried to replace the original system calls by my own ones (as these programs do) I forget the asmlinkage tag.... and everything works fine.
I've read that asmlinkage tells a function not to expect the parameters at the cpu registers (common optimization) but in the stack...
Why does this works regardless of the asmlinkage tag?
This is what I defined:
asmlinkage static int (*old_brk) (struct pt_regs regs);
asmlinkage int
my_brk(struct pt_regs regs)
{
struct pt_regs *tmp;
int ret = -EINVAL;
printk(KERN_INFO "Bridging brk, calling original...\n");
ret = old_brk(regs);
__asm__("movl %%esp, %0": "=m"(tmp):);
regs = *tmp;
return (ret);
}
old_brk is set to the value of the original address.
Thanks in advance