Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
triazo
/
kernel
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
3
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
37f5b7d8
authored
Nov 30, 2015
by
triazo
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add helper function to create a blank table
parent
66b2c0ee
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
src/mem.c
src/mem.h
src/mem.c
View file @
37f5b7d8
...
...
@@ -161,6 +161,24 @@ page_directory_entry* page_new_directory()
return
pgdir
;
}
// Returns a blank table
page_table_entry
*
page_new_table
()
{
page_table_entry
*
pgtab
=
(
page_table_entry
*
)
page_allocate
();
int
i
;
for
(
i
=
0
;
i
<
1024
;
i
++
)
{
// This sets the following flags to the pages:
// Supervisor: Only kernel-mode can access them
// Write Enabled: It can be both read from and written to
// (this is the 2 bit)
// Not Present: The page table is not present
pgtab
[
i
]
=
0
;
pgtab
[
i
]
|=
PAGE_WRITABLE
;
}
return
pgtab
;
}
page_directory_entry
*
initiate_directory
()
{
// set each entry to not present
...
...
src/mem.h
View file @
37f5b7d8
...
...
@@ -37,11 +37,11 @@ void page_free(void* page_start);
// Initilization
page_directory_entry
*
mem_init_kern_tables
(
multiboot_memory_map
*
mmap
,
multiboot_memory_map
*
mmap_end
);
// Directory handling
// Directory
and table
handling
page_directory_entry
*
page_new_directory
();
page_table_entry
*
page_new_table
();
page_directory_entry
*
initiate_directory
();
// DEPRECATED
// memory mark stores a counter of bytes for the most recently used
// memory. Everything before it is used and all valid memory after it
// is free
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment