45,8 → 45,10 |
#include <arch/mm/frame.h> |
|
|
/** |
* Initializes kernel adress space page tables, sets abourts exceptions vectors |
/** Initializes page tables. |
* |
* 1:1 virtual-physical mapping is created in kernel address space. Mapping |
* for table with exception vectors is also created. |
*/ |
void page_arch_init(void) |
{ |
64,14 → 66,10 |
|
// create mapping for exception table at high offset |
#ifdef HIGH_EXCEPTION_VECTORS |
/* Note: this mapping cann't be done by hw_map because fixed |
exception vector is stored at fixed virtual address |
reserve frame for exception table |
*/ |
void* virtaddr = frame_alloc(ONE_FRAME, FRAME_KA); |
void *virtaddr = frame_alloc(ONE_FRAME, FRAME_KA); |
page_mapping_insert(AS_KERNEL, EXC_BASE_ADDRESS, KA2PA(virtaddr), flags); |
#else |
#error "Only high eception vector supported now" |
#error "Only high exception vector supported now" |
#endif |
|
as_switch(NULL, AS_KERNEL); |
79,16 → 77,15 |
boot_page_table_free(); |
} |
|
/** |
* Map device into kernel space. |
/** Maps device into the kernel space. |
* |
* This function adds mapping of physical address that is read/write only |
* from kernel and not bufferable. |
* Maps physical address of device into kernel virtual address space (so it can |
* be accessed only by kernel through virtual address). |
* |
* @param physaddr Physical addres where device is connected |
* @param size Length of area where device is present |
* @param physaddr Physical address where device is connected. |
* @param size Length of area where device is present. |
* |
* @return Virtual address where device will be accessable |
* @return Virtual address where device will be accessible. |
*/ |
uintptr_t hw_map(uintptr_t physaddr, size_t size) |
{ |