merged in removing-assembly branch to do more in C
git-svn-id: svn://anubis/hos/trunk@80 5b3e749e-e535-0410-8002-a9bb6afbdfca
This commit is contained in:
1 parent
76ac4f88a4
commit
e4701b8d96
10 files changed
+104
-147
No files matched your search
+20
-1
@@ -154,8 +154,27 @@ void mm_bootstrap()
|
||||
mm_gdtr.limit = 3 * sizeof(mm_gdt[0]) - 1;
|
||||
mm_gdtr.base = gdt_base;
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"lgdt (mm_gdtr);\n"
|
||||
"jmp $0x08, $42f;\n"
|
||||
"42:\n"
|
||||
"mov $0x10, %%cx\n"
|
||||
"mov %%cx, %%ss\n"
|
||||
"mov %%cx, %%ds\n"
|
||||
"mov %%cx, %%es\n"
|
||||
"mov %%cx, %%fs\n"
|
||||
"mov %%cx, %%gs\n"
|
||||
: /* no outputs */
|
||||
: /* no inputs */
|
||||
: "ecx");
|
||||
|
||||
/* set the page directory base register */
|
||||
set_cr3(page_directory);
|
||||
write_cr3(page_directory);
|
||||
|
||||
/* turn on paging */
|
||||
write_cr0(read_cr0() | (1 << 31));
|
||||
|
||||
stack_bootstrap();
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
|
||||
+13
-11
@@ -21,17 +21,6 @@ typedef struct
|
||||
u64_t length;
|
||||
} mm_mem_range_t;
|
||||
|
||||
void mm_record_mmap_entry(mb_mmap_t * mmap);
|
||||
void mm_bootstrap();
|
||||
|
||||
int mm_early_map(u32_t virtual_address, u32_t physical_address,
|
||||
u32_t user_mode, u32_t writable);
|
||||
int mm_map(u32_t virtual_address, u32_t physical_address,
|
||||
u32_t user_mode, u32_t writable);
|
||||
|
||||
u32_t mm_early_page_alloc();
|
||||
u32_t mm_page_alloc();
|
||||
|
||||
/* http://courses.ece.illinois.edu/ece391/references/descriptors.pdf */
|
||||
/* granularity: 0: limit in bytes; 1: limit in pages */
|
||||
/* dpl: 0: system mode; 3: user mode */
|
||||
@@ -50,6 +39,19 @@ u32_t mm_page_alloc();
|
||||
| ( (((u64_t) base) & 0x00FFFFFFull) << 16) /* base 23:00 */ \
|
||||
| ( (((u64_t) limit) & 0x0000FFFFull) ) ) /* limit 15:00 */
|
||||
|
||||
typedef u64_t descriptor_t;
|
||||
|
||||
void mm_record_mmap_entry(mb_mmap_t * mmap);
|
||||
void mm_bootstrap();
|
||||
|
||||
int mm_early_map(u32_t virtual_address, u32_t physical_address,
|
||||
u32_t user_mode, u32_t writable);
|
||||
int mm_map(u32_t virtual_address, u32_t physical_address,
|
||||
u32_t user_mode, u32_t writable);
|
||||
|
||||
u32_t mm_early_page_alloc();
|
||||
u32_t mm_page_alloc();
|
||||
|
||||
void mm_print_memory_map();
|
||||
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user