Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
18 user(s) are online (10 user(s) are browsing Forums)

Members: 0
Guests: 18

more...

Support us!

Headlines

 
  Register To Post  

« 1 2 3 (4)
Re: A1222 support in the SDK and problems
Not too shy to talk
Not too shy to talk


See User information
I tried to link it with gcc 11.2 and 10.3, still receive allingnment error.
Next I will try pointers workaround.

@all, thanks for advice

AmigaOS3: Amiga 1200
AmigaOS4: Micro A1-C, AmigaOne XE, Pegasos II, Sam440ep, Sam440ep-flex, AmigaOne X1000
MorphOS: Efika 5200b, Pegasos I, Pegasos II, Powerbook, Mac Mini, iMac, Powermac Quad
Go to top
Re: A1222 support in the SDK and problems
Just can't stay away
Just can't stay away


See User information
@sailor

You could use a method similar to what has been used in m68k-amigaos C code to allocate long word aligned structures like FileInfoBlock from the stack:

static char align_buffer[3*sizeof(double)-1];
double *T1ptr;
double *T2ptr;
#define T1 (*T1ptr)
#define T2 (*T2ptr)

__attribute__((constructor))
static 
void __init_T1T2(void)
{
    
T1ptr = (double *)(((uintptr_t)align_buffer sizeof(double) - 1) & ~(sizeof(double) - 1));
    
T2ptr T1ptr 1;
}


If T1 and T2 were arrays instead of simple double variables you could even make use of C's pointer/array equivalence to get rid of the ugly macros.

Go to top
Re: A1222 support in the SDK and problems
Not too shy to talk
Not too shy to talk


See User information
@salass00
interesting idea - many thanks. For the first time I heard about constructor attribute. Looks nice, on weekend I will test.

Before you post this advice, I had in plan more dirty solution, something like:
double Tarray[3];
double *pT,*pT1;
pT= (double*)((long)(Tarray +1) - (long)(Tarray % 8));
pT1= pT+1;

Thx!


Edited by sailor on 2025/1/24 20:47:35
Edited by sailor on 2025/1/24 20:48:45
Edited by sailor on 2025/1/24 20:53:08
Edited by sailor on 2025/1/24 20:53:41
AmigaOS3: Amiga 1200
AmigaOS4: Micro A1-C, AmigaOne XE, Pegasos II, Sam440ep, Sam440ep-flex, AmigaOne X1000
MorphOS: Efika 5200b, Pegasos I, Pegasos II, Powerbook, Mac Mini, iMac, Powermac Quad
Go to top
Re: A1222 support in the SDK and problems
Not too shy to talk
Not too shy to talk


See User information
@salass00
thanks, it works nice!
For global vars and global arrys too.


Edited by sailor on 2025/1/25 12:58:29
Edited by sailor on 2025/1/25 12:58:47
AmigaOS3: Amiga 1200
AmigaOS4: Micro A1-C, AmigaOne XE, Pegasos II, Sam440ep, Sam440ep-flex, AmigaOne X1000
MorphOS: Efika 5200b, Pegasos I, Pegasos II, Powerbook, Mac Mini, iMac, Powermac Quad
Go to top
Re: A1222 support in the SDK and problems
Not too shy to talk
Not too shy to talk


See User information
@salass00Quote:
salass00 wrote:@sailor

You could use a method similar to what has been used in m68k-amigaos C code to allocate long word aligned structures like FileInfoBlock from the stack:

static char align_buffer[3*sizeof(double)-1];
double *T1ptr;
double *T2ptr;
#define T1 (*T1ptr)
#define T2 (*T2ptr)

__attribute__((constructor))
static 
void __init_T1T2(void)
{
    
T1ptr = (double *)(((uintptr_t)align_buffer sizeof(double) - 1) & ~(sizeof(double) - 1));
    
T2ptr T1ptr 1;
}


If T1 and T2 were arrays instead of simple double variables you could even make use of C's pointer/array equivalence to get rid of the ugly macros.


If I used single dimension array, as you said alignment is easy for array[A]:
static char align_buffer[(A+1)*sizeof(double)-1];
double *array;
__attribute__((constructor))
static 
void __init_array(void)
{
    array = (
double *)(((uintptr_t)align_buffer sizeof(double) - 1) & ~(sizeof(double) - 1));
}


And please, how it will work for multidimensional arrays - like array[A][B][C]? Should I use this?
static char align_buffer[(A*B*C+1)*sizeof(double)-1];
double (*array)[A][B][C];
__attribute__((constructor))
static 
void __init_array(void)
{
    array = (
double *)(((uintptr_t)align_buffer sizeof(double) - 1) & ~(sizeof(double) - 1));
}

and in the rest of code use normally array[a][b][c] ?

AmigaOS3: Amiga 1200
AmigaOS4: Micro A1-C, AmigaOne XE, Pegasos II, Sam440ep, Sam440ep-flex, AmigaOne X1000
MorphOS: Efika 5200b, Pegasos I, Pegasos II, Powerbook, Mac Mini, iMac, Powermac Quad
Go to top

  Register To Post
« 1 2 3 (4)

 




Currently Active Users Viewing This Thread: 2 ( 0 members and 2 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project