1) How to use the functions of the ppc.library

Only look at Tools/PPCLoad.c

2) How to use gcc to produce code for the ppc.library ElfLoader ?

Look at the Examples/ directory

 o start the compiler to produce a .s
 o start the assembler to produce an .o (Elf format)
 o start the linker to produce a relocatable Elf Binary
 o dumps the contents of the file...probably interesting to
   you.

You can also combine all these steps into gcc calling parameters
but you should read the gcc guides first.

!!!!!!!!!!!!!!!!!!!!!!!!!!!! ATTENTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!                                                                   !
!    -r MUST be used with the linker otherwise it can't load        !
!    the file.                                                      !
!                                                                   !
!    the current ld doesn't show an error if it can't resolve a     !
!    symbol in the "-r" mode !                                      !
!    So be CAREFUL. Use dump to check for unresolved symbols        !
!    which are marked as *UND*                                      !
!                                                                   !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

3) Can i use any OS function in my PPC C Source ?
   Yes but only functions which make sense for a PPC Task.
   For example SwapStack doesn`t make much sense:-)
   Basicly the ppc.library has a Process running that gets
   a Message from the PPC to do something and so the OS
   function is actually called in the context of that Process.
   You also aren`t allowed to start ppc.library functions from
   the PPC os interface.

4) The ppc.library outputs debug code to the serial port in
   certain situations. Please always use "sushi".
   For example when the PPC crashes and it doesn`t crash the
   whole machine you get debug output through the exec debug
   output routines which are captured by sushi.
   

5) Only the ELF Load format is allowed.
   The current ELF PPC API we support is System V4.
   See PowerOpenABI.txt.
   Only important for compiler developers.


6) VERY VERY VERY VERY important.

   The PPC MUST NOT poke/peek into AmigaOS system structures.

   You MUST use the PPCAllocMem/PPCFreeMem routines on the
   Amiga side to allocate Memory which the PowerPC should access.

   Calling AmigaOS functions from the PPC side is expensive, so
   instead of calling xyz times AllocMem you should use the
   Pool routines in the PPCAmiga.lib, which will only ask for new
   memory when there's not enough space or the size is greater than
   the treshsize.

7) This is still a pre pre preliminary developer documentation and
   how the ppc.library will look like in the future also depends on
   your feedback.
   A better documentation is worked on.

!!!!!!!!!!!!!!!!!!!!!!!!!!!! ATTENTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!                                                                   !
! o You MUST be careful with alignment of Bytes used in SAS         !
!   and on the PPC. The GCC does a long alignment for a long        !
!   instead of a word alignment                                     !
!   Example:                                                        !
!                                                                   !
!     SAS            GCC                                            !
!   0  ln_Succ   0 ln_Succ                                          !
!   4  ln_Pred   4 ln_Pred                                          !
!   8  ln_Type   8 ln_Type                                          !
!   9  ln_Pri    9 ln_Pri                                           !
!   10 ln_Name   12 ln_Name                                         !
!   the ln_Name Entry because before that there ln_Pri/ln_Type      !
!   Bytes.                                                          !
!                                                                   !
!   This is a serious problem. And we plan to fix this with         !
!   a GCC enhancement                                               !
!                                                                   !
! o You MUST be careful with alignment of DOUBLE floats used in SAS !
!   and on the PPC. The PPC needs an alignment of LONG for DOUBLE.  !
!   SAS only aligns on word border so it`s your business to add     !
!   pad words if necessary.                                         !
!                                                                   !
!!!!!!!!!!!!!!!!!!!!!!!!!!!! ATTENTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
