• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Using OMS from Carbon under OS9
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using OMS from Carbon under OS9


  • Subject: Re: Using OMS from Carbon under OS9
  • From: email@hidden (Stefan Haller)
  • Date: Wed, 30 Oct 2002 11:03:23 +0100
  • Organization: Ableton

Jeff Evans <email@hidden> wrote:

> And I would be interested in seeing this CallUniversalProc glue mentioned
> by Stefan, if that's possible.

Here it is. You need to get a pointer to the CallUniversalProc function
from InterfaceLib at program startup (using GetSharedLibrary and
FindSymbol); this code is omitted here.

What I do here is keep my own stack of return addresses, so that I don't
have to alter the processor stack when forwarding to the real
CallUniversalProc. In practice I don't think that there are any nested
calls to CallUniversalProc, but you never know. A stack size of 100
will be more than enough, in any case.



#if TARGET_API_MAC_CARBON

typedef long
(*TPCallUniversalProc)(UniversalProcPtr, ProcInfoType, ...);

static TPCallUniversalProc
spCallUniversalProc; // must be resolved manually at program startup

extern "C" {

// It's not really "void", but the linker doesn't care, and the
// assembler glue below doesn't either.
EXTERN_API_C(long) CallUniversalProc(void);

};


static void*
spReturnAddresses[100];

static void*
*sStackPtr = spReturnAddresses;

asm DEFINE_API_C(long) CallUniversalProc(void)
{
nofralloc

// *sStackPtr++ = LR;
lwz r12,sStackPtr
addi r0,r12,4
stw r0,sStackPtr
mflr r0
stw r0,0(r12)

// Call the real CallUniversalProc
lwz r12,spCallUniversalProc
lwz r0,0(r12)
stw RTOC,20(SP)
mtctr r0
lwz RTOC,4(r12)
bctrl
lwz RTOC,20(SP)

// LR = *--sStackPtr;
lwz r12,sStackPtr
subi r12,r12,4
stw r12,sStackPtr
lwz r0,0(r12)
mtlr r0

blr
}

#endif


--
Stefan Haller
Ableton
http://www.ableton.com/
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Using OMS from Carbon under OS9 (From: Jeff Evans <email@hidden>)

  • Prev by Date: ANN: Monomaker AU
  • Next by Date: Resetting IOAudioEngine Timing Mechanism?
  • Previous by thread: Re: Using OMS from Carbon under OS9
  • Next by thread: Re: coreaudio-api digest, Vol 2 #344 - 11 msgs
  • Index(es):
    • Date
    • Thread