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
4587b358
Commit
4587b358
authored
14 years ago
by
Robert Morris
Browse files
Options
Downloads
Patches
Plain Diff
exec questions
parent
faad047a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
exec.c
+6
-0
6 additions, 0 deletions
exec.c
kalloc.c
+3
-3
3 additions, 3 deletions
kalloc.c
with
9 additions
and
3 deletions
exec.c
+
6
−
0
View file @
4587b358
...
...
@@ -48,6 +48,9 @@ exec(char *path, char **argv)
}
iunlockput
(
ip
);
// XXX rtm: what about the BSS? shouldn't there be some
// bzero()ing here?
// Allocate and initialize stack at sz
sz
=
spbottom
=
PGROUNDUP
(
sz
);
if
(
!
(
sz
=
allocuvm
(
pgdir
,
sz
,
sz
+
PGSIZE
)))
...
...
@@ -62,6 +65,9 @@ exec(char *path, char **argv)
sp
=
sz
;
argp
=
sz
-
arglen
-
4
*
(
argc
+
1
);
// XXX rtm: does the following code work if the
// arguments &c do not fit in one page?
// Copy argv strings and pointers to stack.
*
(
uint
*
)(
mem
+
argp
-
spbottom
+
4
*
argc
)
=
0
;
// argv[argc]
for
(
i
=
argc
-
1
;
i
>=
0
;
i
--
){
...
...
This diff is collapsed.
Click to expand it.
kalloc.c
+
3
−
3
View file @
4587b358
...
...
@@ -17,12 +17,12 @@ struct {
struct
run
*
freelist
;
}
kmem
;
extern
char
end
[];
// first address after kernel loaded from ELF file
// Initialize free list of physical pages.
void
kinit
(
void
)
{
extern
char
end
[];
initlock
(
&
kmem
.
lock
,
"kmem"
);
char
*
p
=
(
char
*
)
PGROUNDUP
((
uint
)
end
);
for
(
;
p
+
PGSIZE
-
1
<
(
char
*
)
PHYSTOP
;
p
+=
PGSIZE
)
...
...
@@ -39,7 +39,7 @@ kfree(char *v)
{
struct
run
*
r
;
if
(((
uint
)
v
)
%
PGSIZE
||
(
uint
)
v
<
1024
*
1024
||
(
uint
)
v
>=
PHYSTOP
)
if
(((
uint
)
v
)
%
PGSIZE
||
v
<
end
||
(
uint
)
v
>=
PHYSTOP
)
panic
(
"kfree"
);
// Fill with junk to catch dangling refs.
...
...
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