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
b69ec898
authored
Nov 09, 2015
by
triazo
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add function to map a region of virtual memory to real mem
parent
acf84412
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
src/mem.c
src/mem.h
src/mem.c
View file @
b69ec898
...
...
@@ -132,6 +132,13 @@ page_directory_entry* initiate_directory()
return
page_directory
;
}
// Expect addr to be page aligned
void
map_directory_entry
(
void
*
addr
,
page_directory_entry
*
page_dir
)
{
page_table_entry
*
new_page_table
=
(
page_table_entry
*
)
(
malloc
(
2048
)
+
1024
)
&
0xfffffc00
;
populate_page_table
(
new_page_table
,
addr
&
0xffc00000
,
1024
,
0
);
page_dir
[
addr
>>
22
]
=
new_page_table
;
}
void
*
malloc
(
uint32_t
bytes
)
{
void
*
old_mark
=
memory_mark
;
...
...
src/mem.h
View file @
b69ec898
...
...
@@ -31,6 +31,9 @@ extern void enablePaging();
page_directory_entry
*
initiate_directory
();
page_directory_entry
*
mem_init_kern_tables
(
multiboot_memory_map
*
mmap
,
multiboot_memory_map
*
mmap_end
);
// map_directory_entry maps the real address given to a page directory at the same memory
void
map_directory_entry
(
void
*
);
// 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