Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
109 user(s) are online (56 user(s) are browsing Forums)

Members: 0
Guests: 109

more...

Headlines

 
  Register To Post  

« 1 (2) 3 »
Re: WarpOS/PowerOpenABI vs OS4/ System V.4 ABI problems
Just can't stay away
Just can't stay away


See User information
@kas1e

Are you using mixed PPC asm and C code? In that case you may have to use the GCC arguments to use the PowerOpenAPI (WarpOS) instead of the (default) SysV one used by AmigaOS 4.x for the C parts. Or change the asm parts from PowerOpen to SysV.
I'd be very surprised if current AmigaOS 4.x GCC ports still support the PowerOpenAPI used by WarpOS at all, but the old GCC 2.9.x versions did support both APIs.
VBCC probably still supports both APIs as well if you don't want to use an ancient GCC version.

Go to top
Re: H&P PowerAsm
Just can't stay away
Just can't stay away


See User information
@Hedeon
Quote:
wosdb uses WarpOS ppc exception handlers that are not(/cannot be ?) implemented as part of the warpos emulation on OS4. It is low-level kernel stuff.
In my powerpc.library WarpOS emulation it should be implemented, but that was only possible because I had access to both of the ExecNG as well as the WarpOS sources.

Go to top
Re: WarpOS/PowerOpenABI vs OS4/ System V.4 ABI problems
Home away from home
Home away from home


See User information
@joerg
Quote:

Are you using mixed PPC asm and C code?


Yesh, compile C objects via GCC , and assembler ones via vasmppc_mot (as this one have the same syntax almost 1:1 as have PowerASM back in past, on which those assembler parts are based).

Quote:

Or change the asm parts from PowerOpen to SysV.


Yes, that what i do (check plz 2 latest posts from me with my_macros.i for sysv, and question about function whhich while looks ok in terms of sysv , but still crashes by some reassons)

Quote:

VBCC probably still supports both APIs as well if you don't want to use an ancient GCC version.


Nah, i of course don't want any old PowerABI, i even don't want any assembler as it make no sense anymore on any NG machine, but as soures were already written not by me, and i only adapt them to make os4 native version, i had to use them.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: WarpOS/PowerOpenABI vs OS4/ System V.4 ABI problems
Just can't stay away
Just can't stay away


See User information
@kas1e
Quote:
Yes, that what i do (check plz 2 latest posts from me with my_macros.i for sysv, and question about function whhich while looks ok in terms of sysv , but still crashes by some reassons)
Sorry, I don't understand PPC asm at all, I'd have to look up every instruction in a manual.
For example my powerpc.library is nearly 100% C code, with very few __asm__(inline) instructions added, unlike the newer versions which seem to be 100% PPC asm code instead.

Go to top
Re: H&P PowerAsm
Just popping in
Just popping in


See User information
@kas1e

_BlankChunky:
lis 26,_BlankChunky@ha # load the address of the label
addi r26,26,_BlankChunky@l # in r26 (2 steps)


whitout use of mnemonics try these two couple of commands, maybe on your assembler you have to remove the '%' or '%r' registers prefix, under GCC instead I use this.

addis %r26,0,_BlankChunky@ha
addi %r26,%r26,_BlankChunky@l


*************************************

ADDIS - Add Immediate Shifted

Syntax: addis rD,rA,SIMM

This command is used to add a 16-bit immediate value to the upper 16 bits of a 32bit register. It adds a 16-bit signed integer (SIMM) to register rA, then shifts left register rA by 16 bits and then puts the result into the register rD (destination). The lower 16 bits are cleared by this command. So to fill a 32 bit register with an immediate 32-bit value you first have to use addis to fill the upper 16 bits and then addi to fill the lower 16 bits. Otherwise the lower 16 bits would be cleared again by the addis command.

Example: addis 3,3,4

In this example GPR3 and the value 4 are added, then GPR3 is shifted 16 bits to the left and the result is put into GPR3. This will then contain 0x00040000 in hexadecimal. If you then execute an addi 3,3,4 command GPR3 will contain 0x00040004 in hexadecimal.

To move a pointer to an address of a variable or function into a register there are the @ha/@h and @l modifiers available. If you append these to the variable name you get the lower (@l) 16 bit of the absolute 32-bit address of the variable and with @ha you get the higher 16 bit of the absolute 32-bit address.

Example:

addis 3,0,hello@ha
addi 3,0,hello@l
With these two instructions the absolute 32-bit address of the string variable hello is moved into the GPR 3 register.

