Hi you guys!!
I posted an article three days ago about implementing periodic tasks and
maybe I didn't explain the point quite allright.
I'm working according to a RT architecture my department has given to
me, and the implementation of hard real-time periodic tasks is a must. I
use the 8254 interval timer to trigger interrupts that activate those
periodic tasks. They are loaded before starting and they MUST NOT be
unloaded to save loading time -no major faults allowed-.
In order to do that I intercept the exit system call at the end of every
C program. Instead of doing the normal exit I try to leave the process
in a similar state to that one when it has just done execve, setting the
eip to the address specified in the field ex.a_entry and passed to the
function start_thread in execve, as well as setting the esp to the
address mm->start_stack where arguments and envelopes should be.
The new routine I've made is more or less:
int do_exit2(struct pt_regs *regs]
regs->eip = start_ip;
regs->esp = start_stack;
current->state = TASK_UNINTERRUPTIBLE;
When the process is awaken again by an interrupt from the 8254, it comesQuote:}
out from the schedule(] and after returning from the system call it
should resume at the beginning of the program.
However, everything gets screwed up after the first run: the program
doesn't like the change in regs and causes a general protection error.
After that it's killed and everything stops.
Here are my questions for kernel and C gurus:
- Are the arguments and envelopes kept in the stack until a normal exit
- Is there are library similar to the crtso.s in MINIX which is linked
to the beginning of a normal user program and whose task is preparing
the arguments left in the stack by execve?
- If so, does the ex.a_entry point to the beginnig of that library or to
the beginning of the actual program?
Your help is greatly appreciated. This is part of my senior project and
I want to finish it ASAP.
Thanks a lot in advance.............CARLOS AKA SLACKER