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
417c3711
Commit
417c3711
authored
14 years ago
by
Russ Cox
Browse files
Options
Downloads
Patches
Plain Diff
more trivial cleanup
parent
89bfdd4d
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
defs.h
+3
-3
3 additions, 3 deletions
defs.h
kalloc.c
+1
-1
1 addition, 1 deletion
kalloc.c
vm.c
+9
-12
9 additions, 12 deletions
vm.c
with
13 additions
and
16 deletions
defs.h
+
3
−
3
View file @
417c3711
...
...
@@ -161,11 +161,11 @@ int allocuvm(pde_t*, uint, uint);
int
deallocuvm
(
pde_t
*
,
uint
,
uint
);
void
freevm
(
pde_t
*
);
void
inituvm
(
pde_t
*
,
char
*
,
uint
);
int
loaduvm
(
pde_t
*
,
char
*
,
struct
inode
*
,
uint
,
uint
);
pde_t
*
copyuvm
(
pde_t
*
,
uint
);
int
loaduvm
(
pde_t
*
,
char
*
,
struct
inode
*
,
uint
,
uint
);
pde_t
*
copyuvm
(
pde_t
*
,
uint
);
void
switchuvm
(
struct
proc
*
);
void
switchkvm
(
void
);
int
copyout
(
pde_t
*
pgdir
,
uint
va
,
void
*
buf
,
uint
len
);
int
copyout
(
pde_t
*
,
uint
,
void
*
,
uint
);
// number of elements in fixed-size array
#define NELEM(x) (sizeof(x)/sizeof((x)[0]))
This diff is collapsed.
Click to expand it.
kalloc.c
+
1
−
1
View file @
417c3711
...
...
@@ -27,7 +27,7 @@ kinit(void)
initlock
(
&
kmem
.
lock
,
"kmem"
);
p
=
(
char
*
)
PGROUNDUP
((
uint
)
end
);
for
(;
p
+
PGSIZE
-
1
<
(
char
*
)
PHYSTOP
;
p
+=
PGSIZE
)
for
(;
p
+
PGSIZE
<
=
(
char
*
)
PHYSTOP
;
p
+=
PGSIZE
)
kfree
(
p
);
}
...
...
This diff is collapsed.
Click to expand it.
vm.c
+
9
−
12
View file @
417c3711
...
...
@@ -250,16 +250,16 @@ loaduvm(pde_t *pgdir, char *addr, struct inode *ip, uint offset, uint sz)
int
allocuvm
(
pde_t
*
pgdir
,
uint
oldsz
,
uint
newsz
)
{
char
*
a
,
*
last
,
*
mem
;
char
*
mem
;
uint
a
;
if
(
newsz
>
USERTOP
)
return
0
;
if
(
newsz
<
oldsz
)
return
oldsz
;
a
=
(
char
*
)
PGROUNDUP
(
oldsz
);
last
=
PGROUNDDOWN
(
newsz
-
1
);
for
(;
a
<=
last
;
a
+=
PGSIZE
){
a
=
PGROUNDUP
(
oldsz
);
for
(;
a
<
newsz
;
a
+=
PGSIZE
){
mem
=
kalloc
();
if
(
mem
==
0
){
cprintf
(
"allocuvm out of memory
\n
"
);
...
...
@@ -267,7 +267,7 @@ allocuvm(pde_t *pgdir, uint oldsz, uint newsz)
return
0
;
}
memset
(
mem
,
0
,
PGSIZE
);
mappages
(
pgdir
,
a
,
PGSIZE
,
PADDR
(
mem
),
PTE_W
|
PTE_U
);
mappages
(
pgdir
,
(
char
*
)
a
,
PGSIZE
,
PADDR
(
mem
),
PTE_W
|
PTE_U
);
}
return
newsz
;
}
...
...
@@ -279,17 +279,15 @@ allocuvm(pde_t *pgdir, uint oldsz, uint newsz)
int
deallocuvm
(
pde_t
*
pgdir
,
uint
oldsz
,
uint
newsz
)
{
char
*
a
,
*
last
;
pte_t
*
pte
;
uint
pa
;
uint
a
,
pa
;
if
(
newsz
>=
oldsz
)
return
oldsz
;
a
=
(
char
*
)
PGROUNDUP
(
newsz
);
last
=
PGROUNDDOWN
(
oldsz
-
1
);
for
(;
a
<=
last
;
a
+=
PGSIZE
){
pte
=
walkpgdir
(
pgdir
,
a
,
0
);
a
=
PGROUNDUP
(
newsz
);
for
(;
a
<
oldsz
;
a
+=
PGSIZE
){
pte
=
walkpgdir
(
pgdir
,
(
char
*
)
a
,
0
);
if
(
pte
&&
(
*
pte
&
PTE_P
)
!=
0
){
pa
=
PTE_ADDR
(
*
pte
);
if
(
pa
==
0
)
...
...
@@ -351,7 +349,6 @@ bad:
// copy some data to user address va in page table pgdir.
// most useful when pgdir is not the current page table.
// returns 1 if everthing OK, 0 on error.
// uva2ka ensures this only works for PTE_U pages.
int
copyout
(
pde_t
*
pgdir
,
uint
va
,
void
*
xbuf
,
uint
len
)
...
...
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