mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-14 18:15:43 +00:00
a11d7b1a68
Sun Mar 1 10:45:23 1998 Andreas Mohr <100.30936@germany.net> * [loader/ne_image.c] Fixed problem with weird DLLs (NE_FFLAGS_SINGLEDATA && DGROUP = 0). * [msdos/dosmem.c] Export address for __0000H, too. * [msdos/dpmi.c] Changed MemAlloc functions to return less fragmented addresses. Sat Feb 28 18:50:12 1998 Alexandre Julliard <julliard@lrc.epfl.ch> * [scheduler/process.c] [scheduler/sysdeps.c] Don't use %fs register before threading initialization. Sat Feb 28 14:04:56 1998 Kristian Nielsen <kristian.nielsen@risoe.dk> * [configure.in] [include/acconfig.h] Autoconf macro to check for non-reentrant X libraries. * [windows/winpos.c] In SetWindowPos32(), do not cause WM_SIZE messages when the SWP_NOSIZE flag is specified. This fixes the division-by-zero in Borland C++ 4.0 "Open Project" menu item. Sat Feb 28 13:11:26 1998 James Moody <013263m@dragon.acadiau.ca> * [ole/ole2nls.c] Changed "English" values from German to English. * [files/dos_fs.c] Fixed off-by-one month bug. Fri Feb 27 22:12:01 1998 Douglas Ridgway <ridgway@winehq.com> * [windows/win.c] Fix winelib class menu loading bug. * [include/module.h] [loader/module.c] LoadModule32 should be implemented in terms of CreateProcess. * [programs/view/*] Metafile viewer sample program. * [documentation/wine.texinfo] [documentation/Makefile.in] Improvements and additions, HTML target. Fri Feb 27 04:27:48 1998 Dimitrie O. Paun <dimi@cs.toronto.edu> * [*/*] Switched to the new debug messages interface. For more information please refer to documentation/debug-msgs. Because the new scheme introduces a new semantic level, I had to manually do through about 530 dprintf_xxx! The rest of about 2400 where transformed via a script. Because of the large number of changes that I had to do, some may have not come out as nicely as I wanted them. If this is the case, please let me know. There is a lot of work left to do: -- a few hundred printf's to be converted -- about 2300 fprintf's to be converted -- about 600 FIXME's to be transformed The problem is that in the above mentioned cases, a lot of manual intervention is required because a lot of the information is missing. There are also a lot of other things to be done to the interface and so forth. I have now ideas for a at least a month worth of full time work :) I will proceed with many changes in the next few releases, so please do not start modifing things because there will be a hell of a lot of conflicts. If you have ideas that you want to integrate or you want to work on different things, please coordinate with me. Thu Feb 26 13:04:29 1998 David Lee Lambert <lamber45@egr.msu.edu> * [ole/ole2nls.c] [include/windows.h] First try at OLE date- and time-formatting functions. Wed Feb 25 11:20:35 1998 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [files/*.c] Changed dos device handling, added 'CON' devicehandling. * [graphics/ddraw.c] Bug fixes, some additions. * [if1632/builtin.c][loader/module.c][library/winestub.c] Small hack so we don't need a dummy BUILTIN_LoadModule in winestub.c. * [ole/*][relay32/ole32.spec][if1632/storage.spec] storage.dll started. winword loads documents (saving doesn't work yet, dunno why). Several ole additions, some cleanups and bugfixes. IMalloc16 implemented. * [loader/pe_image.c] Added some comments, fixed circular dll references, fixed modref ordering, fixed tls allocation. * [memory/global.c] Added validity checks before every GET_ARENA_PTR. (several functions rely on Global* return values on invalid handles, like IsTask). Implemented GlobalUnlockFree16. * [memory/virtual.c] Replaced dprintf_virtual by fprintf, so we can do 'info map' again in the debugger. Increase read linesize for Linux2.1 cases. * [misc/cpu.c][misc/registry.c] Moved cpu registry initialization to misc/cpu.c. * [multimedia/dsound.c] Enhanced, replaced GETOSPACE bufferingcheck by SETFRAGMENT. * [relay32/crtdll.spec][relay32/ntdll.spec] Replaced some ptr by respective 'str' and 'wstr' arguments for libc functions. * [scheduler/thread.c] Added some sanity checks to stackallocation, tlshandling fixed. * [tools/build.c] Fixed cdecl argumenttype order (was reversed). * [win32/ordinals.c] Implemented KERNEL_449. * [windows/dinput.c] Some fixes, needs much more work. Tomb Raider2 works with keyboard ;) Tue Feb 24 20:46:37 1998 James Juran <jrj120@psu.edu> * [windows/win.c] Fixed USER32 ordinal numbers in documentation. Sat Feb 21 12:30:38 1998 John Richardson <jrichard@zko.dec.com> * [files/file.c] [include/k32obj.h] [memory/virtual.c] [scheduler/critsection.c] [scheduler/event.c] [scheduler/handle.c] [scheduler/k32obj.c] [scheduler/mutex.c] [scheduler/process.c] [scheduler/semaphore.c] [scheduler/thread.c] Added generic k32obj read and write routines for k32objs that support I/O. * [documentation/console] Updated console docs. * [win32/console.c] Make console work like a k32obj that supports I/O. * [include/windows.h] Make WriteFile and ReadFile take HANDLE32 for handle. Sun Feb 15 14:07:07 1998 Dimitrie O. Paun <dimi@mail.cs.toronto.edu> * [controls/menu.c] [misc/ver.c] [multimedia/dsound.c] [multimedia/joystick.c] [windows/dialog.c] Modified some dprintf_xxx's to prepare them for a new dprintf_ scheme. Basically, I changed the dprintf's that outputed a line with many dprintf calls to do just one dprintf call.
182 lines
5.3 KiB
C
182 lines
5.3 KiB
C
/***************************************************************************
|
|
* Copyright 1995, Technion, Israel Institute of Technology
|
|
* Electrical Eng, Software Lab.
|
|
* Author: Michael Veksler.
|
|
***************************************************************************
|
|
* File: shm_fragment.c
|
|
* Purpose: Data fragments and free list items. Allocate and free blocks.
|
|
***************************************************************************
|
|
*/
|
|
#ifdef CONFIG_IPC
|
|
|
|
#include <stdio.h> /* for debugging only */
|
|
#include <debug.h> /* for "stddeb" */
|
|
|
|
#include "shm_fragment.h"
|
|
#include "shm_block.h"
|
|
|
|
/******************************************************************************
|
|
*
|
|
* Free list: all fragments are ordered according to memory location.
|
|
* new fragments are inserted in this way.
|
|
*
|
|
******************************************************************************
|
|
*/
|
|
|
|
#define FRAG_PTR(block,ofs) ((struct shm_fragment *) ((char *) block + ofs) )
|
|
#define NEXT_FRAG(block,ofs) ( FRAG_PTR(block,ofs)->info.next )
|
|
|
|
/* setup first item in the free list */
|
|
void shm_FragmentInit(struct shm_block *block,int first, int size)
|
|
{
|
|
struct shm_fragment *fragment;
|
|
|
|
/* round up to nearest 16 byte boundary */
|
|
first=(first+15)& ~15;
|
|
block->free_list=first;
|
|
|
|
/* make all the block (exluding the header) free */
|
|
fragment= FRAG_PTR(block, first);
|
|
block->free= fragment->size= size-first;
|
|
fragment->info.next=0;
|
|
}
|
|
|
|
void shm_FragPtrFree(struct shm_block *block, void *ptr)
|
|
{
|
|
/* ptr points to fragment->info.data, find pointer to fragment,
|
|
* find the offset of this pointer in block.
|
|
*/
|
|
if (ptr)
|
|
shm_FragmentFree(block, PTR2REL(block, ptr));
|
|
}
|
|
void shm_FragmentFree(struct shm_block *block, int fragment_ofs)
|
|
{
|
|
struct shm_fragment *fragment=NULL;
|
|
int prev;
|
|
int next;
|
|
|
|
fragment_ofs-=(int )&fragment->info.data;
|
|
fragment= FRAG_PTR(block, fragment_ofs);
|
|
|
|
block->free+=fragment->size;
|
|
/* scan free list to find candidates for merging with fragment */
|
|
for (prev=0, next=block->free_list;
|
|
(next!=0) && (fragment_ofs > next) ;
|
|
prev=next, next=NEXT_FRAG(block,next) )
|
|
;
|
|
|
|
/* insert fragment between, prev and next
|
|
* prev==0: fragment will be the first item in free list
|
|
* next==0: fragment will be the last item in free list
|
|
*/
|
|
|
|
|
|
/* update fragment (point to next, or merge with next) */
|
|
|
|
if ( fragment_ofs+fragment->size == next ) {
|
|
/* merge with the next free block */
|
|
fragment->size+= FRAG_PTR(block,next)->size;
|
|
fragment->info.next=FRAG_PTR(block,next)->info.next;
|
|
} else
|
|
/* fragment should be inserted before the next fragment or end of */
|
|
/* list. (not merged) */
|
|
fragment->info.next=next;
|
|
/* now fragment has all the information about the rest of the list */
|
|
|
|
|
|
/* upate prev fragment (point or merge with fragment) */
|
|
|
|
if (prev==0) /* first item in free list */
|
|
block->free_list=fragment_ofs;
|
|
else if ( prev+FRAG_PTR(block,prev)->size == fragment_ofs ) {
|
|
/* merge fragment with previous fragment */
|
|
FRAG_PTR(block,prev)->size+= fragment->size;
|
|
FRAG_PTR(block,prev)->info.next=fragment->info.next;
|
|
} else
|
|
/* insert fragment after previous fragment */
|
|
FRAG_PTR(block,prev)->info.next=fragment_ofs;
|
|
}
|
|
|
|
/* use "first fit" algorithm,
|
|
* return: offset to data in fragment.
|
|
*/
|
|
int shm_FragmentAlloc(struct shm_block *block, int size)
|
|
{
|
|
int prev;
|
|
int candidate;
|
|
struct shm_fragment *fragment;
|
|
struct shm_fragment *ret_fragment;
|
|
|
|
if (size <= 0)
|
|
return NIL;
|
|
/* add size of "fragment->size" */
|
|
size+= (char *)&fragment->info.data - (char *)fragment ;
|
|
|
|
/* round "size" to nearest 16 byte value */
|
|
size= (size+15) & ~15;
|
|
if (size > block->free)
|
|
return NIL;
|
|
/* scan free list to find candidates for allocation */
|
|
for (prev=0, candidate=block->free_list;
|
|
candidate!=0 ;
|
|
prev=candidate, candidate= fragment->info.next )
|
|
{
|
|
fragment=FRAG_PTR(block,candidate);
|
|
if (fragment->size >= size)
|
|
break;
|
|
}
|
|
|
|
if (candidate == 0)
|
|
return NIL;
|
|
|
|
block->free-=size;
|
|
if (fragment->size == size) {
|
|
if (prev == 0)
|
|
block->free_list= fragment->info.next;
|
|
else
|
|
FRAG_PTR(block,prev)->info.next= fragment->info.next;
|
|
return PTR2REL(block, &fragment->info.data);
|
|
}
|
|
|
|
/* fragment->size > size */
|
|
|
|
/* Split fragment in two, return one part, put the other in free list. */
|
|
/* The part that starts at the old location - will stay in the free list. */
|
|
fragment->size -= size;
|
|
|
|
ret_fragment=FRAG_PTR(block, candidate + fragment->size);
|
|
ret_fragment->size= size;
|
|
return PTR2REL(block, ret_fragment->info.data);
|
|
}
|
|
|
|
/* like shm_FragmentAlloc, returns pointer instead of offset */
|
|
char *shm_FragPtrAlloc(struct shm_block *block, int size)
|
|
{
|
|
int ofs;
|
|
ofs= shm_FragmentAlloc(block,size);
|
|
if (ofs == NIL)
|
|
return NULL;
|
|
else
|
|
return (char *) REL2PTR(block, ofs);
|
|
}
|
|
/* This is used for debugging only */
|
|
void shm_print_free_list(struct shm_block *block)
|
|
{
|
|
struct shm_fragment *fragment;
|
|
int item;
|
|
|
|
item=block->free_list;
|
|
if (item==0) {
|
|
fprintf(stddeb,"no free fragments");
|
|
} else {
|
|
for (; item ; item=fragment->info.next) {
|
|
fragment=FRAG_PTR(block,item);
|
|
fprintf(stddeb,"{0x%04x,0x%04x} ",item,fragment->size);
|
|
}
|
|
}
|
|
fprintf(stddeb," [total free=%04x]\n",block->free);
|
|
fflush(stddeb);
|
|
}
|
|
|
|
#endif /* CONFIG_IPC */
|