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
74493bf4
Commit
74493bf4
authored
18 years ago
by
kaashoek
Browse files
Options
Downloads
Patches
Plain Diff
kill user process when it generates an unhandled trap (e.g., 13)
fix bug in test code of malloc
parent
81d52199
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
trap.c
+3
-1
3 additions, 1 deletion
trap.c
umalloc.c
+0
-6
0 additions, 6 deletions
umalloc.c
usertests.c
+0
-12
0 additions, 12 deletions
usertests.c
with
3 additions
and
19 deletions
trap.c
+
3
−
1
View file @
74493bf4
...
...
@@ -126,8 +126,10 @@ trap(struct trapframe *tf)
}
cprintf
(
"trap %d from cpu %d eip %x
\n
"
,
v
,
cpu
(),
tf
->
eip
);
if
(
curproc
[
cpu
()])
if
(
curproc
[
cpu
()])
{
cprintf
(
"pid %d
\n
"
,
curproc
[
cpu
()]
->
pid
);
proc_exit
();
}
// panic("trap");
return
;
...
...
This diff is collapsed.
Click to expand it.
umalloc.c
+
0
−
6
View file @
74493bf4
...
...
@@ -26,8 +26,6 @@ free(void *ap)
{
Header
*
bp
,
*
p
;
printf
(
1
,
"free
\n
"
);
bp
=
(
Header
*
)
ap
-
1
;
for
(
p
=
freep
;
!
(
bp
>
p
&&
bp
<
p
->
s
.
ptr
);
p
=
p
->
s
.
ptr
)
if
(
p
>=
p
->
s
.
ptr
&&
(
bp
>
p
||
bp
<
p
->
s
.
ptr
))
...
...
@@ -53,7 +51,6 @@ morecore(uint nu)
if
(
nu
<
PAGE
)
nu
=
PAGE
;
printf
(
1
,
"call sbrk
\n
"
);
cp
=
sbrk
(
nu
*
sizeof
(
Header
));
if
(
cp
==
(
char
*
)
-
1
)
return
0
;
...
...
@@ -69,8 +66,6 @@ malloc(uint nbytes)
Header
*
p
,
*
prevp
;
uint
nunits
;
printf
(
1
,
"malloc %d
\n
"
,
nbytes
);
nunits
=
(
nbytes
+
sizeof
(
Header
)
-
1
)
/
sizeof
(
Header
)
+
1
;
if
((
prevp
=
freep
)
==
0
)
{
base
.
s
.
ptr
=
freep
=
prevp
=
&
base
;
...
...
@@ -86,7 +81,6 @@ malloc(uint nbytes)
p
->
s
.
size
=
nunits
;
}
freep
=
prevp
;
printf
(
1
,
"malloc returns: %d
\n
"
,
(
int
)
(
p
+
1
));
return
(
void
*
)
(
p
+
1
);
}
if
(
p
==
freep
)
...
...
This diff is collapsed.
Click to expand it.
usertests.c
+
0
−
12
View file @
74493bf4
...
...
@@ -120,20 +120,8 @@ exitwait(void)
void
mem
(
void
)
{
void
*
m
=
malloc
(
4096
);
void
*
m1
,
*
m2
;
free
(
m
+
3
*
1024
);
free
(
m
+
2
*
1024
);
free
(
m
+
1024
);
free
(
m
);
m1
=
malloc
(
4096
);
if
(
m1
!=
m
)
{
puts
(
"didn't coalesce
\n
"
);
exit
();
}
free
(
m1
);
m1
=
0
;
while
((
m2
=
malloc
(
1024
))
!=
0
)
{
*
(
char
**
)
m2
=
m1
;
...
...
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