View Single Post
Old 30 December 2013, 17:17   #30
FS-UAE Developer

FrodeSolheim's Avatar
Join Date: Dec 2011
Location: Førde, Norway
Age: 37
Posts: 3,412
Current thoughts:
  • Keep the native interface itself relatively simple, like in this example, and pass up to n parameters in registers. The flags register can be used for future extensions.
  • No magic on the Amiga side, instead rely on optional auto-generated library helper modules (C and/or ASM) for convenience and a degree of parameter checking (when using C).
  • To allow for async calls, values are never returned a registers, but always through pointers passed in registers.
  • Use the uaelib demuxer for now, perhaps not much to gain by having a separate library (and there are more than enough free switch cases).
I think having a simple low-level mechanism and having other convince stuff as optional add-ons is the way to go. This allows you to use the convenience stuff, or go "low-level" if you need the flexibility or extra performance.

The parameter macros used in the example will be a good way to auto-generate proxy/helper modules.

Auto-generated modules can become really nice to use from the Amiga side, especially in C code. But proxy functions will mean one extra level of indirection, and a slight performance hit. While use of such proxy function is completely optional of course, there is one optimization we could do:

If there is a very common c calling convention on the Amiga, where n arguments are passed in n specific registers in order, we could use the same registers (in that order) to pass parameters to the UAE handler. Then C proxy functions (if those are used) would not need to re-order parameters for compilers using that calling convention… (Anyone having any input on this?)

@Toni I also have a question for you. Is writing to pointers resolved by get_real_address always safe (from the native side), provided that the Amiga memory is properly allocated/reserved (and UAE isn't reset in the meantime, etc)? (Is there for example an emulated CPU cache for some CPU models?)

Oh, and I still won't mind a volunteer to write some Amiga-side test cases (The Wanderer?)
FrodeSolheim is offline  
Page generated in 0.05077 seconds with 9 queries