Example #1
0
/*
 * Return address of the stub function is passed into eip
 */
static void m_munprotect(unsigned int addr, unsigned int len, unsigned char *eip)
{
	if (debug_level('e')>3) e_printf("\tM_MUNPROT %08x:%p [%08x]\n",
		addr,eip,*((int *)(eip-3)));
	/* if only data in aliased low memory is hit, nothing to do */
	if (LINEAR2UNIX(addr) != MEM_BASE32(addr) && !e_querymark(addr, len))
		return;
	/* Always unprotect and clear all code in the pages
	 * for either DPMI data or code.
	 * Maybe the stub was set up before that code was parsed.
	 * Clear that code */
	if (debug_level('e')>1 && e_querymark(addr, len))
	    e_printf("CODE %08x hit in DATA %p patch\n",addr,eip);
/*	if (UnCpatch((void *)(eip-3))) leavedos_main(0); */
	InvalidateNodePage(addr,len,eip,NULL);
	e_resetpagemarks(addr,len);
	e_munprotect(addr,len);
}
Example #2
0
static void r_munprotect(unsigned int addr, unsigned int len, unsigned char *eip)
{
	if (EFLAGS & EFLAGS_DF) addr -= len;
	if (debug_level('e')>3)
	    dbug_printf("\tR_MUNPROT %08x:%08x %s\n",
		addr,addr+len,(EFLAGS&EFLAGS_DF?"back":"fwd"));
	if (LINEAR2UNIX(addr) != MEM_BASE32(addr) && !e_querymark(addr, len))
		return;
	InvalidateNodePage(addr,len,eip,NULL);
	e_resetpagemarks(addr,len);
	e_munprotect(addr,len);
}
Example #3
0
/*
 * Return address of the stub function is passed into eip
 */
static int m_munprotect(unsigned int addr, unsigned int len, unsigned char *eip)
{
	if (debug_level('e')>3) e_printf("\tM_MUNPROT %08x:%p [%08x]\n",
		addr,eip,*((int *)(eip-3)));
	/* verify that data, not code, has been hit */
	if (!e_querymark(addr, len))
	    return e_check_munprotect(addr, len);
	/* Oops.. we hit code, maybe the stub was set up before that
	 * code was parsed. Ok, undo the patch and clear that code */
	if (debug_level('e')>1)
	    e_printf("CODE %08x hit in DATA %p patch\n",addr,eip);
/*	if (UnCpatch((void *)(eip-3))) leavedos_main(0); */
	InvalidateNodePage(addr,len,eip,NULL);
	return e_check_munprotect(addr, len);
}