user_space #4
@ -25,20 +25,6 @@
|
||||
#define PD_SHIFT 22
|
||||
#define PD_MIRROR_PAGE_IDX 1023U
|
||||
|
||||
/** Frontier between kernel and user space virtual addresses */
|
||||
#define PAGING_BASE_USER_ADDRESS (0x40000000) /* 1GB (must be 4MB-aligned) */
|
||||
#define PAGING_TOP_USER_ADDRESS (0xFFFFFFFF) /* 4GB - 1B */
|
||||
#define PAGING_USER_SPACE_SIZE (0xc0000000) /* 3GB */
|
||||
|
||||
/** Length of the space reserved for the mirroring in the kernel
|
||||
virtual space */
|
||||
#define PAGING_MIRROR_SIZE (PAGE_SIZE << 10) /* 1 PD = 1024 Page Tables = 4MB */
|
||||
|
||||
/** Virtual address where the mirroring takes place */
|
||||
#define PAGING_MIRROR_VADDR \
|
||||
(PAGING_BASE_USER_ADDRESS - PAGING_MIRROR_SIZE)
|
||||
|
||||
|
||||
static unsigned long mappedPage = 0;
|
||||
|
||||
struct pde {
|
||||
|
@ -1,6 +1,19 @@
|
||||
#pragma once
|
||||
#include "types.h"
|
||||
|
||||
/** Frontier between kernel and user space virtual addresses */
|
||||
#define PAGING_BASE_USER_ADDRESS (0x40000000) /* 1GB (must be 4MB-aligned) */
|
||||
#define PAGING_TOP_USER_ADDRESS (0xFFFFFFFF) /* 4GB - 1B */
|
||||
#define PAGING_USER_SPACE_SIZE (0xc0000000) /* 3GB */
|
||||
|
||||
/** Length of the space reserved for the mirroring in the kernel
|
||||
virtual space */
|
||||
#define PAGING_MIRROR_SIZE (PAGE_SIZE << 10) /* 1 PD = 1024 Page Tables = 4MB */
|
||||
|
||||
/** Virtual address where the mirroring takes place */
|
||||
#define PAGING_MIRROR_VADDR \
|
||||
(PAGING_BASE_USER_ADDRESS - PAGING_MIRROR_SIZE)
|
||||
|
||||
#define PAGING_MEM_USER (1U << 0)
|
||||
#define PAGING_MEM_READ (1U << 1)
|
||||
#define PAGING_MEM_WRITE (1U << 2)
|
||||
|
@ -33,8 +33,8 @@ void areaInit(vaddr_t firstMemUsed, vaddr_t lastUsed, vaddr_t stackBottom, vaddr
|
||||
int nbPagesStack = DIV_ROUND_UP((stackTop - stackBottom), PAGE_SIZE);
|
||||
areaAdd(ALIGN_DOWN(stackBottom, PAGE_SIZE), nbPagesStack, FALSE);
|
||||
}
|
||||
//TODO: fix the 300
|
||||
areaAdd(ALIGN_DOWN(areaAddr + PAGE_SIZE, PAGE_SIZE), 300 , TRUE);
|
||||
int nbFreePages = DIV_ROUND_UP((AREA_MEM_TOP - areaAddr), PAGE_SIZE);
|
||||
areaAdd(ALIGN_DOWN(areaAddr + PAGE_SIZE, PAGE_SIZE), nbFreePages , TRUE);
|
||||
allocPopulate();
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
// areaAlloc map vmem to phy pages
|
||||
#define AREA_PHY_MAP (1<<0)
|
||||
#define AREA_MEM_TOP PAGING_MIRROR_VADDR
|
||||
|
||||
struct memArea {
|
||||
vaddr_t startAddr;
|
||||
|
Loading…
Reference in New Issue
Block a user