No malloc() in VM.
This commit is contained in:
parent
6011237232
commit
5c7d64b981
@ -88,6 +88,8 @@ int kernmappings = 0;
|
||||
/* 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 *
|
||||
@ -131,21 +133,6 @@ PUBLIC void pt_sanitycheck(pt_t *pt, char *file, int line)
|
||||
}
|
||||
#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 *
|
||||
*===========================================================================*/
|
||||
@ -727,12 +714,15 @@ PUBLIC void pt_init(phys_bytes usedlimit)
|
||||
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)
|
||||
|
@ -4,7 +4,6 @@
|
||||
#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>
|
||||
@ -151,23 +150,6 @@ vir_bytes *sp; /* put stack pointer here */
|
||||
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 *
|
||||
*===========================================================================*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user