home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 15 / AACD15.ISO / AACD / System / MorphOS / Developer / docs_dev / Problems.txt < prev    next >
Encoding:
Text File  |  2000-07-31  |  5.4 KB  |  165 lines

  1.  
  2. #####################################################################################################
  3. #####################################################################################################
  4. #####################################################################################################
  5.  
  6. o you can`t write .elf binary "dos loadable"
  7.   handlers or filesystems yet. We need to fully rewrite DeviceProc();
  8.   because it calls LoadSeg through bsr...maybe some rom patch could
  9.   fix this easier.
  10.  
  11.  
  12. #####################################################################################################
  13. #####################################################################################################
  14. #####################################################################################################
  15.  
  16. o The PPC fd2inline does NOT generate gcc 68k compatible macros as
  17.   it ignores the A4,A5,D7 problem cases completely.
  18.   So don`t copy over your old 68k inlines into the ppcinline dir.
  19.   Always generate it new...there are enough examples how to do it.
  20.  
  21. #####################################################################################################
  22. #####################################################################################################
  23. #####################################################################################################
  24.  
  25. o MorphOS executable elfs work different than powerup elfs therefore
  26.   we have to seperate both.
  27.   Put that into your programs for now.
  28.  
  29.    /*
  30.     * New PPC AmigaOS startup
  31.     */
  32.    ULONG            __amigappc__=1;
  33.  
  34.  
  35.  
  36. #####################################################################################################
  37. #####################################################################################################
  38. #####################################################################################################
  39.  
  40. o When you port 68k C to GCC PPC you must be *VERY* careful with
  41.   "..." functions because the PPC has a complete different varargs
  42.   ABI than the 68k.
  43.   It shares the varargs elements between registers and the stack.
  44.  
  45.   This means that you can`t address varargs elements as if it were
  46.   a linear stream like "((ULONG*) &Args"
  47.  
  48.   You *MUST* use the varargs macros.
  49.  
  50.   Make also sure that you use the gcc's OWN stdargs.h and *NOT* some
  51.   stdargs from some ixemul/linix includes. It will save you a lot
  52.   headaches.
  53.  
  54.  
  55.  
  56.   An example.
  57.  
  58.   void    kprintf(const char    *FmtString,
  59.                 ...)
  60.   {
  61.     va_list args;
  62.  
  63.     va_start(args,FmtString);
  64.  
  65.     vhprintf((char*) FmtString,
  66.              (void*) 1,
  67.              NULL,
  68.              args);
  69.  
  70.     va_end(args);
  71.   }
  72.  
  73.  
  74.   Now more experienced people will probably wonder how to handle
  75.   AmigaOS`s varargs APIs.
  76.   Expecially the Boopsi interface which is heavily used in datatypes,
  77.   gadgets and mui is a problem here.
  78.  
  79.   fd2inline generally handles such cases for AmigaOS functions
  80.   but there are cases (amiga.lib) and own functions which must
  81.   be done in a different way.
  82.  
  83.   Examples:
  84.  
  85.   Send a Notify Msg...
  86.  
  87.    #define SendOMNotify(MyObject, GInfo, Flags, tags...)            \
  88.    ({                                    \
  89.    ULONG            _tags[] = { tags };                 \
  90.    struct opUpdate        MyopUpdate;                    \
  91.      MyopUpdate.MethodID        =    OM_NOTIFY;            \
  92.      MyopUpdate.opu_AttrList    =(struct TagItem*) _tags;        \
  93.      MyopUpdate.opu_GInfo        =    GInfo;                \
  94.      MyopUpdate.opu_Flags        =    Flags;                \
  95.      DoMethodA((MyObject), (APTR) &MyopUpdate);                \
  96.    })
  97.  
  98.   Or convert a Method() call into a Ptr MethodA call.
  99.  
  100.    #define DoMethod(MyObject, tags...) \
  101.        ({ULONG _tags[] = { tags }; DoMethodA((MyObject), (APTR)_tags);})
  102.  
  103.          !!!!!!!!!!!!! Attention !!!!!!!!!!!!!!!
  104.  
  105.  MUI uses a special recursive tagarray programming style
  106.  which collides with the varargs macros. You need to
  107.  preprocess MUI sources with a special preprocessor we
  108.  provide in <emultools>.
  109.  
  110. .c.o$(TARGET):
  111.     emultools/muicp/pregcc <$*.c > /t/$*.cp
  112.     ppc-amigaos-gcc $(G_CFLAGS) $(G_OPTFLAGS) $(G_DEBUG) $(G_DEFINES) $(G_IPATH) -x c -S -o $*.s /t/$*.cp
  113.     ppc-amigaos-as -o$*.o$(TARGET) $*.s
  114.  
  115.  would do the job in a makefile
  116.  
  117.  
  118.  As you can see...it`s not that difficult.
  119.  You only have to know what to do.
  120.  
  121.  
  122. #####################################################################################################
  123. #####################################################################################################
  124. #####################################################################################################
  125.  
  126. o When a lot of inline os calls are used in a function you compile
  127.   with gcc this may cause hidden stack demands you wouldn`t have
  128.   expected.
  129.  
  130.   Current gcc is very unsmart about the following situation
  131.  
  132.   ({
  133.     struct EmulCaos MyCaos;
  134.     .
  135.     .
  136.     CallOS
  137.   })
  138.  
  139.   ({
  140.     struct EmulCaos MyCaos;
  141.     .
  142.     .
  143.     CallOS
  144.   })
  145.  
  146.   ({
  147.     struct EmulCaos MyCaos;
  148.     .
  149.     .
  150.     CallOS
  151.   })
  152.  
  153.   where it *adds* these EmulCaos structures to the stacksize instead
  154.   of making a union on the stack as the lifetime of these structs is
  155.   limited.
  156.   Let's hope this is fixed in the next gcc release.
  157.  
  158.  
  159. #####################################################################################################
  160. #####################################################################################################
  161. #####################################################################################################
  162.  
  163. o Coldreboot is not 100% safe. It may always work for you but there is
  164.   a potential dead lock as it can`t cause a hw reset.
  165.