What I'm trying to do here is add an overhead to every single system call. I can do this either by modifying ~320 C methods or I can do it in one place in i386 assembly land. As you might have guessed I'd much rather make this change in one place, the problem is I such at assembly and I'm having a hard time finding a resource that can help, so here I am asking for some help.
I'm working with the 2.6.22 kernel, and I'm trying to modify the arch/i386/kernel/entry.S file (I think that's the path). Right around like 370 or so is the main entry point after the processor interrupt has occurred. Here's what I have now:
# system call handler stub
#THIS IS MY LOOP
movl %cx, 100000;
add %eax, %eax;
RING0_INT_FRAME # can't unwind into user space anyway
pushl %eax # save orig_eax
# system call tracing in operation / emulation
/* Note, _TIF_SECCOMP is bit number 8, and so it needs testw and not testb */
cmpl $(nr_syscalls), %eax
As you can see I'm just adding a loop that does something minimal like add some values together. It fails miserably. I'm sure it's because I'm overwriting something important and not putting it back, but I don't know how to do that.
Any help would be GREATLY appreciated as I'm dead in the water here.
Disclaimer: Yes, this is part of a project for my CS master's degree, I'm not trying to get anyone to help me cheat on my homework, just need some help. The real part of this assignment is doing the analysis on the effects of this overhead. Just want to get that out there.