Instead of addis/addi the mnemonics lis/la are often used.


Edited by flash on 2022/4/11 1:37:20
Go to top
Re: WarpOS/PowerOpenABI vs OS4/ System V.4 ABI problems
Home away from home
Home away from home


See User information
@All
Is anyone know if old WarpOS support "unalignment memory access" ?

What i mean, were these exceptions handled and emulated by WarpOS and by our powerpc.libraries be it old Joerg's one, or new one from Hedeon ?

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: WarpOS/PowerOpenABI vs OS4/ System V.4 ABI problems
Just popping in
Just popping in


See User information
lzwu 0(rx) does not work as you think it does maybe. It should be lzw 0(rx) as lwzu is post-incrementing the rx with the offset; in this case 0 so nothing happens.

And stack is normally restored by lwz r1,0(r1).

This doesn't help you with your crash. I'll have a look at your source.

EDIT: Apparently I replied to an old posting..

Go to top
Re: WarpOS/PowerOpenABI vs OS4/ System V.4 ABI problems
Just popping in
Just popping in


See User information
@kas1e

WOS: yes
ReWarp: yes (revealed a bug in ExecSG actually as Shogo was drawn incorrecly, which was an error in the alignment exception handler for fpu registers)
WOSEmu: I think so.

Why?

Go to top
Re: WarpOS/PowerOpenABI vs OS4/ System V.4 ABI problems
Home away from home
Home away from home


See User information
@Hedeon

Quote:

Why?


Because seems that this code on which i always crashes does not take care about alignment:

_loop2:
    
lhz r11,0(r3)
    
rlwimi r10,r11,0,16,31
    lbz r11
,0(r4)
    
addi r4,r4,maybe get rid of this?
    
rlwimi r10,r11,0,24,31
    lbzx r11
,r9,r10
    stb r11
,0(r3)
    
addi r3,r3,maybe get rid of this?
    
bdnz _loop2


"lhz" reads 16 bits from the first argument passed pointer, which is incremented by 1 with "addi r3,r3,1" at the end of the loop.

While my crash is DSI, and point out that issues is with second argument, i think this unaligment thing can cause this and explain why i crash not from the first call to this function, but from second.

Have maybe any idea how to "align" this part for fast check ?

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: WarpOS/PowerOpenABI vs OS4/ System V.4 ABI problems
Just can't stay away
Just can't stay away


See User information
@kas1e
Quote:
Is anyone know if old WarpOS support "unalignment memory access" ?

What i mean, were these exceptions handled and emulated by WarpOS and by our powerpc.libraries be it old Joerg's one, or new one from Hedeon ?
Of course my powerpc.library includes an alignment exception hander, but I don't remember if it only emulates unaligned float/double accesses, which is required for nearly all WarpOS software using the FPU, or unaligned integer accesses as well.

Go to top
Re: WarpOS/PowerOpenABI vs OS4/ System V.4 ABI problems
Just popping in
Just popping in


See User information
@kas1e

Had a look and it indeed applies only to FPU access. Integers can be accessed any way you like.

Go to top
Re: WarpOS/PowerOpenABI vs OS4/ System V.4 ABI problems
Home away from home
Home away from home


See User information
@kas1e

_loop2:
    
lhz r11,0(r3)                
    
rlwimi r10,r11,0,16,31
    lbz r11
,0(r4)
    
addi r4,r4,

    rlwimi r10
,r11,0,24,31
    lbzx r11
,r9,r10
    stb r11
,0(r3)
    
addi r3,r3,
    bdnz _loop2


you can write this as:
do
{
    
r11 = *((short *) r3);
    
r10 = (r11 << 0) & 0x0000FFFF// rlwimi r10,r11,0,16,31  

// ^^^^ R10 is not used (result is over written), so R11 is also not used...

    
r11 = *((char *) r4);
    
r4=r4+1;
    
r10 = (r11 << 0) & 0x000000FF// rlwimi r10,r11,0,24,31
    
r11 = *((char *) r9+r10); 
    *((
char *) r3) = r11// store r11 in r3
    
r3=r3+1;
}
while (
CTR--); // bdnz _loop2, what is CTR where was it set, crash becouse of this maybe?


R3 is source & destionation pointer,
R4 is source pointer.
R10 is the result of shift and mask, also used as offset.
R9 is a base address to some data, because R10 is result of some calculation.
for "bdnz" to work CTR has to be set some where before the loop.
Make sure R3,R4 and r9 points to something valid.

