Example #1
0
/*===========================================================================*
 *				pt_sanitycheck		     		     *
 *===========================================================================*/
PUBLIC void pt_sanitycheck(pt_t *pt, char *file, int line)
{
    /* Basic pt sanity check. */
    int i;
    int slot;

    MYASSERT(pt);
    MYASSERT(pt->pt_dir);
    MYASSERT(pt->pt_dir_phys);

    for(slot = 0; slot < ELEMENTS(vmproc); slot++) {
        if(pt == &vmproc[slot].vm_pt)
            break;
    }

    if(slot >= ELEMENTS(vmproc)) {
        vm_panic("pt_sanitycheck: passed pt not in any proc", NO_NUM);
    }

    MYASSERT(usedpages_add(pt->pt_dir_phys, I386_PAGE_SIZE) == OK);

    for(i = proc_pde; i < I386_VM_DIR_ENTRIES; i++) {
        if(pt->pt_pt[i]) {
            if(!(pt->pt_dir[i] & I386_VM_PRESENT)) {
                printf("slot %d: pt->pt_pt[%d] = 0x%lx, but pt_dir entry 0x%lx\n",
                       slot, i, pt->pt_pt[i], pt->pt_dir[i]);
            }
            MYASSERT(pt->pt_dir[i] & I386_VM_PRESENT);
            MYASSERT(usedpages_add(I386_VM_PFA(pt->pt_dir[i]),
                                   I386_PAGE_SIZE) == OK);
        } else {
            MYASSERT(!(pt->pt_dir[i] & I386_VM_PRESENT));
        }
    }
}
Example #2
0
/*===========================================================================*
 *				checklist				     *
 *===========================================================================*/
static int checklist(char *file, int line,
	struct slabheader *s, int l, int bytes)
{
	struct slabdata *n = s->list_head[l];
	int ch = 0;

	while(n) {
		int count = 0, i;
		MYASSERT(n->sdh.magic1 == MAGIC1);
		MYASSERT(n->sdh.magic2 == MAGIC2);
		MYASSERT(n->sdh.list == l);
		MYASSERT(usedpages_add(n->sdh.phys, VM_PAGE_SIZE) == 0);
		if(n->sdh.prev)
			MYASSERT(n->sdh.prev->sdh.next == n);
		else
			MYASSERT(s->list_head[l] == n);
		if(n->sdh.next) MYASSERT(n->sdh.next->sdh.prev == n);
		for(i = 0; i < USEELEMENTS*8; i++)
			if(i >= ITEMSPERPAGE(bytes))
				MYASSERT(!GETBIT(n, i));
			else
				if(GETBIT(n,i))
					count++;
		MYASSERT(count == n->sdh.nused);
		ch += count;
		n = n->sdh.next;
	}

	return ch;
}
Example #3
0
void mem_sanitycheck(char *file, int line)
{
	int i;
	for(i = 0; i < NUMBER_PHYSICAL_PAGES; i++) {
		if(!page_isfree(i)) continue;
		MYASSERT(usedpages_add(i * VM_PAGE_SIZE, VM_PAGE_SIZE) == OK);
	}
}
Example #4
0
/*===========================================================================*
 *				pt_sanitycheck		     		     *
 *===========================================================================*/
void pt_sanitycheck(pt_t *pt, char *file, int line)
{
    /* Basic pt sanity check. */
    int slot;

    MYASSERT(pt);
    MYASSERT(pt->pt_dir);
    MYASSERT(pt->pt_dir_phys);

    for(slot = 0; slot < ELEMENTS(vmproc); slot++) {
        if(pt == &vmproc[slot].vm_pt)
            break;
    }

    if(slot >= ELEMENTS(vmproc)) {
        panic("pt_sanitycheck: passed pt not in any proc");
    }

    MYASSERT(usedpages_add(pt->pt_dir_phys, VM_PAGE_SIZE) == OK);
}
Example #5
0
static int mappedfile_sanitycheck(struct phys_region *pr, const char *file, int line)
{
	MYASSERT(usedpages_add(pr->ph->phys, VM_PAGE_SIZE) == OK);
	return OK;
}