Page 1 of 1

loading executables

Posted: Sun Feb 25, 2007 10:29 pm
by pulsar
hi,
i used load the executables when a page fault occurs, when loading from disk i will set the interrupts and after loading i will clear the interrupts this way it worked well, but now when i want to load it thru the system calls it doesn't load from the disk, it's because i used sti and cli which is not the correct way of doing this. simply put, inside an interrupt/exception routine another interrupt like floppy interrupt is not occuring, what shall i do? previously i used sti and cli whenever an interrupt has to occur, but this method will not work when called thru system calls.
I 've implemented a shell and i want to load executables. shell is just an other program. so it has to make system calls, that's where i'm having the problem.

Posted: Sun Feb 25, 2007 10:55 pm
by deadmutex
I had a similar problem when one of my system calls were waiting for a keyboard interrupt when interrupts were turned off.

I managed to solve the problem by:

1. Marking the thread doing the syscall as blocked
2. Saving the old kernel stack
3. Calling the scheduler to get the next scheduled thread
4 Saving the state(while in the syscall)
5. Doing a context switch to the next scheduled thread

After the other thread completed what it needed to do, it would wake the blocked thread. After the woken thread has it's state restored from a context switch, it will

1. Restore the old kernel stack
2. Resume with anything else left in the syscall

I'm not sure if this is the best way to do things, but it doesn't seem to have caused problems(yet)

Posted: Mon Feb 26, 2007 10:00 am
by pulsar
Thanks for the reply,
problem is solved, it was somewhere else all i have to do is to set and clear interrupt when required ( it occured only once)