this two can be removed, not doing anything useful.

lhz r11,0(r3)                
    
rlwimi r10,r11,0,16,31


Edited by LiveForIt on 2022/4/14 9:55:32
Edited by LiveForIt on 2022/4/14 9:56:57
Edited by LiveForIt on 2022/4/14 10:02:50
Edited by LiveForIt on 2022/4/14 10:05:26
Edited by LiveForIt on 2022/4/14 12:25:25
Edited by LiveForIt on 2022/4/14 12:27:34
Edited by LiveForIt on 2022/4/15 0:06:55
Edited by LiveForIt on 2022/4/15 0:09:46
(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: WarpOS/PowerOpenABI vs OS4/ System V.4 ABI problems
Just popping in
Just popping in


See User information
In the first post there's the whole code.
Maybe instead of debug ASM it can be rewritten in C, it's quite short.

Memento audere semper!
Go to top
Re: WarpOS/PowerOpenABI vs OS4/ System V.4 ABI problems
Just can't stay away
Just can't stay away


See User information
@LiveForIt
Quote:
you can write this as:
do
{
    
r11 = *((short *) r3);
    
r10 blackbox(r11) ? //not sure what this does--> rlwimi r10,r11,0,16,31
Check for example rlwimi

Go to top
Re: WarpOS/PowerOpenABI vs OS4/ System V.4 ABI problems
Just can't stay away
Just can't stay away


See User information
@Hedeon
Quote:
Integers can be accessed any way you like.
No. While 16 bit accesses, as in those sources, should work on any PowerPC CPU supported by AmigaOS 4.x, be it e300, e400 or e500 API ones, 32 and 64 bit accesses to odd addresses may not be supported by all of those PowerPC CPUs.
POWER CPUs, like the P6T in the X1000, may have even more strict alignment requirements for integers.


Edited by joerg on 2022/4/14 18:55:43
Edited by joerg on 2022/4/14 18:57:36
Go to top
Re: WarpOS/PowerOpenABI vs OS4/ System V.4 ABI problems
Home away from home
Home away from home


See User information
@joerg

Quote:
POWER CPUs, like the P6T in the X1000, may have even more strict alignment requirements for integers.


I have not noticed an issue with that, but it will slow down the program if you have misalignments.


Edited by LiveForIt on 2022/4/14 23:16:55
(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: WarpOS/PowerOpenABI vs OS4/ System V.4 ABI problems
Just popping in
Just popping in


See User information
Never heard of e400, but indeed, it seems that for example the PPC400 is a bit picky. Still, I think this is not an alignment problem.

Go to top
Re: WarpOS/PowerOpenABI vs OS4/ System V.4 ABI problems
Just can't stay away
Just can't stay away


See User information
@Hedeon
Quote:
it seems that for example the PPC400 is a bit picky.
IIRC the FPU in the 440ep used in the Sam440ep isn't in the CPU core but external to it and crossing a cache line with a FPU access causes an alignment exception, which isn't the case for example on 60x, 750 and 74xy CPUs.
You don't get an alignment exception in your programs because the alignment exception handler in the 440ep HAL of the kernel takes care of it, but of course that's very slow.
It's probably the same for the 460 CPUs.
Quote:
Still, I think this is not an alignment problem.
If it would be an alignment problem he should get an alignment exception instead of a DSI one.

@LiveForIt
Quote:
I have not noticed an issue with that, but it will slow down the program if you have misalignments.
If it's not just a little bit slower it may be because it's emulated by an integer alignment exception handler in the kernel, just like the FPU one for the 440ep.

Go to top
Re: WarpOS/PowerOpenABI vs OS4/ System V.4 ABI problems
Home away from home
Home away from home


See User information
@joerg

But this code snippet does not use any FPU instructions, it only uses integer instructions.

(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: WarpOS/PowerOpenABI vs OS4/ System V.4 ABI problems
Just popping in
Just popping in


See User information
rlwimi r10,r11,0,16,31
rlwimi r10,r11,0,24,31

can be both replaced with
andi r10,r11,0xFFFF
andi r10,r11,0xFF

compiler has generated a complex instruction instead of a much simpler one

About DSI crash it could be a previous mem allocation bug, so pointers r3 and r4 can exceed limits.

Memento audere semper!
Go to top

  Register To Post
« 1 (2) 3 »

 




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




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project