Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/include/vmparam.h
Show First 20 Lines • Show All 164 Lines • ▼ Show 20 Lines | |||||
#define KERNBASE KVADDR(KPML4I, KPDPI, 0, 0) | #define KERNBASE KVADDR(KPML4I, KPDPI, 0, 0) | ||||
#define UPT_MAX_ADDRESS KVADDR(PML4PML4I, PML4PML4I, PML4PML4I, PML4PML4I) | #define UPT_MAX_ADDRESS KVADDR(PML4PML4I, PML4PML4I, PML4PML4I, PML4PML4I) | ||||
#define UPT_MIN_ADDRESS KVADDR(PML4PML4I, 0, 0, 0) | #define UPT_MIN_ADDRESS KVADDR(PML4PML4I, 0, 0, 0) | ||||
#define VM_MAXUSER_ADDRESS UVADDR(NUPML4E, 0, 0, 0) | #define VM_MAXUSER_ADDRESS UVADDR(NUPML4E, 0, 0, 0) | ||||
#define SHAREDPAGE (VM_MAXUSER_ADDRESS - PAGE_SIZE) | #define SHAREDPAGE (VM_MAXUSER_ADDRESS - PAGE_SIZE) | ||||
#define USRSTACK SHAREDPAGE | #define USRSTACK (SHAREDPAGE - 4*PAGE_SIZE) | ||||
op: Hi Robert!
- Show quoted text -
The SHAREDPAGE - 4*PAGE_SIZE constant is for separate the stack… | |||||
Not Done Inline ActionsPlease add a comment explaining the magic number '4', and ideally use a #define that makes the choice obvious as well. A bare number is almost never the right thing. rwatson: Please add a comment explaining the magic number '4', and ideally use a #define that makes the… | |||||
Not Done Inline ActionsIs the comment explaining (4) now elsewhere? I've not spotted it yet. rwatson: Is the comment explaining (4) now elsewhere? I've not spotted it yet. | |||||
#define VM_MAX_ADDRESS UPT_MAX_ADDRESS | #define VM_MAX_ADDRESS UPT_MAX_ADDRESS | ||||
#define VM_MIN_ADDRESS (0) | #define VM_MIN_ADDRESS (0) | ||||
#define PHYS_TO_DMAP(x) ((x) | DMAP_MIN_ADDRESS) | #define PHYS_TO_DMAP(x) ((x) | DMAP_MIN_ADDRESS) | ||||
#define DMAP_TO_PHYS(x) ((x) & ~DMAP_MIN_ADDRESS) | #define DMAP_TO_PHYS(x) ((x) & ~DMAP_MIN_ADDRESS) | ||||
/* | /* | ||||
* How many physical pages per kmem arena virtual page. | * How many physical pages per kmem arena virtual page. | ||||
Show All 22 Lines |
Hi Robert!
The SHAREDPAGE - 4*PAGE_SIZE constant is for separate the stack and
the shared page, because the shared-page are double mapped with kernel
and user-space, and the shared-page and stack are overlapped. This
means, when stack become read-write-executable (in firefox case it's
RWX), then the shared-page became too. To avoid this case, I separated
it from stack with 4 page.