/* Page table that contains pointers to all page directories. */
u32_t page_directories_phys, *page_directories = NULL;
+PRIVATE char static_sparepages[I386_PAGE_SIZE*SPAREPAGES + I386_PAGE_SIZE];
+
#if SANITYCHECKS
/*===========================================================================*
* pt_sanitycheck *
}
#endif
-/*===========================================================================*
- * aalloc *
- *===========================================================================*/
-PRIVATE void *aalloc(size_t bytes)
-{
-/* Page-aligned malloc(). only used if vm_allocpage can't be used. */
- u32_t b;
-
- b = (u32_t) malloc(I386_PAGE_SIZE + bytes);
- if(!b) panic("aalloc: out of memory: %d", bytes);
- b += I386_PAGE_SIZE - (b % I386_PAGE_SIZE);
-
- return (void *) b;
-}
-
/*===========================================================================*
* findhole *
*===========================================================================*/
struct vm_ep_data ep_data;
vir_bytes sparepages_mem;
phys_bytes sparepages_ph;
+ vir_bytes ptr;
/* Shorthand. */
newpt = &vmprocess->vm_pt;
/* Get ourselves spare pages. */
- if(!(sparepages_mem = (vir_bytes) aalloc(I386_PAGE_SIZE*SPAREPAGES)))
+ ptr = (vir_bytes) static_sparepages;
+ ptr += I386_PAGE_SIZE - (ptr % I386_PAGE_SIZE);
+ if(!(sparepages_mem = ptr))
panic("pt_init: aalloc for spare failed");
if((r=sys_umap(SELF, VM_D, (vir_bytes) sparepages_mem,
I386_PAGE_SIZE*SPAREPAGES, &sparepages_ph)) != OK)
#define _SYSTEM 1
#define _MINIX 1 /* To get the brk() prototype (as _brk()). */
-#define brk _brk /* Our brk() must redefine _brk(). */
#include <minix/callnr.h>
#include <minix/com.h>
return(OK);
}
-/*===========================================================================*
- * _brk *
- *===========================================================================*/
-extern char *_brksize;
-PUBLIC int brk(brk_addr)
-char *brk_addr;
-{
- int r;
- struct vmproc *vmm = &vmproc[VM_PROC_NR];
-
-/* VM wants to call brk() itself. */
- if((r=real_brk(vmm, (vir_bytes) brk_addr)) != OK)
- panic("VM: brk() on myself failed");
- _brksize = brk_addr;
- return 0;
-}
-
/*===========================================================================*
* do_info *
*===========================================================================*/