1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00

- The memory allocated by malloc() and friends is now of type MEMF_PRIVATE

under OS4 and beyond. The AmigaOS 2.x/3.x compatible code will still
  use MEMF_ANY in the same situation, though. Other uses of MEMF_ANY have
  been replaced as well where MEMF_PRIVATE would have made better sense.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15201 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2008-09-30 14:09:00 +00:00
parent 8a1347e61d
commit 4291a0564f
5 changed files with 52 additions and 9 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: amiga_argarrayinit.c,v 1.6 2006-09-22 09:02:51 obarthel Exp $
* $Id: amiga_argarrayinit.c,v 1.7 2008-09-30 14:09:00 obarthel Exp $
*
* :ts=4
*
@ -52,6 +52,14 @@
/****************************************************************************/
#ifdef __amigaos4__
#define MEMORY_TYPE MEMF_PRIVATE
#else
#define MEMORY_TYPE MEMF_ANY
#endif /* __amigaos4__ */
/****************************************************************************/
const unsigned char ** CXLIB_argarray;
struct DiskObject * CXLIB_disko;
@ -70,7 +78,7 @@ ArgArrayInit(LONG argc, CONST_STRPTR * argv)
if(argc == 1)
goto out; /* skip command name */
CXLIB_argarray = (const unsigned char **)AllocVec(sizeof(char *) * argc,MEMF_ANY|MEMF_CLEAR);
CXLIB_argarray = (const unsigned char **)AllocVec(sizeof(char *) * argc,MEMORY_TYPE|MEMF_CLEAR);
if(CXLIB_argarray == NULL)
goto out;

View File

@ -1,3 +1,8 @@
- The memory allocated by malloc() and friends is now of type MEMF_PRIVATE
under OS4 and beyond. The AmigaOS 2.x/3.x compatible code will still
use MEMF_ANY in the same situation, though. Other uses of MEMF_ANY have
been replaced as well where MEMF_PRIVATE would have made better sense.
- I/O buffers allocated are now aligned according to the CPU cache line size,
if the operating system can supply that detailed information.

View File

@ -1,5 +1,5 @@
/*
* $Id: stdlib_main.c,v 1.33 2006-09-25 14:51:15 obarthel Exp $
* $Id: stdlib_main.c,v 1.34 2008-09-30 14:09:00 obarthel Exp $
*
* :ts=4
*
@ -61,6 +61,16 @@
/****************************************************************************/
/* On OS4 memory of type MEMF_ANY may not be paged out. Where this is desirable
MEMF_PRIVATE should be used instead. */
#ifdef __amigaos4__
#define MEMORY_TYPE MEMF_PRIVATE
#else
#define MEMORY_TYPE MEMF_ANY
#endif /* __amigaos4__ */
/****************************************************************************/
extern int main(int arg_c,char ** arg_v);
/****************************************************************************/
@ -107,7 +117,7 @@ call_main(void)
struct Process * this_process = (struct Process *)FindTask(NULL);
UBYTE * arg_str = GetArgStr();
size_t arg_str_len = strlen(arg_str);
UBYTE * arg_str_copy = AllocVec(arg_str_len+1,MEMF_ANY);
UBYTE * arg_str_copy = AllocVec(arg_str_len+1,MEMF_PRIVATE);
UBYTE current_dir_name[256];
if(arg_str_copy != NULL && NameFromLock(this_process->pr_CurrentDir,current_dir_name,sizeof(current_dir_name)))

View File

@ -1,5 +1,5 @@
/*
* $Id: stdlib_malloc.c,v 1.19 2006-01-08 12:04:25 obarthel Exp $
* $Id: stdlib_malloc.c,v 1.20 2008-09-30 14:09:00 obarthel Exp $
*
* :ts=4
*
@ -143,9 +143,21 @@ __allocate_memory(size_t size,BOOL never_free,const char * UNUSED unused_file,in
#endif /* __MEM_DEBUG */
if(__memory_pool != NULL)
{
mn = AllocPooled(__memory_pool,allocation_size);
}
else
mn = AllocMem(allocation_size,MEMF_ANY);
{
#if defined(__amigaos4__)
{
mn = AllocMem(allocation_size,MEMF_PRIVATE);
}
#else
{
mn = AllocMem(allocation_size,MEMF_ANY);
}
#endif /* __amigaos4__ */
}
if(mn == NULL)
{
@ -401,7 +413,7 @@ STDLIB_CONSTRUCTOR(stdlib_memory_init)
#if defined(__amigaos4__)
{
__memory_pool = CreatePool(MEMF_ANY,(ULONG)__default_pool_size,(ULONG)__default_puddle_size);
__memory_pool = CreatePool(MEMF_PRIVATE,(ULONG)__default_pool_size,(ULONG)__default_puddle_size);
}
#else
{

View File

@ -1,5 +1,5 @@
/*
* $Id: stdlib_program_name.c,v 1.2 2006-01-08 12:04:26 obarthel Exp $
* $Id: stdlib_program_name.c,v 1.3 2008-09-30 14:09:00 obarthel Exp $
*
* :ts=4
*
@ -49,6 +49,14 @@
/****************************************************************************/
#ifdef __amigaos4__
#define MEMORY_TYPE MEMF_PRIVATE
#else
#define MEMORY_TYPE MEMF_ANY
#endif /* __amigaos4__ */
/****************************************************************************/
static BOOL free_program_name;
/****************************************************************************/
@ -83,7 +91,7 @@ STDLIB_CONSTRUCTOR(stdlib_program_name_init)
const size_t program_name_size = 256;
/* Make a copy of the current command name string. */
__program_name = AllocVec((ULONG)program_name_size,MEMF_ANY);
__program_name = AllocVec((ULONG)program_name_size,MEMORY_TYPE);
if(__program_name == NULL)
goto out;