Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
osy.pages.fel.cvut.cz
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
osy
osy.pages.fel.cvut.cz
Commits
1c15e42f
Commit
1c15e42f
authored
3 years ago
by
Matěj Kafka
Committed by
Michal Sojka
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
nova: Add explanation for `Kalloc::phys2virt` and `virt2phys`
parent
3739b179
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
nova/kern/include/kalloc.h
+13
-0
13 additions, 0 deletions
nova/kern/include/kalloc.h
with
13 additions
and
0 deletions
nova/kern/include/kalloc.h
+
13
−
0
View file @
1c15e42f
...
...
@@ -38,7 +38,20 @@ class Kalloc
void
*
alloc_page
(
unsigned
size
,
Fill
fill
=
NOFILL
);
void
free_page
(
void
*
);
/**
* Even kernel can only access virtual memory, it cannot access physical memory directly.
* However, CPU and bootloader work with physical addresses, so we sometimes need to read/write
* to physical addresses.
*
* To resolve this, part of the physical memory is mapped 1:1 to a sequential block of virtual
* memory addresses at a known offset `OFFSET`, so that the physical address X is accessible
* at the virtual address OFFSET + X. This mapping is configured during kernel startup at
* `kern/src/start.S` (section `SETUP BOOT PAGE TABLE`).
*
* This method returns the virtual address that can be used to access the physical address `phys`.
*/
static
void
*
phys2virt
(
mword
);
/** Return the physical address that is mapped from the virtual address `virt` (opposite of `phys2virt`). */
static
mword
virt2phys
(
void
*
);
};
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