mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 10:53:16 +01:00
Seems phys_to_page/page_to_phys macros are fixed in mm0
This commit is contained in:
@@ -29,7 +29,7 @@ struct container_info cinfo[] = {
|
||||
[0] = {
|
||||
.pager_lma = __pfn(CONFIG_CONT0_PAGER_START),
|
||||
.pager_vma = __pfn(0xE0000000),
|
||||
.pager_size = __pfn(0x9F000),
|
||||
.pager_size = __pfn(0xa0000),
|
||||
.ncaps = 14,
|
||||
.caps = {
|
||||
[0] = {
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <task.h>
|
||||
#include <arch/mm.h>
|
||||
#include <lib/spinlock.h>
|
||||
#include <physmem.h>
|
||||
|
||||
// #define DEBUG_FAULT_HANDLING
|
||||
#ifdef DEBUG_FAULT_HANDLING
|
||||
@@ -76,10 +77,11 @@ struct devpage {
|
||||
|
||||
#define page_refcnt(x) ((x)->count + 1)
|
||||
#define virtual(x) ((x)->virtual)
|
||||
#define phys_to_page(x) (page_array + __pfn(x))
|
||||
#define page_to_phys(x) __pfn_to_addr((((void *)x) - \
|
||||
(void *)page_array) \
|
||||
/ sizeof(struct page))
|
||||
#define phys_to_page(x) (page_array + __pfn((x) - membank[0].start))
|
||||
#define page_to_phys(x) (__pfn_to_addr((((void *)(x)) - \
|
||||
(void *)page_array) / \
|
||||
sizeof(struct page)) + \
|
||||
membank[0].start)
|
||||
|
||||
/* Fault data specific to this task + ptr to kernel's data */
|
||||
struct fault_data {
|
||||
|
||||
@@ -131,6 +131,9 @@ void init_physmem_secondary(struct initdata *initdata, struct membank *membank)
|
||||
|
||||
/* Set global page array to this bank's array */
|
||||
page_array = membank[0].page_array;
|
||||
|
||||
/* Test that page/phys macros work */
|
||||
BUG_ON(phys_to_page(page_to_phys(&page_array[5])) != &page_array[5])
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user