changed mm functions to C++ linkage

git-svn-id: svn://anubis/hos/trunk@36 5b3e749e-e535-0410-8002-a9bb6afbdfca
This commit is contained in:
josh 2009-07-02 03:35:24 +00:00
parent a8947f8aa3
commit e907902ca0
2 changed files with 6 additions and 14 deletions

View File

@ -8,8 +8,6 @@
static bool mm_use_virtual_offset; static bool mm_use_virtual_offset;
extern "C" {
pagedirectory_t page_directory __attribute__ ((aligned (4096))); pagedirectory_t page_directory __attribute__ ((aligned (4096)));
static mm_mem_range_t mm_mmap_entries[MM_MAX_MMAP_ENTRIES]; static mm_mem_range_t mm_mmap_entries[MM_MAX_MMAP_ENTRIES];
@ -129,8 +127,10 @@ void mm_bootstrap()
mm_use_virtual_offset = false; mm_use_virtual_offset = false;
} }
} /* extern "C" */ /**************************************************************************
* Map virtual_address to physical_address. *
* Both addresses should be page-aligned. *
*************************************************************************/
int mm_map(u32_t virtual_address, u32_t physical_address, int mm_map(u32_t virtual_address, u32_t physical_address,
u32_t user_mode, u32_t writable) u32_t user_mode, u32_t writable)
{ {
@ -142,7 +142,7 @@ int mm_map(u32_t virtual_address, u32_t physical_address,
u32_t page_table_address = mm_page_alloc(); u32_t page_table_address = mm_page_alloc();
if (page_table_address == 0) if (page_table_address == 0)
{ {
return 1; return 0;
} }
page_directory[directory_index] = page_table_address page_directory[directory_index] = page_table_address
| 0x1 << 2 /* PTs can be user mode */ | 0x1 << 2 /* PTs can be user mode */
@ -162,7 +162,7 @@ int mm_map(u32_t virtual_address, u32_t physical_address,
| (writable & 0x1) << 1 | (writable & 0x1) << 1
| 0x1; /* present */ | 0x1; /* present */
return 0; return 1;
} }
/************************************************************************** /**************************************************************************

View File

@ -6,10 +6,6 @@
#include "hos_defines.h" #include "hos_defines.h"
#include "multiboot.h" #include "multiboot.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef u32_t pagedirectory_entry_t; typedef u32_t pagedirectory_entry_t;
#define NUM_PAGETABLE_ENTRIES (PAGE_SIZE / sizeof(pagedirectory_entry_t)) #define NUM_PAGETABLE_ENTRIES (PAGE_SIZE / sizeof(pagedirectory_entry_t))
@ -28,10 +24,6 @@ typedef struct
void mm_record_mmap_entry(mb_mmap_t * mmap); void mm_record_mmap_entry(mb_mmap_t * mmap);
void mm_bootstrap(); void mm_bootstrap();
#ifdef __cplusplus
}
#endif
int mm_map(u32_t virtual_address, u32_t physical_address, int mm_map(u32_t virtual_address, u32_t physical_address,
u32_t user_mode, u32_t writable); u32_t user_mode, u32_t writable);