ChangeLog: * dlls/winedos/int21.c * msdos/int21.c * dlls/kernel/kernel32.spec Move memory functions to winedos. nog.
--- dlls/winedos/int21.c.9 2002-11-27 16:45:19.000000000 +0200 +++ dlls/winedos/int21.c 2002-11-27 16:47:02.000000000 +0200 @@ -2066,6 +2066,65 @@ SET_AX(context, 0x0100); /* success return code */ break; + case 0x48: /* ALLOCATE MEMORY */ + TRACE("ALLOCATE MEMORY for %d paragraphs\n", BX_reg(context)); + { + LPVOID *mem; + if(ISV86(context)) { + mem = DOSMEM_GetBlock((DWORD)BX_reg(context) << 4, NULL); + if(mem) + SET_AX(context, DOSMEM_MapLinearToDos(mem) >> 4); + } else { + mem = (LPVOID)GlobalDOSAlloc16(BX_reg(context)<<4); + if(mem) + SET_AX(context, (DWORD)mem & 0xffff); + } + if (!mem) { + SET_CFLAG(context); + SET_AX(context, 0x0008); /* insufficient memory */ + SET_BX(context, DOSMEM_Available() >> 4); + } + } + break; + + case 0x49: /* FREE MEMORY */ + TRACE("FREE MEMORY segment %04lX\n", context->SegEs); + { + BOOL ret; + if(ISV86(context)) + ret= DOSMEM_FreeBlock(DOSMEM_MapDosToLinear(context->SegEs<<4)); else { + ret = !GlobalDOSFree16(context->SegEs); + /* If we don't reset ES_reg, we will fail in the relay code */ + context->SegEs=ret; + } + if(!ret) { + TRACE("FREE MEMORY failed\n"); + SET_CFLAG(context); + SET_AX(context, 0x0009); /* memory block address invalid */ + } + } + break; + + case 0x4a: /* RESIZE MEMORY BLOCK */ + TRACE("RESIZE MEMORY segment %04lX to %d paragraphs\n", context->SegEs, + BX_reg(context)); + if(!ISV86(context)) + FIXME("RESIZE MEMORY probably insufficient implementation. Expect " + "crash soon\n"); + { + LPVOID *mem = DOSMEM_ResizeBlock(DOSMEM_MapDosToLinear( + context->SegEs << 4), + BX_reg(context) << 4, NULL); + if(mem) + SET_AX(context, DOSMEM_MapLinearToDos(mem) >> 4); + else { + SET_CFLAG(context); + SET_AX(context, 0x0008); /* insufficient memory */ + SET_BX(context, DOSMEM_Available() >> 4); /* not quite right */ + } + } + break; + case 0x4b: /* "EXEC" - LOAD AND/OR EXECUTE PROGRAM */ TRACE("EXEC %s\n", (LPCSTR)CTX_SEG_OFF_TO_LIN(context, context->SegDs, context->Edx)); --- msdos/int21.c.9 2002-11-27 16:45:10.000000000 +0200 +++ msdos/int21.c 2002-11-27 16:47:20.000000000 +0200 @@ -223,69 +223,6 @@ bSetDOSExtendedError = (FILE_Dup2( BX_reg(context), CX_reg(context) ) == HFILE_ERROR16); break; - case 0x48: /* ALLOCATE MEMORY */ - TRACE("ALLOCATE MEMORY for %d paragraphs\n", BX_reg(context)); - { - LPVOID *mem; - if (ISV86(context)) - { - mem= DOSMEM_GetBlock((DWORD)BX_reg(context)<<4,NULL); - if (mem) - SET_AX( context, DOSMEM_MapLinearToDos(mem)>>4 ); - } - else - { - mem = (LPVOID)GlobalDOSAlloc16(BX_reg(context)<<4); - if (mem) - SET_AX( context, (DWORD)mem&0xffff ); - } - if (!mem) - { - SET_CFLAG(context); - SET_AX( context, 0x0008 ); /* insufficient memory */ - SET_BX( context, DOSMEM_Available()>>4 ); - } - } - break; - - case 0x49: /* FREE MEMORY */ - TRACE("FREE MEMORY segment %04lX\n", context->SegEs); - { - BOOL ret; - if (ISV86(context)) - ret= DOSMEM_FreeBlock(DOSMEM_MapDosToLinear(context->SegEs<<4)); - else - { - ret = !GlobalDOSFree16(context->SegEs); - /* If we don't reset ES_reg, we will fail in the relay code */ - context->SegEs=ret; - } - if (!ret) - { - TRACE("FREE MEMORY failed\n"); - SET_CFLAG(context); - SET_AX( context, 0x0009 ); /* memory block address invalid */ - } - } - break; - - case 0x4a: /* RESIZE MEMORY BLOCK */ - TRACE("RESIZE MEMORY segment %04lX to %d paragraphs\n", context->SegEs, BX_reg(context)); - if (!ISV86(context)) - FIXME("RESIZE MEMORY probably insufficient implementation. Expect crash soon\n"); - { - LPVOID *mem = DOSMEM_ResizeBlock(DOSMEM_MapDosToLinear(context->SegEs<<4), - BX_reg(context)<<4,NULL); - if (mem) - SET_AX( context, DOSMEM_MapLinearToDos(mem)>>4 ); - else { - SET_CFLAG(context); - SET_AX( context, 0x0008 ); /* insufficient memory */ - SET_BX( context, DOSMEM_Available()>>4 ); /* not quite right */ - } - } - break; - case 0x5e: bSetDOSExtendedError = INT21_networkfunc (context); break; --- dlls/kernel/kernel32.spec.0 2002-11-27 16:55:31.000000000 +0200 +++ dlls/kernel/kernel32.spec 2002-11-27 16:55:43.000000000 +0200 @@ -1054,6 +1054,9 @@ @ cdecl DOSMEM_GetBlock(long ptr) DOSMEM_GetBlock @ cdecl DOSMEM_GetDPMISegments() DOSMEM_GetDPMISegments @ cdecl DOSMEM_Init(long) DOSMEM_Init +@ cdecl DOSMEM_MapDosToLinear(long) DOSMEM_MapDosToLinear +@ cdecl DOSMEM_MapLinearToDos(ptr) DOSMEM_MapLinearToDos +@ cdecl DOSMEM_ResizeBlock(ptr long ptr) DOSMEM_ResizeBlock @ cdecl DRIVE_OpenDevice(long long) DRIVE_OpenDevice @ cdecl LOCAL_Alloc(long long long) LOCAL_Alloc @ cdecl LOCAL_Compact(long long long) LOCAL_Compact