Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CSEP551
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Krishna Vinnakota
CSEP551
Commits
7e7cb106
Commit
7e7cb106
authored
Sep 13, 2011
by
Robert Morris
Browse files
Options
Downloads
Patches
Plain Diff
more regular kmap[] and description
parent
90a81b32
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
entry.S
+1
-1
1 addition, 1 deletion
entry.S
memlayout.h
+4
-4
4 additions, 4 deletions
memlayout.h
vm.c
+22
-19
22 additions, 19 deletions
vm.c
with
27 additions
and
24 deletions
entry.S
+
1
−
1
View file @
7e7cb106
...
...
@@ -36,7 +36,7 @@ multiboot_header:
.
globl
_start
_start
=
V2P_WO
(
entry
)
#
Entering
xv6
on
boot
processor
.
Machine
is
mostly
set
up
.
#
Entering
xv6
on
boot
processor
,
with
paging
off
.
.
globl
entry
entry
:
#
Turn
on
page
size
extension
for
4
Mbyte
pages
...
...
This diff is collapsed.
Click to expand it.
memlayout.h
+
4
−
4
View file @
7e7cb106
...
...
@@ -10,13 +10,13 @@
#ifndef __ASSEMBLER__
static
inline
uint
v2p
(
void
*
a
)
{
return
(
uint
)
a
-
KERNBASE
;
}
static
inline
void
*
p2v
(
uint
a
)
{
return
(
void
*
)
a
+
KERNBASE
;
}
static
inline
uint
v2p
(
void
*
a
)
{
return
(
(
uint
)
(
a
))
-
KERNBASE
;
}
static
inline
void
*
p2v
(
uint
a
)
{
return
(
void
*
)
((
a
)
+
KERNBASE
)
;
}
#endif
#define V2P(a) ((uint)
a
- KERNBASE)
#define P2V(a) ((void *)
a
+ KERNBASE)
#define V2P(a) ((
(
uint)
(a))
- KERNBASE)
#define P2V(a) ((
(
void *)
(a))
+ KERNBASE)
#define V2P_WO(x) ((x) - KERNBASE) // same as V2P, but without casts
#define P2V_WO(x) ((x) + KERNBASE) // same as V2P, but without casts
This diff is collapsed.
Click to expand it.
vm.c
+
22
−
19
View file @
7e7cb106
...
...
@@ -90,35 +90,38 @@ mappages(pde_t *pgdir, void *va, uint size, uint pa,
return
0
;
}
// 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). A user process uses the same page table as
the kernel
; the
//
page protection bits prevent it from accessing kernel memory
.
// The
re is one page table per process, plus one that's used when
//
a CPU is not running any process (kpgdir). The kernel uses the
//
current process's page table during system calls and interrupts;
//
page protection bits prevent user code from using
the kernel
's
//
mappings
.
//
// setupkvm() and exec() set up every page table like this:
// 0..KERNBASE: user memory (text+data+stack+heap), mapped to some free
// phys memory
//
// 0..KERNBASE: user memory (text+data+stack+heap), mapped to
// phys memory allocated by the kernel
// KERNBASE..KERNBASE+EXTMEM: mapped to 0..EXTMEM (for I/O space)
// KERNBASE+EXTMEM..
KERNBASE+end
: mapped to EXTMEM..
end kernel,
//
w. no writ
e
p
er
mission
//
KERNBASE+end
..KERBASE+PHYSTOP: mapped to
end
..PHYSTOP,
// rw data + free memory
// KERNBASE+EXTMEM..
data
: mapped to EXTMEM..
V2P(data)
//
for th
e
k
er
nel's instructions and r/o data
//
data
..KER
N
BASE+PHYSTOP: mapped to
V2P(data)
..PHYSTOP,
// rw data + free
physical
memory
// 0xfe000000..0: mapped direct (devices such as ioapic)
//
// The kernel allocates memory for its heap and for user memory
// between KERNBASE+end and the end of physical memory (PHYSTOP).
// The user program sits in the bottom of the address space, and the
// kernel at the top at KERNBASE.
// The kernel allocates physical memory for its heap and for user memory
// between V2P(end) and the end of physical memory (PHYSTOP)
// (directly addressable from end..P2V(PHYSTOP)).
// This table defines the kernel's mappings, which are present in
// every process's page table.
static
struct
kmap
{
void
*
virt
;
uint
phys_start
;
uint
phys_end
;
int
perm
;
}
kmap
[]
=
{
{
P2V
(
0
),
0
,
1024
*
1024
,
PTE_W
},
// I/O space
{
(
void
*
)
KERNBASE
,
0
,
EXTMEM
,
PTE_W
},
// I/O space
{
(
void
*
)
KERNLINK
,
V2P
(
KERNLINK
),
V2P
(
data
),
0
},
// kernel text+rodata
{
data
,
V2P
(
data
),
PHYSTOP
,
PTE_W
},
// kernel data, memory
{
(
void
*
)
data
,
V2P
(
data
),
PHYSTOP
,
PTE_W
},
// kernel data, memory
{
(
void
*
)
DEVSPACE
,
DEVSPACE
,
0
,
PTE_W
},
// more devices
};
...
...
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
sign in
to comment