#define ALLOCRETURNCHECK \
availbytes(&avail2, &chunks2); \
vm_assert(avail1 - bytes == avail2); \
- vm_assert(chunks1 == chunks2 || chunks1-1 == chunks2); \
- if(verbosealloc) \
- printf("memory: 0x%lx bytes in %d chunks\n", avail2, chunks2);
+ vm_assert(chunks1 == chunks2 || chunks1-1 == chunks2);
#else
#define ALLOCRETURNCHECK
#endif
#if SANITYCHECKS
#define FREERETURNCHECK \
- availbytes(&avail2, &chunks2); \
- vm_assert(avail1 + origsize == avail2); \
- vm_assert(chunks1 == chunks2 || chunks1+1 == chunks2 || chunks1-1 == chunks2); \
- if(verbosealloc) \
- printf("memory: 0x%lx bytes in %d chunks\n", avail2, chunks2);
+ availbytes(&avail2, &chunks2); \
+ vm_assert(avail1 + origsize == avail2); \
+ vm_assert(chunks1 == chunks2 || chunks1+1 == chunks2 || chunks1-1 == chunks2);
#else
#define FREERETURNCHECK
#endif
vmp->vm_offset = vstart;
/* page mapping flags for code */
-#define TEXTFLAGS (PTF_PRESENT | PTF_USER | PTF_WRITE)
+#define TEXTFLAGS (PTF_PRESENT | PTF_USER)
SANITYCHECK(SCL_DETAIL);
if(text_bytes > 0) {
if(!map_page_region(vmp, vstart, 0, text_bytes,
EXTERN long vm_sanitychecklevel;
#endif
-int verbosealloc;
-
#define VMP_SYSTEM _NR_PROCS
/* vm operation mode state and values */
/* Map in text. flags: don't write, supervisor only */
if((r=pt_writemap(pt, KERNEL_TEXT, KERNEL_TEXT, KERNEL_TEXT_LEN,
- I386_VM_PRESENT | I386_VM_USER | I386_VM_WRITE, 0)) != OK)
+ I386_VM_PRESENT, 0)) != OK)
return r;
/* Map in data. flags: read-write, supervisor only */
if((r=pt_writemap(pt, KERNEL_DATA, KERNEL_DATA, KERNEL_DATA_LEN,
- I386_VM_PRESENT | I386_VM_USER | I386_VM_WRITE, 0)) != OK)
+ I386_VM_PRESENT|I386_VM_WRITE, 0)) != OK)
return r;
return OK;
*/
kernel_top_bytes = find_kernel_top();
+ /* Can first kernel pages of code and data be (left) mapped out?
+ * If so, change the SYSTEM process' memory map to reflect this
+ * (future mappings of SYSTEM into other processes will not include
+ * first pages), and free the first pages.
+ */
+ if(vm_paged && sys_vmctl(SELF, VMCTL_NOPAGEZERO, 0) == OK) {
+ struct vmproc *vmp;
+ vmp = &vmproc[VMP_SYSTEM];
+ if(vmp->vm_arch.vm_seg[T].mem_len > 0) {
+#define DIFF CLICKSPERPAGE
+ vmp->vm_arch.vm_seg[T].mem_phys += DIFF;
+ vmp->vm_arch.vm_seg[T].mem_len -= DIFF;
+ }
+ vmp->vm_arch.vm_seg[D].mem_phys += DIFF;
+ vmp->vm_arch.vm_seg[D].mem_len -= DIFF;
+ }
+
/* Give these processes their own page table. */
for (ip = &image[0]; ip < &image[NR_BOOT_PROCS]; ip++) {
int s;
#define ABS2CLICK(a) ((a) >> CLICK_SHIFT)
/* Compile in asserts and custom sanity checks at all? */
-#define SANITYCHECKS 0
+#define SANITYCHECKS 1
#define VMSTATS 1
/* If so, this level: */