Fix VM -Wall warnings and enable -Werror
This commit is contained in:
parent
f7c1307878
commit
0cb22acbda
@ -16,6 +16,9 @@ INSTALLFLAGS+= -S 128k
|
|||||||
|
|
||||||
CPPFLAGS+= -I${.CURDIR} -I${.CURDIR}/arch/${ARCH}
|
CPPFLAGS+= -I${.CURDIR} -I${.CURDIR}/arch/${ARCH}
|
||||||
CPPFLAGS+= -I${MINIXSRCDIR}
|
CPPFLAGS+= -I${MINIXSRCDIR}
|
||||||
|
.if ${CC} == gcc
|
||||||
|
CFLAGS+= -Wall -Werror
|
||||||
|
.endif
|
||||||
|
|
||||||
.include "arch/${ARCH}/Makefile.inc"
|
.include "arch/${ARCH}/Makefile.inc"
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
|
@ -57,8 +57,6 @@ struct hole {
|
|||||||
int holelist;
|
int holelist;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int startpages;
|
|
||||||
|
|
||||||
|
|
||||||
#define _NR_HOLES (_NR_PROCS*2) /* No. of memory holes maintained by VM */
|
#define _NR_HOLES (_NR_PROCS*2) /* No. of memory holes maintained by VM */
|
||||||
|
|
||||||
@ -169,9 +167,7 @@ PUBLIC phys_clicks alloc_mem(phys_clicks clicks, u32_t memflags)
|
|||||||
* always on a click boundary. This procedure is called when memory is
|
* always on a click boundary. This procedure is called when memory is
|
||||||
* needed for FORK or EXEC.
|
* needed for FORK or EXEC.
|
||||||
*/
|
*/
|
||||||
register struct hole *hp, *prev_ptr;
|
phys_clicks mem = NO_MEM, align_clicks = 0;
|
||||||
phys_clicks old_base, mem = NO_MEM, align_clicks = 0;
|
|
||||||
int s;
|
|
||||||
|
|
||||||
if(memflags & PAF_ALIGN64K) {
|
if(memflags & PAF_ALIGN64K) {
|
||||||
align_clicks = (64 * 1024) / CLICK_SIZE;
|
align_clicks = (64 * 1024) / CLICK_SIZE;
|
||||||
@ -332,7 +328,6 @@ struct memory *chunks; /* list of free memory chunks */
|
|||||||
*/
|
*/
|
||||||
int i, first = 0;
|
int i, first = 0;
|
||||||
register struct hole *hp;
|
register struct hole *hp;
|
||||||
int nodes, largest;
|
|
||||||
|
|
||||||
/* Put all holes on the free list. */
|
/* Put all holes on the free list. */
|
||||||
for (hp = &hole[0]; hp < &hole[_NR_HOLES]; hp++) {
|
for (hp = &hole[0]; hp < &hole[_NR_HOLES]; hp++) {
|
||||||
@ -383,7 +378,7 @@ PRIVATE void sanitycheck(void)
|
|||||||
|
|
||||||
PUBLIC void memstats(int *nodes, int *pages, int *largest)
|
PUBLIC void memstats(int *nodes, int *pages, int *largest)
|
||||||
{
|
{
|
||||||
pagerange_t *p, *prevp = NULL;
|
pagerange_t *p;
|
||||||
addr_iter iter;
|
addr_iter iter;
|
||||||
addr_start_iter_least(&addravl, &iter);
|
addr_start_iter_least(&addravl, &iter);
|
||||||
*nodes = 0;
|
*nodes = 0;
|
||||||
@ -681,9 +676,8 @@ PUBLIC int do_adddma(message *msg)
|
|||||||
PUBLIC int do_deldma(message *msg)
|
PUBLIC int do_deldma(message *msg)
|
||||||
{
|
{
|
||||||
endpoint_t req_proc_e, target_proc_e;
|
endpoint_t req_proc_e, target_proc_e;
|
||||||
int i, j, proc_n;
|
int i, j;
|
||||||
phys_bytes base, size;
|
phys_bytes base, size;
|
||||||
struct vmproc *vmp;
|
|
||||||
|
|
||||||
req_proc_e= msg->VMDD_REQ;
|
req_proc_e= msg->VMDD_REQ;
|
||||||
target_proc_e= msg->VMDD_EP;
|
target_proc_e= msg->VMDD_EP;
|
||||||
@ -740,10 +734,7 @@ PUBLIC int do_deldma(message *msg)
|
|||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC int do_getdma(message *msg)
|
PUBLIC int do_getdma(message *msg)
|
||||||
{
|
{
|
||||||
endpoint_t target_proc_e;
|
int i;
|
||||||
int i, proc_n;
|
|
||||||
phys_bytes base, size;
|
|
||||||
struct vmproc *vmp;
|
|
||||||
|
|
||||||
/* Find slot to report */
|
/* Find slot to report */
|
||||||
for (i= 0; i<NR_DMA; i++)
|
for (i= 0; i<NR_DMA; i++)
|
||||||
@ -774,10 +765,8 @@ PUBLIC int do_getdma(message *msg)
|
|||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC void release_dma(struct vmproc *vmp)
|
PUBLIC void release_dma(struct vmproc *vmp)
|
||||||
{
|
{
|
||||||
int i, found_one;
|
|
||||||
|
|
||||||
panic("release_dma not done");
|
|
||||||
#if 0
|
#if 0
|
||||||
|
int i, found_one;
|
||||||
|
|
||||||
found_one= FALSE;
|
found_one= FALSE;
|
||||||
for (i= 0; i<NR_DMA; i++)
|
for (i= 0; i<NR_DMA; i++)
|
||||||
@ -796,6 +785,8 @@ PUBLIC void release_dma(struct vmproc *vmp)
|
|||||||
free_mem(base, size);
|
free_mem(base, size);
|
||||||
|
|
||||||
msg->VMRD_FOUND = found_one;
|
msg->VMRD_FOUND = found_one;
|
||||||
|
#else
|
||||||
|
panic("release_dma not done");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -144,7 +144,7 @@ PRIVATE u32_t findhole(pt_t *pt, u32_t vmin, u32_t vmax)
|
|||||||
* between page-aligned BYTE offsets vmin and vmax, to fit
|
* between page-aligned BYTE offsets vmin and vmax, to fit
|
||||||
* a page in. Return byte offset.
|
* a page in. Return byte offset.
|
||||||
*/
|
*/
|
||||||
u32_t freefound = 0, curv;
|
u32_t curv;
|
||||||
int pde = 0, try_restart;
|
int pde = 0, try_restart;
|
||||||
static u32_t lastv = 0;
|
static u32_t lastv = 0;
|
||||||
|
|
||||||
@ -291,7 +291,6 @@ PUBLIC void *vm_allocpage(phys_bytes *phys, int reason)
|
|||||||
assert(level <= 2);
|
assert(level <= 2);
|
||||||
|
|
||||||
if(level > 1 || !(vmprocess->vm_flags & VMF_HASPT) || !meminit_done) {
|
if(level > 1 || !(vmprocess->vm_flags & VMF_HASPT) || !meminit_done) {
|
||||||
int r;
|
|
||||||
void *s;
|
void *s;
|
||||||
s=vm_getsparepage(phys);
|
s=vm_getsparepage(phys);
|
||||||
level--;
|
level--;
|
||||||
@ -536,8 +535,7 @@ PUBLIC int pt_map_in_range(struct vmproc *src_vmp, struct vmproc *dst_vmp,
|
|||||||
* the destination process in the range specified.
|
* the destination process in the range specified.
|
||||||
*/
|
*/
|
||||||
int pde, pte;
|
int pde, pte;
|
||||||
int r;
|
vir_bytes viraddr;
|
||||||
vir_bytes viraddr, mapaddr;
|
|
||||||
pt_t *pt, *dst_pt;
|
pt_t *pt, *dst_pt;
|
||||||
|
|
||||||
pt = &src_vmp->vm_pt;
|
pt = &src_vmp->vm_pt;
|
||||||
@ -652,7 +650,7 @@ PUBLIC int pt_writemap(struct vmproc * vmp,
|
|||||||
{
|
{
|
||||||
/* Write mapping into page table. Allocate a new page table if necessary. */
|
/* Write mapping into page table. Allocate a new page table if necessary. */
|
||||||
/* Page directory and table entries for this virtual address. */
|
/* Page directory and table entries for this virtual address. */
|
||||||
int p, r, pages;
|
int p, pages;
|
||||||
int verify = 0;
|
int verify = 0;
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
|
|
||||||
@ -778,14 +776,13 @@ resume_exit:
|
|||||||
PUBLIC int pt_checkrange(pt_t *pt, vir_bytes v, size_t bytes,
|
PUBLIC int pt_checkrange(pt_t *pt, vir_bytes v, size_t bytes,
|
||||||
int write)
|
int write)
|
||||||
{
|
{
|
||||||
int p, pages, pde;
|
int p, pages;
|
||||||
|
|
||||||
assert(!(bytes % I386_PAGE_SIZE));
|
assert(!(bytes % I386_PAGE_SIZE));
|
||||||
|
|
||||||
pages = bytes / I386_PAGE_SIZE;
|
pages = bytes / I386_PAGE_SIZE;
|
||||||
|
|
||||||
for(p = 0; p < pages; p++) {
|
for(p = 0; p < pages; p++) {
|
||||||
u32_t entry;
|
|
||||||
int pde = I386_VM_PDE(v);
|
int pde = I386_VM_PDE(v);
|
||||||
int pte = I386_VM_PTE(v);
|
int pte = I386_VM_PTE(v);
|
||||||
|
|
||||||
@ -873,7 +870,6 @@ PUBLIC void pt_init(phys_bytes usedlimit)
|
|||||||
u32_t moveup = 0;
|
u32_t moveup = 0;
|
||||||
int global_bit_ok = 0;
|
int global_bit_ok = 0;
|
||||||
int free_pde;
|
int free_pde;
|
||||||
int p;
|
|
||||||
struct vm_ep_data ep_data;
|
struct vm_ep_data ep_data;
|
||||||
vir_bytes sparepages_mem;
|
vir_bytes sparepages_mem;
|
||||||
phys_bytes sparepages_ph;
|
phys_bytes sparepages_ph;
|
||||||
@ -943,9 +939,6 @@ PUBLIC void pt_init(phys_bytes usedlimit)
|
|||||||
|
|
||||||
/* Set up mappings for VM process. */
|
/* Set up mappings for VM process. */
|
||||||
for(v = lo; v < hi; v += I386_PAGE_SIZE) {
|
for(v = lo; v < hi; v += I386_PAGE_SIZE) {
|
||||||
phys_bytes addr;
|
|
||||||
u32_t flags;
|
|
||||||
|
|
||||||
/* We have to write the new position in the PT,
|
/* We have to write the new position in the PT,
|
||||||
* so we can move our segments.
|
* so we can move our segments.
|
||||||
*/
|
*/
|
||||||
@ -1153,7 +1146,7 @@ PUBLIC void pt_init_mem()
|
|||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC int pt_bind(pt_t *pt, struct vmproc *who)
|
PUBLIC int pt_bind(pt_t *pt, struct vmproc *who)
|
||||||
{
|
{
|
||||||
int slot, ispt;
|
int slot;
|
||||||
u32_t phys;
|
u32_t phys;
|
||||||
void *pdes;
|
void *pdes;
|
||||||
|
|
||||||
@ -1213,7 +1206,7 @@ PUBLIC void pt_free(pt_t *pt)
|
|||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC int pt_mapkernel(pt_t *pt)
|
PUBLIC int pt_mapkernel(pt_t *pt)
|
||||||
{
|
{
|
||||||
int r, i;
|
int i;
|
||||||
|
|
||||||
/* Any i386 page table needs to map in the kernel address space. */
|
/* Any i386 page table needs to map in the kernel address space. */
|
||||||
assert(vmproc[VMP_SYSTEM].vm_flags & VMF_INUSE);
|
assert(vmproc[VMP_SYSTEM].vm_flags & VMF_INUSE);
|
||||||
|
@ -50,7 +50,6 @@ PUBLIC char *arch_map2str(struct vmproc *vmp, vir_bytes addr)
|
|||||||
{
|
{
|
||||||
static char bufstr[100];
|
static char bufstr[100];
|
||||||
vir_bytes textstart = CLICK2ABS(vmp->vm_arch.vm_seg[T].mem_phys);
|
vir_bytes textstart = CLICK2ABS(vmp->vm_arch.vm_seg[T].mem_phys);
|
||||||
vir_bytes textend = textstart + CLICK2ABS(vmp->vm_arch.vm_seg[T].mem_len);
|
|
||||||
vir_bytes datastart = CLICK2ABS(vmp->vm_arch.vm_seg[D].mem_phys);
|
vir_bytes datastart = CLICK2ABS(vmp->vm_arch.vm_seg[D].mem_phys);
|
||||||
vir_bytes textsegbase = CLICK2ABS(vmp->vm_arch.vm_seg[T].mem_phys -
|
vir_bytes textsegbase = CLICK2ABS(vmp->vm_arch.vm_seg[T].mem_phys -
|
||||||
vmp->vm_arch.vm_seg[T].mem_vir);
|
vmp->vm_arch.vm_seg[T].mem_vir);
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
** Version: 1.5 Author: Walt Karas
|
** Version: 1.5 Author: Walt Karas
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#undef L__
|
#undef L__
|
||||||
#undef L__EST_LONG_BIT
|
#undef L__EST_LONG_BIT
|
||||||
#undef L__SIZE
|
#undef L__SIZE
|
||||||
@ -14,6 +16,7 @@
|
|||||||
#undef L__MASK_HIGH_BIT
|
#undef L__MASK_HIGH_BIT
|
||||||
#undef L__LONG_BIT
|
#undef L__LONG_BIT
|
||||||
#undef L__BIT_ARR_DEFN
|
#undef L__BIT_ARR_DEFN
|
||||||
|
#undef L__BIT_ARR_CLEAR
|
||||||
#undef L__BIT_ARR_VAL
|
#undef L__BIT_ARR_VAL
|
||||||
#undef L__BIT_ARR_0
|
#undef L__BIT_ARR_0
|
||||||
#undef L__BIT_ARR_1
|
#undef L__BIT_ARR_1
|
||||||
@ -98,6 +101,8 @@
|
|||||||
|
|
||||||
#define L__BIT_ARR_DEFN(NAME) unsigned long NAME[L__BIT_ARR_LONGS];
|
#define L__BIT_ARR_DEFN(NAME) unsigned long NAME[L__BIT_ARR_LONGS];
|
||||||
|
|
||||||
|
#define L__BIT_ARR_CLEAR(NAME) memset(NAME, 0, sizeof(NAME));
|
||||||
|
|
||||||
#define L__BIT_ARR_VAL(BIT_ARR, BIT_NUM) \
|
#define L__BIT_ARR_VAL(BIT_ARR, BIT_NUM) \
|
||||||
((BIT_ARR)[(BIT_NUM) / L__LONG_BIT] & (1L << ((BIT_NUM) % L__LONG_BIT)))
|
((BIT_ARR)[(BIT_NUM) / L__LONG_BIT] & (1L << ((BIT_NUM) % L__LONG_BIT)))
|
||||||
|
|
||||||
@ -114,6 +119,8 @@
|
|||||||
|
|
||||||
#define L__BIT_ARR_DEFN(NAME) unsigned long NAME;
|
#define L__BIT_ARR_DEFN(NAME) unsigned long NAME;
|
||||||
|
|
||||||
|
#define L__BIT_ARR_CLEAR(NAME) NAME = 0;
|
||||||
|
|
||||||
#define L__BIT_ARR_VAL(BIT_ARR, BIT_NUM) ((BIT_ARR) & (1L << (BIT_NUM)))
|
#define L__BIT_ARR_VAL(BIT_ARR, BIT_NUM) ((BIT_ARR) & (1L << (BIT_NUM)))
|
||||||
|
|
||||||
#define L__BIT_ARR_0(BIT_ARR, BIT_NUM) (BIT_ARR) &= ~(1L << (BIT_NUM));
|
#define L__BIT_ARR_0(BIT_ARR, BIT_NUM) (BIT_ARR) &= ~(1L << (BIT_NUM));
|
||||||
@ -340,6 +347,8 @@ L__SC AVL_HANDLE L__(insert)(L__(avl) *L__tree, AVL_HANDLE h)
|
|||||||
AVL_HANDLE hh = L__tree->root;
|
AVL_HANDLE hh = L__tree->root;
|
||||||
AVL_HANDLE parent = AVL_NULL;
|
AVL_HANDLE parent = AVL_NULL;
|
||||||
int cmp;
|
int cmp;
|
||||||
|
|
||||||
|
L__BIT_ARR_CLEAR(branch)
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@ -548,12 +557,14 @@ L__SC AVL_HANDLE L__(remove)(L__(avl) *L__tree, AVL_KEY k)
|
|||||||
AVL_HANDLE parent = AVL_NULL;
|
AVL_HANDLE parent = AVL_NULL;
|
||||||
AVL_HANDLE child;
|
AVL_HANDLE child;
|
||||||
AVL_HANDLE path;
|
AVL_HANDLE path;
|
||||||
int cmp, cmp_shortened_sub_with_path;
|
int cmp, cmp_shortened_sub_with_path = 0;
|
||||||
int reduced_depth;
|
int reduced_depth;
|
||||||
int bf;
|
int bf;
|
||||||
AVL_HANDLE rm;
|
AVL_HANDLE rm;
|
||||||
AVL_HANDLE parent_rm;
|
AVL_HANDLE parent_rm;
|
||||||
|
|
||||||
|
L__BIT_ARR_CLEAR(branch)
|
||||||
|
|
||||||
for ( ; ; )
|
for ( ; ; )
|
||||||
{
|
{
|
||||||
if (h == AVL_NULL)
|
if (h == AVL_NULL)
|
||||||
@ -752,7 +763,7 @@ L__SC AVL_HANDLE L__(subst)(L__(avl) *L__tree, AVL_HANDLE new_node)
|
|||||||
{
|
{
|
||||||
AVL_HANDLE h = L__tree->root;
|
AVL_HANDLE h = L__tree->root;
|
||||||
AVL_HANDLE parent = AVL_NULL;
|
AVL_HANDLE parent = AVL_NULL;
|
||||||
int cmp, last_cmp;
|
int cmp, last_cmp = 0;
|
||||||
|
|
||||||
/* Search for node already in tree with same key. */
|
/* Search for node already in tree with same key. */
|
||||||
for ( ; ; )
|
for ( ; ; )
|
||||||
@ -833,6 +844,9 @@ L__SC int L__(build)(
|
|||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
L__BIT_ARR_CLEAR(branch)
|
||||||
|
L__BIT_ARR_CLEAR(rem)
|
||||||
|
|
||||||
for ( ; ; )
|
for ( ; ; )
|
||||||
{
|
{
|
||||||
while (num_sub > 2)
|
while (num_sub > 2)
|
||||||
@ -1178,6 +1192,7 @@ L__SC void L__(decr_iter)(L__(iter) *iter)
|
|||||||
#undef L__MASK_HIGH_BIT
|
#undef L__MASK_HIGH_BIT
|
||||||
#undef L__LONG_BIT
|
#undef L__LONG_BIT
|
||||||
#undef L__BIT_ARR_DEFN
|
#undef L__BIT_ARR_DEFN
|
||||||
|
#undef L__BIT_ARR_CLEAR
|
||||||
#undef L__BIT_ARR_VAL
|
#undef L__BIT_ARR_VAL
|
||||||
#undef L__BIT_ARR_0
|
#undef L__BIT_ARR_0
|
||||||
#undef L__BIT_ARR_1
|
#undef L__BIT_ARR_1
|
||||||
|
@ -37,8 +37,6 @@ FORWARD _PROTOTYPE( int new_mem, (struct vmproc *vmp,
|
|||||||
vir_bytes stk_bytes, phys_bytes tot_bytes, vir_bytes *stack_top,
|
vir_bytes stk_bytes, phys_bytes tot_bytes, vir_bytes *stack_top,
|
||||||
int is_elf));
|
int is_elf));
|
||||||
|
|
||||||
static int failcount;
|
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* exec_newmem *
|
* exec_newmem *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
@ -150,8 +148,7 @@ PRIVATE int new_mem(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
vir_clicks text_clicks, data_clicks, gap_clicks, stack_clicks, tot_clicks;
|
vir_clicks text_clicks, data_clicks, gap_clicks, stack_clicks, tot_clicks;
|
||||||
phys_bytes bytes, base, bss_offset;
|
int r, hadpt = 0;
|
||||||
int s, r2, r, hadpt = 0;
|
|
||||||
struct vmproc *vmpold = &vmproc[VMP_EXECTMP];
|
struct vmproc *vmpold = &vmproc[VMP_EXECTMP];
|
||||||
int ptok = 1;
|
int ptok = 1;
|
||||||
|
|
||||||
@ -298,7 +295,6 @@ PUBLIC int proc_new(struct vmproc *vmp,
|
|||||||
{
|
{
|
||||||
int s;
|
int s;
|
||||||
vir_bytes hole_bytes;
|
vir_bytes hole_bytes;
|
||||||
int prealloc;
|
|
||||||
struct vir_region *reg;
|
struct vir_region *reg;
|
||||||
phys_bytes map_text_addr, map_data_addr, map_stack_addr;
|
phys_bytes map_text_addr, map_data_addr, map_stack_addr;
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC int do_fork(message *msg)
|
PUBLIC int do_fork(message *msg)
|
||||||
{
|
{
|
||||||
int r, proc, s, childproc, fullvm;
|
int r, proc, childproc, fullvm;
|
||||||
struct vmproc *vmp, *vmc;
|
struct vmproc *vmp, *vmc;
|
||||||
pt_t origpt;
|
pt_t origpt;
|
||||||
vir_bytes msgaddr;
|
vir_bytes msgaddr;
|
||||||
|
@ -75,7 +75,6 @@ PUBLIC int main(void)
|
|||||||
{
|
{
|
||||||
message msg;
|
message msg;
|
||||||
int result, who_e, rcv_sts;
|
int result, who_e, rcv_sts;
|
||||||
sigset_t sigset;
|
|
||||||
int caller_slot;
|
int caller_slot;
|
||||||
struct vmproc *vmp_caller;
|
struct vmproc *vmp_caller;
|
||||||
|
|
||||||
@ -172,7 +171,6 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
|
|||||||
{
|
{
|
||||||
/* Initialize the vm server. */
|
/* Initialize the vm server. */
|
||||||
int s, i;
|
int s, i;
|
||||||
int click, clicksforgotten = 0;
|
|
||||||
struct memory mem_chunks[NR_MEMS];
|
struct memory mem_chunks[NR_MEMS];
|
||||||
struct boot_image image[NR_BOOT_PROCS];
|
struct boot_image image[NR_BOOT_PROCS];
|
||||||
struct boot_image *ip;
|
struct boot_image *ip;
|
||||||
@ -271,7 +269,6 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
|
|||||||
|
|
||||||
/* Give these processes their own page table. */
|
/* Give these processes their own page table. */
|
||||||
for (ip = &image[0]; ip < &image[NR_BOOT_PROCS]; ip++) {
|
for (ip = &image[0]; ip < &image[NR_BOOT_PROCS]; ip++) {
|
||||||
int s;
|
|
||||||
struct vmproc *vmp;
|
struct vmproc *vmp;
|
||||||
vir_bytes old_stacktop, old_stacklen;
|
vir_bytes old_stacktop, old_stacklen;
|
||||||
|
|
||||||
|
@ -52,8 +52,6 @@ PUBLIC int do_mmap(message *m)
|
|||||||
return ENXIO;
|
return ENXIO;
|
||||||
|
|
||||||
if(m->VMM_FD == -1 || (m->VMM_FLAGS & MAP_ANON)) {
|
if(m->VMM_FD == -1 || (m->VMM_FLAGS & MAP_ANON)) {
|
||||||
int s;
|
|
||||||
vir_bytes v;
|
|
||||||
u32_t vrflags = VR_ANON | VR_WRITABLE;
|
u32_t vrflags = VR_ANON | VR_WRITABLE;
|
||||||
size_t len = (vir_bytes) m->VMM_LEN;
|
size_t len = (vir_bytes) m->VMM_LEN;
|
||||||
|
|
||||||
@ -221,7 +219,7 @@ PUBLIC int do_remap(message *m)
|
|||||||
int dn, sn;
|
int dn, sn;
|
||||||
vir_bytes da, sa, startv;
|
vir_bytes da, sa, startv;
|
||||||
size_t size;
|
size_t size;
|
||||||
struct vir_region *vr, *region;
|
struct vir_region *region;
|
||||||
struct vmproc *dvmp, *svmp;
|
struct vmproc *dvmp, *svmp;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ PUBLIC void do_pagefaults(message *m)
|
|||||||
u32_t addr = m->VPF_ADDR;
|
u32_t addr = m->VPF_ADDR;
|
||||||
u32_t err = m->VPF_FLAGS;
|
u32_t err = m->VPF_FLAGS;
|
||||||
struct vmproc *vmp;
|
struct vmproc *vmp;
|
||||||
int r, s;
|
int s;
|
||||||
|
|
||||||
struct vir_region *region;
|
struct vir_region *region;
|
||||||
vir_bytes offset;
|
vir_bytes offset;
|
||||||
@ -76,7 +76,7 @@ PUBLIC void do_pagefaults(message *m)
|
|||||||
ep, arch_map2str(vmp, addr), pf_errstr(err));
|
ep, arch_map2str(vmp, addr), pf_errstr(err));
|
||||||
if((s=sys_kill(vmp->vm_endpoint, SIGSEGV)) != OK)
|
if((s=sys_kill(vmp->vm_endpoint, SIGSEGV)) != OK)
|
||||||
panic("sys_kill failed: %d", s);
|
panic("sys_kill failed: %d", s);
|
||||||
if((s=sys_vmctl(ep, VMCTL_CLEAR_PAGEFAULT, r)) != OK)
|
if((s=sys_vmctl(ep, VMCTL_CLEAR_PAGEFAULT, 0 /*unused*/)) != OK)
|
||||||
panic("do_pagefaults: sys_vmctl failed: %d", ep);
|
panic("do_pagefaults: sys_vmctl failed: %d", ep);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ PUBLIC void do_pagefaults(message *m)
|
|||||||
ep, arch_map2vir(vmp, addr), pf_errstr(err));
|
ep, arch_map2vir(vmp, addr), pf_errstr(err));
|
||||||
if((s=sys_kill(vmp->vm_endpoint, SIGSEGV)) != OK)
|
if((s=sys_kill(vmp->vm_endpoint, SIGSEGV)) != OK)
|
||||||
panic("sys_kill failed: %d", s);
|
panic("sys_kill failed: %d", s);
|
||||||
if((s=sys_vmctl(ep, VMCTL_CLEAR_PAGEFAULT, r)) != OK)
|
if((s=sys_vmctl(ep, VMCTL_CLEAR_PAGEFAULT, 0 /*unused*/)) != OK)
|
||||||
panic("do_pagefaults: sys_vmctl failed: %d", ep);
|
panic("do_pagefaults: sys_vmctl failed: %d", ep);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -106,17 +106,17 @@ PUBLIC void do_pagefaults(message *m)
|
|||||||
offset = addr - region->vaddr;
|
offset = addr - region->vaddr;
|
||||||
|
|
||||||
/* Access is allowed; handle it. */
|
/* Access is allowed; handle it. */
|
||||||
if((r=map_pf(vmp, region, offset, wr)) != OK) {
|
if((map_pf(vmp, region, offset, wr)) != OK) {
|
||||||
printf("VM: pagefault: SIGSEGV %d pagefault not handled\n", ep);
|
printf("VM: pagefault: SIGSEGV %d pagefault not handled\n", ep);
|
||||||
if((s=sys_kill(vmp->vm_endpoint, SIGSEGV)) != OK)
|
if((s=sys_kill(vmp->vm_endpoint, SIGSEGV)) != OK)
|
||||||
panic("sys_kill failed: %d", s);
|
panic("sys_kill failed: %d", s);
|
||||||
if((s=sys_vmctl(ep, VMCTL_CLEAR_PAGEFAULT, r)) != OK)
|
if((s=sys_vmctl(ep, VMCTL_CLEAR_PAGEFAULT, 0 /*unused*/)) != OK)
|
||||||
panic("do_pagefaults: sys_vmctl failed: %d", ep);
|
panic("do_pagefaults: sys_vmctl failed: %d", ep);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pagefault is handled, so now reactivate the process. */
|
/* Pagefault is handled, so now reactivate the process. */
|
||||||
if((s=sys_vmctl(ep, VMCTL_CLEAR_PAGEFAULT, r)) != OK)
|
if((s=sys_vmctl(ep, VMCTL_CLEAR_PAGEFAULT, 0 /*unused*/)) != OK)
|
||||||
panic("do_pagefaults: sys_vmctl failed: %d", ep);
|
panic("do_pagefaults: sys_vmctl failed: %d", ep);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,7 +167,6 @@ int handle_memory(struct vmproc *vmp, vir_bytes mem, vir_bytes len, int wrflag)
|
|||||||
{
|
{
|
||||||
struct vir_region *region;
|
struct vir_region *region;
|
||||||
vir_bytes o;
|
vir_bytes o;
|
||||||
vir_bytes v;
|
|
||||||
|
|
||||||
/* Page-align memory and length. */
|
/* Page-align memory and length. */
|
||||||
o = mem % VM_PAGE_SIZE;
|
o = mem % VM_PAGE_SIZE;
|
||||||
|
@ -39,7 +39,7 @@ static struct query_exit_struct array[NR_PROCS];
|
|||||||
PUBLIC int do_query_exit(message *m)
|
PUBLIC int do_query_exit(message *m)
|
||||||
{
|
{
|
||||||
int i, nr;
|
int i, nr;
|
||||||
endpoint_t ep;
|
endpoint_t ep = NONE;
|
||||||
|
|
||||||
for (i = 0; i < NR_PROCS; i++) {
|
for (i = 0; i < NR_PROCS; i++) {
|
||||||
if (!array[i].avail) {
|
if (!array[i].avail) {
|
||||||
|
@ -405,7 +405,7 @@ PRIVATE vir_bytes region_find_slot_range(struct vmproc *vmp,
|
|||||||
vir_bytes minv, vir_bytes maxv, vir_bytes length)
|
vir_bytes minv, vir_bytes maxv, vir_bytes length)
|
||||||
{
|
{
|
||||||
struct vir_region *firstregion;
|
struct vir_region *firstregion;
|
||||||
vir_bytes startv;
|
vir_bytes startv = 0;
|
||||||
int foundflag = 0;
|
int foundflag = 0;
|
||||||
region_iter iter;
|
region_iter iter;
|
||||||
|
|
||||||
@ -522,7 +522,6 @@ int mapflags;
|
|||||||
{
|
{
|
||||||
struct vir_region *newregion;
|
struct vir_region *newregion;
|
||||||
vir_bytes startv;
|
vir_bytes startv;
|
||||||
struct phys_region *ph;
|
|
||||||
physr_avl *phavl;
|
physr_avl *phavl;
|
||||||
|
|
||||||
assert(!(length % VM_PAGE_SIZE));
|
assert(!(length % VM_PAGE_SIZE));
|
||||||
@ -606,7 +605,6 @@ USE(newregion,
|
|||||||
PUBLIC void pb_unreferenced(struct vir_region *region, struct phys_region *pr)
|
PUBLIC void pb_unreferenced(struct vir_region *region, struct phys_region *pr)
|
||||||
{
|
{
|
||||||
struct phys_block *pb;
|
struct phys_block *pb;
|
||||||
int remap = 0;
|
|
||||||
|
|
||||||
pb = pr->ph;
|
pb = pr->ph;
|
||||||
assert(pb->refcount > 0);
|
assert(pb->refcount > 0);
|
||||||
@ -663,7 +661,7 @@ PRIVATE struct phys_region *reset_physr_iter(struct vir_region *region,
|
|||||||
PRIVATE int map_subfree(struct vmproc *vmp,
|
PRIVATE int map_subfree(struct vmproc *vmp,
|
||||||
struct vir_region *region, vir_bytes len)
|
struct vir_region *region, vir_bytes len)
|
||||||
{
|
{
|
||||||
struct phys_region *pr, *nextpr;
|
struct phys_region *pr;
|
||||||
physr_iter iter;
|
physr_iter iter;
|
||||||
|
|
||||||
|
|
||||||
@ -706,7 +704,6 @@ PRIVATE int map_subfree(struct vmproc *vmp,
|
|||||||
assert(!(sublen % VM_PAGE_SIZE));
|
assert(!(sublen % VM_PAGE_SIZE));
|
||||||
assert(sublen < pr->ph->length);
|
assert(sublen < pr->ph->length);
|
||||||
if(pr->ph->refcount > 1) {
|
if(pr->ph->refcount > 1) {
|
||||||
int r;
|
|
||||||
if(!(pr = map_clone_ph_block(vmp, region,
|
if(!(pr = map_clone_ph_block(vmp, region,
|
||||||
pr, &iter)))
|
pr, &iter)))
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
@ -1189,7 +1186,6 @@ int write;
|
|||||||
|
|
||||||
if((ph = physr_search(region->phys, offset, AVL_LESS_EQUAL)) &&
|
if((ph = physr_search(region->phys, offset, AVL_LESS_EQUAL)) &&
|
||||||
(ph->offset <= offset && offset < ph->offset + ph->ph->length)) {
|
(ph->offset <= offset && offset < ph->offset + ph->ph->length)) {
|
||||||
phys_bytes blockoffset = ph->offset;
|
|
||||||
/* Pagefault in existing block. Do copy-on-write. */
|
/* Pagefault in existing block. Do copy-on-write. */
|
||||||
assert(write);
|
assert(write);
|
||||||
assert(region->flags & VR_WRITABLE);
|
assert(region->flags & VR_WRITABLE);
|
||||||
@ -1277,7 +1273,6 @@ int write;
|
|||||||
if(r2) { \
|
if(r2) { \
|
||||||
end = MIN(end, r2->offset); } \
|
end = MIN(end, r2->offset); } \
|
||||||
if(start < end) { \
|
if(start < end) { \
|
||||||
int r; \
|
|
||||||
SANITYCHECK(SCL_DETAIL); \
|
SANITYCHECK(SCL_DETAIL); \
|
||||||
if(map_new_physblock(vmp, region, start, \
|
if(map_new_physblock(vmp, region, start, \
|
||||||
end-start, MAP_NONE, PAF_CLEAR, 0) != OK) { \
|
end-start, MAP_NONE, PAF_CLEAR, 0) != OK) { \
|
||||||
@ -1675,7 +1670,6 @@ PUBLIC int map_region_extend(struct vmproc *vmp, struct vir_region *vr,
|
|||||||
{
|
{
|
||||||
vir_bytes end;
|
vir_bytes end;
|
||||||
struct vir_region *nextvr;
|
struct vir_region *nextvr;
|
||||||
region_iter v_iter;
|
|
||||||
|
|
||||||
assert(vr);
|
assert(vr);
|
||||||
assert(vr->flags & VR_ANON);
|
assert(vr->flags & VR_ANON);
|
||||||
@ -2187,7 +2181,7 @@ PUBLIC int unmap_memory(endpoint_t sour, endpoint_t dest,
|
|||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE int split_phys(struct phys_region *pr, vir_bytes point)
|
PRIVATE int split_phys(struct phys_region *pr, vir_bytes point)
|
||||||
{
|
{
|
||||||
struct phys_region *newpr, *q, *prev;
|
struct phys_region *newpr, *q, *prev = NULL;
|
||||||
struct phys_block *newpb;
|
struct phys_block *newpb;
|
||||||
struct phys_block *pb = pr->ph;
|
struct phys_block *pb = pr->ph;
|
||||||
/* Split the phys region into 2 parts by @point. */
|
/* Split the phys region into 2 parts by @point. */
|
||||||
@ -2224,6 +2218,7 @@ PRIVATE int split_phys(struct phys_region *pr, vir_bytes point)
|
|||||||
prev = newpr;
|
prev = newpr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
assert(prev);
|
||||||
prev->next_ph_list = NULL;
|
prev->next_ph_list = NULL;
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
@ -2299,7 +2294,6 @@ PUBLIC int map_memory(endpoint_t sour, endpoint_t dest,
|
|||||||
*/
|
*/
|
||||||
struct vmproc *vms, *vmd;
|
struct vmproc *vms, *vmd;
|
||||||
struct vir_region *vrs, *vrd;
|
struct vir_region *vrs, *vrd;
|
||||||
physr_iter iterd;
|
|
||||||
vir_bytes offset_s, offset_d;
|
vir_bytes offset_s, offset_d;
|
||||||
int p;
|
int p;
|
||||||
int r;
|
int r;
|
||||||
@ -2416,7 +2410,6 @@ get_clean_phys_region(struct vmproc *vmp, vir_bytes vaddr, vir_bytes length,
|
|||||||
/* If it's mapped more than once, make a copy. */
|
/* If it's mapped more than once, make a copy. */
|
||||||
assert(ph->ph->refcount > 0);
|
assert(ph->ph->refcount > 0);
|
||||||
if(ph->ph->refcount > 1) {
|
if(ph->ph->refcount > 1) {
|
||||||
int r;
|
|
||||||
if(!(ph = map_clone_ph_block(vmp, region,
|
if(!(ph = map_clone_ph_block(vmp, region,
|
||||||
ph, NULL))) {
|
ph, NULL))) {
|
||||||
printf("VM: get_clean_phys_region: ph copy failed\n");
|
printf("VM: get_clean_phys_region: ph copy failed\n");
|
||||||
@ -2485,7 +2478,7 @@ PRIVATE int yieldblock(struct vmproc *vmp, u64_t id,
|
|||||||
vir_bytes vaddr, vir_bytes len, yielded_t **retyb)
|
vir_bytes vaddr, vir_bytes len, yielded_t **retyb)
|
||||||
{
|
{
|
||||||
yielded_t *newyb;
|
yielded_t *newyb;
|
||||||
vir_bytes mem_clicks, newmem, clicks;
|
vir_bytes mem_clicks, clicks;
|
||||||
struct vir_region *region;
|
struct vir_region *region;
|
||||||
struct phys_region *ph;
|
struct phys_region *ph;
|
||||||
yielded_avl *avl;
|
yielded_avl *avl;
|
||||||
@ -2634,7 +2627,7 @@ PUBLIC int do_forgetblock(message *m)
|
|||||||
PUBLIC int do_yieldblockgetblock(message *m)
|
PUBLIC int do_yieldblockgetblock(message *m)
|
||||||
{
|
{
|
||||||
u64_t yieldid, getid;
|
u64_t yieldid, getid;
|
||||||
int n, get = 0;
|
int n;
|
||||||
endpoint_t caller = m->m_source;
|
endpoint_t caller = m->m_source;
|
||||||
struct vmproc *vmp;
|
struct vmproc *vmp;
|
||||||
yielded_t *yb = NULL;
|
yielded_t *yb = NULL;
|
||||||
|
@ -64,7 +64,6 @@ PUBLIC int do_rs_update(message *m_ptr)
|
|||||||
endpoint_t src_e, dst_e, reply_e;
|
endpoint_t src_e, dst_e, reply_e;
|
||||||
int src_p, dst_p;
|
int src_p, dst_p;
|
||||||
struct vmproc *src_vmp, *dst_vmp;
|
struct vmproc *src_vmp, *dst_vmp;
|
||||||
struct vir_region *vr;
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
src_e = m_ptr->VM_RS_SRC_ENDPT;
|
src_e = m_ptr->VM_RS_SRC_ENDPT;
|
||||||
@ -118,7 +117,7 @@ PUBLIC int do_rs_update(message *m_ptr)
|
|||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE int rs_memctl_make_vm_instance(struct vmproc *new_vm_vmp)
|
PRIVATE int rs_memctl_make_vm_instance(struct vmproc *new_vm_vmp)
|
||||||
{
|
{
|
||||||
int vm_p, r;
|
int r;
|
||||||
u32_t flags;
|
u32_t flags;
|
||||||
int verify;
|
int verify;
|
||||||
struct vmproc *this_vm_vmp;
|
struct vmproc *this_vm_vmp;
|
||||||
|
@ -277,7 +277,9 @@ PUBLIC int slabsane_f(char *file, int line, void *mem, int bytes)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if SANITYCHECKS
|
||||||
static int nojunkwarning = 0;
|
static int nojunkwarning = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* void *slaballoc *
|
* void *slaballoc *
|
||||||
@ -332,7 +334,6 @@ PUBLIC void *slaballoc(int bytes)
|
|||||||
i = i % ITEMSPERPAGE(bytes);
|
i = i % ITEMSPERPAGE(bytes);
|
||||||
|
|
||||||
if(!GETBIT(firstused, i)) {
|
if(!GETBIT(firstused, i)) {
|
||||||
struct slabdata *f;
|
|
||||||
char *ret;
|
char *ret;
|
||||||
SETBIT(firstused, i);
|
SETBIT(firstused, i);
|
||||||
SLABSANITYCHECK(SCL_DETAIL);
|
SLABSANITYCHECK(SCL_DETAIL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user