mirror of https://github.com/deadw00d/AROS.git
ManagedMem pools will now grow using pool requirements
mh_First needs to be set as early as possible so that mhe_InitPool can possibly cache this information (as is the case for TLSF). mh_First however cannot have MEMF_SEM_PROTECTED as the semaphore is not yet crated and this will lead to crashes when calling ObtainSemaphore (for example during mhe_InitPool) Set MEMF_SEM_PROTECTED only once semaphore is initialized. For non-ManagedMem nothing changes as pool.Requirements is used to check for MEMF_SEM_PROTECTED This solves the problem when MEMF_31BIT pool started returning 64-bit memory after it has grown.
This commit is contained in:
parent
886dae9d22
commit
9d96346b4f
|
@ -105,7 +105,7 @@
|
|||
D(bug("[CreatePool] Aligned puddle size: %u (0x%08X)\n", puddleSize, puddleSize);)
|
||||
|
||||
/* Allocate the first puddle. It will contain pool header. */
|
||||
firstPuddle = AllocMemHeader(puddleSize, requirements, &tp, SysBase);
|
||||
firstPuddle = AllocMemHeader(puddleSize, requirements & ~MEMF_SEM_PROTECTED, &tp, SysBase);
|
||||
D(bug("[CreatePool] Initial puddle 0x%p\n", firstPuddle);)
|
||||
|
||||
if (firstPuddle)
|
||||
|
@ -144,10 +144,11 @@
|
|||
* Just link the pool structure at the ln_Name - we will need that
|
||||
* for the semaphore
|
||||
*/
|
||||
firstPuddle->mh_Node.ln_Name = (STRPTR)&pool->sem;
|
||||
|
||||
/* Use mh_First to store the pool requirements */
|
||||
firstPuddle->mh_First = (APTR)(IPTR)requirements;
|
||||
if (requirements & MEMF_SEM_PROTECTED)
|
||||
{
|
||||
firstPuddle->mh_Node.ln_Name = (STRPTR)&pool->sem;
|
||||
firstPuddle->mh_First = (APTR)((IPTR)firstPuddle->mh_First | MEMF_SEM_PROTECTED);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -808,7 +808,8 @@ APTR AllocMemHeader(IPTR size, ULONG flags, struct TraceLocation *loc, struct Ex
|
|||
mh->mh_Attributes = orig->mh_Attributes;
|
||||
mh->mh_Upper = (void *)mh + size;
|
||||
mh->mh_Lower = (void *)mh;
|
||||
mh->mh_First = NULL;
|
||||
/* Use mh_First to store the pool requirements */
|
||||
mh->mh_First = (APTR)(IPTR)flags;
|
||||
mh->mh_Free = 0;
|
||||
|
||||
mhe->mhe_Magic = mhe_orig->mhe_Magic;
|
||||
|
|
Loading…
Reference in New Issue