Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CSEP551
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Krishna Vinnakota
CSEP551
Commits
0b75a8e8
Commit
0b75a8e8
authored
18 years ago
by
rsc
Browse files
Options
Downloads
Patches
Plain Diff
no recursive interrupts
parent
5a71f933
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
trap.c
+34
-31
34 additions, 31 deletions
trap.c
with
34 additions
and
31 deletions
trap.c
+
34
−
31
View file @
0b75a8e8
...
...
@@ -18,10 +18,9 @@ tvinit(void)
{
int
i
;
for
(
i
=
0
;
i
<
256
;
i
++
){
SETGATE
(
idt
[
i
],
1
,
SEG_KCODE
<<
3
,
vectors
[
i
],
0
);
}
SETGATE
(
idt
[
T_SYSCALL
],
1
,
SEG_KCODE
<<
3
,
vectors
[
T_SYSCALL
],
3
);
for
(
i
=
0
;
i
<
256
;
i
++
)
SETGATE
(
idt
[
i
],
0
,
SEG_KCODE
<<
3
,
vectors
[
i
],
0
);
SETGATE
(
idt
[
T_SYSCALL
],
0
,
SEG_KCODE
<<
3
,
vectors
[
T_SYSCALL
],
3
);
}
void
...
...
@@ -34,9 +33,9 @@ void
trap
(
struct
trapframe
*
tf
)
{
int
v
=
tf
->
trapno
;
struct
proc
*
cp
=
curproc
[
cpu
()];
if
(
v
==
T_SYSCALL
){
struct
proc
*
cp
=
curproc
[
cpu
()];
if
(
cp
->
killed
)
proc_exit
();
cp
->
tf
=
tf
;
...
...
@@ -46,9 +45,15 @@ trap(struct trapframe *tf)
return
;
}
if
(
v
==
(
IRQ_OFFSET
+
IRQ_TIMER
)){
struct
proc
*
cp
=
curproc
[
cpu
()];
// Increment nlock to make sure interrupts stay off
// during interrupt handler. Must decrement before
// returning.
cpus
[
cpu
()].
nlock
++
;
switch
(
v
){
case
IRQ_OFFSET
+
IRQ_TIMER
:
lapic_timerintr
();
cpus
[
cpu
()].
nlock
--
;
if
(
cp
){
// Force process exit if it has been killed
// and the interrupt came from user space.
...
...
@@ -63,36 +68,34 @@ trap(struct trapframe *tf)
yield
();
}
return
;
}
if
(
v
==
IRQ_OFFSET
+
IRQ_IDE
){
case
IRQ_OFFSET
+
IRQ_IDE
:
ide_intr
();
cli
();
// prevent a waiting interrupt from overflowing stack
lapic_eoi
();
return
;
}
if
(
v
==
IRQ_OFFSET
+
IRQ_KBD
){
break
;
case
IRQ_OFFSET
+
IRQ_KBD
:
kbd_intr
();
cli
();
// prevent a waiting interrupt from overflowing stack
lapic_eoi
();
return
;
}
if
(
v
==
IRQ_OFFSET
+
IRQ_SPURIOUS
){
break
;
case
IRQ_OFFSET
+
IRQ_SPURIOUS
:
cprintf
(
"spurious interrupt from cpu %d eip %x
\n
"
,
cpu
(),
tf
->
eip
);
return
;
// no eoi for this one.
}
if
(
curproc
[
cpu
()])
{
// assume process caused unexpected trap,
// for example by dividing by zero or dereferencing a bad pointer
cprintf
(
"pid %d: unhandled trap %d on cpu %d eip %x -- kill proc
\n
"
,
curproc
[
cpu
()]
->
pid
,
v
,
cpu
(),
tf
->
eip
);
proc_exit
();
break
;
default:
if
(
curproc
[
cpu
()])
{
// assume process caused unexpected trap,
// for example by dividing by zero or dereferencing a bad pointer
cprintf
(
"pid %d: unhandled trap %d on cpu %d eip %x -- kill proc
\n
"
,
curproc
[
cpu
()]
->
pid
,
v
,
cpu
(),
tf
->
eip
);
proc_exit
();
}
// otherwise it's our mistake
cprintf
(
"unexpected trap %d from cpu %d eip %x
\n
"
,
v
,
cpu
(),
tf
->
eip
);
panic
(
"trap"
);
}
// otherwise it's our mistake
cprintf
(
"unexpected trap %d from cpu %d eip %x
\n
"
,
v
,
cpu
(),
tf
->
eip
);
panic
(
"trap"
);
cpus
[
cpu
()].
nlock
--
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment