loading executables

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
pulsar
Member
Member
Posts: 49
Joined: Wed Nov 22, 2006 1:01 am
Location: chennai

loading executables

Post 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.
everyone here are best programmers ( not yet not yet)
User avatar
deadmutex
Member
Member
Posts: 85
Joined: Wed Sep 28, 2005 11:00 pm

Post 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)
User avatar
pulsar
Member
Member
Posts: 49
Joined: Wed Nov 22, 2006 1:01 am
Location: chennai

Post 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)
everyone here are best programmers ( not yet not yet)
Post Reply