--- np2/i386c/ia32/ia32.c 2005/03/05 16:47:04 1.17 +++ np2/i386c/ia32/ia32.c 2008/01/25 17:49:46 1.20 @@ -1,4 +1,4 @@ -/* $Id: ia32.c,v 1.17 2005/03/05 16:47:04 monaka Exp $ */ +/* $Id: ia32.c,v 1.20 2008/01/25 17:49:46 monaka Exp $ */ /* * Copyright (c) 2002-2003 NONAKA Kimihiro @@ -12,8 +12,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES @@ -31,7 +29,6 @@ #include "cpu.h" #include "ia32.mcr" - I386CORE i386core; UINT8 *reg8_b20[0x100]; @@ -41,7 +38,6 @@ UINT16 *reg16_b53[0x100]; UINT32 *reg32_b20[0x100]; UINT32 *reg32_b53[0x100]; - void ia32_init(void) { @@ -85,18 +81,30 @@ ia32_setextsize(UINT32 size) { if (CPU_EXTMEMSIZE != size) { - if (CPU_EXTMEM) { - _MFREE(CPU_EXTMEM); - CPU_EXTMEM = NULL; + UINT8 *extmem; + extmem = CPU_EXTMEM; + if (extmem != NULL) { + _MFREE(extmem); + extmem = NULL; + } + if (size != 0) { + extmem = (UINT8 *)_MALLOC(size + 16, "EXTMEM"); + } + if (extmem != NULL) { + ZeroMemory(extmem, size + 16); + CPU_EXTMEM = extmem; + CPU_EXTMEMSIZE = size; + CPU_EXTMEMBASE = CPU_EXTMEM - 0x100000; + CPU_EXTLIMIT16 = min(size + 0x100000, 0xf00000); + CPU_EXTLIMIT = size + 0x100000; } - if (size) { - CPU_EXTMEM = (BYTE *)_MALLOC(size + 16, "EXTMEM"); - if (CPU_EXTMEM == NULL) { - size = 0; - } - ZeroMemory(CPU_EXTMEM, size + 16); + else { + CPU_EXTMEM = NULL; + CPU_EXTMEMSIZE = 0; + CPU_EXTMEMBASE = NULL; + CPU_EXTLIMIT16 = 0; + CPU_EXTLIMIT = 0; } - CPU_EXTMEMSIZE = size; } CPU_EMSPTR[0] = mem + 0xc0000; CPU_EMSPTR[1] = mem + 0xc4000; @@ -183,7 +191,6 @@ change_vm(BOOL onoff) } } -#if !defined(IA32_DONT_USE_SET_EFLAGS_FUNCTION) /* * flags */ @@ -227,4 +234,3 @@ set_eflags(UINT32 new_flags, UINT32 mask mask |= AC_FLAG|ID_FLAG; modify_eflags(new_flags, mask); } -#endif /* !IA32_DONT_USE_SET_EFLAGS_FUNCTION */