Exemplo n.º 1
0
void debugpageptr(UINT32 addr) {

	FILEH	fh;
	char	buf[256];
	UINT32	pde;
	UINT32	pte;
	UINT	i;
	UINT32	a;

	fh = file_create("page.txt");
	SPRINTF(buf, "CR3=%.8x\r\n", CPU_CR3);
	file_write(fh, buf, strlen(buf));
	for (i=0; i<1024; i++) {
		a = CPU_STAT_PDE_BASE + (i * 4);
		pde = cpu_memoryread_d(a);
		SPRINTF(buf, "%.8x=>%.8x [%.8x]\r\n", (i << 22), pde, a);
		file_write(fh, buf, strlen(buf));
	}
	addr >>= 22;
	pde = cpu_memoryread_d(CPU_STAT_PDE_BASE + (addr * 4));
	for (i=0; i<1024; i++) {
		a = (pde & CPU_PDE_BASEADDR_MASK) + (i * 4);
		pte = cpu_memoryread_d(a);
		SPRINTF(buf, "%.8x=>%.8x [%.8x]\r\n", (addr << 22) + (i << 12), pte, a);
		file_write(fh, buf, strlen(buf));
	}
	file_close(fh);
}
Exemplo n.º 2
0
/*
 * additional physical address memory access functions
 */
UINT64 MEMCALL
cpu_memoryread_q(UINT32 paddr)
{
    UINT64 value;

    value = cpu_memoryread_d(paddr);
    value += (UINT64)cpu_memoryread_d(paddr + 4) << 32;

    return value;
}
Exemplo n.º 3
0
UINT32 MEMCALL
cpu_codefetch_d(UINT32 offset)
{
    const int ucrw = CPU_PAGE_READ_CODE | CPU_STAT_USER_MODE;
    descriptor_t *sdp;
    UINT32 addr;

    sdp = &CPU_CS_DESC;
    addr = sdp->u.seg.segbase + offset;

    if (!CPU_STAT_PM)
        return cpu_memoryread_d(addr);

    if (offset <= sdp->u.seg.limit - 3)
        return cpu_lmemoryread_d(addr, ucrw);

    EXCEPTION(GP_EXCEPTION, 0);
    return 0;	/* compiler happy */
}