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
6532990d
authored
Nov 19, 2015
by
triazo
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Minor fix to paging (not working)
parent
b69ec898
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
6 deletions
src/kern.c
src/mem.c
src/mem.h
src/kern.c
View file @
6532990d
...
...
@@ -62,12 +62,12 @@ void kernel_main(multiboot_info* mbt, uint32_t magic)
int
o
=
0
;
int
j
=
5
/
o
;
serial_hexword
(
j
);
//test_mem();
serial_writechar
(
'\n'
);
// PCI
checkAllBuses
();
void
*
ahciAddr
=
pciFindAHCI
();
mem_map_directory_entry
(
ahciAddr
,
kern_page_dir
);
serial_hexstring
(
ahciAddr
,
0x1100
);
test_idt
();
...
...
src/mem.c
View file @
6532990d
...
...
@@ -133,10 +133,11 @@ page_directory_entry* initiate_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
mem_map_directory_entry
(
void
*
addr
,
page_directory_entry
*
page_dir
)
{
page_table_entry
*
new_page_table
=
(
page_table_entry
*
)
(((
uint32_t
)
malloc
(
2048
)
+
1024
)
&
0xfffffc00
);
populate_page_table
(
new_page_table
,
(
uint32_t
)
addr
&
0xffc00000
,
1024
,
0
);
page_dir
[(
uint32_t
)
addr
>>
22
]
=
(
uint32_t
)
new_page_table
;
page_dir
[(
uint32_t
)
addr
>>
22
]
|=
PAGE_WRITABLE
|
PAGE_PRESENT
;
}
void
*
malloc
(
uint32_t
bytes
)
...
...
src/mem.h
View file @
6532990d
...
...
@@ -32,7 +32,7 @@ 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
m
ap_directory_entry
(
void
*
);
void
m
em_map_directory_entry
(
void
*
addr
,
page_directory_entry
*
page_dir
);
// memory mark stores a counter of bytes for the most recently used
// memory. Everything before it is used and all valid memory after it
...
...
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