From 8246c89f3bb27f4aa4e63dbf1677bb9f49d6665e Mon Sep 17 00:00:00 2001 From: "rogerl%netscape.com" Date: Thu, 29 Apr 1999 21:34:25 +0000 Subject: [PATCH] !!! Not a part of SeaMonkey Build !!! new sparc stub code + added missing initialization to invoke_copy git-svn-id: svn://10.0.0.236/trunk@29805 18797224-902f-48f8-a5cc-f745e15eee43 --- .../src/md/unix/xptcinvoke_sparc_solaris.cpp | 2 +- .../src/md/unix/xptcstubs_sparc_solaris.cpp | 116 ++++++++++++++++++ .../src/md/unix/xptcstubs_sparc_solaris.s | 39 ++++++ .../src/md/unix/xptcinvoke_sparc_solaris.cpp | 2 +- .../src/md/unix/xptcstubs_sparc_solaris.cpp | 116 ++++++++++++++++++ .../src/md/unix/xptcstubs_sparc_solaris.s | 39 ++++++ 6 files changed, 312 insertions(+), 2 deletions(-) create mode 100644 mozilla/xpcom/libxpt/xptcall/src/md/unix/xptcstubs_sparc_solaris.cpp create mode 100644 mozilla/xpcom/libxpt/xptcall/src/md/unix/xptcstubs_sparc_solaris.s create mode 100644 mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_sparc_solaris.cpp create mode 100644 mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_sparc_solaris.s diff --git a/mozilla/xpcom/libxpt/xptcall/src/md/unix/xptcinvoke_sparc_solaris.cpp b/mozilla/xpcom/libxpt/xptcall/src/md/unix/xptcinvoke_sparc_solaris.cpp index d46b73e0053..b12be4d0952 100644 --- a/mozilla/xpcom/libxpt/xptcall/src/md/unix/xptcinvoke_sparc_solaris.cpp +++ b/mozilla/xpcom/libxpt/xptcall/src/md/unix/xptcinvoke_sparc_solaris.cpp @@ -82,7 +82,7 @@ invoke_copy_to_stack(PRUint32* d, PRUint32 paramCount, nsXPTCVariant* s) from there since the parameters occupy the same stack space as the stack we're trying to populate. */ - uint32 *l_d; + uint32 *l_d = d; nsXPCVariant *l_s = s; uint32 l_paramCount = paramCount; diff --git a/mozilla/xpcom/libxpt/xptcall/src/md/unix/xptcstubs_sparc_solaris.cpp b/mozilla/xpcom/libxpt/xptcall/src/md/unix/xptcstubs_sparc_solaris.cpp new file mode 100644 index 00000000000..c4a0c378340 --- /dev/null +++ b/mozilla/xpcom/libxpt/xptcall/src/md/unix/xptcstubs_sparc_solaris.cpp @@ -0,0 +1,116 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1999 Netscape Communications Corporation. All Rights + * Reserved. + */ + +/* Implement shared vtbl methods. */ + +#include "xptcprivate.h" + +#ifdef sparc + +static nsresult +PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, uint32* args) +{ +#define PARAM_BUFFER_COUNT 16 + + nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT]; + nsXPTCMiniVariant* dispatchParams = NULL; + nsIInterfaceInfo* iface_info = NULL; + const nsXPTMethodInfo* info; + PRUint8 paramCount; + PRUint8 i; + nsresult result = NS_ERROR_FAILURE; + + NS_ASSERTION(self,"no self"); + + self->GetInterfaceInfo(&iface_info); + NS_ASSERTION(iface_info,"no interface info"); + + iface_info->GetMethodInfo(PRUint16(methodIndex), &info); + NS_ASSERTION(info,"no interface info"); + + paramCount = info->GetParamCount(); + + // setup variant array pointer + if(paramCount > PARAM_BUFFER_COUNT) + dispatchParams = new nsXPTCMiniVariant[paramCount]; + else + dispatchParams = paramBuffer; + NS_ASSERTION(dispatchParams,"no place for params"); + + PRUint32* ap = args; + for(i = 0; i < paramCount; i++, ap++) + { + const nsXPTParamInfo& param = info->GetParam(i); + const nsXPTType& type = param.GetType(); + nsXPTCMiniVariant* dp = &dispatchParams[i]; + + if(param.IsOut() || !type.IsArithmetic()) + { + dp->val.p = (void*) *ap; + continue; + } + // else + switch(type) + { + case nsXPTType::T_I8 : dp->val.i8 = *((PRInt8*) ap); break; + case nsXPTType::T_I16 : dp->val.i16 = *((PRInt16*) ap); break; + case nsXPTType::T_I32 : dp->val.i32 = *((PRInt32*) ap); break; + case nsXPTType::T_I64 : dp->val.i64 = *((PRInt64*) ap); ap++; break; + case nsXPTType::T_U8 : dp->val.u8 = *((PRUint8*) ap); break; + case nsXPTType::T_U16 : dp->val.u16 = *((PRUint16*)ap); break; + case nsXPTType::T_U32 : dp->val.u32 = *((PRUint32*)ap); break; + case nsXPTType::T_U64 : dp->val.u64 = *((PRUint64*)ap); ap++; break; + case nsXPTType::T_FLOAT : dp->val.f = *((float*) ap); break; + case nsXPTType::T_DOUBLE : dp->val.d = *((double*) ap); ap++; break; + case nsXPTType::T_BOOL : dp->val.b = *((PRBool*) ap); break; + case nsXPTType::T_CHAR : dp->val.c = *((char*) ap); break; + case nsXPTType::T_WCHAR : dp->val.wc = *((wchar_t*) ap); break; + default: + NS_ASSERTION(0, "bad type"); + break; + } + } + + result = self->CallMethod((PRUint16)methodIndex, info, dispatchParams); + + NS_RELEASE(iface_info); + + if(dispatchParams != paramBuffer) + delete [] dispatchParams; + + return result; +} + +extern "C" int SharedStub(int); + +#define STUB_ENTRY(n) \ +nsresult nsXPTCStubBase::Stub##n() \ +{ \ + return SharedStub(n); \ +} \ + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" + +#endif diff --git a/mozilla/xpcom/libxpt/xptcall/src/md/unix/xptcstubs_sparc_solaris.s b/mozilla/xpcom/libxpt/xptcall/src/md/unix/xptcstubs_sparc_solaris.s new file mode 100644 index 00000000000..e7d19131068 --- /dev/null +++ b/mozilla/xpcom/libxpt/xptcall/src/md/unix/xptcstubs_sparc_solaris.s @@ -0,0 +1,39 @@ + .global _SharedStub +/* + in the frame for the function that called SharedStub are the + rest of the parameters we need + +*/ + +_SharedStub: +! we don't create a new frame yet, but work within the frame of the calling +! function to give ourselves the other parameters we want + + mov %o0, %o1 ! shuffle the index up to 2nd place + mov %i0, %o0 ! the original 'this' + add %fp, 72, %o2 ! previous stack top adjusted to the first argument slot (beyond 'this') +! save off the original incoming parameters that arrived in +! registers, the ABI guarantees the space for us to do this + st %i1, [%fp + 72] + st %i2, [%fp + 76] + st %i3, [%fp + 80] + st %i4, [%fp + 84] + st %i5, [%fp + 88] +! now we can build our own stack frame + save %sp,-(64 + 8),%sp ! room for the register window and + ! struct pointer, rounded up to 0 % 8 +! our function now appears to have been called +! as SharedStub(nsISupports* that, PRUint32 index, PRUint32* args) +! so we can just copy these through + + mov %i0, %o0 + mov %i1, %o1 + mov %i2, %o2 + call _PrepareAndDispatch + nop + mov %o0,%i0 ! propogate return value + b .LL1 + nop +.LL1: + ret + restore diff --git a/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_sparc_solaris.cpp b/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_sparc_solaris.cpp index d46b73e0053..b12be4d0952 100644 --- a/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_sparc_solaris.cpp +++ b/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_sparc_solaris.cpp @@ -82,7 +82,7 @@ invoke_copy_to_stack(PRUint32* d, PRUint32 paramCount, nsXPTCVariant* s) from there since the parameters occupy the same stack space as the stack we're trying to populate. */ - uint32 *l_d; + uint32 *l_d = d; nsXPCVariant *l_s = s; uint32 l_paramCount = paramCount; diff --git a/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_sparc_solaris.cpp b/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_sparc_solaris.cpp new file mode 100644 index 00000000000..c4a0c378340 --- /dev/null +++ b/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_sparc_solaris.cpp @@ -0,0 +1,116 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1999 Netscape Communications Corporation. All Rights + * Reserved. + */ + +/* Implement shared vtbl methods. */ + +#include "xptcprivate.h" + +#ifdef sparc + +static nsresult +PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, uint32* args) +{ +#define PARAM_BUFFER_COUNT 16 + + nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT]; + nsXPTCMiniVariant* dispatchParams = NULL; + nsIInterfaceInfo* iface_info = NULL; + const nsXPTMethodInfo* info; + PRUint8 paramCount; + PRUint8 i; + nsresult result = NS_ERROR_FAILURE; + + NS_ASSERTION(self,"no self"); + + self->GetInterfaceInfo(&iface_info); + NS_ASSERTION(iface_info,"no interface info"); + + iface_info->GetMethodInfo(PRUint16(methodIndex), &info); + NS_ASSERTION(info,"no interface info"); + + paramCount = info->GetParamCount(); + + // setup variant array pointer + if(paramCount > PARAM_BUFFER_COUNT) + dispatchParams = new nsXPTCMiniVariant[paramCount]; + else + dispatchParams = paramBuffer; + NS_ASSERTION(dispatchParams,"no place for params"); + + PRUint32* ap = args; + for(i = 0; i < paramCount; i++, ap++) + { + const nsXPTParamInfo& param = info->GetParam(i); + const nsXPTType& type = param.GetType(); + nsXPTCMiniVariant* dp = &dispatchParams[i]; + + if(param.IsOut() || !type.IsArithmetic()) + { + dp->val.p = (void*) *ap; + continue; + } + // else + switch(type) + { + case nsXPTType::T_I8 : dp->val.i8 = *((PRInt8*) ap); break; + case nsXPTType::T_I16 : dp->val.i16 = *((PRInt16*) ap); break; + case nsXPTType::T_I32 : dp->val.i32 = *((PRInt32*) ap); break; + case nsXPTType::T_I64 : dp->val.i64 = *((PRInt64*) ap); ap++; break; + case nsXPTType::T_U8 : dp->val.u8 = *((PRUint8*) ap); break; + case nsXPTType::T_U16 : dp->val.u16 = *((PRUint16*)ap); break; + case nsXPTType::T_U32 : dp->val.u32 = *((PRUint32*)ap); break; + case nsXPTType::T_U64 : dp->val.u64 = *((PRUint64*)ap); ap++; break; + case nsXPTType::T_FLOAT : dp->val.f = *((float*) ap); break; + case nsXPTType::T_DOUBLE : dp->val.d = *((double*) ap); ap++; break; + case nsXPTType::T_BOOL : dp->val.b = *((PRBool*) ap); break; + case nsXPTType::T_CHAR : dp->val.c = *((char*) ap); break; + case nsXPTType::T_WCHAR : dp->val.wc = *((wchar_t*) ap); break; + default: + NS_ASSERTION(0, "bad type"); + break; + } + } + + result = self->CallMethod((PRUint16)methodIndex, info, dispatchParams); + + NS_RELEASE(iface_info); + + if(dispatchParams != paramBuffer) + delete [] dispatchParams; + + return result; +} + +extern "C" int SharedStub(int); + +#define STUB_ENTRY(n) \ +nsresult nsXPTCStubBase::Stub##n() \ +{ \ + return SharedStub(n); \ +} \ + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" + +#endif diff --git a/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_sparc_solaris.s b/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_sparc_solaris.s new file mode 100644 index 00000000000..e7d19131068 --- /dev/null +++ b/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_sparc_solaris.s @@ -0,0 +1,39 @@ + .global _SharedStub +/* + in the frame for the function that called SharedStub are the + rest of the parameters we need + +*/ + +_SharedStub: +! we don't create a new frame yet, but work within the frame of the calling +! function to give ourselves the other parameters we want + + mov %o0, %o1 ! shuffle the index up to 2nd place + mov %i0, %o0 ! the original 'this' + add %fp, 72, %o2 ! previous stack top adjusted to the first argument slot (beyond 'this') +! save off the original incoming parameters that arrived in +! registers, the ABI guarantees the space for us to do this + st %i1, [%fp + 72] + st %i2, [%fp + 76] + st %i3, [%fp + 80] + st %i4, [%fp + 84] + st %i5, [%fp + 88] +! now we can build our own stack frame + save %sp,-(64 + 8),%sp ! room for the register window and + ! struct pointer, rounded up to 0 % 8 +! our function now appears to have been called +! as SharedStub(nsISupports* that, PRUint32 index, PRUint32* args) +! so we can just copy these through + + mov %i0, %o0 + mov %i1, %o1 + mov %i2, %o2 + call _PrepareAndDispatch + nop + mov %o0,%i0 ! propogate return value + b .LL1 + nop +.LL1: + ret + restore