Discussion:
Enabling/Disabling interrupts for system call
(too old to reply)
Timothy Finley
2005-02-20 04:20:34 UTC
Permalink
Do we need to worry about enabling/disabling interrupts for system calls?
I'm wondering because I'm failing an assertion (line 116 in sync.c) that
checks to see if interrupts are enabled and I didn't think I ever had to
turn interrupts on. The failed assertion happens after attempting to
spawn a new executable in shell.exe.

Tim
Tom Brubaker
2005-02-22 15:41:48 UTC
Permalink
I ran into this problem too. Has it been answered?

Thanks

-Tom-
Post by Timothy Finley
Do we need to worry about enabling/disabling interrupts for system calls?
I'm wondering because I'm failing an assertion (line 116 in sync.c) that
checks to see if interrupts are enabled and I didn't think I ever had to
turn interrupts on. The failed assertion happens after attempting to
spawn a new executable in shell.exe.
Tim
Timothy Finley
2005-02-22 16:47:48 UTC
Permalink
Post by Tom Brubaker
I ran into this problem too. Has it been answered?
Nope, not yet.

Tim
Ben Rogers
2005-02-22 23:25:39 UTC
Permalink
Has a solution for this problem been found, I've run into it now too.
In discussion on monday someone mentioned it, and I think we were told
to enable interrupts around Read_Fully() which seems to be what calls
subsequent functions and eventually leads to the Mutex function that
actually fails the assertion. This didn't seem to work since in spawn
it then fails an assertion if I try to enable interrupts. Am I doing
this wrong, or have either of you (or anyone else for that matter) found
another way around this problem?
David Hershey
2005-02-22 23:34:02 UTC
Permalink
In my project, I enabled/disabled interrupts around the call to Spawn
from Sys_Spawn, and everything worked great. Hope that helps.

- David
Tom Brubaker
2005-02-22 23:56:13 UTC
Permalink
Yeah, I was hoping for the final word from Iulian, but really I can't think
of any reason that this wouldn't be ok. During a syscall, interrupts are
disabled, but we have called spawn with interrupts ENabled already --
specifically when loading the shell during boot. Incidentally, I'm pretty
sure that that's why Enable_Interrupts() sometimes fails the assertion as
described in Ben Rodgers' post in this thread. Take a look at the
implementation of Enable_Interrupts() and you'll see what I mean.


-Tom-
In my project, I enabled/disabled interrupts around the call to Spawn from
Sys_Spawn, and everything worked great. Hope that helps.
- David
Timothy Finley
2005-02-22 23:54:04 UTC
Permalink
Post by Ben Rogers
Has a solution for this problem been found, I've run into it now too.
In discussion on monday someone mentioned it, and I think we were told
to enable interrupts around Read_Fully() which seems to be what calls
subsequent functions and eventually leads to the Mutex function that
actually fails the assertion. This didn't seem to work since in spawn
it then fails an assertion if I try to enable interrupts. Am I doing
this wrong, or have either of you (or anyone else for that matter) found
another way around this problem?
Enabling interrupts will always fail if interrupts are already enabled. It
seems like interrupts are enabled before the first time you call read
fully and not the second time. You should be able to account for this
somehow (I'm being indirect since I don't know how much I can actually say).

Tim

Continue reading on narkive:
Loading...