[webkit-dev] Porting a carbon netscape plugin to universal?

Tim Omernick timo at apple.com
Tue Sep 19 15:25:09 PDT 2006


Hi Rick,

I don't think there is any documentation on universal Netscape plug- 
ins, but there probably should be.

The only tricky part is that on Intel, you need to always pass raw  
function pointers (as opposed to tvectors) between the browser and the  
plug-in.  Many plug-ins include "helper functions" to do the function  
pointer/tvector translation.  These functions could be modified like  
so to work on Intel:

static FunctionPointer functionPointerForTVector(TransitionVector tvp)
{
#ifdef __ppc__
     const uint32 temp[6] = {0x3D800000, 0x618C0000, 0x800C0000,  
0x804C0004, 0x7C0903A6, 0x4E800420};
     uint32 *newGlue = NULL;

     if (tvp != NULL) {
         newGlue = (uint32 *)malloc(sizeof(temp));
         if (newGlue != NULL) {
             unsigned i;
             for (i = 0; i < 6; i++) newGlue[i] = temp[i];
             newGlue[0] |= ((UInt32)tvp >> 16);
             newGlue[1] |= ((UInt32)tvp & 0xFFFF);
             MakeDataExecutable(newGlue, sizeof(temp));
         }
     }

     return (FunctionPointer)newGlue;
#else
     // Just use the function pointer on other architectures
     return (FunctionPointer)tvp;
#endif /* __ppc__ */
}

static TransitionVector tVectorForFunctionPointer(FunctionPointer fp)
{
#ifdef __ppc__
     FunctionPointer *newGlue = NULL;
     if (fp != NULL) {
         newGlue = (FunctionPointer *)malloc(2 * sizeof 
(FunctionPointer));
         if (newGlue != NULL) {
             newGlue[0] = fp;
             newGlue[1] = NULL;
         }
     }
     return (TransitionVector)newGlue;
#else
     // Just use the function pointer on other architectures
     return (TransitionVector)fp;
#endif /* __ppc__ */
}

Hope that helps!

Thanks,
-t

On Sep 19, 2006, at 12:52 PM, Rick Mann wrote:

> Can someone point me at a resource(s) describing how I would port an  
> older, but carbonized, plugin to a universal plugin that works in  
> Safari? Thanks!
>
> -- 
> Rick
>
>
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at opendarwin.org
> http://www.opendarwin.org/mailman/listinfo/webkit-dev




More information about the webkit-dev mailing list