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
66b2c0ee
authored
Nov 30, 2015
by
triazo
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add function to initiate a blank directory
parent
20eeaa3a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
4 deletions
src/elf.h
src/mem.c
src/mem.h
src/elf.h
View file @
66b2c0ee
...
...
@@ -46,4 +46,7 @@ typedef struct
uint32_t
alignment
;
}
elf_program_header
;
// Will probably return a pointer to the PCB block eventually. Dunno though.
void
load_elf
(
elf_header
*
elf_start
);
#endif
src/mem.c
View file @
66b2c0ee
...
...
@@ -64,6 +64,7 @@ void* page_allocate()
return
(
void
*
)
&
_kernel_end
+
0x1000
*
page_number
;
}
// page_free just flips the bit to say that the page has been freed
void
page_free
(
void
*
page_start
)
{
if
(((
uint32_t
)
page_start
&
0xfff
)
!=
0
)
...
...
@@ -143,6 +144,23 @@ page_directory_entry* mem_init_kern_tables(multiboot_memory_map* mmap, multiboot
return
kern_page_dir
;
}
page_directory_entry
*
page_new_directory
()
{
page_directory_entry
*
pgdir
=
(
page_directory_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
pgdir
[
i
]
=
0
;
pgdir
[
i
]
|=
PAGE_WRITABLE
;
}
return
pgdir
;
}
page_directory_entry
*
initiate_directory
()
{
// set each entry to not present
...
...
src/mem.h
View file @
66b2c0ee
...
...
@@ -34,13 +34,12 @@ extern char _kernel_end[];
void
*
page_allocate
();
void
page_free
(
void
*
page_start
);
// Allocatoion of memory
// Initilization
page_directory_entry
*
mem_init_kern_tables
(
multiboot_memory_map
*
mmap
,
multiboot_memory_map
*
mmap_end
);
// Defined in the file mem.c
page_directory_entry
*
initiate_directory
();
// Directory handling
page_directory_entry
*
page_new_directory
();
page_directory_entry
*
initiate_directory
();
// DEPRECATED
// memory mark stores a counter of bytes for the most recently used
...
...
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