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
cd12eea3
Commit
cd12eea3
authored
18 years ago
by
rsc
Browse files
Options
Downloads
Patches
Plain Diff
make trap fit on one page
parent
1656b1b2
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
+6
-12
6 additions, 12 deletions
trap.c
with
6 additions
and
12 deletions
trap.c
+
6
−
12
View file @
cd12eea3
...
...
@@ -9,10 +9,8 @@
// Interrupt descriptor table (shared by all CPUs).
struct
gatedesc
idt
[
256
];
extern
uint
vectors
[];
// in vectors.S: array of 256 entry pointers
void
tvinit
(
void
)
{
...
...
@@ -46,8 +44,7 @@ trap(struct trapframe *tf)
}
// Increment nlock to make sure interrupts stay off
// during interrupt handler. Must decrement before
// returning.
// during interrupt handler. Decrement before returning.
cpus
[
cpu
()].
nlock
++
;
switch
(
v
){
...
...
@@ -55,11 +52,9 @@ trap(struct trapframe *tf)
lapic_timerintr
();
cpus
[
cpu
()].
nlock
--
;
if
(
cp
){
// Force process exit if it has been killed
// and the interrupt came from user space.
// (If the kernel was executing at time of interrupt,
// don't kill the process. Let the process get back
// out to its regular system call return.)
// Force process exit if it has been killed and is in user space.
// (If it is still executing in the kernel, let it keep running
// until it gets to the regular system call return.)
if
((
tf
->
cs
&
3
)
==
3
&&
cp
->
killed
)
proc_exit
();
...
...
@@ -85,14 +80,13 @@ trap(struct trapframe *tf)
default:
if
(
curproc
[
cpu
()])
{
// assume process caused unexpected trap,
// for example by dividing by zero or dereferencing a bad pointer
// Assume process divided by zero or dereferenced null, etc.
cprintf
(
"pid %d: unhandled trap %d on cpu %d eip %x -- kill proc
\n
"
,
curproc
[
cpu
()]
->
pid
,
v
,
cpu
(),
tf
->
eip
);
proc_exit
();
}
//
o
therwise it's our mistake
//
O
therwise it's our mistake
.
cprintf
(
"unexpected trap %d from cpu %d eip %x
\n
"
,
v
,
cpu
(),
tf
->
eip
);
panic
(
"trap"
);
}
...
...
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