Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xv6-19au
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
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
csep551
xv6-19au
Commits
d9818bdd
Commit
d9818bdd
authored
13 years ago
by
Frans Kaashoek
Browse files
Options
Downloads
Patches
Plain Diff
Make Austin happier
2011
parent
a4b213cf
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README
+1
-1
1 addition, 1 deletion
README
vm.c
+12
-12
12 additions, 12 deletions
vm.c
with
13 additions
and
13 deletions
README
+
1
−
1
View file @
d9818bdd
...
...
@@ -26,7 +26,7 @@ In addition, we are grateful for the patches contributed by Greg
Price, Yandong Mao, and Hitoshi Mitake.
The code in the files that constitute xv6 is
Copyright 2006-20
07
Frans Kaashoek, Robert Morris, and Russ Cox.
Copyright 2006-20
11
Frans Kaashoek, Robert Morris, and Russ Cox.
ERROR REPORTS
...
...
This diff is collapsed.
Click to expand it.
vm.c
+
12
−
12
View file @
d9818bdd
...
...
@@ -18,7 +18,7 @@ seginit(void)
{
struct
cpu
*
c
;
// Map
virtu
al addresses to
linear
addresses using identity map.
// Map
"logic
al
"
addresses to
virtual
addresses using identity map.
// Cannot share a CODE descriptor for both kernel and user
// because it would have to have DPL_USR, but the CPU forbids
// an interrupt from CPL=0 to DPL=3.
...
...
@@ -40,7 +40,7 @@ seginit(void)
}
// Return the address of the PTE in page table pgdir
// that corresponds to
linear
address va. If alloc!=0,
// that corresponds to
virtual
address va. If alloc!=0,
// create any required page table pages.
static
pte_t
*
walkpgdir
(
pde_t
*
pgdir
,
const
void
*
va
,
char
*
(
*
alloc
)(
void
))
...
...
@@ -64,17 +64,17 @@ walkpgdir(pde_t *pgdir, const void *va, char* (*alloc)(void))
return
&
pgtab
[
PTX
(
va
)];
}
// Create PTEs for
linear
addresses starting at la that refer to
// Create PTEs for
virtual
addresses starting at la that refer to
// physical addresses starting at pa. la and size might not
// be page-aligned.
static
int
mappages
(
pde_t
*
pgdir
,
void
*
l
a
,
uint
size
,
uint
pa
,
int
perm
,
char
*
(
*
alloc
)(
void
))
mappages
(
pde_t
*
pgdir
,
void
*
v
a
,
uint
size
,
uint
pa
,
int
perm
,
char
*
(
*
alloc
)(
void
))
{
char
*
a
,
*
last
;
pte_t
*
pte
;
a
=
PGROUNDDOWN
(
l
a
);
last
=
PGROUNDDOWN
(
l
a
+
size
-
1
);
a
=
PGROUNDDOWN
(
v
a
);
last
=
PGROUNDDOWN
(
v
a
+
size
-
1
);
for
(;;){
pte
=
walkpgdir
(
pgdir
,
a
,
alloc
);
if
(
pte
==
0
)
...
...
@@ -90,7 +90,7 @@ mappages(pde_t *pgdir, void *la, uint size, uint pa, int perm, char* (*alloc)(vo
return
0
;
}
// The mappings from logical to
linear
are one to one (i.e.,
// The mappings from logical to
virtual
are one to one (i.e.,
// segmentation doesn't do anything).
// There is one page table per process, plus one that's used
// when a CPU is not running any process (kpgdir).
...
...
@@ -98,7 +98,6 @@ mappages(pde_t *pgdir, void *la, uint size, uint pa, int perm, char* (*alloc)(vo
// page protection bits prevent it from using anything other
// than its memory.
//
//
// setupkvm() and exec() set up every page table like this:
// 0..USERTOP : user memory (text, data, stack, heap), mapped to some unused phys mem
// KERNBASE..KERNBASE+1M: mapped to 0..1M
...
...
@@ -112,9 +111,9 @@ mappages(pde_t *pgdir, void *la, uint size, uint pa, int perm, char* (*alloc)(vo
// (which is inaccessible in user mode). The user program sits in
// the bottom of the address space, and the kernel at the top at KERNBASE.
static
struct
kmap
{
void
*
l
;
uint
p
;
uint
e
;
void
*
virt
;
uint
p
hys_start
;
uint
phys_end
;
int
perm
;
}
kmap
[]
=
{
{
P2V
(
0
),
0
,
1024
*
1024
,
PTE_W
},
// First 1Mbyte contains BIOS and some IO devices
...
...
@@ -135,7 +134,8 @@ setupkvm(char* (*alloc)(void))
memset
(
pgdir
,
0
,
PGSIZE
);
k
=
kmap
;
for
(
k
=
kmap
;
k
<
&
kmap
[
NELEM
(
kmap
)];
k
++
)
if
(
mappages
(
pgdir
,
k
->
l
,
k
->
e
-
k
->
p
,
(
uint
)
k
->
p
,
k
->
perm
,
alloc
)
<
0
)
if
(
mappages
(
pgdir
,
k
->
virt
,
k
->
phys_end
-
k
->
phys_start
,
(
uint
)
k
->
phys_start
,
k
->
perm
,
alloc
)
<
0
)
return
0
;
return
pgdir
;
...
...
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