diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 14:19:18 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 14:19:18 +0000 |
commit | 4035b1bfb1e5843a539a8b624d21952b756974d1 (patch) | |
tree | f1e9cd5bf548cbc57ff2fddfb2b4aa9ae95587e2 /src/libs/xpcom18a4/xpcom/reflect/xptcall | |
parent | Initial commit. (diff) | |
download | virtualbox-upstream.tar.xz virtualbox-upstream.zip |
Adding upstream version 6.1.22-dfsg.upstream/6.1.22-dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/libs/xpcom18a4/xpcom/reflect/xptcall')
148 files changed, 23595 insertions, 0 deletions
diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/.cvsignore b/src/libs/xpcom18a4/xpcom/reflect/xptcall/.cvsignore new file mode 100644 index 00000000..a1af50c2 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/.cvsignore @@ -0,0 +1,4 @@ +Makefile +mk.bat +set_env.bat +none.pdb diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/Makefile.in b/src/libs/xpcom18a4/xpcom/reflect/xptcall/Makefile.in new file mode 100644 index 00000000..e3173730 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/Makefile.in @@ -0,0 +1,49 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1998 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = xpcom +DIRS = public src + +include $(topsrcdir)/config/rules.mk + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/README b/src/libs/xpcom18a4/xpcom/reflect/xptcall/README new file mode 100644 index 00000000..0c401fe8 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/README @@ -0,0 +1,6 @@ +see: + +http://www.mozilla.org/scriptable/xptcall-faq.html +and +http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/porting.html + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/porting.html b/src/libs/xpcom18a4/xpcom/reflect/xptcall/porting.html new file mode 100644 index 00000000..b8b204a1 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/porting.html @@ -0,0 +1,212 @@ +<html> +<head> +<title>xptcall Porting Guide</title> +</head> +<body bgcolor = "white"> +<h2><center>xptcall Porting Guide</center></h2> + +<h3>Overview</h3> + +<blockquote> + +<a href="http://www.mozilla.org/scriptable/xptcall-faq.html"> xptcall</a> is a +library that supports both invoking methods on arbitrary xpcom objects and +implementing classes whose objects can impersonate any xpcom interface. It does +this using platform specific assembly language code. This code needs to be +ported to all platforms that want to support xptcall (and thus mozilla). + +</blockquote> + +<h3>The tree</h3> + +<blockquote> +<pre> +<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall">mozilla/xpcom/reflect/xptcall</a> + +--<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/public">public</a> // exported headers + +--<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src">src</a> // core source + | \--<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md">md</a> // platform specific parts + | +--<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/mac">mac</a> // mac ppc + | +--<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/unix">unix</a> // all unix + | \--<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/win32">win32</a> // win32 + | +--<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/test">test</a> // simple tests to get started + \--<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/tests">tests</a> // full tests via api +</pre> + +Porters are free to create subdirectories under the base <code>md</code> +directory for their given platforms and to integrate into the build system as +appropriate for their platform. + +</blockquote> + +<h3>Theory of operation</h3> + +<blockquote> + +There are really two pieces of functionality: <i>invoke</i> and <i>stubs</i>... + +<p> + +The <b><i>invoke</i></b> functionality requires the implementation of the +following on each platform (from <a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/public/xptcall.h#131">xptcall/public/xptcall.h</a>): + +<pre> +XPTC_PUBLIC_API(nsresult) +XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params); +</pre> + +Calling code is expected to supply an array of <code>nsXPTCVariant</code> +structs. These are discriminated unions describing the type and value of each +parameter of the target function. The platform specific code then builds a call +frame and invokes the method indicated by the index <code>methodIndex</code> on +the xpcom interface <code>that</code>. + +<p> + +Here are examples of this implementation for +<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/win32/xptcinvoke.cpp">Win32</a> +and +<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unixish_x86.cpp">Linux x86, NetBSD x86, and FreeBSD</a>. + +Both of these implementations use the basic strategy of: figure out how much +stack space is needed for the params, make the space in a new frame, copy the +params to that space, invoke the method, cleanup and return. C++ is used where +appropriate, Assembly language is used where necessary. Inline assembly language is used here, +but it is equally valid to use separate assembly language source files. Porters +can decide how best to do this for their platforms. + +<p> + +The <b><i>stubs</i></b> functionality is more complex. The goal here is a class +whose vtbl can look like the vtbl of any arbitrary xpcom interface. Objects of +this class can then be built to impersonate any xpcom object. The base interface +for this is (from <a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/public/xptcall.h#109">xptcall/public/xptcall.h</a>): + +<pre> +class nsXPTCStubBase : public nsISupports +{ +public: + // Include generated vtbl stub declarations. + // These are virtual and *also* implemented by this class.. +#include "xptcstubsdecl.inc" + + // The following methods must be provided by inheritor of this class. + + // return a refcounted pointer to the InterfaceInfo for this object + // NOTE: on some platforms this MUST not fail or we crash! + NS_IMETHOD GetInterfaceInfo(nsIInterfaceInfo** info) = 0; + + // call this method and return result + NS_IMETHOD CallMethod(PRUint16 methodIndex, + const nsXPTMethodInfo* info, + nsXPTCMiniVariant* params) = 0; +}; +</pre> + +Code that wishes to make use of this <i>stubs</i> functionality (such as +<a href="http://www.mozilla.org/scriptable/">XPConnect</a>) implement a class +which inherits from <code>nsXPTCStubBase</code> and implements the +<code>GetInterfaceInfo</code> and <code>CallMethod</code> to let the +platform specific code know how to get interface information and how to dispatch methods +once their parameters have been pulled out of the platform specific calling +frame. + +<p> + +Porters of this functionality implement the platform specific code for the +<i>stub</i> methods that fill the vtbl for this class. The idea here is that the +class has a vtbl full of a large number of generic stubs. All instances of this +class share that vtbl and the same stubs. The stubs forward calls to a platform +specific method that uses the interface information supplied by +the overridden <code>GetInterfaceInfo</code> to extract the parameters and build +an array of platform independent <code>nsXPTCMiniVariant</code> structs which +are in turn passed on to the overridden <code>CallMethod</code>. The +platform dependent code is responsible for doing any cleanup and returning. + +<p> + +The stub methods are declared in <a +href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/public/xptcstubsdecl.inc">xptcall/public/xptcstubsdecl.inc</a>. +These are '#included' into the declaration of <code>nsXPTCStubBase</code>. A +similar include file (<a +href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/public/xptcstubsdef.inc">xptcall/public/xptcstubsdef.inc</a>) +is expanded using platform specific macros to define the stub functions. These +'.inc' files are checked into cvs. However, they can be regenerated as necessary +(i.e. to change the number of stubs or to change their specific declaration) +using the Perl script <a +href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/public/genstubs.pl">xptcall/public/genstubs.pl</a>. + +<p> + +Here are examples of this implementation for <a +href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/win32/xptcstubs.cpp">Win32</a> +and <a +href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/unix/xptcstubs_unixish_x86.cpp">Linux x86, NetBSD x86, and FreeBSD</a>. +Both of these examples use inline assembly language. That is just how I +decided to do it. You can do it as you choose. + +<p> + +The Win32 version is somewhat tighter because the __declspec(naked) feature +allows for very small stubs. However, the __stdcall requires the callee to clean +up the stack, so it is imperative that the interface information scheme allow +the code to determine the correct stack pointer fixup for return without fail, +else the process will crash. + +<p> + +I opted to use inline assembler for the gcc Linux x86 port. I ended up with +larger stubs than I would have preferred rather than battle the compiler over +what would happen to the stack before my asm code began running. + +<p> + +I believe that the non-assembly parts of these files can be copied and reused +with minimal (but not zero) platform specific tweaks. Feel free to copy and +paste as necessary. Please remember that safety and reliability are more +important than speed optimizations. This code is primarily used to connect XPCOM +components with JavaScript; function call overhead is a <b>tiny</b> part of the +time involved. + +<p> + +I put together +<a +href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/test">xptcall/src/md/test +</a> as a place to evolve the basic functionality as a port is coming together. +Not all of the functionality is exercised, but it is a place to get started. +<a +href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/tests">xptcall/tests +</a> has an api level test for <code>XPTC_InvokeByIndex</code>, but no tests for +the <i>stubs</i> functionality. Such a test ought to be written, but this has not +yet been done. + +<p> + +A full 'test' at this point requires building the client and running the +XPConnect test called <i>TestXPC</i> in +<a +href="http://lxr.mozilla.org/mozilla/source/js/src/xpconnect/tests">mozilla/js/src/xpconnect/tests +</a>. + +<p> + +Getting these ports done is very important. Please let <a +href="mailto:jband@netscape.com">me</a> know if you are interested in doing one. +I'll answer any questions as I get them. + +<p> + +<a +href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/status.html"> +Porting Status +</a> + +</blockquote> + +<hr> +<b>Author:</b> <a href="mailto:jband@netscape.com">John Bandhauer <jband@netscape.com></a><br> +<b>Last modified:</b> 31 May 1999 + +</body> +</html> diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/public/.cvsignore b/src/libs/xpcom18a4/xpcom/reflect/xptcall/public/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/public/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/public/Makefile.in b/src/libs/xpcom18a4/xpcom/reflect/xptcall/public/Makefile.in new file mode 100644 index 00000000..ac8432af --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/public/Makefile.in @@ -0,0 +1,54 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1998 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = ../../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = xpcom + +EXPORTS = \ + xptcall.h \ + xptcstubsdecl.inc \ + xptcstubsdef.inc \ + $(NULL) + +include $(topsrcdir)/config/rules.mk + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/public/genstubs.pl b/src/libs/xpcom18a4/xpcom/reflect/xptcall/public/genstubs.pl new file mode 100755 index 00000000..b8962930 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/public/genstubs.pl @@ -0,0 +1,78 @@ +#!/usr/local/bin/perl + +# This is used to generate stub entry points. We generate a file to +# be included in the declaraion and a file to be used for expanding macros +# to represent the implementation of the stubs. + +# +# if "$entry_count" is ever changed and the .inc files regenerated then +# the following issues need to be addressed: +# +# 1) Alpha NT has a .def file that lists exports by symbol. It will need +# updating. +# 2) The current Linux ARM code has a limitation of only having 256-3 stubs +# +# more dependencies??? +# + +# 3 entries are already 'used' by the 3 methods of nsISupports. +# 3+247+5=255 This should get us in under the Linux ARM limitation +$entry_count = 247; +$sentinel_count = 5; + +$decl_name = "xptcstubsdecl.inc"; +$def_name = "xptcstubsdef.inc"; + +## +## Write the declarations include file +## + +die "Can't open $decl_name" if !open(OUTFILE, ">$decl_name"); + +print OUTFILE "/* generated file - DO NOT EDIT */\n\n"; +print OUTFILE "/* includes ",$entry_count," stub entries, and ", + $sentinel_count," sentinel entries */\n\n"; +print OUTFILE "/*\n"; +print OUTFILE "* declarations of normal stubs...\n"; +print OUTFILE "* 0 is QueryInterface\n"; +print OUTFILE "* 1 is AddRef\n"; +print OUTFILE "* 2 is Release\n"; +print OUTFILE "*/\n"; +print OUTFILE "#if !defined(__ia64) || (!defined(__hpux) && !defined(__linux__))\n"; +for($i = 0; $i < $entry_count; $i++) { + print OUTFILE "NS_IMETHOD Stub",$i+3,"();\n"; +} +print OUTFILE "#else\n"; +for($i = 0; $i < $entry_count; $i++) { + print OUTFILE "NS_IMETHOD Stub",$i+3,"(PRUint64,\n"; + print OUTFILE " PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);\n"; + +} +print OUTFILE "#endif\n"; + +print OUTFILE "\n/* declarations of sentinel stubs */\n"; + +for($i = 0; $i < $sentinel_count; $i++) { + print OUTFILE "NS_IMETHOD Sentinel",$i,"();\n"; +} +close(OUTFILE); + + +## +## Write the definitions include file. This assumes a macro will be used to +## expand the entries written... +## + +die "Can't open $def_name" if !open(OUTFILE, ">$def_name"); + +print OUTFILE "/* generated file - DO NOT EDIT */\n\n"; +print OUTFILE "/* includes ",$entry_count," stub entries, and ", + $sentinel_count," sentinel entries */\n\n"; + +for($i = 0; $i < $entry_count; $i++) { + print OUTFILE "STUB_ENTRY(",$i+3,")\n"; +} + +for($i = 0; $i < $sentinel_count; $i++) { + print OUTFILE "SENTINEL_ENTRY(",$i,")\n"; +} diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/public/xptcall.h b/src/libs/xpcom18a4/xpcom/reflect/xptcall/public/xptcall.h new file mode 100644 index 00000000..73042ce6 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/public/xptcall.h @@ -0,0 +1,264 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Public declarations for xptcall. */ + +#ifndef xptcall_h___ +#define xptcall_h___ + +#include "prtypes.h" +#include "nscore.h" +#include "nsISupports.h" +#include "xpt_struct.h" +#include "xptinfo.h" +#include "nsIInterfaceInfo.h" + +#ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP +#define XPTC_InvokeByIndex VBoxNsxpXPTC_InvokeByIndex +#endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */ + +/***************************************************************************/ +/* + * The linkage of XPTC API functions differs depending on whether the file is + * used within the XPTC library or not. Any source file within the XPTC + * library should define EXPORT_XPTC_API whereas any client of the library + * should not. + */ +#ifdef EXPORT_XPTC_API +#define XPTC_PUBLIC_API(t) PR_IMPLEMENT(t) +#define XPTC_PUBLIC_DATA(t) PR_IMPLEMENT_DATA(t) +#if defined(_WIN32) +# define XPTC_EXPORT __declspec(dllexport) +#elif defined(XP_OS2) && defined(__declspec) +# define XPTC_EXPORT __declspec(dllexport) +#elif defined(XP_OS2_VACPP) +# define XPTC_EXPORT extern +#else +# ifdef VBOX_HAVE_VISIBILITY_HIDDEN +# define XPTC_EXPORT __attribute__((visibility("default"))) +# else +# define XPTC_EXPORT +# endif +#endif +#else +#if defined(_WIN32) +# define XPTC_PUBLIC_API(t) __declspec(dllimport) t +# define XPTC_PUBLIC_DATA(t) __declspec(dllimport) t +# define XPTC_EXPORT __declspec(dllimport) +#elif defined(XP_OS2) && defined(__declspec) +# define XPTC_PUBLIC_API(t) __declspec(dllimport) t +# define XPTC_PUBLIC_DATA(t) __declspec(dllimport) t +# define XPTC_EXPORT __declspec(dllimport) +#elif defined(XP_OS2_VACPP) +# define XPTC_PUBLIC_API(t) extern t +# define XPTC_PUBLIC_DATA(t) extern t +# define XPTC_EXPORT extern +#else +# define XPTC_PUBLIC_API(t) PR_IMPLEMENT(t) +# define XPTC_PUBLIC_DATA(t) t +# define XPTC_EXPORT +#endif +#endif +#define XPTC_FRIEND_API(t) XPTC_PUBLIC_API(t) +#define XPTC_FRIEND_DATA(t) XPTC_PUBLIC_DATA(t) +/***************************************************************************/ + +struct nsXPTCMiniVariant +{ +// No ctors or dtors so that we can use arrays of these on the stack +// with no penalty. + union + { + PRInt8 i8; + PRInt16 i16; + PRInt32 i32; + PRInt64 i64; + PRUint8 u8; + PRUint16 u16; + PRUint32 u32; + PRUint64 u64; + float f; + double d; + PRBool b; + char c; + PRUnichar wc; + void* p; + } val; +}; + +struct nsXPTCVariant : public nsXPTCMiniVariant +{ +// No ctors or dtors so that we can use arrays of these on the stack +// with no penalty. + + // inherits 'val' here + void* ptr; + nsXPTType type; + PRUint8 flags; + + enum + { + // these are bitflags! + PTR_IS_DATA = 0x1, // ptr points to 'real' data in val + VAL_IS_ALLOCD = 0x2, // val.p holds alloc'd ptr that must be freed + VAL_IS_IFACE = 0x4, // val.p holds interface ptr that must be released + VAL_IS_ARRAY = 0x8, // val.p holds a pointer to an array needing cleanup + VAL_IS_DOMSTR = 0x10, // val.p holds a pointer to domstring needing cleanup + VAL_IS_UTF8STR = 0x20, // val.p holds a pointer to utf8string needing cleanup + VAL_IS_CSTR = 0x40 // val.p holds a pointer to cstring needing cleanup + }; + + void ClearFlags() {flags = 0;} + void SetPtrIsData() {flags |= PTR_IS_DATA;} + void SetValIsAllocated() {flags |= VAL_IS_ALLOCD;} + void SetValIsInterface() {flags |= VAL_IS_IFACE;} + void SetValIsArray() {flags |= VAL_IS_ARRAY;} + void SetValIsDOMString() {flags |= VAL_IS_DOMSTR;} + void SetValIsUTF8String() {flags |= VAL_IS_UTF8STR;} + void SetValIsCString() {flags |= VAL_IS_CSTR;} + + PRBool IsPtrData() const {return 0 != (flags & PTR_IS_DATA);} + PRBool IsValAllocated() const {return 0 != (flags & VAL_IS_ALLOCD);} + PRBool IsValInterface() const {return 0 != (flags & VAL_IS_IFACE);} + PRBool IsValArray() const {return 0 != (flags & VAL_IS_ARRAY);} + PRBool IsValDOMString() const {return 0 != (flags & VAL_IS_DOMSTR);} + PRBool IsValUTF8String() const {return 0 != (flags & VAL_IS_UTF8STR);} + PRBool IsValCString() const {return 0 != (flags & VAL_IS_CSTR);} +#ifdef VBOX + PRBool MustFreeVal() const {return 0 != (flags & ( VAL_IS_ALLOCD + | VAL_IS_IFACE + | VAL_IS_DOMSTR + | VAL_IS_UTF8STR + | VAL_IS_CSTR)); } +#endif + + void Init(const nsXPTCMiniVariant& mv, const nsXPTType& t, PRUint8 f) + { + type = t; + flags = f; + + if(f & PTR_IS_DATA) + { + ptr = mv.val.p; + val.p = nsnull; + } + else + { + ptr = nsnull; + switch(t.TagPart()) { + case nsXPTType::T_I8: val.i8 = mv.val.i8; break; + case nsXPTType::T_I16: val.i16 = mv.val.i16; break; + case nsXPTType::T_I32: val.i32 = mv.val.i32; break; + case nsXPTType::T_I64: val.i64 = mv.val.i64; break; + case nsXPTType::T_U8: val.u8 = mv.val.u8; break; + case nsXPTType::T_U16: val.u16 = mv.val.u16; break; + case nsXPTType::T_U32: val.u32 = mv.val.u32; break; + case nsXPTType::T_U64: val.u64 = mv.val.u64; break; + case nsXPTType::T_FLOAT: val.f = mv.val.f; break; + case nsXPTType::T_DOUBLE: val.d = mv.val.d; break; + case nsXPTType::T_BOOL: val.b = mv.val.b; break; + case nsXPTType::T_CHAR: val.c = mv.val.c; break; + case nsXPTType::T_WCHAR: val.wc = mv.val.wc; break; + case nsXPTType::T_VOID: /* fall through */ + case nsXPTType::T_IID: /* fall through */ + case nsXPTType::T_DOMSTRING: /* fall through */ + case nsXPTType::T_CHAR_STR: /* fall through */ + case nsXPTType::T_WCHAR_STR: /* fall through */ + case nsXPTType::T_INTERFACE: /* fall through */ + case nsXPTType::T_INTERFACE_IS: /* fall through */ + case nsXPTType::T_ARRAY: /* fall through */ + case nsXPTType::T_PSTRING_SIZE_IS: /* fall through */ + case nsXPTType::T_PWSTRING_SIZE_IS: /* fall through */ + case nsXPTType::T_UTF8STRING: /* fall through */ + case nsXPTType::T_CSTRING: /* fall through */ + default: val.p = mv.val.p; break; + } + } + } +}; + +/***************************************************************************/ + +#undef IMETHOD_VISIBILITY +#define IMETHOD_VISIBILITY NS_VISIBILITY_DEFAULT + +class XPTC_EXPORT nsXPTCStubBase : public nsISupports +{ +public: + // We are going to implement this to force the compiler to generate a + // vtbl for this class. Since this is overridden in the inheriting class + // we expect it to never be called. + // *This is needed by the Irix implementation.* + NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr); + + // Implement dummy constructor, destructor to workaround Solaris gcc 4.8.2 + // linking issue (see @bugref{5838}). + nsXPTCStubBase() {} + ~nsXPTCStubBase() {} + + // Include generated vtbl stub declarations. + // These are virtual and *also* implemented by this class.. +#include "xptcstubsdecl.inc" + + // The following methods must be provided by inheritor of this class. + + // return a refcounted pointer to the InterfaceInfo for this object + // NOTE: on some platforms this MUST not fail or we crash! + NS_IMETHOD GetInterfaceInfo(nsIInterfaceInfo** info) = 0; + + // call this method and return result + NS_IMETHOD CallMethod(PRUint16 methodIndex, + const nsXPTMethodInfo* info, + nsXPTCMiniVariant* params) = 0; +}; + +#undef IMETHOD_VISIBILITY +#define IMETHOD_VISIBILITY NS_VISIBILITY_HIDDEN + +PR_BEGIN_EXTERN_C + +XPTC_PUBLIC_API(nsresult) +XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params); + +// Used to force linking of these obj for the static library into the dll +extern void xptc_dummy(); +extern void xptc_dummy2(); + +PR_END_EXTERN_C + +#endif /* xptcall_h___ */ diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/public/xptcstubsdecl.inc b/src/libs/xpcom18a4/xpcom/reflect/xptcall/public/xptcstubsdecl.inc new file mode 100644 index 00000000..99116d68 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/public/xptcstubsdecl.inc @@ -0,0 +1,761 @@ +/* generated file - DO NOT EDIT */ + +/* includes 247 stub entries, and 5 sentinel entries */ + +/* +* declarations of normal stubs... +* 0 is QueryInterface +* 1 is AddRef +* 2 is Release +*/ +#if !defined(__ia64) || (!defined(__hpux) && !defined(__linux__)) +NS_IMETHOD Stub3(); +NS_IMETHOD Stub4(); +NS_IMETHOD Stub5(); +NS_IMETHOD Stub6(); +NS_IMETHOD Stub7(); +NS_IMETHOD Stub8(); +NS_IMETHOD Stub9(); +NS_IMETHOD Stub10(); +NS_IMETHOD Stub11(); +NS_IMETHOD Stub12(); +NS_IMETHOD Stub13(); +NS_IMETHOD Stub14(); +NS_IMETHOD Stub15(); +NS_IMETHOD Stub16(); +NS_IMETHOD Stub17(); +NS_IMETHOD Stub18(); +NS_IMETHOD Stub19(); +NS_IMETHOD Stub20(); +NS_IMETHOD Stub21(); +NS_IMETHOD Stub22(); +NS_IMETHOD Stub23(); +NS_IMETHOD Stub24(); +NS_IMETHOD Stub25(); +NS_IMETHOD Stub26(); +NS_IMETHOD Stub27(); +NS_IMETHOD Stub28(); +NS_IMETHOD Stub29(); +NS_IMETHOD Stub30(); +NS_IMETHOD Stub31(); +NS_IMETHOD Stub32(); +NS_IMETHOD Stub33(); +NS_IMETHOD Stub34(); +NS_IMETHOD Stub35(); +NS_IMETHOD Stub36(); +NS_IMETHOD Stub37(); +NS_IMETHOD Stub38(); +NS_IMETHOD Stub39(); +NS_IMETHOD Stub40(); +NS_IMETHOD Stub41(); +NS_IMETHOD Stub42(); +NS_IMETHOD Stub43(); +NS_IMETHOD Stub44(); +NS_IMETHOD Stub45(); +NS_IMETHOD Stub46(); +NS_IMETHOD Stub47(); +NS_IMETHOD Stub48(); +NS_IMETHOD Stub49(); +NS_IMETHOD Stub50(); +NS_IMETHOD Stub51(); +NS_IMETHOD Stub52(); +NS_IMETHOD Stub53(); +NS_IMETHOD Stub54(); +NS_IMETHOD Stub55(); +NS_IMETHOD Stub56(); +NS_IMETHOD Stub57(); +NS_IMETHOD Stub58(); +NS_IMETHOD Stub59(); +NS_IMETHOD Stub60(); +NS_IMETHOD Stub61(); +NS_IMETHOD Stub62(); +NS_IMETHOD Stub63(); +NS_IMETHOD Stub64(); +NS_IMETHOD Stub65(); +NS_IMETHOD Stub66(); +NS_IMETHOD Stub67(); +NS_IMETHOD Stub68(); +NS_IMETHOD Stub69(); +NS_IMETHOD Stub70(); +NS_IMETHOD Stub71(); +NS_IMETHOD Stub72(); +NS_IMETHOD Stub73(); +NS_IMETHOD Stub74(); +NS_IMETHOD Stub75(); +NS_IMETHOD Stub76(); +NS_IMETHOD Stub77(); +NS_IMETHOD Stub78(); +NS_IMETHOD Stub79(); +NS_IMETHOD Stub80(); +NS_IMETHOD Stub81(); +NS_IMETHOD Stub82(); +NS_IMETHOD Stub83(); +NS_IMETHOD Stub84(); +NS_IMETHOD Stub85(); +NS_IMETHOD Stub86(); +NS_IMETHOD Stub87(); +NS_IMETHOD Stub88(); +NS_IMETHOD Stub89(); +NS_IMETHOD Stub90(); +NS_IMETHOD Stub91(); +NS_IMETHOD Stub92(); +NS_IMETHOD Stub93(); +NS_IMETHOD Stub94(); +NS_IMETHOD Stub95(); +NS_IMETHOD Stub96(); +NS_IMETHOD Stub97(); +NS_IMETHOD Stub98(); +NS_IMETHOD Stub99(); +NS_IMETHOD Stub100(); +NS_IMETHOD Stub101(); +NS_IMETHOD Stub102(); +NS_IMETHOD Stub103(); +NS_IMETHOD Stub104(); +NS_IMETHOD Stub105(); +NS_IMETHOD Stub106(); +NS_IMETHOD Stub107(); +NS_IMETHOD Stub108(); +NS_IMETHOD Stub109(); +NS_IMETHOD Stub110(); +NS_IMETHOD Stub111(); +NS_IMETHOD Stub112(); +NS_IMETHOD Stub113(); +NS_IMETHOD Stub114(); +NS_IMETHOD Stub115(); +NS_IMETHOD Stub116(); +NS_IMETHOD Stub117(); +NS_IMETHOD Stub118(); +NS_IMETHOD Stub119(); +NS_IMETHOD Stub120(); +NS_IMETHOD Stub121(); +NS_IMETHOD Stub122(); +NS_IMETHOD Stub123(); +NS_IMETHOD Stub124(); +NS_IMETHOD Stub125(); +NS_IMETHOD Stub126(); +NS_IMETHOD Stub127(); +NS_IMETHOD Stub128(); +NS_IMETHOD Stub129(); +NS_IMETHOD Stub130(); +NS_IMETHOD Stub131(); +NS_IMETHOD Stub132(); +NS_IMETHOD Stub133(); +NS_IMETHOD Stub134(); +NS_IMETHOD Stub135(); +NS_IMETHOD Stub136(); +NS_IMETHOD Stub137(); +NS_IMETHOD Stub138(); +NS_IMETHOD Stub139(); +NS_IMETHOD Stub140(); +NS_IMETHOD Stub141(); +NS_IMETHOD Stub142(); +NS_IMETHOD Stub143(); +NS_IMETHOD Stub144(); +NS_IMETHOD Stub145(); +NS_IMETHOD Stub146(); +NS_IMETHOD Stub147(); +NS_IMETHOD Stub148(); +NS_IMETHOD Stub149(); +NS_IMETHOD Stub150(); +NS_IMETHOD Stub151(); +NS_IMETHOD Stub152(); +NS_IMETHOD Stub153(); +NS_IMETHOD Stub154(); +NS_IMETHOD Stub155(); +NS_IMETHOD Stub156(); +NS_IMETHOD Stub157(); +NS_IMETHOD Stub158(); +NS_IMETHOD Stub159(); +NS_IMETHOD Stub160(); +NS_IMETHOD Stub161(); +NS_IMETHOD Stub162(); +NS_IMETHOD Stub163(); +NS_IMETHOD Stub164(); +NS_IMETHOD Stub165(); +NS_IMETHOD Stub166(); +NS_IMETHOD Stub167(); +NS_IMETHOD Stub168(); +NS_IMETHOD Stub169(); +NS_IMETHOD Stub170(); +NS_IMETHOD Stub171(); +NS_IMETHOD Stub172(); +NS_IMETHOD Stub173(); +NS_IMETHOD Stub174(); +NS_IMETHOD Stub175(); +NS_IMETHOD Stub176(); +NS_IMETHOD Stub177(); +NS_IMETHOD Stub178(); +NS_IMETHOD Stub179(); +NS_IMETHOD Stub180(); +NS_IMETHOD Stub181(); +NS_IMETHOD Stub182(); +NS_IMETHOD Stub183(); +NS_IMETHOD Stub184(); +NS_IMETHOD Stub185(); +NS_IMETHOD Stub186(); +NS_IMETHOD Stub187(); +NS_IMETHOD Stub188(); +NS_IMETHOD Stub189(); +NS_IMETHOD Stub190(); +NS_IMETHOD Stub191(); +NS_IMETHOD Stub192(); +NS_IMETHOD Stub193(); +NS_IMETHOD Stub194(); +NS_IMETHOD Stub195(); +NS_IMETHOD Stub196(); +NS_IMETHOD Stub197(); +NS_IMETHOD Stub198(); +NS_IMETHOD Stub199(); +NS_IMETHOD Stub200(); +NS_IMETHOD Stub201(); +NS_IMETHOD Stub202(); +NS_IMETHOD Stub203(); +NS_IMETHOD Stub204(); +NS_IMETHOD Stub205(); +NS_IMETHOD Stub206(); +NS_IMETHOD Stub207(); +NS_IMETHOD Stub208(); +NS_IMETHOD Stub209(); +NS_IMETHOD Stub210(); +NS_IMETHOD Stub211(); +NS_IMETHOD Stub212(); +NS_IMETHOD Stub213(); +NS_IMETHOD Stub214(); +NS_IMETHOD Stub215(); +NS_IMETHOD Stub216(); +NS_IMETHOD Stub217(); +NS_IMETHOD Stub218(); +NS_IMETHOD Stub219(); +NS_IMETHOD Stub220(); +NS_IMETHOD Stub221(); +NS_IMETHOD Stub222(); +NS_IMETHOD Stub223(); +NS_IMETHOD Stub224(); +NS_IMETHOD Stub225(); +NS_IMETHOD Stub226(); +NS_IMETHOD Stub227(); +NS_IMETHOD Stub228(); +NS_IMETHOD Stub229(); +NS_IMETHOD Stub230(); +NS_IMETHOD Stub231(); +NS_IMETHOD Stub232(); +NS_IMETHOD Stub233(); +NS_IMETHOD Stub234(); +NS_IMETHOD Stub235(); +NS_IMETHOD Stub236(); +NS_IMETHOD Stub237(); +NS_IMETHOD Stub238(); +NS_IMETHOD Stub239(); +NS_IMETHOD Stub240(); +NS_IMETHOD Stub241(); +NS_IMETHOD Stub242(); +NS_IMETHOD Stub243(); +NS_IMETHOD Stub244(); +NS_IMETHOD Stub245(); +NS_IMETHOD Stub246(); +NS_IMETHOD Stub247(); +NS_IMETHOD Stub248(); +NS_IMETHOD Stub249(); +#else +NS_IMETHOD Stub3(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub4(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub5(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub6(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub7(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub8(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub9(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub10(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub11(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub12(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub13(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub14(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub15(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub16(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub17(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub18(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub19(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub20(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub21(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub22(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub23(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub24(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub25(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub26(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub27(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub28(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub29(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub30(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub31(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub32(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub33(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub34(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub35(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub36(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub37(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub38(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub39(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub40(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub41(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub42(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub43(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub44(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub45(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub46(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub47(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub48(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub49(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub50(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub51(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub52(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub53(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub54(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub55(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub56(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub57(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub58(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub59(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub60(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub61(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub62(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub63(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub64(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub65(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub66(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub67(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub68(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub69(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub70(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub71(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub72(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub73(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub74(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub75(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub76(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub77(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub78(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub79(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub80(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub81(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub82(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub83(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub84(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub85(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub86(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub87(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub88(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub89(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub90(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub91(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub92(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub93(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub94(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub95(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub96(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub97(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub98(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub99(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub100(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub101(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub102(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub103(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub104(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub105(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub106(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub107(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub108(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub109(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub110(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub111(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub112(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub113(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub114(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub115(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub116(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub117(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub118(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub119(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub120(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub121(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub122(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub123(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub124(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub125(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub126(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub127(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub128(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub129(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub130(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub131(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub132(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub133(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub134(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub135(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub136(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub137(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub138(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub139(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub140(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub141(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub142(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub143(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub144(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub145(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub146(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub147(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub148(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub149(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub150(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub151(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub152(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub153(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub154(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub155(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub156(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub157(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub158(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub159(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub160(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub161(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub162(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub163(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub164(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub165(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub166(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub167(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub168(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub169(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub170(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub171(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub172(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub173(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub174(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub175(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub176(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub177(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub178(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub179(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub180(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub181(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub182(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub183(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub184(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub185(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub186(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub187(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub188(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub189(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub190(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub191(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub192(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub193(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub194(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub195(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub196(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub197(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub198(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub199(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub200(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub201(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub202(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub203(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub204(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub205(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub206(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub207(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub208(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub209(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub210(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub211(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub212(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub213(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub214(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub215(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub216(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub217(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub218(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub219(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub220(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub221(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub222(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub223(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub224(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub225(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub226(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub227(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub228(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub229(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub230(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub231(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub232(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub233(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub234(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub235(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub236(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub237(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub238(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub239(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub240(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub241(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub242(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub243(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub244(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub245(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub246(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub247(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub248(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +NS_IMETHOD Stub249(PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); +#endif + +/* declarations of sentinel stubs */ +NS_IMETHOD Sentinel0(); +NS_IMETHOD Sentinel1(); +NS_IMETHOD Sentinel2(); +NS_IMETHOD Sentinel3(); +NS_IMETHOD Sentinel4(); diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/public/xptcstubsdef.inc b/src/libs/xpcom18a4/xpcom/reflect/xptcall/public/xptcstubsdef.inc new file mode 100644 index 00000000..780e2f52 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/public/xptcstubsdef.inc @@ -0,0 +1,256 @@ +/* generated file - DO NOT EDIT */ + +/* includes 247 stub entries, and 5 sentinel entries */ + +STUB_ENTRY(3) +STUB_ENTRY(4) +STUB_ENTRY(5) +STUB_ENTRY(6) +STUB_ENTRY(7) +STUB_ENTRY(8) +STUB_ENTRY(9) +STUB_ENTRY(10) +STUB_ENTRY(11) +STUB_ENTRY(12) +STUB_ENTRY(13) +STUB_ENTRY(14) +STUB_ENTRY(15) +STUB_ENTRY(16) +STUB_ENTRY(17) +STUB_ENTRY(18) +STUB_ENTRY(19) +STUB_ENTRY(20) +STUB_ENTRY(21) +STUB_ENTRY(22) +STUB_ENTRY(23) +STUB_ENTRY(24) +STUB_ENTRY(25) +STUB_ENTRY(26) +STUB_ENTRY(27) +STUB_ENTRY(28) +STUB_ENTRY(29) +STUB_ENTRY(30) +STUB_ENTRY(31) +STUB_ENTRY(32) +STUB_ENTRY(33) +STUB_ENTRY(34) +STUB_ENTRY(35) +STUB_ENTRY(36) +STUB_ENTRY(37) +STUB_ENTRY(38) +STUB_ENTRY(39) +STUB_ENTRY(40) +STUB_ENTRY(41) +STUB_ENTRY(42) +STUB_ENTRY(43) +STUB_ENTRY(44) +STUB_ENTRY(45) +STUB_ENTRY(46) +STUB_ENTRY(47) +STUB_ENTRY(48) +STUB_ENTRY(49) +STUB_ENTRY(50) +STUB_ENTRY(51) +STUB_ENTRY(52) +STUB_ENTRY(53) +STUB_ENTRY(54) +STUB_ENTRY(55) +STUB_ENTRY(56) +STUB_ENTRY(57) +STUB_ENTRY(58) +STUB_ENTRY(59) +STUB_ENTRY(60) +STUB_ENTRY(61) +STUB_ENTRY(62) +STUB_ENTRY(63) +STUB_ENTRY(64) +STUB_ENTRY(65) +STUB_ENTRY(66) +STUB_ENTRY(67) +STUB_ENTRY(68) +STUB_ENTRY(69) +STUB_ENTRY(70) +STUB_ENTRY(71) +STUB_ENTRY(72) +STUB_ENTRY(73) +STUB_ENTRY(74) +STUB_ENTRY(75) +STUB_ENTRY(76) +STUB_ENTRY(77) +STUB_ENTRY(78) +STUB_ENTRY(79) +STUB_ENTRY(80) +STUB_ENTRY(81) +STUB_ENTRY(82) +STUB_ENTRY(83) +STUB_ENTRY(84) +STUB_ENTRY(85) +STUB_ENTRY(86) +STUB_ENTRY(87) +STUB_ENTRY(88) +STUB_ENTRY(89) +STUB_ENTRY(90) +STUB_ENTRY(91) +STUB_ENTRY(92) +STUB_ENTRY(93) +STUB_ENTRY(94) +STUB_ENTRY(95) +STUB_ENTRY(96) +STUB_ENTRY(97) +STUB_ENTRY(98) +STUB_ENTRY(99) +STUB_ENTRY(100) +STUB_ENTRY(101) +STUB_ENTRY(102) +STUB_ENTRY(103) +STUB_ENTRY(104) +STUB_ENTRY(105) +STUB_ENTRY(106) +STUB_ENTRY(107) +STUB_ENTRY(108) +STUB_ENTRY(109) +STUB_ENTRY(110) +STUB_ENTRY(111) +STUB_ENTRY(112) +STUB_ENTRY(113) +STUB_ENTRY(114) +STUB_ENTRY(115) +STUB_ENTRY(116) +STUB_ENTRY(117) +STUB_ENTRY(118) +STUB_ENTRY(119) +STUB_ENTRY(120) +STUB_ENTRY(121) +STUB_ENTRY(122) +STUB_ENTRY(123) +STUB_ENTRY(124) +STUB_ENTRY(125) +STUB_ENTRY(126) +STUB_ENTRY(127) +STUB_ENTRY(128) +STUB_ENTRY(129) +STUB_ENTRY(130) +STUB_ENTRY(131) +STUB_ENTRY(132) +STUB_ENTRY(133) +STUB_ENTRY(134) +STUB_ENTRY(135) +STUB_ENTRY(136) +STUB_ENTRY(137) +STUB_ENTRY(138) +STUB_ENTRY(139) +STUB_ENTRY(140) +STUB_ENTRY(141) +STUB_ENTRY(142) +STUB_ENTRY(143) +STUB_ENTRY(144) +STUB_ENTRY(145) +STUB_ENTRY(146) +STUB_ENTRY(147) +STUB_ENTRY(148) +STUB_ENTRY(149) +STUB_ENTRY(150) +STUB_ENTRY(151) +STUB_ENTRY(152) +STUB_ENTRY(153) +STUB_ENTRY(154) +STUB_ENTRY(155) +STUB_ENTRY(156) +STUB_ENTRY(157) +STUB_ENTRY(158) +STUB_ENTRY(159) +STUB_ENTRY(160) +STUB_ENTRY(161) +STUB_ENTRY(162) +STUB_ENTRY(163) +STUB_ENTRY(164) +STUB_ENTRY(165) +STUB_ENTRY(166) +STUB_ENTRY(167) +STUB_ENTRY(168) +STUB_ENTRY(169) +STUB_ENTRY(170) +STUB_ENTRY(171) +STUB_ENTRY(172) +STUB_ENTRY(173) +STUB_ENTRY(174) +STUB_ENTRY(175) +STUB_ENTRY(176) +STUB_ENTRY(177) +STUB_ENTRY(178) +STUB_ENTRY(179) +STUB_ENTRY(180) +STUB_ENTRY(181) +STUB_ENTRY(182) +STUB_ENTRY(183) +STUB_ENTRY(184) +STUB_ENTRY(185) +STUB_ENTRY(186) +STUB_ENTRY(187) +STUB_ENTRY(188) +STUB_ENTRY(189) +STUB_ENTRY(190) +STUB_ENTRY(191) +STUB_ENTRY(192) +STUB_ENTRY(193) +STUB_ENTRY(194) +STUB_ENTRY(195) +STUB_ENTRY(196) +STUB_ENTRY(197) +STUB_ENTRY(198) +STUB_ENTRY(199) +STUB_ENTRY(200) +STUB_ENTRY(201) +STUB_ENTRY(202) +STUB_ENTRY(203) +STUB_ENTRY(204) +STUB_ENTRY(205) +STUB_ENTRY(206) +STUB_ENTRY(207) +STUB_ENTRY(208) +STUB_ENTRY(209) +STUB_ENTRY(210) +STUB_ENTRY(211) +STUB_ENTRY(212) +STUB_ENTRY(213) +STUB_ENTRY(214) +STUB_ENTRY(215) +STUB_ENTRY(216) +STUB_ENTRY(217) +STUB_ENTRY(218) +STUB_ENTRY(219) +STUB_ENTRY(220) +STUB_ENTRY(221) +STUB_ENTRY(222) +STUB_ENTRY(223) +STUB_ENTRY(224) +STUB_ENTRY(225) +STUB_ENTRY(226) +STUB_ENTRY(227) +STUB_ENTRY(228) +STUB_ENTRY(229) +STUB_ENTRY(230) +STUB_ENTRY(231) +STUB_ENTRY(232) +STUB_ENTRY(233) +STUB_ENTRY(234) +STUB_ENTRY(235) +STUB_ENTRY(236) +STUB_ENTRY(237) +STUB_ENTRY(238) +STUB_ENTRY(239) +STUB_ENTRY(240) +STUB_ENTRY(241) +STUB_ENTRY(242) +STUB_ENTRY(243) +STUB_ENTRY(244) +STUB_ENTRY(245) +STUB_ENTRY(246) +STUB_ENTRY(247) +STUB_ENTRY(248) +STUB_ENTRY(249) +SENTINEL_ENTRY(0) +SENTINEL_ENTRY(1) +SENTINEL_ENTRY(2) +SENTINEL_ENTRY(3) +SENTINEL_ENTRY(4) diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/.cvsignore b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/Makefile.in b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/Makefile.in new file mode 100644 index 00000000..987fc505 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/Makefile.in @@ -0,0 +1,62 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1998 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = ../../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = xpcom +LIBRARY_NAME = xptcall + + +DIRS = md + +CPPSRCS = xptcall.cpp + +# we don't want the shared lib, but we want to force the creation of a static lib. +FORCE_STATIC_LIB = 1 + +# Force use of PIC +FORCE_USE_PIC = 1 + +include $(topsrcdir)/config/rules.mk + +DEFINES += -DEXPORT_XPTC_API -D_IMPL_NS_COM -D_IMPL_NS_BASE + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/.cvsignore b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/Makefile.in b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/Makefile.in new file mode 100644 index 00000000..dd70cabf --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/Makefile.in @@ -0,0 +1,56 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1998 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = ../../../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +ifeq ($(MOZ_WIDGET_TOOLKIT),os2) +DIRS = os2 +else +ifeq ($(MOZ_WIDGET_TOOLKIT),windows) +DIRS = win32 +else +DIRS = unix +endif +endif + +include $(topsrcdir)/config/rules.mk + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/mac/xptcinvoke_mac.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/mac/xptcinvoke_mac.cpp new file mode 100644 index 00000000..29343c08 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/mac/xptcinvoke_mac.cpp @@ -0,0 +1,148 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + +#include "xptcprivate.h" + +#ifndef XP_MAC +#error "This code is for Macintosh only" +#endif + +extern "C" uint32 +invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s) +{ + PRUint32 result = 0; + for(PRUint32 i = 0; i < paramCount; i++, s++) + { + if(s->IsPtrData()) + { + result++; + continue; + } + switch(s->type) + { + case nsXPTType::T_I8 : + case nsXPTType::T_I16 : + case nsXPTType::T_I32 : + result++; + break; + case nsXPTType::T_I64 : + result+=2; + break; + case nsXPTType::T_U8 : + case nsXPTType::T_U16 : + case nsXPTType::T_U32 : + result++; + break; + case nsXPTType::T_U64 : + result+=2; + break; + case nsXPTType::T_FLOAT : + result++; + break; + case nsXPTType::T_DOUBLE : + result+=2; + break; + case nsXPTType::T_BOOL : + case nsXPTType::T_CHAR : + case nsXPTType::T_WCHAR : + result++; + break; + default: + // all the others are plain pointer types + result++; + break; + } + } + return result; +} + +extern "C" void +invoke_copy_to_stack(PRUint32* d, PRUint32 paramCount, nsXPTCVariant* s, double *fprData) +{ + PRUint32 fpCount = 0; + for(PRUint32 i = 0; i < paramCount; i++, d++, s++) + { + if(s->IsPtrData()) + { + *((void**)d) = s->ptr; + continue; + } + switch(s->type) + { + case nsXPTType::T_I8 : *((PRInt32*) d) = s->val.i8; break; + case nsXPTType::T_I16 : *((PRInt32*) d) = s->val.i16; break; + case nsXPTType::T_I32 : *((PRInt32*) d) = s->val.i32; break; + case nsXPTType::T_I64 : *((PRInt64*) d) = s->val.i64; d++; break; + case nsXPTType::T_U8 : *((PRUint32*) d) = s->val.u8; break; + case nsXPTType::T_U16 : *((PRUint32*)d) = s->val.u16; break; + case nsXPTType::T_U32 : *((PRUint32*)d) = s->val.u32; break; + case nsXPTType::T_U64 : *((PRUint64*)d) = s->val.u64; d++; break; + case nsXPTType::T_FLOAT : *((float*) d) = s->val.f; + if (fpCount < 13) + fprData[fpCount++] = s->val.f; + break; + case nsXPTType::T_DOUBLE : *((double*) d) = s->val.d; d++; + if (fpCount < 13) + fprData[fpCount++] = s->val.d; + break; + case nsXPTType::T_BOOL : *((PRBool*) d) = s->val.b; break; + case nsXPTType::T_CHAR : *((PRInt32*) d) = s->val.c; break; + case nsXPTType::T_WCHAR : *((PRUint32*) d) = s->val.wc; break; + default: + // all the others are plain pointer types + *((void**)d) = s->val.p; + break; + } + } +} + +#pragma export on + +extern "C" nsresult _XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params); + +extern "C" +XPTC_PUBLIC_API(nsresult) +XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params) +{ + return _XPTC_InvokeByIndex(that, methodIndex, paramCount, params); +} + +#pragma export off diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/mac/xptcinvoke_mac.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/mac/xptcinvoke_mac.s new file mode 100644 index 00000000..47544dd3 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/mac/xptcinvoke_mac.s @@ -0,0 +1,128 @@ + # + # -*- 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.1 (the "License"); you may not use this file + # except in compliance with the License. You may obtain a copy of + # the License at http://www.mozilla.org/NPL/ + # + # Software distributed under the License is distributed on an "AS + # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + # implied. See the License for the specific language governing + # rights and limitations under the License. + # + # The Original Code is mozilla.org code. + # + # The Initial Developer of the Original Code is Netscape + # Communications Corporation. Portions created by Netscape are + # Copyright (C) 1999 Netscape Communications Corporation. All + # Rights Reserved. + # + # Contributor(s): + # + + csect CODE{PR} +# +# XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, +# PRUint32 paramCount, nsXPTCVariant* params) +# + + import .invoke_count_words + import .invoke_copy_to_stack + import .__ptr_glue + +._XPTC_InvokeByIndex: + mflr r0 + stw r31,-4(sp) +# +# save off the incoming values in the caller's parameter area +# + stw r3,24(sp) # that + stw r4,28(sp) # methodIndex + stw r5,32(sp) # paramCount + stw r6,36(sp) # params + stw r0,8(sp) + stwu sp,-144(sp) # = 24 for linkage area, 8 * 13 for fprData area, 8 for saved registers, + # 8 to keep stack 16-byte aligned. + +# set up for and call 'invoke_count_words' to get new stack size +# + mr r3,r5 + mr r4,r6 + bl .invoke_count_words + nop + +# prepare args for 'invoke_copy_to_stack' call +# + lwz r4,176(sp) # paramCount + lwz r5,180(sp) # params +# addi r6,sp,128 # fprData + mr r6,sp # fprData + slwi r3,r3,2 # number of bytes of stack required + addi r3,r3,28 # linkage area + mr r31,sp # save original stack top + sub sp,sp,r3 # bump the stack + clrrwi sp,sp,4 # keep the stack 16-byte aligned. + lwz r3,0(r31) # act like real alloca, so 0(sp) always points back to + stw r3,0(sp) # previous stack frame. + addi r3,sp,28 # parameter pointer excludes linkage area size + 'this' + + bl .invoke_copy_to_stack + nop + + lfd f1,0(r31) + lfd f2,8(r31) + lfd f3,16(r31) + lfd f4,24(r31) + lfd f5,32(r31) + lfd f6,40(r31) + lfd f7,48(r31) + lfd f8,56(r31) + lfd f9,64(r31) + lfd f10,72(r31) + lfd f11,80(r31) + lfd f12,88(r31) + lfd f13,96(r31) + + lwz r3,168(r31) # that + lwz r4,0(r3) # get vTable from 'that' + lwz r5,172(r31) # methodIndex + slwi r5,r5,2 # methodIndex * 4 + addi r5,r5,8 # step over junk at start of vTable ! + lwzx r12,r5,r4 # get function pointer + + lwz r4,28(sp) + lwz r5,32(sp) + lwz r6,36(sp) + lwz r7,40(sp) + lwz r8,44(sp) + lwz r9,48(sp) + lwz r10,52(sp) + + bl .__ptr_glue + nop + + + mr sp,r31 + lwz r0,152(sp) + addi sp,sp,144 + mtlr r0 + lwz r31,-4(sp) + blr + +# traceback table. + traceback: + dc.l 0 + dc.l 0x00002040 + dc.l 0 + dc.l (traceback - ._XPTC_InvokeByIndex) # size of the code. + dc.w 20 # short length of identifier. + dc.b '._XPTC_InvokeByIndex' + + csect DATA + import TOC + export ._XPTC_InvokeByIndex + + dc.l ._XPTC_InvokeByIndex + dc.l TOC +
\ No newline at end of file diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/mac/xptcstubs_mac.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/mac/xptcstubs_mac.cpp new file mode 100644 index 00000000..3fea7d51 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/mac/xptcstubs_mac.cpp @@ -0,0 +1,265 @@ +/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Implement shared vtbl methods. */ + +#pragma export on + +#include "xptcprivate.h" + +#if defined(XP_MAC) + +/* + For mac, the first 8 integral and the first 13 f.p. parameters arrive + in a separate chunk of data that has been loaded from the registers. The + args pointer has been set to the start of the parameters BEYOND the ones + arriving in registers +*/ +extern "C" nsresult +PrepareAndDispatch(nsXPTCStubBase* self, PRUint32 methodIndex, PRUint32* args, PRUint32 *gprData, double *fprData) +{ +#define PARAM_BUFFER_COUNT 16 +#define PARAM_GPR_COUNT 7 + + 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; + PRUint32 iCount = 0; + PRUint32 fpCount = 0; + for(i = 0; i < paramCount; i++) + { + const nsXPTParamInfo& param = info->GetParam(i); + const nsXPTType& type = param.GetType(); + nsXPTCMiniVariant* dp = &dispatchParams[i]; + + if(param.IsOut() || !type.IsArithmetic()) + { + if (iCount < PARAM_GPR_COUNT) + dp->val.p = (void*) gprData[iCount++]; + else + dp->val.p = (void*) *ap++; + continue; + } + // else + switch(type) + { + case nsXPTType::T_I8 : if (iCount < PARAM_GPR_COUNT) + dp->val.i8 = (PRInt8) gprData[iCount++]; + else + dp->val.i8 = (PRInt8) *ap++; + break; + case nsXPTType::T_I16 : if (iCount < PARAM_GPR_COUNT) + dp->val.i16 = (PRInt16) gprData[iCount++]; + else + dp->val.i16 = (PRInt16) *ap++; + break; + case nsXPTType::T_I32 : if (iCount < PARAM_GPR_COUNT) + dp->val.i32 = (PRInt32) gprData[iCount++]; + else + dp->val.i32 = (PRInt32) *ap++; + break; + case nsXPTType::T_I64 : +#ifdef HAVE_LONG_LONG + PRUint64 tempu64; + if (iCount & 1) iCount++; // longlongs are aligned in odd/even register pairs, eg. r5/r6 + if ((iCount + 1) < PARAM_GPR_COUNT) + { + tempu64 = *(PRUint64*) &gprData[iCount]; + iCount += 2; + } + else + { + if ((PRUint32) ap & 4) ap++; // longlongs are 8-byte aligned on stack + tempu64 = *(PRUint64*) ap; + ap += 2; + } + dp->val.i64 = (PRUint64)tempu64; +#else + if (iCount < PARAM_GPR_COUNT) + dp->val.i64.hi = (PRInt32) gprData[iCount++]; + else + dp->val.i64.hi = (PRInt32) *ap++; + if (iCount < PARAM_GPR_COUNT) + dp->val.i64.lo = (PRUint32) gprData[iCount++]; + else + dp->val.i64.lo = (PRUint32) *ap++; +#endif + break; + case nsXPTType::T_U8 : if (iCount < PARAM_GPR_COUNT) + dp->val.i8 = (PRUint8) gprData[iCount++]; + else + dp->val.i8 = (PRUint8) *ap++; + break; + case nsXPTType::T_U16 : if (iCount < PARAM_GPR_COUNT) + dp->val.i16 = (PRUint16) gprData[iCount++]; + else + dp->val.i16 = (PRUint16) *ap++; + break; + case nsXPTType::T_U32 : if (iCount < PARAM_GPR_COUNT) + dp->val.i32 = (PRUint32) gprData[iCount++]; + else + dp->val.i32 = (PRUint32) *ap++; + break; + case nsXPTType::T_U64 : +#ifdef HAVE_LONG_LONG + // PRUint64 tempu64; // declared above and still in scope + if (iCount & 1) iCount++; // longlongs are aligned in odd/even register pairs, eg. r5/r6 + if ((iCount + 1) < PARAM_GPR_COUNT) + { + tempu64 = *(PRUint64*) &gprData[iCount]; + iCount += 2; + } + else + { + if ((PRUint32) ap & 4) ap++; // longlongs are 8-byte aligned on stack + tempu64 = *(PRUint64*) ap; + ap += 2; + } + dp->val.i64 = (PRUint64)tempu64; +#else + if (iCount < PARAM_GPR_COUNT) + dp->val.i64.hi = (PRUint32) gprData[iCount++]; + else + dp->val.i64.hi = (PRUint32) *ap++; + if (iCount < PARAM_GPR_COUNT) + dp->val.i64.lo = (PRUint32) gprData[iCount++]; + else + dp->val.i64.lo = (PRUint32) *ap++; +#endif + break; + case nsXPTType::T_FLOAT : if (fpCount < 13) { + dp->val.f = (float) fprData[fpCount++]; + if (iCount < PARAM_GPR_COUNT) + ++iCount; + else + ++ap; + } + else + dp->val.f = *((float*) ap++); + break; + case nsXPTType::T_DOUBLE : if (fpCount < 13) { + dp->val.d = (double) fprData[fpCount++]; + if (iCount < PARAM_GPR_COUNT) + ++iCount; + else + ++ap; + if (iCount < PARAM_GPR_COUNT) + ++iCount; + else + ++ap; + } + else { + dp->val.f = *((double*) ap); + ap += 2; + } + break; + case nsXPTType::T_BOOL : if (iCount < PARAM_GPR_COUNT) + dp->val.b = (PRBool) gprData[iCount++]; + else + dp->val.b = (PRBool) *ap++; + break; + case nsXPTType::T_CHAR : if (iCount < PARAM_GPR_COUNT) + dp->val.c = (char) gprData[iCount++]; + else + dp->val.c = (char) *ap++; + break; + case nsXPTType::T_WCHAR : if (iCount < PARAM_GPR_COUNT) + dp->val.wc = (wchar_t) gprData[iCount++]; + else + 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" void SharedStub(); + +#define STUB_ENTRY(n) \ +asm nsresult nsXPTCStubBase::Stub##n() \ +{ \ + addi r12,r0,n; \ + b SharedStub \ +} + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + + +#include "xptcstubsdef.inc" + +#pragma export off + +#endif diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/mac/xptcstubs_mac.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/mac/xptcstubs_mac.s new file mode 100644 index 00000000..d2f7185b --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/mac/xptcstubs_mac.s @@ -0,0 +1,78 @@ + # + # -*- 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.1 (the "License"); you may not use this file + # except in compliance with the License. You may obtain a copy of + # the License at http://www.mozilla.org/NPL/ + # + # Software distributed under the License is distributed on an "AS + # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + # implied. See the License for the specific language governing + # rights and limitations under the License. + # + # The Original Code is mozilla.org code. + # + # The Initial Developer of the Original Code is Netscape + # Communications Corporation. Portions created by Netscape are + # Copyright (C) 1999 Netscape Communications Corporation. All + # Rights Reserved. + # + # Contributor(s): + # + + csect CODE{PR} +# +# on entry SharedStub has the method selector in r12, the rest of the original +# parameters are in r3 thru r10 and f1 thru f13 +# + import .PrepareAndDispatch + +.SharedStub: + mflr r0 + stw r0,8(sp) + + stwu sp,-176(sp) # room for linkage (24), fprData (104), gprData(28) + # outgoing params to PrepareAndDispatch (20) + + stw r4,44(sp) + stw r5,48(sp) + stw r6,52(sp) + stw r7,56(sp) + stw r8,60(sp) + stw r9,64(sp) + stw r10,68(sp) + stfd f1,72(sp) + stfd f2,80(sp) + stfd f3,88(sp) + stfd f4,96(sp) + stfd f5,104(sp) + stfd f6,112(sp) + stfd f7,120(sp) + stfd f8,128(sp) + stfd f9,136(sp) + stfd f10,144(sp) + stfd f11,152(sp) + stfd f12,156(sp) + stfd f13,164(sp) + + addi r6,sp,44 # gprData + addi r7,sp,72 # fprData + # r3 has the 'self' pointer already + mr r4,r12 # methodIndex selector + addi r5,sp,232 # pointer to callers args area, beyond r3-r10 mapped range + + bl .PrepareAndDispatch + nop + + lwz r0,184(sp) + addi sp,sp,176 + mtlr r0 + blr + + csect DATA + import TOC + export .SharedStub + + dc.l .SharedStub + dc.l TOC diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/os2/.cvsignore b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/os2/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/os2/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/os2/Makefile.in b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/os2/Makefile.in new file mode 100644 index 00000000..cfd57c83 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/os2/Makefile.in @@ -0,0 +1,72 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1998 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = ../../../../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = xpcom +LIBRARY_NAME = xptcmd + +ifdef GNU_CXX +CPPSRCS = \ + ../unix/xptcinvoke_gcc_x86_unix.cpp \ + ../unix/xptcstubs_gcc_x86_unix.cpp \ + $(NULL) +LOCAL_INCLUDES = -I$(srcdir)/../unix +DEFINES += -DMOZ_NEED_LEADING_UNDERSCORE +else +CPPSRCS = xptcstubs_os2.cpp +ASFILES = xptcinvoke_vacpp.asm xptcstubs_vacpp.asm +endif + +# Force use of PIC +FORCE_USE_PIC = 1 + +include $(topsrcdir)/config/config.mk + +# we don't want the shared lib, but we want to force the creation of a static lib. +FORCE_STATIC_LIB = 1 + +include $(topsrcdir)/config/rules.mk + +DEFINES += -DEXPORT_XPTC_API + +INCLUDES += -I$(srcdir)/../.. diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/os2/xptcinvoke_emx.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/os2/xptcinvoke_emx.cpp new file mode 100644 index 00000000..17fcadfe --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/os2/xptcinvoke_emx.cpp @@ -0,0 +1,185 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * John Fairhurst <john_fairhurst@iname.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** + * + * This Original Code has been modified by IBM Corporation. + * Modifications made by IBM described herein are + * Copyright (c) International Business Machines + * Corporation, 2000 + * + * Modifications to Mozilla code or documentation + * identified per MPL Section 3.3 + * + * Date Modified by Description of modification + * 03/22/2000 IBM Corp. Fixed multiple inheritance bug in XPTC_InvokeByIndex to adjust the + * "that" (this) pointer appropriately. + */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + +// This is 80% copied directly from other platforms; the assembler +// stuff is all my fault, though. (jmf) + +#if !defined(__EMX__) +#error "This code is for OS/2 EMX only" +#endif + +#include "xptcprivate.h" + +// Remember that these 'words' are 32-bit DWORDs +static PRUint32 +invoke_count_words( PRUint32 paramCount, nsXPTCVariant* s) +{ + PRUint32 result = 0; + + for(PRUint32 i = 0; i < paramCount; i++, s++) + { + if(s->IsPtrData()) + result++; + + else { + + switch(s->type) + { + // 64-bit types + case nsXPTType::T_I64 : + case nsXPTType::T_U64 : + case nsXPTType::T_DOUBLE : + result+=2; + break; + + // all others are dwords + default: + result++; + break; + } + } + } + return result; +} + + +static void +invoke_copy_to_stack( PRUint32* d, uint32 paramCount, nsXPTCVariant* s) +{ + for( PRUint32 i = 0; i < paramCount; i++, d++, s++) + { + if(s->IsPtrData()) + *((void**)d) = s->ptr; + + else { + + switch(s->type) + { + case nsXPTType::T_I8 : *((int8*) d) = s->val.i8; break; + case nsXPTType::T_I16 : *((int16*) d) = s->val.i16; break; + case nsXPTType::T_I32 : *((int32*) d) = s->val.i32; break; + case nsXPTType::T_I64 : *((int64*) d) = s->val.i64; d++; break; + case nsXPTType::T_U8 : *((uint8*) d) = s->val.u8; break; + case nsXPTType::T_U16 : *((uint16*) d) = s->val.u16; break; + case nsXPTType::T_U32 : *((uint32*) d) = s->val.u32; break; + case nsXPTType::T_U64 : *((uint64*) d) = s->val.u64; d++; break; + case nsXPTType::T_FLOAT : *((float*) d) = s->val.f; break; + case nsXPTType::T_DOUBLE : *((double*) d) = s->val.d; d++; break; + case nsXPTType::T_BOOL : *((PRBool*) d) = s->val.b; break; + case nsXPTType::T_CHAR : *((char*) d) = s->val.c; break; + case nsXPTType::T_WCHAR : *((wchar_t*)d) = s->val.wc; break; + default: + // all the others are plain pointer types + *((void**)d) = s->val.p; + break; + } + } + } +} + + +XPTC_PUBLIC_API(nsresult) +XPTC_InvokeByIndex( nsISupports *that, PRUint32 index, + PRUint32 paramcount, nsXPTCVariant* params) +{ + int ibytes; + void *pStack; + int result = NS_OK; + + // Find size in bytes necessary for call + ibytes = 4 * invoke_count_words( paramcount, params); + + __asm__ __volatile__( + "movl %1, %%eax\n" /* load |ibytes| into eax */ + "subl %%eax, %%esp\n" /* make room on stack */ + "movl %%esp, %0" /* store base in |pStack| */ + : "=g" (pStack) /* %0 */ + : "g" (ibytes) /* %1 */ + : "ax", "memory", "sp" + ); + + // Fill in that gap in the stack with the params to the method + invoke_copy_to_stack( (PRUint32*) pStack, paramcount, params); + + // push the hidden 'this' parameter, traverse the vtable, + // and then call the method. + + __asm__ __volatile__( + "movl %2, %%eax\n" /* |that| ptr -> eax */ + "movl (%%eax), %%edx\n" /* vptr -> edx */ + "movl %3, %%ebx\n" + "shl $3, %%ebx\n" /* 8 bytes per method.. */ + "addl $8, %%ebx\n" /* ..plus 8 to skip over 1st 8 bytes of vtbl */ + + "addl %%ebx, %%edx\n" /* find appropriate vtbl entry */ + "movswl (%%edx),%%ecx\n" /* get possible |that| ptr adjustment value */ + "addl %%ecx, %%eax\n" /* adjust the |that| ptr (needed for multiple inheritance) */ + "pushl %%eax\n" /* enstack the possibly-adjusted |that| */ + + "addl $4, %%edx\n" /* ..add 4 more to get to the method's entry point */ + + "call (%%edx)\n" /* call method */ + "movl %%eax, %0\n" /* save rc in |result| */ + "movl %1, %%ebx\n" /* clear up stack */ + "addl $4, %%ebx\n" + "addl %%ebx, %%esp" + : "=g" (result) /* %0 */ + : "g" (ibytes), /* %1 */ + "g" (that), /* %2 */ + "g" (index) /* %3 */ + : "ax", "bx", "dx", "memory", "sp" + ); + + return result; +} diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/os2/xptcinvoke_gcc_x86_os2.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/os2/xptcinvoke_gcc_x86_os2.cpp new file mode 100644 index 00000000..6bbb93b0 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/os2/xptcinvoke_gcc_x86_os2.cpp @@ -0,0 +1,159 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/* Platform specific code to invoke XPCOM methods on native objects */
+
+/* This file is basically a copy of xptcinvoke_gcc_x86_unix.cpp with some
+ * irrelevant parts stipped off and some OS/2 specific modifications added,
+ * so it needs to be kept in sync with the original. */
+
+#include "xptcprivate.h"
+#include "xptc_platforms_unixish_x86.h"
+#include "xptc_gcc_x86_unix.h"
+
+extern "C" {
+static
+void ATTRIBUTE_USED __attribute__ ((regparm(3)))
+invoke_copy_to_stack(PRUint32 paramCount, nsXPTCVariant* s, PRUint32* d)
+{
+ for(PRUint32 i = paramCount; i >0; i--, d++, s++)
+ {
+ if(s->IsPtrData())
+ {
+ *((void**)d) = s->ptr;
+ continue;
+ }
+
+ switch(s->type)
+ {
+ case nsXPTType::T_I64 : *((PRInt64*) d) = s->val.i64; d++; break;
+ case nsXPTType::T_U64 : *((PRUint64*)d) = s->val.u64; d++; break;
+ case nsXPTType::T_DOUBLE : *((double*) d) = s->val.d; d++; break;
+ default : *((void**)d) = s->val.p; break;
+ }
+ }
+}
+} // extern "C"
+
+/*
+ XPTC_PUBLIC_API(nsresult)
+ XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
+ PRUint32 paramCount, nsXPTCVariant* params);
+
+ Each param takes at most two 4-byte words.
+ It doesn't matter if we push too many words, and calculating the exact
+ amount takes time.
+
+ that = ebp + 0x08
+ methodIndex = ebp + 0x0c
+ paramCount = ebp + 0x10
+ params = ebp + 0x14
+
+ NOTE NOTE NOTE:
+ As of 2002-04-29 this function references no global variables nor does
+ it call non-static functions so preserving and loading the PIC register
+ is unnecessary. Define MOZ_PRESERVE_PIC if this changes. See mozilla
+ bug 140412 for details. However, avoid this if you can. It's slower.
+*/
+
+#if defined(__declspec)
+#define SYMBOL_EXPORT(sym) \
+ ".stabs \"" sym ",0=" sym ",code\", 0x6c,0,0,-42\n\t"
+#else
+#define SYMBOL_EXPORT(sym)
+#endif
+
+__asm__ (
+ ".text\n\t"
+/* alignment here seems unimportant here; this was 16, now it's 2 which
+ is what xptcstubs uses. */
+ ".align 2\n\t"
+ ".globl " SYMBOL_UNDERSCORE "XPTC_InvokeByIndex\n\t"
+ ".type " SYMBOL_UNDERSCORE "XPTC_InvokeByIndex,@function\n"
+ SYMBOL_EXPORT(SYMBOL_UNDERSCORE "XPTC_InvokeByIndex")
+ SYMBOL_UNDERSCORE "XPTC_InvokeByIndex:\n\t"
+ "pushl %ebp\n\t"
+ "movl %esp, %ebp\n\t"
+#ifdef MOZ_PRESERVE_PIC
+ "pushl %ebx\n\t"
+ "call 0f\n\t"
+ ".subsection 1\n"
+ "0:\n\t"
+ "movl (%esp), %ebx\n\t"
+ "ret\n\t"
+ ".previous\n\t"
+ "addl $_GLOBAL_OFFSET_TABLE_, %ebx\n\t"
+#endif
+ "movl 0x10(%ebp), %eax\n\t"
+ "leal 0(,%eax,8),%edx\n\t"
+ "movl %esp, %ecx\n\t"
+ "subl %edx, %ecx\n\t"
+/* Since there may be 64-bit data, it occurs to me that aligning this
+ space might be a performance gain. However, I don't think the rest
+ of mozilla worries about such things. In any event, do it here.
+ "andl $0xfffffff8, %ecx\n\t"
+ */
+ "movl %ecx, %esp\n\t" /* make stack space */
+ "movl 0x14(%ebp), %edx\n\t"
+ "call " SYMBOL_UNDERSCORE "invoke_copy_to_stack\n\t"
+ "movl 0x08(%ebp), %ecx\n\t" /* 'that' */
+#ifdef CFRONT_STYLE_THIS_ADJUST
+ "movl (%ecx), %edx\n\t"
+ "movl 0x0c(%ebp), %eax\n\t" /* function index */
+ "shll $3, %eax\n\t" /* *= 8 */
+ "addl $8, %eax\n\t" /* += 8 skip first entry */
+ "addl %eax, %edx\n\t"
+ "movswl (%edx), %eax\n\t" /* 'this' offset */
+ "addl %eax, %ecx\n\t"
+ "pushl %ecx\n\t"
+ "addl $4, %edx\n\t" /* += 4, method pointer */
+#else /* THUNK_BASED_THIS_ADJUST */
+ "pushl %ecx\n\t"
+ "movl (%ecx), %edx\n\t"
+ "movl 0x0c(%ebp), %eax\n\t" /* function index */
+ "leal (%edx,%eax,4), %edx\n\t"
+#endif
+ "call *(%edx)\n\t"
+#ifdef MOZ_PRESERVE_PIC
+ "movl -4(%ebp), %ebx\n\t"
+#endif
+ "movl %ebp, %esp\n\t"
+ "popl %ebp\n\t"
+ "ret\n"
+ ".size " SYMBOL_UNDERSCORE "XPTC_InvokeByIndex, . -" SYMBOL_UNDERSCORE "XPTC_InvokeByIndex\n\t"
+);
+
diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/os2/xptcinvoke_vacpp.asm b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/os2/xptcinvoke_vacpp.asm new file mode 100644 index 00000000..4d013fdb --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/os2/xptcinvoke_vacpp.asm @@ -0,0 +1,268 @@ +COMMENT | -*- Mode: asm; tab-width: 8; c-basic-offset: 4 -*- + + ***** BEGIN LICENSE BLOCK ***** + Version: MPL 1.1/GPL 2.0/LGPL 2.1 + + The contents of this file are subject to the Mozilla Public License Version + 1.1 (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + for the specific language governing rights and limitations under the + License. + + The Original Code is mozilla.org Code. + + The Initial Developer of the Original Code is + Netscape Communications Corporation. + Portions created by the Initial Developer are Copyright (C) 2001 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Henry Sobotka <sobotka@axess.com> + + Alternatively, the contents of this file may be used under the terms of + either of the GNU General Public License Version 2 or later (the "GPL"), + or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + in which case the provisions of the GPL or the LGPL are applicable instead + of those above. If you wish to allow use of your version of this file only + under the terms of either the GPL or the LGPL, and not to allow others to + use your version of this file under the terms of the MPL, indicate your + decision by deleting the provisions above and replace them with the notice + and other provisions required by the GPL or the LGPL. If you do not delete + the provisions above, a recipient may use your version of this file under + the terms of any one of the MPL, the GPL or the LGPL. + + ***** END LICENSE BLOCK ***** + 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. + + Contributor: Henry Sobotka <sobotka@axess.com> + + This Original Code has been modified by IBM Corporation. + Modifications made by IBM described herein are + Copyright (c) International Business Machines + Corporation, 2000 + + Modifications to Mozilla code or documentation + identified per MPL Section 3.3 + + Date Modified by Description of modification + 03/23/2000 IBM Corp. Various fixes for parameter passing and adjusting the 'this' + pointer for multiply inherited objects. + + xptcall_vacpp.asm: ALP assembler procedures for VAC++ build of xptcall + + We use essentially the same algorithm as the other platforms, except + Optlink as calling convention. This means loading the three leftmost + conforming (<= 4 bytes, enum or pointer) parameters into eax, edx and ecx, + and the four leftmost float types atop the FP stack. As "this" goes into + eax, we only have to load edx and ecx (if there are two parameters). + Nonconforming parameters go on the stack. As the right-size space has + to be allocated at the proper place (order of parameters) in the stack + for each conforming parameter, we simply copy them all. | + + + .486P + .MODEL FLAT, OPTLINK + .STACK + + .CODE + +t_Int4Bytes equ 001004h +t_Int8Bytes equ 001008h +t_Float4Bytes equ 000104h +t_Float8Bytes equ 000108h + +TypesArray dd t_Int4Bytes ; nsXPTType::T_I8 + dd t_Int4Bytes ; nsXPTType::T_I16 + dd t_Int4Bytes ; nsXPTType::T_I32 + dd t_Int8Bytes ; nsXPTType::T_I64 (***) + dd t_Int4Bytes ; nsXPTType::T_U8 + dd t_Int4Bytes ; nsXPTType::T_U16 + dd t_Int4Bytes ; nsXPTType::T_U32 + dd t_Int8Bytes ; nsXPTType::T_U64 (***) + dd t_Float4Bytes ; nsXPTType::T_FLOAT (***) + dd t_Float8Bytes ; nsXPTType::T_DOUBLE (***) + dd t_Int4Bytes ; nsXPTType::T_BOOL + dd t_Int4Bytes ; nsXPTType::T_CHAR + dd t_Int4Bytes ; nsXPTType::T_WCHAR + dd t_Int4Bytes ; TD_VOID + dd t_Int4Bytes ; TD_PNSIID + dd t_Int4Bytes ; TD_DOMSTRING + dd t_Int4Bytes ; TD_PSTRING + dd t_Int4Bytes ; TD_PWSTRING + dd t_Int4Bytes ; TD_INTERFACE_TYPE + dd t_Int4Bytes ; TD_INTERFACE_IS_TYPE + dd t_Int4Bytes ; TD_ARRAY + dd t_Int4Bytes ; TD_PSTRING_SIZE_IS + dd t_Int4Bytes ; TD_PWSTRING_SIZE_IS + dd t_Int4Bytes ; TD_UTF8STRING + dd t_Int4Bytes ; TD_CSTRING + dd t_Int4Bytes ; TD_ASTRING + ; All other values default to 4 byte int/ptr + + + + ; Optlink puts 'that' in eax, 'index' in edx, 'paramcount' in ecx + ; 'params' is on the stack... +XPTC_InvokeByIndex PROC OPTLINK EXPORT USES ebx edi esi, that, index, paramcount, params + + LOCAL cparams:dword, fparams:dword, reg_edx:dword, reg_ecx:dword, count:dword + + mov dword ptr [that], eax ; that + mov dword ptr [index], edx ; index + mov dword ptr [paramcount], ecx ; paramcount + mov dword ptr [count], ecx ; save a copy of count + +; #define FOURBYTES 4 +; #define EIGHTBYTES 8 +; #define FLOAT 0x00000100 +; #define INT 0x00001000 +; #define LENGTH 0x000000ff +; +;types[ ] = { +; FOURBYES | INT, // int/uint/ptr/etc +; EIGHTBYTES | INT, // long long +; FOURBYES | FLOAT, // float +; EIGHTBYTES | FLOAT // double +;}; +; params+00h = val // double +; params+08h = ptr +; params+0ch = type +; params+0dh = flags +; PTR_IS_DATA = 0x01 +; ecx = params +; edx = src +; edi = dst +; ebx = type (bh = int/float, bl = byte count) + + xor eax, eax + mov dword ptr [cparams],eax ; cparams = 0; + mov dword ptr [fparams],eax ; fparams = 0; + + shl ecx, 03h + sub esp, ecx ; dst/esp = add esp, paramCount * 8 + mov edi, esp + + push eax ; push 0 // "end" of floating point register stack... + + mov ecx, dword ptr [params] ; // params is a "register" variable +@While1: + mov eax, dword ptr [count] ; while( count-- ) + or eax, eax ; // (test for zero) + je @EndWhile1 + dec eax + mov dword ptr [count], eax + ; { + + test byte ptr [ecx+0dh],01h ; if ( params->flags & PTR_IS_DATA ) { + je @IfElse1 + lea edx, dword ptr [ecx+08h] ; src = ¶ms->ptr; + mov ebx, 01004h ; type = INT | FOURBYTES; + jmp @EndIf1 +@IfElse1: ; } else { + mov edx, ecx ; src = ¶ms->val + movzx eax, byte ptr [ecx+0ch] ; type = types[params->type]; + cmp eax, 22 ; // range check params->type... (0 to 22) + jle @TypeOK + mov eax,2 ; // all others default to 4 byte int +@TypeOK: + mov ebx, dword ptr [TypesArray+eax*4] +@EndIf1: ; } + + test bh, 001h ; if ( type & FLOAT ) { + je @EndIf2 + cmp dword ptr [fparams], 4 ; if ( fparams < 4 ) { + jge @EndIf3 + push edx ; push src; + push ebx ; push type + inc dword ptr [fparams] ; fparams++; +;;; movzx eax, bl ; // dst += (type & LENGTH); +;;; add edi, eax ; +;;; xor ebx, ebx ; // type = 0; // "handled" +@EndIf3: ; } +@EndIf2: ; } + + ; // copy bytes... +@While2: or bl, bl ; while( type & LENGTH ) { + je @EndWhile2 + test bh, 010h ; if( type & INT ) { + je @EndIf4 + cmp dword ptr [cparams], 8 ; if( cparams < 8 ) { + jge @EndIf5 + lea eax, dword ptr [reg_edx] ; (®_edx)[cparams] = *src; + sub eax, dword ptr [cparams] + mov esi, dword ptr [edx] + mov dword ptr [eax], esi + add dword ptr [cparams], 4 ; cparams += 4; +;;; jmp @NoCopy ; // goto nocopy; +@EndIf5: ; } +@EndIf4: ; } + mov eax, dword ptr [edx] ; *dst = *src; + mov dword ptr [edi], eax +@NoCopy: ;nocopy: + add edi, 4 ; dst++; + add edx, 4 ; src++; + sub bl, 4 ; type -= 4; + jmp @While2 +@EndWhile2: ; } + add ecx, 010h ; params++; + jmp @While1 +@EndWhile1: ; } + + ; // Set up fpu and regs can make the call... +@While3: pop ebx ; while ( pop type ) { + or ebx, ebx + je @EndWhile3 + pop edx ; pop src + cmp bl, 08h ; if( type & EIGHTBYTES ) { + jne @IfElse6 + fld qword ptr [edx] ; fld qword ptr [src] + jmp @EndIf6 +@IfElse6: ; } else { + fld dword ptr [edx] ; fld dword ptr [src] +@EndIf6: ; } + jmp @While3 +@EndWhile3: ; } + + ; make the call + mov eax, dword ptr [that] ; get 'that' ("this" ptr) + mov ebx, dword ptr [index] ; get index + shl ebx, 03h ; index *= 8 bytes per method + add ebx, 08h ; += 8 at head of vtable + add ebx, [eax] ; calculate address + + mov ecx, dword ptr [ebx+04h] + add eax, ecx + sub esp, 04h ; make room for 'this' ptr on stack + + mov edx, dword ptr [reg_edx] + mov ecx, dword ptr [reg_ecx] + + call dword ptr [ebx] ; call method + + mov ecx, dword ptr [paramcount] + shl ecx, 03h + add esp, ecx ; remove space on stack for params + add esp, 04h ; remove space on stack for 'this' ptr + ret + + ENDP + + END + + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/os2/xptcstubs_emx.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/os2/xptcstubs_emx.cpp new file mode 100644 index 00000000..6cde9231 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/os2/xptcstubs_emx.cpp @@ -0,0 +1,153 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Implement shared vtbl methods */ + +// This is a 98% copy of other implementations; see comment at top of +// xptcinvoke_emx.cpp for why this file exists. +// + +#include "xptcprivate.h" + +#if !defined(__EMX__) +#error "This code is for OS/2 EMX only" +#endif + +static nsresult +PrepareAndDispatch( nsXPTCStubBase *self, PRUint32 methodIndex, + PRUint32 *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; + + // If anything fails before stackBytesToPop can be set then + // the failure is completely catastrophic! + + 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; +} + +#define STUB_ENTRY(n) \ +nsresult nsXPTCStubBase::Stub##n() \ +{ \ + register void* method = PrepareAndDispatch; \ + register nsresult result; \ + __asm__ __volatile__( \ + "leal 0x0c(%%ebp), %%ecx\n\t" /* args */ \ + "pushl %%ecx\n\t" \ + "pushl $"#n"\n\t" /* method index */ \ + "movl 0x08(%%ebp), %%ecx\n\t" /* this */ \ + "pushl %%ecx\n\t" \ + "call *%%edx" /* PrepareAndDispatch */ \ + : "=a" (result) /* %0 */ \ + : "d" (method) /* %1 */ \ + : "ax", "dx", "cx", "memory" ); \ + return result; \ +} + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPCWrappedJS::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/os2/xptcstubs_gcc_x86_os2.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/os2/xptcstubs_gcc_x86_os2.cpp new file mode 100644 index 00000000..6304b67a --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/os2/xptcstubs_gcc_x86_os2.cpp @@ -0,0 +1,180 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1999
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/* Implement shared vtbl methods. */
+
+/* This file is basically a copy of xptcinvoke_gcc_x86_unix.cpp with some
+ * irrelevant parts stipped off and some OS/2 specific modifications added,
+ * so it needs to be kept in sync with the original. */
+
+#include "xptcprivate.h"
+#include "xptc_platforms_unixish_x86.h"
+#include "xptc_gcc_x86_unix.h"
+
+extern "C" {
+static nsresult ATTRIBUTE_USED
+__attribute__ ((regparm (3)))
+PrepareAndDispatch(uint32 methodIndex, nsXPTCStubBase* self, PRUint32* args)
+{
+#define PARAM_BUFFER_COUNT 16
+
+ nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];
+ nsXPTCMiniVariant* dispatchParams = NULL;
+ nsIInterfaceInfo* iface_info = NULL;
+ const nsXPTMethodInfo* info = NULL;
+ 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");
+ if (!iface_info)
+ return NS_ERROR_UNEXPECTED;
+
+ iface_info->GetMethodInfo(PRUint16(methodIndex), &info);
+ NS_ASSERTION(info,"no method info");
+ if (!info)
+ return NS_ERROR_UNEXPECTED;
+
+ 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");
+ if (!dispatchParams)
+ return NS_ERROR_OUT_OF_MEMORY;
+
+ 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
+ dp->val.p = (void*) *ap;
+ switch(type)
+ {
+ case nsXPTType::T_I64 : dp->val.i64 = *((PRInt64*) ap); ap++; break;
+ case nsXPTType::T_U64 : dp->val.u64 = *((PRUint64*)ap); ap++; break;
+ case nsXPTType::T_DOUBLE : dp->val.d = *((double*) ap); ap++; break;
+ }
+ }
+
+ result = self->CallMethod((PRUint16)methodIndex, info, dispatchParams);
+
+ NS_RELEASE(iface_info);
+
+ if(dispatchParams != paramBuffer)
+ delete [] dispatchParams;
+
+ return result;
+}
+} // extern "C"
+
+#if defined(__declspec)
+#define SYMBOL_EXPORT(sym) \
+ ".stabs \"" sym ",0=" sym ",code\", 0x6c,0,0,-42\n\t"
+#else
+#define SYMBOL_EXPORT(sym)
+#endif
+
+#define STUB_ENTRY(n) \
+asm(".text\n\t" \
+ ".align 2\n\t" \
+ ".if " #n " < 10\n\t" \
+ ".globl " SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase5Stub" #n "Ev\n\t" \
+ ".type " SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase5Stub" #n "Ev,@function\n" \
+ SYMBOL_EXPORT(SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase5Stub" #n "Ev") \
+ SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase5Stub" #n "Ev:\n\t" \
+ ".elseif " #n " < 100\n\t" \
+ ".globl " SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase6Stub" #n "Ev\n\t" \
+ ".type " SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase6Stub" #n "Ev,@function\n" \
+ SYMBOL_EXPORT(SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase6Stub" #n "Ev") \
+ SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase6Stub" #n "Ev:\n\t" \
+ ".elseif " #n " < 1000\n\t" \
+ ".globl " SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase7Stub" #n "Ev\n\t" \
+ ".type " SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase7Stub" #n "Ev,@function\n" \
+ SYMBOL_EXPORT(SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase7Stub" #n "Ev") \
+ SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase7Stub" #n "Ev:\n\t" \
+ ".else\n\t" \
+ ".err \"stub number " #n " >= 1000 not yet supported\"\n\t" \
+ ".endif\n\t" \
+ "movl $" #n ", %eax\n\t" \
+ "jmp " SYMBOL_UNDERSCORE "SharedStub\n\t" \
+ ".if " #n " < 10\n\t" \
+ ".size " SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase5Stub" #n "Ev,.-" SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase5Stub" #n "Ev\n\t" \
+ ".elseif " #n " < 100\n\t" \
+ ".size " SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase6Stub" #n "Ev,.-" SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase6Stub" #n "Ev\n\t" \
+ ".else\n\t" \
+ ".size " SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase7Stub" #n "Ev,.-" SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase7Stub" #n "Ev\n\t" \
+ ".endif");
+
+// static nsresult SharedStub(PRUint32 methodIndex) __attribute__((regparm(1)))
+asm(".text\n\t"
+ ".align 2\n\t"
+ ".type " SYMBOL_UNDERSCORE "SharedStub,@function\n\t"
+ SYMBOL_UNDERSCORE "SharedStub:\n\t"
+ "leal 0x08(%esp), %ecx\n\t"
+ "movl 0x04(%esp), %edx\n\t"
+ "jmp " SYMBOL_UNDERSCORE "PrepareAndDispatch\n\t"
+ ".size " SYMBOL_UNDERSCORE "SharedStub,.-" SYMBOL_UNDERSCORE "SharedStub");
+
+#define SENTINEL_ENTRY(n) \
+nsresult nsXPTCStubBase::Sentinel##n() \
+{ \
+ NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \
+ return NS_ERROR_NOT_IMPLEMENTED; \
+}
+
+#include "xptcstubsdef.inc"
+
+void
+xptc_dummy()
+{
+}
+
diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/os2/xptcstubs_os2.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/os2/xptcstubs_os2.cpp new file mode 100644 index 00000000..33e8574a --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/os2/xptcstubs_os2.cpp @@ -0,0 +1,195 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org Code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * John Fairhurst <john_fairhurst@iname.com> + * Henry Sobotka <sobotka@axess.com> added VAC++ support + * and fixed emx asm to work with gcc 2.95.2 (Jan. 2000) + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Implement shared vtbl methods */ + +#include "xptcprivate.h" + +#if !defined (__EMX__) && !defined(__IBMCPP__) +#error "This code is only for OS/2" +#endif + +// Procedure in xptcall_vacpp.asm +#ifdef XP_OS2_VACPP +extern nsresult SetEntryFromIndex(int stubidx); +#endif + +#ifdef XP_OS2_VACPP +nsresult +PrepareAndDispatch( nsXPTCStubBase *self, PRUint32 methodIndex, + PRUint32 *args) +#else +static nsresult +PrepareAndDispatch( nsXPTCStubBase *self, PRUint32 methodIndex, + PRUint32 *args) +#endif +{ +#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; + + // If anything fails before stackBytesToPop can be set then + // the failure is completely catastrophic! + + 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(); + +#ifdef XP_OS2_VACPP + /* If paramCount is > 0, write out the EDX pointer to the + space on the stack args[0]. args[-4] is the space on + the stack where it was pushed */ + if (paramCount) { + args[0] = args[-4]; + + /* If this is the second parameter, or if the first parameter is an + 8 byte long long, write out the ECX pointer to the space on the + stack args[1]. args[-3] is the space on the stack where it was + pushed */ + nsXPTType type = info->GetParam(0).GetType(); + if( paramCount > 1 || + type == nsXPTType::T_I64 || type == nsXPTType::T_U64 ) + { + args[1] = args[-3]; + } + } +#endif + + // 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; +} + +#ifdef XP_OS2_VACPP + +#define STUB_ENTRY(n) + +#else + +#define STUB_ENTRY(n) \ +nsresult nsXPTCStubBase::Stub##n() \ +{ \ + register nsresult (*method) (nsXPTCStubBase *, PRUint32, PRUint32 *) = PrepareAndDispatch; \ + int temp0, temp1; \ + register nsresult result; \ + __asm__ __volatile__( \ + "leal 0x0c(%%ebp), %%ecx\n\t" /* args */ \ + "pushl %%ecx\n\t" \ + "pushl $"#n"\n\t" /* method index */ \ + "movl 0x08(%%ebp), %%ecx\n\t" /* this */ \ + "pushl %%ecx\n\t" \ + "call *%%edx\n\t" /* PrepareAndDispatch */ \ + "addl $12, %%esp" \ + : "=a" (result), /* %0 */ \ + "=&c" (temp0), /* %1 */ \ + "=d" (temp1) /* %2 */ \ + : "2" (method) /* %2 */ \ + : "memory" ); \ + return result; \ +} +#endif + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPCWrappedJS::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/os2/xptcstubs_vacpp.asm b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/os2/xptcstubs_vacpp.asm new file mode 100644 index 00000000..3464a1f9 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/os2/xptcstubs_vacpp.asm @@ -0,0 +1,1563 @@ +COMMENT | -*- Mode: asm; tab-width: 8; c-basic-offset: 4 -*- + + ***** BEGIN LICENSE BLOCK ***** + Version: MPL 1.1/GPL 2.0/LGPL 2.1 + + The contents of this file are subject to the Mozilla Public License Version + 1.1 (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + for the specific language governing rights and limitations under the + License. + + The Original Code is mozilla.org Code. + + The Initial Developer of the Original Code is + Netscape Communications Corporation. + Portions created by the Initial Developer are Copyright (C) 2001 + the Initial Developer. All Rights Reserved. + + Contributor(s): + John Fairhurst <john_fairhurst@iname.com> + Henry Sobotka <sobotka@axess.com> + + Alternatively, the contents of this file may be used under the terms of + either of the GNU General Public License Version 2 or later (the "GPL"), + or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + in which case the provisions of the GPL or the LGPL are applicable instead + of those above. If you wish to allow use of your version of this file only + under the terms of either the GPL or the LGPL, and not to allow others to + use your version of this file under the terms of the MPL, indicate your + decision by deleting the provisions above and replace them with the notice + and other provisions required by the GPL or the LGPL. If you do not delete + the provisions above, a recipient may use your version of this file under + the terms of any one of the MPL, the GPL or the LGPL. + + ***** END LICENSE BLOCK ***** + 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. + + Contributor: Henry Sobotka <sobotka@axess.com> + + xptcallstub_vacpp.asm: ALP assembler procedure for VAC++ build of xptcall + | + + .486P + .MODEL FLAT, OPTLINK + .STACK + + .CODE + + EXTERN OPTLINK PrepareAndDispatch__FP14nsXPTCStubBaseUiPUi:PROC + +setentidx MACRO index + + push ecx ; Save parameters + push edx ; Save parameters - don't need to save eax - it is the "this" ptr + lea ecx, dword ptr [esp+10h] ; Load pointer to "args" into ecx + mov edx, index ; Move vtable index into edx + sub esp, 0ch ; Make room for three parameters on the stack + call PrepareAndDispatch__FP14nsXPTCStubBaseUiPUi + add esp, 14h ; Reset stack pointer + ret + ENDM + +; 251 STUB_ENTRY(249) + +Stub249__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0f9h +Stub249__14nsXPTCStubBaseFv endp + +; 250 STUB_ENTRY(248) + +Stub248__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0f8h +Stub248__14nsXPTCStubBaseFv endp + +; 249 STUB_ENTRY(247) + +Stub247__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0f7h +Stub247__14nsXPTCStubBaseFv endp + +; 248 STUB_ENTRY(246) + +Stub246__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0f6h +Stub246__14nsXPTCStubBaseFv endp + +; 247 STUB_ENTRY(245) + +Stub245__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0f5h +Stub245__14nsXPTCStubBaseFv endp + +; 246 STUB_ENTRY(244) + +Stub244__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0f4h +Stub244__14nsXPTCStubBaseFv endp + +; 245 STUB_ENTRY(243) + +Stub243__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0f3h +Stub243__14nsXPTCStubBaseFv endp + +; 244 STUB_ENTRY(242) + +Stub242__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0f2h +Stub242__14nsXPTCStubBaseFv endp + +; 243 STUB_ENTRY(241) + +Stub241__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0f1h +Stub241__14nsXPTCStubBaseFv endp + +; 242 STUB_ENTRY(240) + +Stub240__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0f0h +Stub240__14nsXPTCStubBaseFv endp + +; 241 STUB_ENTRY(239) + +Stub239__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0efh +Stub239__14nsXPTCStubBaseFv endp + +; 240 STUB_ENTRY(238) + +Stub238__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0eeh +Stub238__14nsXPTCStubBaseFv endp + +; 239 STUB_ENTRY(237) + +Stub237__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0edh +Stub237__14nsXPTCStubBaseFv endp + +; 238 STUB_ENTRY(236) + +Stub236__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0ech +Stub236__14nsXPTCStubBaseFv endp + +; 237 STUB_ENTRY(235) + +Stub235__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0ebh +Stub235__14nsXPTCStubBaseFv endp + +; 236 STUB_ENTRY(234) + +Stub234__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0eah +Stub234__14nsXPTCStubBaseFv endp + +; 235 STUB_ENTRY(233) + +Stub233__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0e9h +Stub233__14nsXPTCStubBaseFv endp + +; 234 STUB_ENTRY(232) + +Stub232__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0e8h +Stub232__14nsXPTCStubBaseFv endp + +; 233 STUB_ENTRY(231) + +Stub231__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0e7h +Stub231__14nsXPTCStubBaseFv endp + +; 232 STUB_ENTRY(230) + +Stub230__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0e6h +Stub230__14nsXPTCStubBaseFv endp + +; 231 STUB_ENTRY(229) + +Stub229__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0e5h +Stub229__14nsXPTCStubBaseFv endp + +; 230 STUB_ENTRY(228) + +Stub228__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0e4h +Stub228__14nsXPTCStubBaseFv endp + +; 229 STUB_ENTRY(227) + +Stub227__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0e3h +Stub227__14nsXPTCStubBaseFv endp + +; 228 STUB_ENTRY(226) + +Stub226__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0e2h +Stub226__14nsXPTCStubBaseFv endp + +; 227 STUB_ENTRY(225) + +Stub225__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0e1h +Stub225__14nsXPTCStubBaseFv endp + +; 226 STUB_ENTRY(224) + +Stub224__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0e0h +Stub224__14nsXPTCStubBaseFv endp + +; 225 STUB_ENTRY(223) + +Stub223__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0dfh +Stub223__14nsXPTCStubBaseFv endp + +; 224 STUB_ENTRY(222) + +Stub222__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0deh +Stub222__14nsXPTCStubBaseFv endp + +; 223 STUB_ENTRY(221) + +Stub221__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0ddh +Stub221__14nsXPTCStubBaseFv endp + +; 222 STUB_ENTRY(220) + +Stub220__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0dch +Stub220__14nsXPTCStubBaseFv endp + +; 221 STUB_ENTRY(219) + +Stub219__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0dbh +Stub219__14nsXPTCStubBaseFv endp + +; 220 STUB_ENTRY(218) + +Stub218__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0dah +Stub218__14nsXPTCStubBaseFv endp + +; 219 STUB_ENTRY(217) + +Stub217__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0d9h +Stub217__14nsXPTCStubBaseFv endp + +; 218 STUB_ENTRY(216) + +Stub216__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0d8h +Stub216__14nsXPTCStubBaseFv endp + +; 217 STUB_ENTRY(215) + +Stub215__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0d7h +Stub215__14nsXPTCStubBaseFv endp + +; 216 STUB_ENTRY(214) + +Stub214__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0d6h +Stub214__14nsXPTCStubBaseFv endp + +; 215 STUB_ENTRY(213) + +Stub213__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0d5h +Stub213__14nsXPTCStubBaseFv endp + +; 214 STUB_ENTRY(212) + +Stub212__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0d4h +Stub212__14nsXPTCStubBaseFv endp + +; 213 STUB_ENTRY(211) + +Stub211__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0d3h +Stub211__14nsXPTCStubBaseFv endp + +; 212 STUB_ENTRY(210) + +Stub210__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0d2h +Stub210__14nsXPTCStubBaseFv endp + +; 211 STUB_ENTRY(209) + +Stub209__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0d1h +Stub209__14nsXPTCStubBaseFv endp + +; 210 STUB_ENTRY(208) + +Stub208__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0d0h +Stub208__14nsXPTCStubBaseFv endp + +; 209 STUB_ENTRY(207) + +Stub207__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0cfh +Stub207__14nsXPTCStubBaseFv endp + +; 208 STUB_ENTRY(206) + +Stub206__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0ceh +Stub206__14nsXPTCStubBaseFv endp + +; 207 STUB_ENTRY(205) + +Stub205__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0cdh +Stub205__14nsXPTCStubBaseFv endp + +; 206 STUB_ENTRY(204) + +Stub204__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0cch +Stub204__14nsXPTCStubBaseFv endp + +; 205 STUB_ENTRY(203) + +Stub203__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0cbh +Stub203__14nsXPTCStubBaseFv endp + +; 204 STUB_ENTRY(202) + +Stub202__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0cah +Stub202__14nsXPTCStubBaseFv endp + +; 203 STUB_ENTRY(201) + +Stub201__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0c9h +Stub201__14nsXPTCStubBaseFv endp + +; 202 STUB_ENTRY(200) + +Stub200__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0c8h +Stub200__14nsXPTCStubBaseFv endp + +; 201 STUB_ENTRY(199) + +Stub199__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0c7h +Stub199__14nsXPTCStubBaseFv endp + +; 200 STUB_ENTRY(198) + +Stub198__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0c6h +Stub198__14nsXPTCStubBaseFv endp + +; 199 STUB_ENTRY(197) + +Stub197__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0c5h +Stub197__14nsXPTCStubBaseFv endp + +; 198 STUB_ENTRY(196) + +Stub196__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0c4h +Stub196__14nsXPTCStubBaseFv endp + +; 197 STUB_ENTRY(195) + +Stub195__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0c3h +Stub195__14nsXPTCStubBaseFv endp + +; 196 STUB_ENTRY(194) + +Stub194__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0c2h +Stub194__14nsXPTCStubBaseFv endp + +; 195 STUB_ENTRY(193) + +Stub193__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0c1h +Stub193__14nsXPTCStubBaseFv endp + +; 194 STUB_ENTRY(192) + +Stub192__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0c0h +Stub192__14nsXPTCStubBaseFv endp + +; 193 STUB_ENTRY(191) + +Stub191__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0bfh +Stub191__14nsXPTCStubBaseFv endp + +; 192 STUB_ENTRY(190) + +Stub190__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0beh +Stub190__14nsXPTCStubBaseFv endp + +; 191 STUB_ENTRY(189) + +Stub189__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0bdh +Stub189__14nsXPTCStubBaseFv endp + +; 190 STUB_ENTRY(188) + +Stub188__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0bch +Stub188__14nsXPTCStubBaseFv endp + +; 189 STUB_ENTRY(187) + +Stub187__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0bbh +Stub187__14nsXPTCStubBaseFv endp + +; 188 STUB_ENTRY(186) + +Stub186__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0bah +Stub186__14nsXPTCStubBaseFv endp + +; 187 STUB_ENTRY(185) + +Stub185__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0b9h +Stub185__14nsXPTCStubBaseFv endp + +; 186 STUB_ENTRY(184) + +Stub184__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0b8h +Stub184__14nsXPTCStubBaseFv endp + +; 185 STUB_ENTRY(183) + +Stub183__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0b7h +Stub183__14nsXPTCStubBaseFv endp + +; 184 STUB_ENTRY(182) + +Stub182__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0b6h +Stub182__14nsXPTCStubBaseFv endp + +; 183 STUB_ENTRY(181) + +Stub181__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0b5h +Stub181__14nsXPTCStubBaseFv endp + +; 182 STUB_ENTRY(180) + +Stub180__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0b4h +Stub180__14nsXPTCStubBaseFv endp + +; 181 STUB_ENTRY(179) + +Stub179__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0b3h +Stub179__14nsXPTCStubBaseFv endp + +; 180 STUB_ENTRY(178) + +Stub178__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0b2h +Stub178__14nsXPTCStubBaseFv endp + +; 179 STUB_ENTRY(177) + +Stub177__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0b1h +Stub177__14nsXPTCStubBaseFv endp + +; 178 STUB_ENTRY(176) + +Stub176__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0b0h +Stub176__14nsXPTCStubBaseFv endp + +; 177 STUB_ENTRY(175) + +Stub175__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0afh +Stub175__14nsXPTCStubBaseFv endp + +; 176 STUB_ENTRY(174) + +Stub174__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0aeh +Stub174__14nsXPTCStubBaseFv endp + +; 175 STUB_ENTRY(173) + +Stub173__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0adh +Stub173__14nsXPTCStubBaseFv endp + +; 174 STUB_ENTRY(172) + +Stub172__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0ach +Stub172__14nsXPTCStubBaseFv endp + +; 173 STUB_ENTRY(171) + +Stub171__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0abh +Stub171__14nsXPTCStubBaseFv endp + +; 172 STUB_ENTRY(170) + +Stub170__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0aah +Stub170__14nsXPTCStubBaseFv endp + +; 171 STUB_ENTRY(169) + +Stub169__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0a9h +Stub169__14nsXPTCStubBaseFv endp + +; 170 STUB_ENTRY(168) + +Stub168__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0a8h +Stub168__14nsXPTCStubBaseFv endp + +; 169 STUB_ENTRY(167) + +Stub167__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0a7h +Stub167__14nsXPTCStubBaseFv endp + +; 168 STUB_ENTRY(166) + +Stub166__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0a6h +Stub166__14nsXPTCStubBaseFv endp + +; 167 STUB_ENTRY(165) + +Stub165__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0a5h +Stub165__14nsXPTCStubBaseFv endp + +; 166 STUB_ENTRY(164) + +Stub164__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0a4h +Stub164__14nsXPTCStubBaseFv endp + +; 165 STUB_ENTRY(163) + +Stub163__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0a3h +Stub163__14nsXPTCStubBaseFv endp + +; 164 STUB_ENTRY(162) + +Stub162__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0a2h +Stub162__14nsXPTCStubBaseFv endp + +; 163 STUB_ENTRY(161) + +Stub161__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0a1h +Stub161__14nsXPTCStubBaseFv endp + +; 162 STUB_ENTRY(160) + +Stub160__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0a0h +Stub160__14nsXPTCStubBaseFv endp + +; 161 STUB_ENTRY(159) + +Stub159__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 09fh +Stub159__14nsXPTCStubBaseFv endp + +; 160 STUB_ENTRY(158) + +Stub158__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 09eh +Stub158__14nsXPTCStubBaseFv endp + +; 159 STUB_ENTRY(157) + +Stub157__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 09dh +Stub157__14nsXPTCStubBaseFv endp + +; 158 STUB_ENTRY(156) + +Stub156__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 09ch +Stub156__14nsXPTCStubBaseFv endp + +; 157 STUB_ENTRY(155) + +Stub155__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 09bh +Stub155__14nsXPTCStubBaseFv endp + +; 156 STUB_ENTRY(154) + +Stub154__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 09ah +Stub154__14nsXPTCStubBaseFv endp + +; 155 STUB_ENTRY(153) + +Stub153__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 099h +Stub153__14nsXPTCStubBaseFv endp + +; 154 STUB_ENTRY(152) + +Stub152__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 098h +Stub152__14nsXPTCStubBaseFv endp + +; 153 STUB_ENTRY(151) + +Stub151__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 097h +Stub151__14nsXPTCStubBaseFv endp + +; 152 STUB_ENTRY(150) + +Stub150__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 096h +Stub150__14nsXPTCStubBaseFv endp + +; 151 STUB_ENTRY(149) + +Stub149__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 095h +Stub149__14nsXPTCStubBaseFv endp + +; 150 STUB_ENTRY(148) + +Stub148__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 094h +Stub148__14nsXPTCStubBaseFv endp + +; 149 STUB_ENTRY(147) + +Stub147__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 093h +Stub147__14nsXPTCStubBaseFv endp + +; 148 STUB_ENTRY(146) + +Stub146__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 092h +Stub146__14nsXPTCStubBaseFv endp + +; 147 STUB_ENTRY(145) + +Stub145__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 091h +Stub145__14nsXPTCStubBaseFv endp + +; 146 STUB_ENTRY(144) + +Stub144__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 090h +Stub144__14nsXPTCStubBaseFv endp + +; 145 STUB_ENTRY(143) + +Stub143__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 08fh +Stub143__14nsXPTCStubBaseFv endp + +; 144 STUB_ENTRY(142) + +Stub142__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 08eh +Stub142__14nsXPTCStubBaseFv endp + +; 143 STUB_ENTRY(141) + +Stub141__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 08dh +Stub141__14nsXPTCStubBaseFv endp + +; 142 STUB_ENTRY(140) + +Stub140__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 08ch +Stub140__14nsXPTCStubBaseFv endp + +; 141 STUB_ENTRY(139) + +Stub139__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 08bh +Stub139__14nsXPTCStubBaseFv endp + +; 140 STUB_ENTRY(138) + +Stub138__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 08ah +Stub138__14nsXPTCStubBaseFv endp + +; 139 STUB_ENTRY(137) + +Stub137__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 089h +Stub137__14nsXPTCStubBaseFv endp + +; 138 STUB_ENTRY(136) + +Stub136__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 088h +Stub136__14nsXPTCStubBaseFv endp + +; 137 STUB_ENTRY(135) + +Stub135__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 087h +Stub135__14nsXPTCStubBaseFv endp + +; 136 STUB_ENTRY(134) + +Stub134__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 086h +Stub134__14nsXPTCStubBaseFv endp + +; 135 STUB_ENTRY(133) + +Stub133__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 085h +Stub133__14nsXPTCStubBaseFv endp + +; 134 STUB_ENTRY(132) + +Stub132__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 084h +Stub132__14nsXPTCStubBaseFv endp + +; 133 STUB_ENTRY(131) + +Stub131__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 083h +Stub131__14nsXPTCStubBaseFv endp + +; 132 STUB_ENTRY(130) + +Stub130__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 082h +Stub130__14nsXPTCStubBaseFv endp + +; 131 STUB_ENTRY(129) + +Stub129__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 081h +Stub129__14nsXPTCStubBaseFv endp + +; 130 STUB_ENTRY(128) + +Stub128__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 080h +Stub128__14nsXPTCStubBaseFv endp + +; 129 STUB_ENTRY(127) + +Stub127__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 07fh +Stub127__14nsXPTCStubBaseFv endp + +; 128 STUB_ENTRY(126) + +Stub126__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 07eh +Stub126__14nsXPTCStubBaseFv endp + +; 127 STUB_ENTRY(125) + +Stub125__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 07dh +Stub125__14nsXPTCStubBaseFv endp + +; 126 STUB_ENTRY(124) + +Stub124__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 07ch +Stub124__14nsXPTCStubBaseFv endp + +; 125 STUB_ENTRY(123) + +Stub123__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 07bh +Stub123__14nsXPTCStubBaseFv endp + +; 124 STUB_ENTRY(122) + +Stub122__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 07ah +Stub122__14nsXPTCStubBaseFv endp + +; 123 STUB_ENTRY(121) + +Stub121__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 079h +Stub121__14nsXPTCStubBaseFv endp + +; 122 STUB_ENTRY(120) + +Stub120__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 078h +Stub120__14nsXPTCStubBaseFv endp + +; 121 STUB_ENTRY(119) + +Stub119__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 077h +Stub119__14nsXPTCStubBaseFv endp + +; 120 STUB_ENTRY(118) + +Stub118__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 076h +Stub118__14nsXPTCStubBaseFv endp + +; 119 STUB_ENTRY(117) + +Stub117__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 075h +Stub117__14nsXPTCStubBaseFv endp + +; 118 STUB_ENTRY(116) + +Stub116__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 074h +Stub116__14nsXPTCStubBaseFv endp + +; 117 STUB_ENTRY(115) + +Stub115__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 073h +Stub115__14nsXPTCStubBaseFv endp + +; 116 STUB_ENTRY(114) + +Stub114__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 072h +Stub114__14nsXPTCStubBaseFv endp + +; 115 STUB_ENTRY(113) + +Stub113__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 071h +Stub113__14nsXPTCStubBaseFv endp + +; 114 STUB_ENTRY(112) + +Stub112__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 070h +Stub112__14nsXPTCStubBaseFv endp + +; 113 STUB_ENTRY(111) + +Stub111__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 06fh +Stub111__14nsXPTCStubBaseFv endp + +; 112 STUB_ENTRY(110) + +Stub110__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 06eh +Stub110__14nsXPTCStubBaseFv endp + +; 111 STUB_ENTRY(109) + +Stub109__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 06dh +Stub109__14nsXPTCStubBaseFv endp + +; 110 STUB_ENTRY(108) + +Stub108__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 06ch +Stub108__14nsXPTCStubBaseFv endp + +; 109 STUB_ENTRY(107) + +Stub107__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 06bh +Stub107__14nsXPTCStubBaseFv endp + +; 108 STUB_ENTRY(106) + +Stub106__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 06ah +Stub106__14nsXPTCStubBaseFv endp + +; 107 STUB_ENTRY(105) + +Stub105__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 069h +Stub105__14nsXPTCStubBaseFv endp + +; 106 STUB_ENTRY(104) + +Stub104__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 068h +Stub104__14nsXPTCStubBaseFv endp + +; 105 STUB_ENTRY(103) + +Stub103__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 067h +Stub103__14nsXPTCStubBaseFv endp + +; 104 STUB_ENTRY(102) + +Stub102__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 066h +Stub102__14nsXPTCStubBaseFv endp + +; 103 STUB_ENTRY(101) + +Stub101__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 065h +Stub101__14nsXPTCStubBaseFv endp + +; 102 STUB_ENTRY(100) + +Stub100__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 064h +Stub100__14nsXPTCStubBaseFv endp + +; 101 STUB_ENTRY(99) + +Stub99__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 063h +Stub99__14nsXPTCStubBaseFv endp + +; 100 STUB_ENTRY(98) + +Stub98__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 062h +Stub98__14nsXPTCStubBaseFv endp + +; 99 STUB_ENTRY(97) + +Stub97__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 061h +Stub97__14nsXPTCStubBaseFv endp + +; 98 STUB_ENTRY(96) + +Stub96__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 060h +Stub96__14nsXPTCStubBaseFv endp + +; 97 STUB_ENTRY(95) + +Stub95__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 05fh +Stub95__14nsXPTCStubBaseFv endp + +; 96 STUB_ENTRY(94) + +Stub94__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 05eh +Stub94__14nsXPTCStubBaseFv endp + +; 95 STUB_ENTRY(93) + +Stub93__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 05dh +Stub93__14nsXPTCStubBaseFv endp + +; 94 STUB_ENTRY(92) + +Stub92__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 05ch +Stub92__14nsXPTCStubBaseFv endp + +; 93 STUB_ENTRY(91) + +Stub91__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 05bh +Stub91__14nsXPTCStubBaseFv endp + +; 92 STUB_ENTRY(90) + +Stub90__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 05ah +Stub90__14nsXPTCStubBaseFv endp + +; 91 STUB_ENTRY(89) + +Stub89__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 059h +Stub89__14nsXPTCStubBaseFv endp + +; 90 STUB_ENTRY(88) + +Stub88__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 058h +Stub88__14nsXPTCStubBaseFv endp + +; 89 STUB_ENTRY(87) + +Stub87__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 057h +Stub87__14nsXPTCStubBaseFv endp + +; 88 STUB_ENTRY(86) + +Stub86__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 056h +Stub86__14nsXPTCStubBaseFv endp + +; 87 STUB_ENTRY(85) + +Stub85__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 055h +Stub85__14nsXPTCStubBaseFv endp + +; 86 STUB_ENTRY(84) + +Stub84__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 054h +Stub84__14nsXPTCStubBaseFv endp + +; 85 STUB_ENTRY(83) + +Stub83__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 053h +Stub83__14nsXPTCStubBaseFv endp + +; 84 STUB_ENTRY(82) + +Stub82__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 052h +Stub82__14nsXPTCStubBaseFv endp + +; 83 STUB_ENTRY(81) + +Stub81__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 051h +Stub81__14nsXPTCStubBaseFv endp + +; 82 STUB_ENTRY(80) + +Stub80__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 050h +Stub80__14nsXPTCStubBaseFv endp + +; 81 STUB_ENTRY(79) + +Stub79__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 04fh +Stub79__14nsXPTCStubBaseFv endp + +; 80 STUB_ENTRY(78) + +Stub78__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 04eh +Stub78__14nsXPTCStubBaseFv endp + +; 79 STUB_ENTRY(77) + +Stub77__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 04dh +Stub77__14nsXPTCStubBaseFv endp + +; 78 STUB_ENTRY(76) + +Stub76__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 04ch +Stub76__14nsXPTCStubBaseFv endp + +; 77 STUB_ENTRY(75) + +Stub75__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 04bh +Stub75__14nsXPTCStubBaseFv endp + +; 76 STUB_ENTRY(74) + +Stub74__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 04ah +Stub74__14nsXPTCStubBaseFv endp + +; 75 STUB_ENTRY(73) + +Stub73__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 049h +Stub73__14nsXPTCStubBaseFv endp + +; 74 STUB_ENTRY(72) + +Stub72__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 048h +Stub72__14nsXPTCStubBaseFv endp + +; 73 STUB_ENTRY(71) + +Stub71__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 047h +Stub71__14nsXPTCStubBaseFv endp + +; 72 STUB_ENTRY(70) + +Stub70__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 046h +Stub70__14nsXPTCStubBaseFv endp + +; 71 STUB_ENTRY(69) + +Stub69__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 045h +Stub69__14nsXPTCStubBaseFv endp + +; 70 STUB_ENTRY(68) + +Stub68__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 044h +Stub68__14nsXPTCStubBaseFv endp + +; 69 STUB_ENTRY(67) + +Stub67__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 043h +Stub67__14nsXPTCStubBaseFv endp + +; 68 STUB_ENTRY(66) + +Stub66__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 042h +Stub66__14nsXPTCStubBaseFv endp + +; 67 STUB_ENTRY(65) + +Stub65__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 041h +Stub65__14nsXPTCStubBaseFv endp + +; 66 STUB_ENTRY(64) + +Stub64__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 040h +Stub64__14nsXPTCStubBaseFv endp + +; 65 STUB_ENTRY(63) + +Stub63__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 03fh +Stub63__14nsXPTCStubBaseFv endp + +; 64 STUB_ENTRY(62) + +Stub62__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 03eh +Stub62__14nsXPTCStubBaseFv endp + +; 63 STUB_ENTRY(61) + +Stub61__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 03dh +Stub61__14nsXPTCStubBaseFv endp + +; 62 STUB_ENTRY(60) + +Stub60__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 03ch +Stub60__14nsXPTCStubBaseFv endp + +; 61 STUB_ENTRY(59) + +Stub59__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 03bh +Stub59__14nsXPTCStubBaseFv endp + +; 60 STUB_ENTRY(58) + +Stub58__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 03ah +Stub58__14nsXPTCStubBaseFv endp + +; 59 STUB_ENTRY(57) + +Stub57__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 039h +Stub57__14nsXPTCStubBaseFv endp + +; 58 STUB_ENTRY(56) + +Stub56__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 038h +Stub56__14nsXPTCStubBaseFv endp + +; 57 STUB_ENTRY(55) + +Stub55__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 037h +Stub55__14nsXPTCStubBaseFv endp + +; 56 STUB_ENTRY(54) + +Stub54__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 036h +Stub54__14nsXPTCStubBaseFv endp + +; 55 STUB_ENTRY(53) + +Stub53__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 035h +Stub53__14nsXPTCStubBaseFv endp + +; 54 STUB_ENTRY(52) + +Stub52__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 034h +Stub52__14nsXPTCStubBaseFv endp + +; 53 STUB_ENTRY(51) + +Stub51__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 033h +Stub51__14nsXPTCStubBaseFv endp + +; 52 STUB_ENTRY(50) + +Stub50__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 032h +Stub50__14nsXPTCStubBaseFv endp + +; 51 STUB_ENTRY(49) + +Stub49__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 031h +Stub49__14nsXPTCStubBaseFv endp + +; 50 STUB_ENTRY(48) + +Stub48__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 030h +Stub48__14nsXPTCStubBaseFv endp + +; 49 STUB_ENTRY(47) + +Stub47__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 02fh +Stub47__14nsXPTCStubBaseFv endp + +; 48 STUB_ENTRY(46) + +Stub46__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 02eh +Stub46__14nsXPTCStubBaseFv endp + +; 47 STUB_ENTRY(45) + +Stub45__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 02dh +Stub45__14nsXPTCStubBaseFv endp + +; 46 STUB_ENTRY(44) + +Stub44__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 02ch +Stub44__14nsXPTCStubBaseFv endp + +; 45 STUB_ENTRY(43) + +Stub43__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 02bh +Stub43__14nsXPTCStubBaseFv endp + +; 44 STUB_ENTRY(42) + +Stub42__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 02ah +Stub42__14nsXPTCStubBaseFv endp + +; 43 STUB_ENTRY(41) + +Stub41__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 029h +Stub41__14nsXPTCStubBaseFv endp + +; 42 STUB_ENTRY(40) + +Stub40__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 028h +Stub40__14nsXPTCStubBaseFv endp + +; 41 STUB_ENTRY(39) + +Stub39__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 027h +Stub39__14nsXPTCStubBaseFv endp + +; 40 STUB_ENTRY(38) + +Stub38__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 026h +Stub38__14nsXPTCStubBaseFv endp + +; 39 STUB_ENTRY(37) + +Stub37__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 025h +Stub37__14nsXPTCStubBaseFv endp + +; 38 STUB_ENTRY(36) + +Stub36__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 024h +Stub36__14nsXPTCStubBaseFv endp + +; 37 STUB_ENTRY(35) + +Stub35__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 023h +Stub35__14nsXPTCStubBaseFv endp + +; 36 STUB_ENTRY(34) + +Stub34__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 022h +Stub34__14nsXPTCStubBaseFv endp + +; 35 STUB_ENTRY(33) + +Stub33__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 021h +Stub33__14nsXPTCStubBaseFv endp + +; 34 STUB_ENTRY(32) + +Stub32__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 020h +Stub32__14nsXPTCStubBaseFv endp + +; 33 STUB_ENTRY(31) + +Stub31__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 01fh +Stub31__14nsXPTCStubBaseFv endp + +; 32 STUB_ENTRY(30) + +Stub30__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 01eh +Stub30__14nsXPTCStubBaseFv endp + +; 31 STUB_ENTRY(29) + +Stub29__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 01dh +Stub29__14nsXPTCStubBaseFv endp + +; 30 STUB_ENTRY(28) + +Stub28__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 01ch +Stub28__14nsXPTCStubBaseFv endp + +; 29 STUB_ENTRY(27) + +Stub27__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 01bh +Stub27__14nsXPTCStubBaseFv endp + +; 28 STUB_ENTRY(26) + +Stub26__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 01ah +Stub26__14nsXPTCStubBaseFv endp + +; 27 STUB_ENTRY(25) + +Stub25__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 019h +Stub25__14nsXPTCStubBaseFv endp + +; 26 STUB_ENTRY(24) + +Stub24__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 018h +Stub24__14nsXPTCStubBaseFv endp + +; 25 STUB_ENTRY(23) + +Stub23__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 017h +Stub23__14nsXPTCStubBaseFv endp + +; 24 STUB_ENTRY(22) + +Stub22__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 016h +Stub22__14nsXPTCStubBaseFv endp + +; 23 STUB_ENTRY(21) + +Stub21__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 015h +Stub21__14nsXPTCStubBaseFv endp + +; 22 STUB_ENTRY(20) + +Stub20__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 014h +Stub20__14nsXPTCStubBaseFv endp + +; 21 STUB_ENTRY(19) + +Stub19__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 013h +Stub19__14nsXPTCStubBaseFv endp + +; 20 STUB_ENTRY(18) + +Stub18__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 012h +Stub18__14nsXPTCStubBaseFv endp + +; 19 STUB_ENTRY(17) + +Stub17__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 011h +Stub17__14nsXPTCStubBaseFv endp + +; 18 STUB_ENTRY(16) + +Stub16__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 010h +Stub16__14nsXPTCStubBaseFv endp + +; 17 STUB_ENTRY(15) + +Stub15__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0fh +Stub15__14nsXPTCStubBaseFv endp + +; 16 STUB_ENTRY(14) + +Stub14__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0eh +Stub14__14nsXPTCStubBaseFv endp + +; 15 STUB_ENTRY(13) + +Stub13__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0dh +Stub13__14nsXPTCStubBaseFv endp + +; 14 STUB_ENTRY(12) + +Stub12__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0ch +Stub12__14nsXPTCStubBaseFv endp + +; 13 STUB_ENTRY(11) + +Stub11__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0bh +Stub11__14nsXPTCStubBaseFv endp + +; 12 STUB_ENTRY(10) + +Stub10__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 0ah +Stub10__14nsXPTCStubBaseFv endp + +; 11 STUB_ENTRY(9) + +Stub9__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 09h +Stub9__14nsXPTCStubBaseFv endp + +; 10 STUB_ENTRY(8) + +Stub8__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 08h +Stub8__14nsXPTCStubBaseFv endp + +; 9 STUB_ENTRY(7) + +Stub7__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 07h +Stub7__14nsXPTCStubBaseFv endp + +; 8 STUB_ENTRY(6) + +Stub6__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 06h +Stub6__14nsXPTCStubBaseFv endp + +; 7 STUB_ENTRY(5) + +Stub5__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 05h +Stub5__14nsXPTCStubBaseFv endp + +; 6 STUB_ENTRY(4) + +Stub4__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 04h +Stub4__14nsXPTCStubBaseFv endp + +; 5 STUB_ENTRY(3) + +Stub3__14nsXPTCStubBaseFv PROC OPTLINK EXPORT + setentidx 03h +Stub3__14nsXPTCStubBaseFv endp + + + END + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/test/.cvsignore b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/test/.cvsignore new file mode 100644 index 00000000..055e647f --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/test/.cvsignore @@ -0,0 +1,2 @@ +Makefile +invoke_test diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/test/Makefile.in b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/test/Makefile.in new file mode 100644 index 00000000..dbf0f64d --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/test/Makefile.in @@ -0,0 +1,50 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1998 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = ../../../../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = xpcom +CPPSRCS = stub_test.cpp #invoke_test.cpp +SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=$(BIN_SUFFIX)) + +include $(topsrcdir)/config/rules.mk + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/test/README b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/test/README new file mode 100644 index 00000000..04850b2e --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/test/README @@ -0,0 +1,6 @@ +These are just simple test programs in which stripped down versions of the +XPConnect invoke and stubs code can be built and tested as the code is brought +up on various platforms. These probrams do not test the param sizing and copying +functionality of the routines. However, they do supply a place where the lowest +level assembly language code can be developed and debugged in the simplest of +contexts before it is moved into the real routines.
\ No newline at end of file diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/test/clean.bat b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/test/clean.bat new file mode 100644 index 00000000..f320e222 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/test/clean.bat @@ -0,0 +1,5 @@ +@echo off +echo deleting intermediate files +if exist *.obj del *.obj > NUL +if exist *.ilk del *.ilk > NUL +if exist *.pdb del *.pdb > NUL
\ No newline at end of file diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/test/invoke_test.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/test/invoke_test.cpp new file mode 100644 index 00000000..376ba58f --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/test/invoke_test.cpp @@ -0,0 +1,239 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include <stdio.h> + +typedef unsigned nsresult; +typedef unsigned PRUint32; +typedef unsigned nsXPCVariant; + + +#if defined(WIN32) +#define NS_IMETHOD virtual nsresult __stdcall +#define NS_IMETHODIMP nsresult __stdcall +#else +#define NS_IMETHOD virtual nsresult +#define NS_IMETHODIMP nsresult +#endif + + +class base{ +public: + NS_IMETHOD ignored() = 0; +}; + +class foo : public base { +public: + NS_IMETHOD callme1(int i, int j) = 0; + NS_IMETHOD callme2(int i, int j) = 0; + NS_IMETHOD callme3(int i, int j) = 0; +}; + +class bar : public foo{ +public: + NS_IMETHOD ignored(); + NS_IMETHOD callme1(int i, int j); + NS_IMETHOD callme2(int i, int j); + NS_IMETHOD callme3(int i, int j); +}; + +/* +class baz : public base { +public: + NS_IMETHOD ignored(); + NS_IMETHOD callme1(); + NS_IMETHOD callme2(); + NS_IMETHOD callme3(); + void setfoo(foo* f) {other = f;} + + foo* other; +}; +NS_IMETHODIMP baz::ignored(){return 0;} +*/ + +NS_IMETHODIMP bar::ignored(){return 0;} + +NS_IMETHODIMP bar::callme1(int i, int j) +{ + printf("called bar::callme1 with: %d %d\n", i, j); + return 5; +} + +NS_IMETHODIMP bar::callme2(int i, int j) +{ + printf("called bar::callme2 with: %d %d\n", i, j); + return 5; +} + +NS_IMETHODIMP bar::callme3(int i, int j) +{ + printf("called bar::callme3 with: %d %d\n", i, j); + return 5; +} + +void docall(foo* f, int i, int j){ + f->callme1(i, j); +} + +/***************************************************************************/ +#if defined(WIN32) + +static PRUint32 __stdcall +invoke_count_words(PRUint32 paramCount, nsXPCVariant* s) +{ + return paramCount; +} + +static void __stdcall +invoke_copy_to_stack(PRUint32* d, PRUint32 paramCount, nsXPCVariant* s) +{ + for(PRUint32 i = 0; i < paramCount; i++, d++, s++) + { + *((PRUint32*)d) = *((PRUint32*)s); + } +} + +static nsresult __stdcall +DoInvoke(void* that, PRUint32 index, + PRUint32 paramCount, nsXPCVariant* params) +{ + __asm { + push params + push paramCount + call invoke_count_words // stdcall, result in eax + shl eax,2 // *= 4 + sub esp,eax // make space for params + mov edx,esp + push params + push paramCount + push edx + call invoke_copy_to_stack // stdcall + mov ecx,that // instance in ecx + push ecx // push this + mov edx,[ecx] // vtable in edx + mov eax,index + shl eax,2 // *= 4 + add edx,eax + call [edx] // stdcall, i.e. callee cleans up stack. + } +} + +#else +/***************************************************************************/ +// just Linux_x86 now. Add other later... + +static PRUint32 +invoke_count_words(PRUint32 paramCount, nsXPCVariant* s) +{ + return paramCount; +} + +static void +invoke_copy_to_stack(PRUint32* d, PRUint32 paramCount, nsXPCVariant* s) +{ + for(PRUint32 i = 0; i < paramCount; i++, d++, s++) + { + *((PRUint32*)d) = *((PRUint32*)s); + } +} + +static nsresult +DoInvoke(void* that, PRUint32 index, + PRUint32 paramCount, nsXPCVariant* params) +{ + PRUint32 result; + void* fn_count = invoke_count_words; + void* fn_copy = invoke_copy_to_stack; + + __asm__ __volatile__( + "pushl %4\n\t" + "pushl %3\n\t" + "movl %5, %%eax\n\t" + "call *%%eax\n\t" /* count words */ + "addl $0x8, %%esp\n\t" + "shl $2, %%eax\n\t" /* *= 4 */ + "subl %%eax, %%esp\n\t" /* make room for params */ + "movl %%esp, %%edx\n\t" + "pushl %4\n\t" + "pushl %3\n\t" + "pushl %%edx\n\t" + "movl %6, %%eax\n\t" + "call *%%eax\n\t" /* copy params */ + "addl $0xc, %%esp\n\t" + "movl %1, %%ecx\n\t" + "pushl %%ecx\n\t" + "movl (%%ecx), %%edx\n\t" + "movl %2, %%eax\n\t" /* function index */ + "shl $2, %%eax\n\t" /* *= 4 */ + "addl $8, %%eax\n\t" /* += 8 */ + "addl %%eax, %%edx\n\t" + "call *(%%edx)\n\t" /* safe to not cleanup esp */ + "movl %%eax, %0" + : "=g" (result) /* %0 */ + : "g" (that), /* %1 */ + "g" (index), /* %2 */ + "g" (paramCount), /* %3 */ + "g" (params), /* %4 */ + "g" (fn_count), /* %5 */ + "g" (fn_copy) /* %6 */ + : "ax", "cx", "dx", "memory" + ); + + return result; +} + +#endif +/***************************************************************************/ + +int main() +{ + nsXPCVariant params1[2] = {1,2}; + nsXPCVariant params2[2] = {2,4}; + nsXPCVariant params3[2] = {3,6}; + + foo* a = new bar(); + +// printf("calling via C++...\n"); +// docall(a, 12, 24); + + printf("calling via ASM...\n"); + DoInvoke(a, 1, 2, params1); + DoInvoke(a, 2, 2, params2); + DoInvoke(a, 3, 2, params3); + + return 0; +} diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/test/mk_invoke.bat b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/test/mk_invoke.bat new file mode 100644 index 00000000..10a9be51 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/test/mk_invoke.bat @@ -0,0 +1,9 @@ +@echo off +@echo deleing old output +if exist invoke_test.obj del invoke_test.obj > NUL +if exist invoke_test.ilk del invoke_test.ilk > NUL +if exist *.pdb del *.pdb > NUL +if exist invoke_test.exe del invoke_test.exe > NUL + +@echo building... +cl /nologo -Zi -DWIN32 invoke_test.cpp
\ No newline at end of file diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/test/mk_stub.bat b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/test/mk_stub.bat new file mode 100644 index 00000000..f9af17af --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/test/mk_stub.bat @@ -0,0 +1,9 @@ +@echo off +@echo deleing old output +if exist stub_test.obj del stub_test.obj > NUL +if exist stub_test.ilk del stub_test.ilk > NUL +if exist *.pdb del *.pdb > NUL +if exist stub_test.exe del stub_test.exe > NUL + +@echo building... +cl /nologo -Zi -DWIN32 stub_test.cpp
\ No newline at end of file diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/test/stub_test.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/test/stub_test.cpp new file mode 100644 index 00000000..10935299 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/test/stub_test.cpp @@ -0,0 +1,210 @@ + +#include <stdio.h> + +typedef unsigned nsresult; +typedef unsigned PRUint32; +typedef unsigned nsXPCVariant; + + +#if defined(WIN32) +#define NS_IMETHOD virtual nsresult __stdcall +#define NS_IMETHODIMP nsresult __stdcall +#else +#define NS_IMETHOD virtual nsresult +#define NS_IMETHODIMP nsresult +#endif + + +class base{ +public: + NS_IMETHOD ignored() = 0; +}; + +class foo : public base { +public: + NS_IMETHOD callme1(int i, int j) = 0; + NS_IMETHOD callme2(int i, int j) = 0; + NS_IMETHOD callme3(int i, int j) = 0; +}; + +class bar : public foo{ +public: + NS_IMETHOD ignored(); + NS_IMETHOD callme1(int i, int j); + NS_IMETHOD callme2(int i, int j); + NS_IMETHOD callme3(int i, int j); +}; + +class baz : public base { +public: + NS_IMETHOD ignored(); + NS_IMETHOD callme1(); + NS_IMETHOD callme2(); + NS_IMETHOD callme3(); + void setfoo(foo* f) {other = f;} + + foo* other; +}; +NS_IMETHODIMP baz::ignored(){return 0;} + +NS_IMETHODIMP bar::ignored(){return 0;} + +NS_IMETHODIMP bar::callme1(int i, int j) +{ + printf("called bar::callme1 with: %d %d\n", i, j); + return 15; +} + +NS_IMETHODIMP bar::callme2(int i, int j) +{ + printf("called bar::callme2 with: %d %d\n", i, j); + return 25; +} + +NS_IMETHODIMP bar::callme3(int i, int j) +{ + printf("called bar::callme3 with: %d %d\n", i, j); + return 35; +} + +void docall(foo* f, int i, int j){ + f->callme1(i, j); +} + +/***************************************************************************/ +#if defined(WIN32) + +static int __stdcall +PrepareAndDispatch(baz* self, PRUint32 methodIndex, + PRUint32* args, PRUint32* stackBytesToPop) +{ + fprintf(stdout, "PrepareAndDispatch (%p, %d, %p)\n", + (void*)self, methodIndex, (void*)args); + foo* a = self->other; + int p1 = (int) *args; + int p2 = (int) *(args+1); + int out = 0; + switch(methodIndex) + { + case 1: out = a->callme1(p1, p2); break; + case 2: out = a->callme2(p1, p2); break; + case 3: out = a->callme3(p1, p2); break; + } + *stackBytesToPop = 2*4; + return out; +} + +#ifndef __GNUC__ +static __declspec(naked) void SharedStub(void) +{ + __asm { + push ebp // set up simple stack frame + mov ebp, esp // stack has: ebp/vtbl_index/retaddr/this/args + push ecx // make room for a ptr + lea eax, [ebp-4] // pointer to stackBytesToPop + push eax + lea ecx, [ebp+16] // pointer to args + push ecx + mov edx, [ebp+4] // vtbl_index + push edx + mov eax, [ebp+12] // this + push eax + call PrepareAndDispatch + mov edx, [ebp+8] // return address + mov ecx, [ebp-4] // stackBytesToPop + add ecx, 12 // for this, the index, and ret address + mov esp, ebp + pop ebp + add esp, ecx // fix up stack pointer + jmp edx // simulate __stdcall return + } +} + +// these macros get expanded (many times) in the file #included below +#define STUB_ENTRY(n) \ +__declspec(naked) nsresult __stdcall baz::callme##n() \ +{ __asm push n __asm jmp SharedStub } + +#else /* __GNUC__ */ + +#define STUB_ENTRY(n) \ +nsresult __stdcall baz::callme##n() \ +{ \ + PRUint32 *args, stackBytesToPop; \ + int result = 0; \ + baz *obj; \ + __asm__ __volatile__ ( \ + "leal 0x0c(%%ebp), %0\n\t" /* args */ \ + "movl 0x08(%%ebp), %1\n\t" /* this */ \ + : "=r" (args), \ + "=r" (obj)); \ + result = PrepareAndDispatch(obj, n, args,&stackBytesToPop); \ + fprintf(stdout, "stub returning: %d\n", result); \ + fprintf(stdout, "bytes to pop: %d\n", stackBytesToPop); \ + return result; \ +} + +#endif /* ! __GNUC__ */ + +#else +/***************************************************************************/ +// just Linux_x86 now. Add other later... + +static int +PrepareAndDispatch(baz* self, PRUint32 methodIndex, PRUint32* args) +{ + foo* a = self->other; + int p1 = (int) *args; + int p2 = (int) *(args+1); + switch(methodIndex) + { + case 1: a->callme1(p1, p2); break; + case 2: a->callme2(p1, p2); break; + case 3: a->callme3(p1, p2); break; + } + return 1; +} + +#define STUB_ENTRY(n) \ +nsresult baz::callme##n() \ +{ \ + register void* method = PrepareAndDispatch; \ + register nsresult result; \ + __asm__ __volatile__( \ + "leal 0x0c(%%ebp), %%ecx\n\t" /* args */ \ + "pushl %%ecx\n\t" \ + "pushl $"#n"\n\t" /* method index */ \ + "movl 0x08(%%ebp), %%ecx\n\t" /* this */ \ + "pushl %%ecx\n\t" \ + "call *%%edx" /* PrepareAndDispatch */ \ + : "=a" (result) /* %0 */ \ + : "d" (method) /* %1 */ \ + : "memory" ); \ + return result; \ +} + +#endif +/***************************************************************************/ + +STUB_ENTRY(1) +STUB_ENTRY(2) +STUB_ENTRY(3) + +int main() +{ + foo* a = new bar(); + baz* b = new baz(); + + /* here we make the global 'check for alloc failure' checker happy */ + if(!a || !b) + return 1; + + foo* c = (foo*)b; + + b->setfoo(a); + c->callme1(1,2); + c->callme2(2,4); + c->callme3(3,6); + + return 0; +} diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/.cvsignore b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/.cvsignore new file mode 100644 index 00000000..ff6fd9bc --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/.cvsignore @@ -0,0 +1,2 @@ +Makefile +xptcstubs_asm_mips.s diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/Makefile.in b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/Makefile.in new file mode 100644 index 00000000..78bf1f92 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/Makefile.in @@ -0,0 +1,416 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1998 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = ../../../../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = xpcom +LIBRARY_NAME = xptcmd + +# +# The default is this buildable, but non-functioning code. +# +CPPSRCS := xptcinvoke_unsupported.cpp xptcstubs_unsupported.cpp + +# Force use of PIC +FORCE_USE_PIC = 1 + +include $(topsrcdir)/config/config.mk + +###################################################################### +# i386 and beyond +###################################################################### +# +# Lots of Unixish x86 flavors +# +ifneq (,$(filter FreeBSD NetBSD OpenBSD BSD_OS Darwin,$(OS_ARCH))) +ifeq (86,$(findstring 86,$(OS_TEST))) +CPPSRCS := xptcinvoke_unixish_x86.cpp xptcstubs_unixish_x86.cpp +endif +endif +# +# New code for Linux, et. al., with gcc +# Migrate other platforms here after testing +# +ifneq (,$(filter Linux,$(OS_ARCH))) +# Linux/x86-64 +ifeq (x86_64,$(OS_TEST)) +CPPSRCS := xptcinvoke_x86_64_linux.cpp xptcstubs_x86_64_linux.cpp +else +ifeq (86,$(findstring 86,$(OS_TEST))) +CPPSRCS := xptcinvoke_gcc_x86_unix.cpp xptcstubs_gcc_x86_unix.cpp +endif +endif +endif +# IA64 Linux +ifneq (,$(filter Linux,$(OS_ARCH))) +ifneq (,$(findstring ia64,$(OS_TEST))) +CPPSRCS := xptcinvoke_ipf64.cpp xptcstubs_ipf64.cpp +ASFILES := xptcstubs_asm_ipf64.s xptcinvoke_asm_ipf64.s +endif +endif +# +# BeOS/Intel (uses the same unixish_x86 code) +# +ifeq ($(OS_ARCH)$(OS_TEST),BeOSBePC) +CPPSRCS := xptcinvoke_unixish_x86.cpp xptcstubs_unixish_x86.cpp +endif +# +# Neutrino/Intel (uses the same unixish_x86 code) +# +ifeq ($(OS_TARGET)$(OS_TEST),NTOx86) +CPPSRCS := xptcinvoke_unixish_x86.cpp xptcstubs_unixish_x86.cpp +endif + +###################################################################### +# Solaris/Intel +###################################################################### +# +# Solaris/Intel +# +ifeq ($(OS_ARCH),SunOS) +ifeq ($(OS_TEST),i86pc) +CPPSRCS := xptcinvoke_x86_solaris.cpp xptcstubs_x86_solaris.cpp +# 28817: if Solaris Intel OS, and native compiler, always build optimised. +ifndef GNU_CC +CXXFLAGS += -O +endif +endif +endif + +###################################################################### +# Alpha +###################################################################### +# +# Tru64/Alpha +# +ifeq ($(OS_ARCH)$(OS_TEST),OSF1alpha) +CPPSRCS := xptcinvoke_osf1_alpha.cpp xptcstubs_osf1_alpha.cpp +ASFILES := xptcinvoke_asm_osf1_alpha.s xptcstubs_asm_osf1_alpha.s +endif +# +# Linux/Alpha +# +ifneq (,$(filter Linuxalpha FreeBSDalpha NetBSDalpha,$(OS_ARCH)$(OS_TEST))) +CPPSRCS := xptcinvoke_linux_alpha.cpp xptcstubs_linux_alpha.cpp +endif +# +# OpenVMS/Alpha +# +ifeq ($(OS_ARCH)$(CPU_ARCH),OpenVMSAlpha) +CPPSRCS := xptcinvoke_openvms_alpha.cpp xptcstubs_openvms_alpha.cpp +ASFILES := xptcinvoke_asm_openvms_alpha.s xptcstubs_asm_openvms_alpha.s +endif + +###################################################################### +# ARM +###################################################################### +# +# Linux/ARM +# +ifeq ($(OS_ARCH),Linux) +ifneq (,$(filter arm% sa110,$(OS_TEST))) +CPPSRCS := xptcinvoke_arm.cpp xptcstubs_arm.cpp +CXXFLAGS += -O2 +endif +endif +# +# NetBSD/ARM +# +ifeq ($(OS_ARCH),NetBSD) +ifneq (,$(filter arm% sa110,$(OS_TEST))) +CPPSRCS := xptcinvoke_arm_netbsd.cpp xptcstubs_arm_netbsd.cpp +endif +endif + +###################################################################### +# HPPA +###################################################################### +# +# HP-UX/PA32 +# +# for gas and gcc, check comment in xptcinvoke_asm_pa32.s +ifeq ($(OS_ARCH),HP-UX) +ifneq ($(CC),gcc) +ifneq ($(OS_TEST),ia64) +CPPSRCS := xptcinvoke_pa32.cpp xptcstubs_pa32.cpp +ASFILES := xptcstubs_asm_pa32.s xptcinvoke_asm_pa32.s +else +CPPSRCS := xptcinvoke_ipf32.cpp xptcstubs_ipf32.cpp +ASFILES := xptcstubs_asm_ipf32.s xptcinvoke_asm_ipf32.s +endif + +# #18875 Building the CPP's (CXX) optimized causes a crash +CXXFLAGS := $(filter-out $(MOZ_OPTIMIZE_FLAGS), $(CXXFLAGS)) +endif +endif + +###################################################################### +# M68k +###################################################################### +# +# NetBSD/m68k +# +ifeq ($(OS_ARCH),NetBSD) +ifneq (,$(filter amiga atari hp300 mac68k mvme68k next68k sun3 sun3x x68k,$(OS_TEST))) +CPPSRCS := xptcinvoke_netbsd_m68k.cpp xptcstubs_netbsd_m68k.cpp +endif +endif + +# +# Linux/m68k +# +ifeq ($(OS_ARCH),Linux) +ifeq ($(OS_TEST),m68k) +CPPSRCS := xptcinvoke_linux_m68k.cpp xptcstubs_linux_m68k.cpp +endif +endif + +###################################################################### +# MIPS +###################################################################### +# +# IRIX/MIPS +# +ifeq ($(OS_ARCH),IRIX) +ifneq ($(basename $(OS_RELEASE)),5) +CPPSRCS := xptcinvoke_irix.cpp xptcstubs_irix.cpp +ASFILES := xptcinvoke_asm_irix.s xptcstubs_asm_irix.s +ifdef GNU_CC +ASFLAGS += -Wa,-D__GNUC__ +else +CXXFLAGS := $(shell echo $(CXXFLAGS) | sed 's/-O\(3\|fast\)/-O2/g') +endif +endif +endif + +ifeq ($(OS_ARCH),Linux) +ifneq (,$(findstring mips, $(OS_TEST))) +CPPSRCS := xptcinvoke_mips.cpp xptcstubs_mips.cpp +ASFILES := xptcinvoke_asm_mips.s xptcstubs_asm_mips.s +#xptcstubs_mips.cpp +# xptcstubs_asm_mips.s +ifdef GNU_CC +ASFLAGS += $(INCLUDES) -x assembler-with-cpp -D__GNUC__ +endif +endif +endif + +###################################################################### +# PowerPC +###################################################################### +# +# AIX/PPC +# +ifeq ($(OS_ARCH),AIX) +ifdef HAVE_64BIT_OS +CPPSRCS := xptcinvoke_ppc_aix64.cpp xptcstubs_ppc_aix64.cpp +ASFILES := xptcinvoke_asm_ppc_aix64.s xptcstubs_asm_ppc_aix64.s +else +ifeq ($(AIX_OBJMODEL),ibm) +CPPSRCS := xptcinvoke_ppc_aix.cpp xptcstubs_ppc_aix.cpp +ASFILES := xptcinvoke_asm_ppc_ibmobj_aix.s xptcstubs_asm_ppc_aix.s +else +CPPSRCS := xptcinvoke_ppc_aix.cpp xptcstubs_ppc_aix.cpp +ASFILES := xptcinvoke_asm_ppc_aix.s xptcstubs_asm_ppc_aix.s +endif +endif + +# #24617 Building the CPP's (CXX) optimized causes a crash +CXXFLAGS := $(filter-out $(MOZ_OPTIMIZE_FLAGS), $(CXXFLAGS)) +endif + +# +# Linux/PPC +# +ifeq ($(OS_ARCH)$(OS_TEST),Linuxppc) +CPPSRCS := xptcinvoke_ppc_linux.cpp xptcstubs_ppc_linux.cpp +ASFILES := xptcinvoke_asm_ppc_linux.s xptcstubs_asm_ppc_linux.s +AS := $(CC) -c -x assembler-with-cpp +endif + +# +# NetBSD/PPC +# +ifneq (,$(filter NetBSDmacppc NetBSDbebox NetBSDofppc NetBSDprep NetBSDamigappc,$(OS_ARCH)$(OS_TEST))) +CPPSRCS := xptcinvoke_ppc_netbsd.cpp xptcstubs_ppc_netbsd.cpp +ASFILES := xptcinvoke_asm_ppc_netbsd.s xptcstubs_asm_ppc_netbsd.s +endif + +# +# Darwin/PPC +# +ifeq ($(OS_ARCH),Darwin) +ifeq ($(TARGET_CPU), powerpc) +ASFLAGS += -x assembler-with-cpp # assumes $(AS) == $(CC) +ifdef HAVE_GCC3_ABI +ASFLAGS += -DHAVE_GCC3_ABI +endif +CPPSRCS := xptcinvoke_ppc_rhapsody.cpp xptcstubs_ppc_rhapsody.cpp +ASFILES := xptcinvoke_asm_ppc_rhapsody.s xptcstubs_asm_ppc_darwin.s +endif +endif + +###################################################################### +# SPARC +###################################################################### +# +# BSD_OS/SPARC +# +ifeq ($(OS_ARCH),BSD_OS) +ifneq (,$(findstring sparc,$(OS_TEST))) +CPPSRCS := xptcinvoke_sparc_solaris.cpp xptcstubs_sparc_solaris.cpp +ASFILES := xptcinvoke_asm_sparc_bsdos.s xptcstubs_asm_sparc_solaris.s +endif +endif +# +# Linux/SPARC +# +ifeq ($(OS_ARCH),Linux) +ifneq (,$(findstring sparc,$(OS_TEST))) +CPPSRCS := xptcinvoke_sparc_solaris.cpp xptcstubs_sparc_solaris.cpp +ifdef HAVE_GCC3_ABI +ASFILES := xptcinvoke_asm_sparc_linux_GCC3.s xptcstubs_asm_sparc_solaris.s +else +ASFILES := xptcinvoke_asm_sparc_linux.s xptcstubs_asm_sparc_solaris.s +endif +endif +endif +# +# NetBSD/SPARC +# +ifeq ($(OS_ARCH)$(OS_TEST),NetBSDsparc) +CPPSRCS := xptcinvoke_sparc_netbsd.cpp xptcstubs_sparc_netbsd.cpp +ASFILES := xptcinvoke_asm_sparc_netbsd.s xptcstubs_asm_sparc_netbsd.s +endif +# +# Solaris/SPARC +# +ifeq ($(OS_ARCH),SunOS) +ifneq (86,$(findstring 86,$(OS_TEST))) +ifdef HAVE_64BIT_OS +CPPSRCS := xptcinvoke_sparcv9_solaris.cpp xptcstubs_sparcv9_solaris.cpp +else +CPPSRCS := xptcinvoke_sparc_solaris.cpp xptcstubs_sparc_solaris.cpp +endif + +ifeq ($(GNU_CC),1) +ifdef HAVE_GCC3_ABI +ASFILES := xptcinvoke_asm_sparc_solaris_GCC3.s xptcstubs_asm_sparc_solaris.s +else +ASFILES := xptcinvoke_asm_sparc_solaris_GCC.s xptcstubs_asm_sparc_solaris.s +endif +else +ifdef HAVE_64BIT_OS +ASFILES := xptcinvoke_asm_sparcv9_solaris_SUNW.s xptcstubs_asm_sparcv9_solaris.s +else +ASFILES := xptcinvoke_asm_sparc_solaris_SUNW.s xptcstubs_asm_sparc_solaris.s +endif +endif + +endif +endif + +###################################################################### +# S/390 +###################################################################### +# +# Linux for S/390 +# +ifeq ($(OS_ARCH)$(OS_TEST),Linuxs390) +CPPSRCS := xptcinvoke_linux_s390.cpp xptcstubs_linux_s390.cpp +endif + +ifeq ($(OS_ARCH)$(OS_TEST),Linuxs390x) +CPPSRCS := xptcinvoke_linux_s390x.cpp xptcstubs_linux_s390x.cpp +endif + + +# we don't want the shared lib, but we want to force the creation of a static lib. +FORCE_STATIC_LIB = 1 + +include $(topsrcdir)/config/rules.mk + +DEFINES += -DEXPORT_XPTC_API + +INCLUDES += -I$(srcdir)/../.. + +ifeq ($(OS_ARCH),Linux) +ifneq (,$(findstring mips, $(OS_TEST))) +xptcstubs_asm_mips.o: xptcstubs_asm_mips.s.m4 $(PUBLIC)/xptcstubsdef.inc + m4 $(INCLUDES) $< > ./xptcstubs_asm_mips.s && \ + $(AS) -o $@ $(ASFLAGS) $(AS_DASH_C_FLAG) ./xptcstubs_asm_mips.s + $(RM) -f ./xptcstubs_asm_mips.s +endif +endif + +ifeq ($(OS_ARCH),Darwin) +xptcstubs_asm_ppc_darwin.o: xptcstubs_asm_ppc_darwin.s.m4 $(PUBLIC)/xptcstubsdef.inc Makefile + gm4 $(INCLUDES) $< > ./xptcstubs_asm_ppc_darwin.s && \ + $(AS) -o $@ $(ASFLAGS) $(AS_DASH_C_FLAG) ./xptcstubs_asm_ppc_darwin.s + $(RM) -f ./xptcstubs_asm_ppc_darwin.s +endif + +ifeq ($(OS_ARCH),IRIX) +# The assembler on IRIX (6.3 only?) seems to have trouble with the default command, +# but works fine if we first copy the header and source file into the current dir. +xptcstubs_asm_irix.o: $(PUBLIC)/xptcstubsdef.inc $(srcdir)/xptcstubs_asm_irix.s + @rm -f ./xptcstubsdef.inc + @cp $(PUBLIC)/xptcstubsdef.inc . + @if test ! -f ./Makefile.in; then rm -f ./xptcstubs_asm_irix.s; cp $(srcdir)/xptcstubs_asm_irix.s .; else true; fi + $(AS) -o $@ $(ASFLAGS) $(AS_DASH_C_FLAG) ./xptcstubs_asm_irix.s + @rm -f ./xptcstubsdef.inc + @if test ! -f ./Makefile.in; then rm -f ./xptcstubs_asm_irix.s; else true; fi +endif + +ifeq ($(OS_ARCH),OpenVMS) +# Our assembler wants the include file to be of assembler syntax, not C/C++ +# syntax, so we have to massage it slightly. + +xptcstubs_asm_openvms_alpha.o: $(PUBLIC)/xptcstubsdef.inc $(srcdir)/xptcstubs_asm_openvms_alpha.s + sed \ + -e 's/^\(.*_ENTRY\)(\([0-9]*\))/ \1 \2/' \ + -e 's/\/\*\(.*\)\*\//; \1/' \ + $(PUBLIC)/xptcstubsdef.inc > ./xptcstubsdef_asm.vms + $(AS) -o $@ $(ASFLAGS) $(AS_DASH_C_FLAG) $(srcdir)/xptcstubs_asm_openvms_alpha.s + @rm -f ./xptcstubsdef_asm.vms +endif + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/vtable_layout_x86.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/vtable_layout_x86.cpp new file mode 100644 index 00000000..912f50e4 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/vtable_layout_x86.cpp @@ -0,0 +1,62 @@ +/* this code contributed by Bert Driehuis <bert_driehuis@nl.compuware.com> */ + +#include <stdio.h> + +// Try to determine the vtable layout generated by G++ +// Produces the offset at which the first vtable entry can be +// found, and the factor to apply for subsequent entries on stdout. +// Example output: +// #define GCC_VTABLE_START 0xc +// #define GCC_VTABLE_FACTOR 0x8 + +class test { +public: + virtual int t1(void); + virtual int t2(void); + int x; +}; + +test::test() { this->x = 0x12121212; }; + +int test::t1(void) { return 1; } +int test::t2(void) { return 2; } + +void die(char *x) { + fprintf(stderr, "%s\n", x); + exit(1); +} + +int +main() +{ + int i; + test *t = new test(); + int *tp = (int *) t; + int off1 = -1; + int off2 = -1; + int factor; + int factorshift; + + if (*tp++ != 0x12121212) + die("Integer element test::x not found!"); + tp = (int *) *tp; + for (i = 0; i < 10; i++) { + if (tp[i] == (int) t->t1) + off1 = i; + if (tp[i] == (int) t->t2) + off2 = i; + } + if (off1 == -1 || off2 == -1) + die("Could not determine offset into vtable!"); + factor = (off2 - off1) * 4; + factorshift = -1; + while (factor) { + factorshift++; + factor >>= 1; + } + printf("/* Automatically generated by vtable_layout_x86.cpp */\n"); + printf("#define GCC_VTABLE_START\t0x%x\n", off1 * 4); + printf("#define GCC_VTABLE_FACTOR\t0x%x\n", (off2 - off1) * 4); + printf("#define GCC_VTABLE_SHIFT\t0x%x\n", factorshift); + exit(0); +} diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptc_gcc_x86_unix.h b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptc_gcc_x86_unix.h new file mode 100644 index 00000000..707352aa --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptc_gcc_x86_unix.h @@ -0,0 +1,92 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Special include file for xptc*_gcc_x86_unix.cpp */ + +// +// this may improve the static function calls, but may not. +// + +// #define MOZ_USE_STDCALL + +#ifdef MOZ_USE_STDCALL +#define ATTRIBUTE_STDCALL __attribute__ ((__stdcall__)) +#else +#define ATTRIBUTE_STDCALL +#endif + +#ifdef MOZ_NEED_LEADING_UNDERSCORE +#define SYMBOL_UNDERSCORE "_" +#else +#define SYMBOL_UNDERSCORE +#endif + +/* + What are those keeper functions? + + The problem: gcc doesn't know that the assembler routines call + static functions so gcc may not emit the definition (i.e., the + code) for these functions. In gcc 3.1 and up + "__attribute__ ((used))" exists and solves the problem. + For older gcc versions it's not so easy. One could use the + -fkeep-inline-functions but that keeps a surprising number of + functions which bloats the compiled library. It seems otherwise + harmless, though. Alternatively, one could use + -fno-inline-functions which works right now but might cause a + slowdown under some circumstances. The problem with these methods + is that they do not automatically adapt to the compiler used. + + The best solution seems to be to create dummy functions that + reference the appropriate static functions. It's then necessary + to "use" these functions in a way that gcc will not optimize + away. The keeper functions use assembly code to confuse gcc. + + One drawback is that the keeper functions are externally visible + so they shouldn't do anything harmful. + + With the right linker, one could make the keeper functions local + so they wouldn't be visible. + */ + + +// gcc 3.1 and up +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) +#define ATTRIBUTE_USED __attribute__ ((__used__)) +#else +#define ATTRIBUTE_USED +#endif + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptc_platforms_unixish_x86.h b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptc_platforms_unixish_x86.h new file mode 100644 index 00000000..23eb23ee --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptc_platforms_unixish_x86.h @@ -0,0 +1,161 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Platform specific #defines to be shared by the various platforms sharing +* the unixish_86 code +*/ + +/* +* The goal here is to clearly define the binary compatibility parameters for +* the platforms that will use this code. Rather than switch at compile time +* based on the compiler that happens to be in use we are forcing implementors +* to make a conscious decision. +* +* For some of these platforms the community may choose to have more than one +* binary model in effect. In that case I suggest that there be explicit sub +* defines for that platform specifying 'TYPE1', 'TYPE2', etc. The decision on +* which 'TYPE' to use would be triggered by a setting passed through from the +* config system. +* +* For example we might end up with something like: +* +* #elif defined(NTO) +* # if defined(TYPE1) +* # define CFRONT_STYLE_THIS_ADJUST +* # elif defined(TYPE1) +* # define THUNK_BASED_THIS_ADJUST +* # else +* # error "need TYPE1 or TYPE2 for NTO" +* # endif +* #elif defined(__BEOS__) +* +* and so on.... +* +*/ + +#if defined(LINUX) + +#if (__GNUC__ == 2) && (__GNUC_MINOR__ <= 7) +/* Old gcc 2.7.x.x. What does gcc 2.8.x do?? */ +#define CFRONT_STYLE_THIS_ADJUST +#else +/* egcs and later */ +#define THUNK_BASED_THIS_ADJUST +#endif + +#elif defined(__FreeBSD__) +/* System versions of gcc on FreeBSD don't use thunks. On 3.x, the system + * compiler is gcc 2.7.2.3, which doesn't use thunks by default. On 4.x and + * 5.x, /usr/src/contrib/gcc/config/freebsd.h explicitly undef's + * DEFAULT_VTABLE_THUNKS. (The one exception is a brief period (September + * 1999 - Jan 2000) during 4.0-CURRENT, after egcs was merged -- + * this was changed before 4.0-RELEASE, but we can handle it anyway.) + * + * Versions of gcc from the ports collection (/usr/ports/lang/egcs), + * however, have DEFAULT_VTABLE_THUNKS #defined to 1, at least + * in all ports collections since the 2.95 merge. (Supporting optional + * compilers from FreeBSD 3.2 or earlier seems unnecessary). + * + * The easiest way to distinguish the ports collection gcc from the system + * gcc is that the system gcc defines __FreeBSD_cc_version. This variable + * can also identify versions that use thunks. This includes some 4.x versions + * and now newer 5.x versions. + */ +#if defined(__FreeBSD_cc_version) && \ + (__FreeBSD_cc_version < 500003) && \ + (__FreeBSD_cc_version < 400002 || __FreeBSD_cc_version > 400003) +#define CFRONT_STYLE_THIS_ADJUST +#else +#define THUNK_BASED_THIS_ADJUST +#endif + +#elif defined(__NetBSD__) +#define THUNK_BASED_THIS_ADJUST + +#elif defined(__OpenBSD__) +/* OpenBSD instroduces GCC 2.95.x in late May 1999 */ +#include <sys/param.h> +#if OpenBSD <= 199905 +#define THUNK_BASED_THIS_ADJUST +#else +#define CFRONT_STYLE_THIS_ADJUST +#endif + +#elif defined(__bsdi__) +#include <sys/param.h> +#if _BSDI_VERSION >= 199910 +/* BSDI/4.1 ships with egcs, ergo thunk-based */ +#define THUNK_BASED_THIS_ADJUST +#else +#define CFRONT_STYLE_THIS_ADJUST +#endif + +#elif defined(NTO) +#define CFRONT_STYLE_THIS_ADJUST + +#elif defined(__BEOS__) +#define CFRONT_STYLE_THIS_ADJUST + +#elif defined(__sun__) || defined(__sun) +#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */ +#define THUNK_BASED_THIS_ADJUST +#else +#define CFRONT_STYLE_THIS_ADJUST +#endif + +#elif defined(_WIN32) +#define THUNK_BASED_THIS_ADJUST + +#elif defined(__EMX__) +#define THUNK_BASED_THIS_ADJUST + +#elif defined (__APPLE__) && (__MACH__) +#define THUNK_BASED_THIS_ADJUST + +#else +#error "need a platform define if using unixish x86 code" +#endif + +/***************************************************************************/ + +#if !defined(THUNK_BASED_THIS_ADJUST) && !defined(CFRONT_STYLE_THIS_ADJUST) +#error "need to define 'this' adjust scheme" +#endif + +#if defined(THUNK_BASED_THIS_ADJUST) && defined(CFRONT_STYLE_THIS_ADJUST) +#error "need to define only ONE 'this' adjust scheme" +#endif diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_amd64_darwin.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_amd64_darwin.cpp new file mode 100644 index 00000000..af2919d8 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_amd64_darwin.cpp @@ -0,0 +1,218 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org Code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +// Platform specific code to invoke XPCOM methods on native objects + +#include "xptcprivate.h" + +// 6 integral parameters are passed in registers +const PRUint32 GPR_COUNT = 6; + +// 8 floating point parameters are passed in SSE registers +const PRUint32 FPR_COUNT = 8; + +// Remember that these 'words' are 64-bit long +static inline void +invoke_count_words(PRUint32 paramCount, nsXPTCVariant * s, + PRUint32 & nr_gpr, PRUint32 & nr_fpr, PRUint32 & nr_stack) +{ + nr_gpr = 1; // skip one GP register for 'that' + nr_fpr = 0; + nr_stack = 0; + + /* Compute number of eightbytes of class MEMORY. */ + for (uint32 i = 0; i < paramCount; i++, s++) { + if (!s->IsPtrData() + && (s->type == nsXPTType::T_FLOAT || s->type == nsXPTType::T_DOUBLE)) { + if (nr_fpr < FPR_COUNT) + nr_fpr++; + else + nr_stack++; + } + else { + if (nr_gpr < GPR_COUNT) + nr_gpr++; + else + nr_stack++; + } + } +} + +static void +invoke_copy_to_stack(PRUint64 * d, PRUint32 paramCount, nsXPTCVariant * s, + PRUint64 * gpregs, double * fpregs) +{ + PRUint32 nr_gpr = 1; // skip one GP register for 'that' + PRUint32 nr_fpr = 0; + PRUint64 value; + + for (uint32 i = 0; i < paramCount; i++, s++) { + if (s->IsPtrData()) + value = (PRUint64) s->ptr; + else { + switch (s->type) { + case nsXPTType::T_FLOAT: break; + case nsXPTType::T_DOUBLE: break; + case nsXPTType::T_I8: value = s->val.i8; break; + case nsXPTType::T_I16: value = s->val.i16; break; + case nsXPTType::T_I32: value = s->val.i32; break; + case nsXPTType::T_I64: value = s->val.i64; break; + case nsXPTType::T_U8: value = s->val.u8; break; + case nsXPTType::T_U16: value = s->val.u16; break; + case nsXPTType::T_U32: value = s->val.u32; break; + case nsXPTType::T_U64: value = s->val.u64; break; + case nsXPTType::T_BOOL: value = s->val.b; break; + case nsXPTType::T_CHAR: value = s->val.c; break; + case nsXPTType::T_WCHAR: value = s->val.wc; break; + default: value = (PRUint64) s->val.p; break; + } + } + + if (!s->IsPtrData() && s->type == nsXPTType::T_DOUBLE) { + if (nr_fpr < FPR_COUNT) + fpregs[nr_fpr++] = s->val.d; + else { + *((double *)d) = s->val.d; + d++; + } + } + else if (!s->IsPtrData() && s->type == nsXPTType::T_FLOAT) { + if (nr_fpr < FPR_COUNT) + // The value in %xmm register is already prepared to + // be retrieved as a float. Therefore, we pass the + // value verbatim, as a double without conversion. + fpregs[nr_fpr++] = s->val.d; + else { + *((float *)d) = s->val.f; + d++; + } + } + else { + if (nr_gpr < GPR_COUNT) + gpregs[nr_gpr++] = value; + else + *d++ = value; + } + } +} + +extern "C" +XPTC_PUBLIC_API(nsresult) +XPTC_InvokeByIndex(nsISupports * that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant * params) +{ + PRUint32 nr_gpr, nr_fpr, nr_stack; + invoke_count_words(paramCount, params, nr_gpr, nr_fpr, nr_stack); + + // Stack, if used, must be 16-bytes aligned + if (nr_stack) + nr_stack = (nr_stack + 1) & ~1; + + // Load parameters to stack, if necessary + PRUint64 *stack = (PRUint64 *) __builtin_alloca(nr_stack * 8); + PRUint64 gpregs[GPR_COUNT]; + double fpregs[FPR_COUNT]; + invoke_copy_to_stack(stack, paramCount, params, gpregs, fpregs); + + // disable the warning about sometimes not initialized variables which is hit + // when we pass less than 8 XMM or less than 6 GPR registers. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wsometimes-uninitialized" + + // Load FPR registers from fpregs[] + register double d0 asm("xmm0"); + register double d1 asm("xmm1"); + register double d2 asm("xmm2"); + register double d3 asm("xmm3"); + register double d4 asm("xmm4"); + register double d5 asm("xmm5"); + register double d6 asm("xmm6"); + register double d7 asm("xmm7"); + + switch (nr_fpr) { +#define ARG_FPR(N) \ + case N+1: d##N = fpregs[N]; + ARG_FPR(7); + ARG_FPR(6); + ARG_FPR(5); + ARG_FPR(4); + ARG_FPR(3); + ARG_FPR(2); + ARG_FPR(1); + ARG_FPR(0); + case 0:; +#undef ARG_FPR + } + + // Load GPR registers from gpregs[] + register PRUint64 a0 asm("rdi"); + register PRUint64 a1 asm("rsi"); + register PRUint64 a2 asm("rdx"); + register PRUint64 a3 asm("rcx"); + register PRUint64 a4 asm("r8"); + register PRUint64 a5 asm("r9"); + + switch (nr_gpr) { +#define ARG_GPR(N) \ + case N+1: a##N = gpregs[N]; + ARG_GPR(5); + ARG_GPR(4); + ARG_GPR(3); + ARG_GPR(2); + ARG_GPR(1); + case 1: a0 = (PRUint64) that; + case 0:; +#undef ARG_GPR + } + + // Ensure that assignments to SSE registers won't be optimized away + asm("" :: + "x" (d0), "x" (d1), "x" (d2), "x" (d3), + "x" (d4), "x" (d5), "x" (d6), "x" (d7)); + + // Get pointer to method + PRUint64 methodAddress = *((PRUint64 *)that); + methodAddress += 8 * methodIndex; + methodAddress = *((PRUint64 *)methodAddress); + + typedef PRUint32 (*Method)(PRUint64, PRUint64, PRUint64, PRUint64, PRUint64, PRUint64); + PRUint32 result = ((Method)methodAddress)(a0, a1, a2, a3, a4, a5); + return result; + +#pragma clang diagnostic pop +} diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_arm.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_arm.cpp new file mode 100644 index 00000000..1b2c5c67 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_arm.cpp @@ -0,0 +1,220 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + +#include "xptcprivate.h" + +#if !defined(LINUX) || !defined(__arm__) +#error "This code is for Linux ARM only. Check that it works on your system, too.\nBeware that this code is highly compiler dependent." +#endif + +// Remember that these 'words' are 32bit DWORDS + +static PRUint32 +invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s) +{ + PRUint32 result = 0; + for(PRUint32 i = 0; i < paramCount; i++, s++) + { + if(s->IsPtrData()) + { + result++; + continue; + } + switch(s->type) + { + case nsXPTType::T_I8 : + case nsXPTType::T_I16 : + case nsXPTType::T_I32 : + result++; + break; + case nsXPTType::T_I64 : + result+=2; + break; + case nsXPTType::T_U8 : + case nsXPTType::T_U16 : + case nsXPTType::T_U32 : + result++; + break; + case nsXPTType::T_U64 : + result+=2; + break; + case nsXPTType::T_FLOAT : + result++; + break; + case nsXPTType::T_DOUBLE : + result+=2; + break; + case nsXPTType::T_BOOL : + case nsXPTType::T_CHAR : + case nsXPTType::T_WCHAR : + result++; + break; + default: + // all the others are plain pointer types + result++; + break; + } + } + return result; +} + +static void +invoke_copy_to_stack(PRUint32* d, PRUint32 paramCount, nsXPTCVariant* s) +{ + for(PRUint32 i = 0; i < paramCount; i++, d++, s++) + { + if(s->IsPtrData()) + { + *((void**)d) = s->ptr; + continue; + } + switch(s->type) + { + case nsXPTType::T_I8 : *((PRInt8*) d) = s->val.i8; break; + case nsXPTType::T_I16 : *((PRInt16*) d) = s->val.i16; break; + case nsXPTType::T_I32 : *((PRInt32*) d) = s->val.i32; break; + case nsXPTType::T_I64 : *((PRInt64*) d) = s->val.i64; d++; break; + case nsXPTType::T_U8 : *((PRUint8*) d) = s->val.u8; break; + case nsXPTType::T_U16 : *((PRUint16*)d) = s->val.u16; break; + case nsXPTType::T_U32 : *((PRUint32*)d) = s->val.u32; break; + case nsXPTType::T_U64 : *((PRUint64*)d) = s->val.u64; d++; break; + case nsXPTType::T_FLOAT : *((float*) d) = s->val.f; break; + case nsXPTType::T_DOUBLE : *((double*) d) = s->val.d; d++; break; + case nsXPTType::T_BOOL : *((PRBool*) d) = s->val.b; break; + case nsXPTType::T_CHAR : *((char*) d) = s->val.c; break; + case nsXPTType::T_WCHAR : *((wchar_t*) d) = s->val.wc; break; + default: + // all the others are plain pointer types + *((void**)d) = s->val.p; + break; + } + } +} + +extern "C" { + struct my_params_struct { + nsISupports* that; + PRUint32 Index; + PRUint32 Count; + nsXPTCVariant* params; + PRUint32 fn_count; + PRUint32 fn_copy; + }; +}; + +XPTC_PUBLIC_API(nsresult) +XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params) +{ + PRUint32 result; + struct my_params_struct my_params; + my_params.that = that; + my_params.Index = methodIndex; + my_params.Count = paramCount; + my_params.params = params; + my_params.fn_copy = (PRUint32) &invoke_copy_to_stack; + my_params.fn_count = (PRUint32) &invoke_count_words; + +/* This is to call a given method of class that. + * The parameters are in params, the number is in paramCount. + * The routine will issue calls to count the number of words + * required for argument passing and to copy the arguments to + * the stack. + * Since APCS passes the first 3 params in r1-r3, we need to + * load the first three words from the stack and correct the stack + * pointer (sp) in the appropriate way. This means: + * + * 1.) more than 3 arguments: load r1-r3, correct sp and remember No. + * of bytes left on the stack in r4 + * + * 2.) <= 2 args: load r1-r3 (we won't be causing a stack overflow I hope), + * restore sp as if nothing had happened and set the marker r4 to zero. + * + * Afterwards sp will be restored using the value in r4 (which is not a temporary register + * and will be preserved by the function/method called according to APCS [ARM Procedure + * Calling Standard]). + * + * !!! IMPORTANT !!! + * This routine makes assumptions about the vtable layout of the c++ compiler. It's implemented + * for arm-linux GNU g++ >= 2.8.1 (including egcs and gcc-2.95.[1-3])! + * + */ + + __asm__ __volatile__( + "ldr r1, [%1, #12] \n\t" /* prepare to call invoke_count_words */ + "ldr ip, [%1, #16] \n\t" /* r0=paramCount, r1=params */ + "ldr r0, [%1, #8] \n\t" + "mov lr, pc \n\t" /* call it... */ + "mov pc, ip \n\t" + "mov r4, r0, lsl #2 \n\t" /* This is the amount of bytes needed. */ + "sub sp, sp, r4 \n\t" /* use stack space for the args... */ + "mov r0, sp \n\t" /* prepare a pointer an the stack */ + "ldr r1, [%1, #8] \n\t" /* =paramCount */ + "ldr r2, [%1, #12] \n\t" /* =params */ + "ldr ip, [%1, #20] \n\t" /* =invoke_copy_to_stack */ + "mov lr, pc \n\t" /* copy args to the stack like the */ + "mov pc, ip \n\t" /* compiler would. */ + "ldr r0, [%1] \n\t" /* =that */ + "ldr r1, [r0, #0] \n\t" /* get that->vtable offset */ + "ldr r2, [%1, #4] \n\t" + "mov r2, r2, lsl #2 \n\t" /* a vtable_entry(x)=8 + (4 bytes * x) */ +#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */ + "ldr ip, [r1, r2] \n\t" /* get method adress from vtable */ +#else /* non G++ V3 ABI */ + "add r2, r2, #8 \n\t" /* with this compilers */ + "ldr ip, [r1, r2] \n\t" /* get method adress from vtable */ +#endif + "cmp r4, #12 \n\t" /* more than 3 arguments??? */ + "ldmgtia sp!, {r1, r2, r3}\n\t" /* yes: load arguments for r1-r3 */ + "subgt r4, r4, #12 \n\t" /* and correct the stack pointer */ + "ldmleia sp, {r1, r2, r3}\n\t" /* no: load r1-r3 from stack */ + "addle sp, sp, r4 \n\t" /* and restore stack pointer */ + "movle r4, #0 \n\t" /* a mark for restoring sp */ + "ldr r0, [%1, #0] \n\t" /* get (self) */ + "mov lr, pc \n\t" /* call mathod */ + "mov pc, ip \n\t" + "add sp, sp, r4 \n\t" /* restore stack pointer */ + "mov %0, r0 \n\t" /* the result... */ + : "=r" (result) + : "r" (&my_params) + : "r0", "r1", "r2", "r3", "r4", "ip", "lr", "sp" + ); + + return result; +} diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_arm_netbsd.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_arm_netbsd.cpp new file mode 100644 index 00000000..0213bd76 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_arm_netbsd.cpp @@ -0,0 +1,213 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + +#include "xptcprivate.h" + +// Remember that these 'words' are 32bit DWORDS + +static PRUint32 +invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s) +{ + PRUint32 result = 0; + for(PRUint32 i = 0; i < paramCount; i++, s++) + { + if(s->IsPtrData()) + { + result++; + continue; + } + switch(s->type) + { + case nsXPTType::T_I8 : + case nsXPTType::T_I16 : + case nsXPTType::T_I32 : + result++; + break; + case nsXPTType::T_I64 : + result+=2; + break; + case nsXPTType::T_U8 : + case nsXPTType::T_U16 : + case nsXPTType::T_U32 : + result++; + break; + case nsXPTType::T_U64 : + result+=2; + break; + case nsXPTType::T_FLOAT : + result++; + break; + case nsXPTType::T_DOUBLE : + result+=2; + break; + case nsXPTType::T_BOOL : + case nsXPTType::T_CHAR : + case nsXPTType::T_WCHAR : + result++; + break; + default: + // all the others are plain pointer types + result++; + break; + } + } + return result; +} + +static void +invoke_copy_to_stack(PRUint32* d, PRUint32 paramCount, nsXPTCVariant* s) +{ + for(PRUint32 i = 0; i < paramCount; i++, d++, s++) + { + if(s->IsPtrData()) + { + *((void**)d) = s->ptr; + continue; + } + switch(s->type) + { + case nsXPTType::T_I8 : *((PRInt8*) d) = s->val.i8; break; + case nsXPTType::T_I16 : *((PRInt16*) d) = s->val.i16; break; + case nsXPTType::T_I32 : *((PRInt32*) d) = s->val.i32; break; + case nsXPTType::T_I64 : *((PRInt64*) d) = s->val.i64; d++; break; + case nsXPTType::T_U8 : *((PRUint8*) d) = s->val.u8; break; + case nsXPTType::T_U16 : *((PRUint16*)d) = s->val.u16; break; + case nsXPTType::T_U32 : *((PRUint32*)d) = s->val.u32; break; + case nsXPTType::T_U64 : *((PRUint64*)d) = s->val.u64; d++; break; + case nsXPTType::T_FLOAT : *((float*) d) = s->val.f; break; + case nsXPTType::T_DOUBLE : *((double*) d) = s->val.d; d++; break; + case nsXPTType::T_BOOL : *((PRBool*) d) = s->val.b; break; + case nsXPTType::T_CHAR : *((char*) d) = s->val.c; break; + case nsXPTType::T_WCHAR : *((wchar_t*) d) = s->val.wc; break; + default: + // all the others are plain pointer types + *((void**)d) = s->val.p; + break; + } + } +} + +extern "C" +struct my_params_struct { + nsISupports* that; + PRUint32 Index; + PRUint32 Count; + nsXPTCVariant* params; + PRUint32 fn_count; + PRUint32 fn_copy; +}; + +XPTC_PUBLIC_API(nsresult) +XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params) +{ + PRUint32 result; + struct my_params_struct my_params; + my_params.that = that; + my_params.Index = methodIndex; + my_params.Count = paramCount; + my_params.params = params; + my_params.fn_copy = (PRUint32) &invoke_copy_to_stack; + my_params.fn_count = (PRUint32) &invoke_count_words; + +/* This is to call a given method of class that. + * The parameters are in params, the number is in paramCount. + * The routine will issue calls to count the number of words + * required for argument passing and to copy the arguments to + * the stack. + * Since APCS passes the first 3 params in r1-r3, we need to + * load the first three words from the stack and correct the stack + * pointer (sp) in the appropriate way. This means: + * + * 1.) more than 3 arguments: load r1-r3, correct sp and remember No. + * of bytes left on the stack in r4 + * + * 2.) <= 2 args: load r1-r3 (we won't be causing a stack overflow I hope), + * restore sp as if nothing had happened and set the marker r4 to zero. + * + * Afterwards sp will be restored using the value in r4 (which is not a temporary register + * and will be preserved by the function/method called according to APCS [ARM Procedure + * Calling Standard]). + * + * !!! IMPORTANT !!! + * This routine makes assumptions about the vtable layout of the c++ compiler. It's implemented + * for arm-linux GNU g++ >= 2.8.1 (including egcs and gcc-2.95.[1-3])! + * + */ + + __asm__ __volatile__( + "ldr r1, [%1, #12] \n\t" /* prepare to call invoke_count_words */ + "ldr ip, [%1, #16] \n\t" /* r0=paramCount, r1=params */ + "ldr r0, [%1, #8] \n\t" + "mov lr, pc \n\t" /* call it... */ + "mov pc, ip \n\t" + "mov r4, r0, lsl #2 \n\t" /* This is the amount of bytes needed. */ + "sub sp, sp, r4 \n\t" /* use stack space for the args... */ + "mov r0, sp \n\t" /* prepare a pointer an the stack */ + "ldr r1, [%1, #8] \n\t" /* =paramCount */ + "ldr r2, [%1, #12] \n\t" /* =params */ + "ldr ip, [%1, #20] \n\t" /* =invoke_copy_to_stack */ + "mov lr, pc \n\t" /* copy args to the stack like the */ + "mov pc, ip \n\t" /* compiler would. */ + "ldr r0, [%1] \n\t" /* =that */ + "ldr r1, [r0, #0] \n\t" /* get that->vtable offset */ + "ldr r2, [%1, #4] \n\t" + "add r2, r1, r2, lsl #3\n\t" /* a vtable_entry(x)=8 + (8 bytes * x) */ + "add r2, r2, #8 \n\t" /* with this compilers */ + "ldr r3, [r2] \n\t" /* get virtual offset from vtable */ + "mov r3, r3, lsl #16 \n\t" + "add r0, r0, r3, asr #16\n\t" + "ldr ip, [r2, #4] \n\t" /* get method address from vtable */ + "cmp r4, #12 \n\t" /* more than 3 arguments??? */ + "ldmgtia sp!, {r1, r2, r3}\n\t" /* yes: load arguments for r1-r3 */ + "subgt r4, r4, #12 \n\t" /* and correct the stack pointer */ + "ldmleia sp, {r1, r2, r3}\n\t" /* no: load r1-r3 from stack */ + "addle sp, sp, r4 \n\t" /* and restore stack pointer */ + "movle r4, #0 \n\t" /* a mark for restoring sp */ + "mov lr, pc \n\t" /* call mathod */ + "mov pc, ip \n\t" + "add sp, sp, r4 \n\t" /* restore stack pointer */ + "mov %0, r0 \n\t" /* the result... */ + : "=r" (result) + : "r" (&my_params) + : "r0", "r1", "r2", "r3", "r4", "ip", "lr" + ); + + return result; +} diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ipf32.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ipf32.s new file mode 100644 index 00000000..c846b1f4 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ipf32.s @@ -0,0 +1,145 @@ + +// Select C numeric constant + .radix C +// for 64 bit mode, use .psr abi64 + .psr abi32 +// big endian + .psr msb +// Section has executable code + .section .text, "ax","progbits" +// procedure named 'XPTC_InvokeByIndex' + .proc XPTC_InvokeByIndex +// manual bundling + .explicit + +// extern "C" PRUint32 +// invoke_copy_to_stack(uint64_t* d, +// const PRUint32 paramCount, nsXPTCVariant* s) + .global invoke_copy_to_stack +// .exclass invoke_copy_to_stack, @fullyvisible + .type invoke_copy_to_stack,@function + +// .exclass XPTC_InvokeByIndex, @fullyvisible + .type XPTC_InvokeByIndex,@function + +// XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, +// PRUint32 paramCount, nsXPTCVariant* params); +XPTC_InvokeByIndex:: + .prologue + .save ar.pfs, r37 +// allocate 4 input args, 6 local args, and 8 output args + alloc r37 = ar.pfs, 4, 6, 8, 0 // M + nop.i 0 ;; // I + +// unwind table already knows gp, no need to specify anything + add r39 = 0, gp // A + .save rp, r36 + mov r36 = rp // I + .vframe r38 + add r38 = 0, sp ;; // A + +// We first calculate the amount of extra memory stack space required +// for the arguments, and register storage. +// We then call invoke_copy_to_stack() to write the argument contents +// to the specified memory regions. +// We then copy the integer arguments to integer registers, and floating +// arguments to float registers. +// Lastly we load the virtual table jump pointer, and call the target +// subroutine. + +// in0 : that +// in1 : methodIndex +// in2 : paramCount +// in3 : params + +// stack frame size is 16 + (8 * even(paramCount)) + 64 + 64 +// 16 byte frame header +// 8 * even(paramCount) memory argument area +// 64 bytes integer register area +// 64 bytes float register area +// This scheme makes sure stack fram size is a multiple of 16 + + .body + add r10 = 8, r0 // A +// r41 points to float register area + add r41 = -64, sp // A +// r40 points to int register area + add r40 = -128, sp ;; // A + + add out1 = 0, r40 // A + add out2 = 0, r41 // A + tbit.z p14,p15 = in2,0 ;; // I + +// compute 8 * even(paramCount) +(p14) shladd r11 = in2, 3, r0 ;; // A +(p15) shladd r11 = in2, 3, r10 ;; // A + sub out0 = r40, r11 ;; // A + +// advance the stack frame + add sp = -16, out0 // A + add out3 = 0, in2 // A + add out4 = 0, in3 // A + +// branch to invoke_copy_to_stack + br.call.sptk.few rp = invoke_copy_to_stack ;; // B + +// restore gp + add gp = 0, r39 // A + add out0 = 0, in0 // A + +// load the integer and float registers + ld8 out1 = [r40], 8 // M + ldfd f8 = [r41], 8 ;; // M + + ld8 out2 = [r40], 8 // M + ldfd f9 = [r41], 8 ;; // M + + ld8 out3 = [r40], 8 // M + ldfd f10 = [r41], 8 ;; // M + + ld8 out4 = [r40], 8 // M + ldfd f11 = [r41], 8 ;; // M + + ld8 out5 = [r40], 8 // M + ldfd f12 = [r41], 8 ;; // M +// 16 * methodIndex + shladd r11 = in1, 4, r0 // A + + ld8 out6 = [r40], 8 // M + ldfd f13 = [r41], 8 ;; // M + + ld8 out7 = [r40], 8 // M + ldfd f14 = [r41], 8 // M + addp4 r8 = 0, in0 ;; // A + +// look up virtual base table and dispatch to target subroutine +// This section assumes 32 bit pointer mode, and virtual base table +// layout from the ABI http://www.codesourcery.com/cxx-abi/abi.html + +// load base table + ld4 r8 = [r8] ;; // M + addp4 r8 = r11, r8 ;; // A + + // first entry is jump pointer, second entry is gp + addp4 r9 = 8, r8 ;; // A +// load jump pointer + ld8 r8 = [r8] + +// load gp + ld8 gp = [r9] ;; // M + mov b6 = r8 ;; // I + +// branch to target virtual function + br.call.sptk.few rp = b6 ;; // B + +// epilog + mov ar.pfs = r37 // I + mov rp = r36 ;; // I + + add sp = 0, r38 // A + add gp = 0, r39 // A + br.ret.sptk.few rp ;; // B + + .endp + + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ipf64.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ipf64.s new file mode 100644 index 00000000..5e1b1a23 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ipf64.s @@ -0,0 +1,145 @@ + +// Select C numeric constant + .radix C +// for 64 bit mode, use .psr abi64 + .psr abi64 +// little endian + .psr lsb +// Section has executable code + .section .text, "ax","progbits" +// procedure named 'XPTC_InvokeByIndex' + .proc XPTC_InvokeByIndex +// manual bundling + .explicit + +// extern "C" PRUint32 +// invoke_copy_to_stack(uint64_t* d, +// const PRUint32 paramCount, nsXPTCVariant* s) + .global invoke_copy_to_stack +// .exclass invoke_copy_to_stack, @fullyvisible + .type invoke_copy_to_stack,@function + +// .exclass XPTC_InvokeByIndex, @fullyvisible + .type XPTC_InvokeByIndex,@function + +// XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, +// PRUint32 paramCount, nsXPTCVariant* params); +XPTC_InvokeByIndex:: + .prologue + .save ar.pfs, r37 +// allocate 4 input args, 6 local args, and 8 output args + alloc r37 = ar.pfs, 4, 6, 8, 0 // M + nop.i 0 ;; // I + +// unwind table already knows gp, no need to specify anything + add r39 = 0, gp // A + .save rp, r36 + mov r36 = rp // I + .vframe r38 + add r38 = 0, sp ;; // A + +// We first calculate the amount of extra memory stack space required +// for the arguments, and register storage. +// We then call invoke_copy_to_stack() to write the argument contents +// to the specified memory regions. +// We then copy the integer arguments to integer registers, and floating +// arguments to float registers. +// Lastly we load the virtual table jump pointer, and call the target +// subroutine. + +// in0 : that +// in1 : methodIndex +// in2 : paramCount +// in3 : params + +// stack frame size is 16 + (8 * even(paramCount)) + 64 + 64 +// 16 byte frame header +// 8 * even(paramCount) memory argument area +// 64 bytes integer register area +// 64 bytes float register area +// This scheme makes sure stack fram size is a multiple of 16 + + .body + add r10 = 8, r0 // A +// r41 points to float register area + add r41 = -64, sp // A +// r40 points to int register area + add r40 = -128, sp ;; // A + + add out1 = 0, r40 // A + add out2 = 0, r41 // A + tbit.z p14,p15 = in2,0 ;; // I + +// compute 8 * even(paramCount) +(p14) shladd r11 = in2, 3, r0 ;; // A +(p15) shladd r11 = in2, 3, r10 ;; // A + sub out0 = r40, r11 ;; // A + +// advance the stack frame + add sp = -16, out0 // A + add out3 = 0, in2 // A + add out4 = 0, in3 // A + +// branch to invoke_copy_to_stack + br.call.sptk.few rp = invoke_copy_to_stack ;; // B + +// restore gp + add gp = 0, r39 // A + add out0 = 0, in0 // A + +// load the integer and float registers + ld8 out1 = [r40], 8 // M + ldfd f8 = [r41], 8 ;; // M + + ld8 out2 = [r40], 8 // M + ldfd f9 = [r41], 8 ;; // M + + ld8 out3 = [r40], 8 // M + ldfd f10 = [r41], 8 ;; // M + + ld8 out4 = [r40], 8 // M + ldfd f11 = [r41], 8 ;; // M + + ld8 out5 = [r40], 8 // M + ldfd f12 = [r41], 8 ;; // M +// 16 * methodIndex + shladd r11 = in1, 4, r0 // A + + ld8 out6 = [r40], 8 // M + ldfd f13 = [r41], 8 ;; // M + + ld8 out7 = [r40], 8 // M + ldfd f14 = [r41], 8 // M + add r8 = 0, in0 ;; // A + +// look up virtual base table and dispatch to target subroutine +// This section assumes 64 bit pointer mode, and virtual base table +// layout from the ABI http://www.codesourcery.com/cxx-abi/abi.html + +// load base table + ld8 r8 = [r8] ;; // M + add r8 = r11, r8 ;; // A + + // first entry is jump pointer, second entry is gp + add r9 = 8, r8 ;; // A +// load jump pointer + ld8 r8 = [r8] + +// load gp + ld8 gp = [r9] ;; // M + mov b6 = r8 ;; // I + +// branch to target virtual function + br.call.sptk.few rp = b6 ;; // B + +// epilog + mov ar.pfs = r37 // I + mov rp = r36 ;; // I + + add sp = 0, r38 // A + add gp = 0, r39 // A + br.ret.sptk.few rp ;; // B + + .endp + + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_irix.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_irix.s new file mode 100644 index 00000000..4e8e0895 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_irix.s @@ -0,0 +1,149 @@ + +#include <sys/regdef.h> +#include <sys/asm.h> + +.text +.globl invoke_count_words +.globl invoke_copy_to_stack + +LOCALSZ=7 # a0, a1, a2, a3, s0, ra, gp +FRAMESZ=(((NARGSAVE+LOCALSZ)*SZREG)+ALSZ)&ALMASK + +RAOFF=FRAMESZ-(1*SZREG) +A0OFF=FRAMESZ-(2*SZREG) +A1OFF=FRAMESZ-(3*SZREG) +A2OFF=FRAMESZ-(4*SZREG) +A3OFF=FRAMESZ-(5*SZREG) +S0OFF=FRAMESZ-(6*SZREG) +GPOFF=FRAMESZ-(7*SZREG) + + # + # _XPTC_InvokeByIndex(that, methodIndex, paramCount, params) + # a0 a1 a2 a3 + +NESTED(_XPTC_InvokeByIndex, FRAMESZ, ra) + SETUP_GP + PTR_SUBU sp, FRAMESZ + SETUP_GP64(GPOFF, _XPTC_InvokeByIndex) + SAVE_GP(GPOFF) + + REG_S ra, RAOFF(sp) + REG_S a0, A0OFF(sp) + REG_S a1, A1OFF(sp) + REG_S a2, A2OFF(sp) + REG_S a3, A3OFF(sp) + REG_S s0, S0OFF(sp) + REG_S gp, GPOFF(sp) + + # invoke_count_words(paramCount, params) + move a0, a2 + move a1, a3 + jal invoke_count_words + + # invoke_copy_to_stack(PRUint32* d, PRUint32 paramCount, + # nsXPTCVariant* s, PRUint32 *reg) + + REG_L a1, A2OFF(sp) # a1 - paramCount + REG_L a2, A3OFF(sp) # a2 - params + + # save sp before we copy the params to the stack + move t0, sp + + # assume full size of 8 bytes per param to be safe + sll v0, 4 # 8 bytes * num params + subu sp, sp, v0 # make room + move a0, sp # a0 - param stack address + + # create temporary stack space to write int and fp regs + subu sp, 64 # 64 = 8 regs of 8 bytes + + move a3, sp + + # save the old sp and save the arg stack + subu sp, sp, 16 + REG_S t0, 0(sp) + REG_S a0, 8(sp) + + # copy the param into the stack areas + jal invoke_copy_to_stack + + REG_L t3, 8(sp) # get previous a0 + REG_L sp, 0(sp) # get orig sp back + + REG_L a0, A0OFF(sp) # a0 - that + REG_L a1, A1OFF(sp) # a1 - methodIndex + +#ifdef __GNUC__ + # t1 = methodIndex * 8 + # (use shift instead of mult) + sll t1, a1, 3 +#else + # t1 = methodIndex * 12 + # (use shift and subtract trick instead of mult) + sll t1, a1, 2 + subu t1, t1, a1 + sll t1, t1, 2 +#endif + + # calculate the function we need to jump to, + # which must then be saved in t9 + lw t9, 0(a0) + addu t9, t9, t1 +#ifdef __GNUC__ + lw t9, 12(t9) # t9 = *(that+t1+12) +#else + li t2, 20 + addu t9, t9, t2 + lw t9, 0(t9) # t9 = *(that+t1+20) +#endif + + # calculate the proper "this" pointer for the + # function that they asked for + lw t0, 0(a0) + addu t0, t1 +#ifdef __GNUC__ + lh t0, 8(t0) +#else + lw t0, 12(t0) +#endif + + addu a0, a0, t0 + + # get register save area from invoke_copy_to_stack + subu t1, t3, 64 + + # a1..a7 and f13..f19 should now be set to what + # invoke_copy_to_stack told us. skip a0 and f12 + # because that's the "this" pointer + + REG_L a1, 0(t1) + REG_L a2, 8(t1) + REG_L a3, 16(t1) + REG_L a4, 24(t1) + REG_L a5, 32(t1) + REG_L a6, 40(t1) + REG_L a7, 48(t1) + + l.d $f13, 0(t1) + l.d $f14, 8(t1) + l.d $f15, 16(t1) + l.d $f16, 24(t1) + l.d $f17, 32(t1) + l.d $f18, 40(t1) + l.d $f19, 48(t1) + + # save away our stack pointer and create + # the stack pointer for the function + move s0, sp + move sp, t3 + + jalr ra, t9 + + move sp, s0 + + RESTORE_GP64 + REG_L ra, RAOFF(sp) + REG_L s0, S0OFF(sp) + PTR_ADDU sp, FRAMESZ + j ra +.end _XPTC_InvokeByIndex diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_mips.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_mips.s new file mode 100644 index 00000000..f011aaf5 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_mips.s @@ -0,0 +1,166 @@ +/* -*- Mode: asm; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corp, Inc. + * Portions created by the Initial Developer are Copyright (C) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Brendan Eich <brendan@mozilla.org> + * Stuart Parmenter <pavlov@netscape.com> + */ + +/* This code is for MIPS using the O32 ABI. */ + +#include <sys/regdef.h> +#include <sys/asm.h> + +.text +.globl invoke_count_words +.globl invoke_copy_to_stack + +# We need a variable number of words allocated from the stack for copies of +# the params, and this space must come between the high frame (where ra, gp, +# and s0 are saved) and the low frame (where a0-a3 are saved by the callee +# functions we invoke). + +LOCALSZ=4 # s0, s1, ra, gp +NARGSAVE=4 # a0, a1, a2, a3 +HIFRAMESZ=(LOCALSZ*SZREG) +LOFRAMESZ=(NARGSAVE*SZREG) +FRAMESZ=(HIFRAMESZ+LOFRAMESZ+ALSZ)&ALMASK + +# XXX these 2*SZREG, etc. are very magic -- we *know* that ALSZ&ALMASK cause +# FRAMESZ to be 0 mod 8, in this case to be 16 and not 12. +RAOFF=FRAMESZ - (2*SZREG) +GPOFF=FRAMESZ - (3*SZREG) +S0OFF=FRAMESZ - (4*SZREG) +S1OFF=FRAMESZ - (5*SZREG) + +# These are not magic -- they are just our argsave slots in the caller frame. +A0OFF=FRAMESZ +A1OFF=FRAMESZ + (1*SZREG) +A2OFF=FRAMESZ + (2*SZREG) +A3OFF=FRAMESZ + (3*SZREG) + + # + # _XPTC_InvokeByIndex(that, methodIndex, paramCount, params) + # a0 a1 a2 a3 + +NESTED(_XPTC_InvokeByIndex, FRAMESZ, ra) + + .set noreorder + .cpload t9 + .set reorder + + subu sp, FRAMESZ + + # specify the save register mask -- XXX do we want the a0-a3 here, given + # our "split" frame where the args are saved below a dynamicly allocated + # region under the high frame? + # + # 10010000000000010000000011110000 + .mask 0x900100F0, -((NARGSAVE+LOCALSZ)*SZREG) + + # thou shalt not use .cprestore if yer frame has variable size... + # .cprestore GPOFF + + REG_S ra, RAOFF(sp) + + # this happens automatically with .cprestore, but we cannot use that op... + REG_S gp, GPOFF(sp) + REG_S s0, S0OFF(sp) + REG_S s1, S1OFF(sp) + + REG_S a0, A0OFF(sp) + REG_S a1, A1OFF(sp) + REG_S a2, A2OFF(sp) + REG_S a3, A3OFF(sp) + + # invoke_count_words(paramCount, params) + move a0, a2 + move a1, a3 + + jal invoke_count_words + lw gp, GPOFF(sp) + + # save the old sp so we can pop the param area and any "low frame" + # needed as an argsave area below the param block for callees that + # we invoke. + move s0, sp + + REG_L a1, A2OFF(sp) # a1 = paramCount + REG_L a2, A3OFF(sp) # a2 = params + + # we define a word as 4 bytes, period end of story! + sll v0, 2 # 4 bytes * result of invoke_copy_words + subu v0, LOFRAMESZ # but we take back the argsave area built into + # our stack frame -- SWEET! + subu sp, sp, v0 # make room + move a0, sp # a0 = param stack address + move s1, a0 # save it for later -- it should be safe here + + # the old sp is still saved in s0, but we now need another argsave + # area ("low frame") for the invoke_copy_to_stack call. + subu sp, sp, LOFRAMESZ + + # copy the param into the stack areas + # invoke_copy_to_stack(PRUint32* d, PRUint32 paramCount, + # nsXPTCVariant* s) + jal invoke_copy_to_stack + lw gp, GPOFF(s0) + + move sp, s0 # get orig sp back, popping params and argsave + + REG_L a0, A0OFF(sp) # a0 = set "that" to be "this" + REG_L a1, A1OFF(sp) # a1 = methodIndex + + # t1 = methodIndex * 4 + # (use shift instead of mult) + sll t1, a1, 2 + + # calculate the function we need to jump to, + # which must then be saved in t9 + lw t9, 0(a0) + addu t9, t9, t1 + lw t9, 8(t9) + + # a1..a3 and f13..f14 should now be set to what + # invoke_copy_to_stack told us. skip a0 and f12 + # because that is the "this" pointer + + REG_L a1, 1*SZREG(s1) + REG_L a2, 2*SZREG(s1) + REG_L a3, 3*SZREG(s1) + + l.d $f13, 8(s1) + l.d $f14, 16(s1) + + # Create the stack pointer for the function, which must have 4 words + # of space for callee-saved args. invoke_count_words allocated space + # for a0 starting at s1, so we just move s1 into sp. + move sp, s1 + + jalr ra, t9 + lw gp, GPOFF(s0) + + move sp, s0 + + REG_L ra, RAOFF(sp) + REG_L s0, S0OFF(sp) + addu sp, FRAMESZ + j ra +.end _XPTC_InvokeByIndex diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_openvms_alpha.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_openvms_alpha.s new file mode 100644 index 00000000..d37a91d2 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_openvms_alpha.s @@ -0,0 +1,99 @@ +;* -*- 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.1 (the "License"); you may not use this file +;* except in compliance with the License. You may obtain a copy of +;* the License at http://www.mozilla.org/NPL/ +;* +;* Software distributed under the License is distributed on an "AS +;* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +;* implied. See the License for the specific language governing +;* rights and limitations under the License. +;* +;* The Original Code is mozilla.org code. +;* +;* The Initial Developer of the Original Code is Netscape +;* Communications Corporation. Portions created by Netscape are +;* Copyright (C) 1998 Netscape Communications Corporation. All +;* Rights Reserved. +;* +;* Contributor(s): +;*/ + +; +; XPTC_PUBLIC_API(nsresult) +; XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, +; PRUint32 paramCount, nsXPTCVariant* params) +; + + .title "INVOKE" "Invoke By Index" + + $routine XPTC_InvokeByIndex, kind=stack, saved_regs=<R2,R3,R4> + + mov r27,r2 ; Need to set up a base register... + .base r2,$LS ; ...for the LINKAGE_PAIR call + + mov r17,r3 ; save methodIndex in r3 + mov r18,r4 ; save paramCount in r4 + +; +; Allocate enough stack space to hold the greater of 6 or "paramCount"+1 +; parameters. (+1 for "this" pointer) Room for at least 6 parameters +; is required for storage of those passed via registers. +; + + cmplt R18,5,R1 ; paramCount = MAX(5, "paramCount") + cmovne R1,5,R18 + s8addq R18,16,R1 ; room for "paramCount"+1 params (8 bytes each) + bic R1,15,R1 ; stack space is rounded up to 0 % 16 + subq SP,R1,SP + + stq R16,0(SP) ; save "that" (as "this" pointer) + addq SP,8,R16 ; pass stack pointer + mov R4,R17 ; pass original "paramCount + mov R19,R18 ; pass "params" + mov 4,r25 ; argument count + + $LINKAGE_PAIR invoke_copy_to_stack + ldq r26,$LP ; get entry point address from linkage pair + ldq r27,$LP+8 ; get procedure descriptor address from lp + jsr r26,r26 ; and call the routine + +; +; Copy the first 6 parameters to registers and remove from stack frame. +; Both the integer and floating point registers are set for each parameter +; except the first which is the "this" pointer. (integer only) +; The floating point registers are all set as doubles since the +; invoke_copy_to_stack function should have converted the floats. +; + ldq R16,0(SP) ; integer registers + ldq R17,8(SP) + ldq R18,16(SP) + ldq R19,24(SP) + ldq R20,32(SP) + ldq R21,40(SP) + ldt F17,8(SP) ; floating point registers + ldt F18,16(SP) + ldt F19,24(SP) + ldt F20,32(SP) + ldt F21,40(SP) + + addq SP,48,SP ; remove params from stack + +; +; Call the virtual function with the constructed stack frame. +; First three methods are always QueryInterface, AddRef and Release. +; + addq r4,1,r25 ; argument count now includes "this" + mov R16,R1 ; load "this" + ldl R1,0(R1) ; load vtable + s4addq r3,0,r28 ; vtable index = "methodIndex" * 4 + addq r1,r28,r1 + ldl r27,0(r1) ; load procedure value + ldq r26,8(r27) ; load entry point address + jsr r26,r26 ; call virtual function + + $return + + $end_routine XPTC_InvokeByIndex + .end diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_osf1_alpha.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_osf1_alpha.s new file mode 100644 index 00000000..ad7b2f82 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_osf1_alpha.s @@ -0,0 +1,83 @@ +/* + * XPTC_PUBLIC_API(nsresult) + * XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + * PRUint32 paramCount, nsXPTCVariant* params) + */ +.text +.align 4 +.globl XPTC_InvokeByIndex +.ent XPTC_InvokeByIndex +XPTC_InvokeByIndex: +.frame $15,32,$26,0 +.mask 0x4008000,-32 +ldgp $29,0($27) +XPTC_InvokeByIndexXv: +subq $30,32,$30 +stq $26,0($30) +stq $15,8($30) +bis $30,$30,$15 +.prologue 1 + +/* + * Allocate enough stack space to hold the greater of 6 or "paramCount"+1 + * parameters. (+1 for "this" pointer) Room for at least 6 parameters + * is required for storage of those passed via registers. + */ + +bis $31,5,$2 /* count = MAX(5, "paramCount") */ +cmplt $2,$18,$1 +cmovne $1,$18,$2 +s8addq $2,16,$1 /* room for count+1 params (8 bytes each) */ +bic $1,15,$1 /* stack space is rounded up to 0 % 16 */ +subq $30,$1,$30 + +stq $16,0($30) /* save "that" (as "this" pointer) */ +stq $17,16($15) /* save "methodIndex" */ + +addq $30,8,$16 /* pass stack pointer */ +bis $18,$18,$17 /* pass "paramCount" */ +bis $19,$19,$18 /* pass "params" */ +jsr $26,invoke_copy_to_stack /* call invoke_copy_to_stack */ +ldgp $29,0($26) + +/* + * Copy the first 6 parameters to registers and remove from stack frame. + * Both the integer and floating point registers are set for each parameter + * except the first which is the "this" pointer. (integer only) + * The floating point registers are all set as doubles since the + * invoke_copy_to_stack function should have converted the floats. + */ +ldq $16,0($30) /* integer registers */ +ldq $17,8($30) +ldq $18,16($30) +ldq $19,24($30) +ldq $20,32($30) +ldq $21,40($30) +ldt $f17,8($30) /* floating point registers */ +ldt $f18,16($30) +ldt $f19,24($30) +ldt $f20,32($30) +ldt $f21,40($30) + +addq $30,48,$30 /* remove params from stack */ + +/* + * Call the virtual function with the constructed stack frame. + */ +bis $16,$16,$1 /* load "this" */ +ldq $2,16($15) /* load "methodIndex" */ +ldq $1,0($1) /* load vtable */ +s8addq $2,0,$2 /* vtable index = "methodIndex" * 8 + 16 */ +addq $1,$2,$1 +ldq $27,0($1) /* load address of function */ +jsr $26,($27),0 /* call virtual function */ +ldgp $29,0($26) + +bis $15,$15,$30 +ldq $26,0($30) +ldq $15,8($30) +addq $30,32,$30 +ret $31,($26),1 +.end XPTC_InvokeByIndex + + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_pa32.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_pa32.s new file mode 100644 index 00000000..8ce8f17f --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_pa32.s @@ -0,0 +1,131 @@ + .LEVEL 1.1 +framesz .EQU 128 + +; XPTC_InvokeByIndex(nsISuppots* that, PRUint32 methodIndex, +; PRUint32 paramCount, nsXPTCVariant* params); + +; g++ need to compile everything with -fvtable-thunks ! + + .SPACE $TEXT$,SORT=8 + .SUBSPA $CODE$,QUAD=0,ALIGN=4,ACCESS=0x2c,CODE_ONLY,SORT=24 +XPTC_InvokeByIndex + .PROC + .CALLINFO CALLER,FRAME=72,ENTRY_GR=%r3,SAVE_RP,SAVE_SP,ARGS_SAVED,ALLOCA_FRAME + + ; frame marker takes 48 bytes, + ; register spill area takes 8 bytes, + ; local stack area takes 72 bytes result in 128 bytes total + + .ENTRY + STW %rp,-20(%sp) + STW,MA %r3,128(%sp) + + LDO -framesz(%r30),%r28 + STW %r28,-4(%r30) ; save previous sp + STW %r19,-32(%r30) + + STW %r26,-36-framesz(%r30) ; save argument registers in + STW %r25,-40-framesz(%r30) ; in PREVIOUS frame + STW %r24,-44-framesz(%r30) ; + STW %r23,-48-framesz(%r30) ; + + B,L .+8,%r2 + ADDIL L'invoke_count_bytes-$PIC_pcrel$1+4,%r2,%r1 + LDO R'invoke_count_bytes-$PIC_pcrel$2+8(%r1),%r1 +$PIC_pcrel$1 + LDSID (%r1),%r31 +$PIC_pcrel$2 + MTSP %r31,%sr0 + .CALL ARGW0=GR,ARGW1=GR,ARGW2=GR ;in=24,25,26;out=28 + BE,L 0(%sr0,%r1),%r31 + COPY %r31,%r2 + + CMPIB,>= 0,%r28, .+76 + COPY %r30,%r3 ; copy stack ptr to saved stack ptr + ADD %r30,%r28,%r30 ; extend stack frame + LDW -4(%r3),%r28 ; move frame + STW %r28,-4(%r30) + LDW -8(%r3),%r28 + STW %r28,-8(%r30) + LDW -12(%r3),%r28 + STW %r28,-12(%r30) + LDW -16(%r3),%r28 + STW %r28,-16(%r30) + LDW -20(%r3),%r28 + STW %r28,-20(%r30) + LDW -24(%r3),%r28 + STW %r28,-24(%r30) + LDW -28(%r3),%r28 + STW %r28,-28(%r30) + LDW -32(%r3),%r28 + STW %r28,-32(%r30) + + LDO -40(%r30),%r26 ; load copy address + LDW -44-framesz(%r3),%r25 ; load rest of 2 arguments + LDW -48-framesz(%r3),%r24 ; + + LDW -32(%r30),%r19 ; shared lib call destroys r19; reload + B,L .+8,%r2 + ADDIL L'invoke_copy_to_stack-$PIC_pcrel$3+4,%r2,%r1 + LDO R'invoke_copy_to_stack-$PIC_pcrel$4+8(%r1),%r1 +$PIC_pcrel$3 + LDSID (%r1),%r31 +$PIC_pcrel$4 + MTSP %r31,%sr0 + .CALL ARGW0=GR,ARGW1=GR,ARGW2=GR ;in=24,25,26 + BE,L 0(%sr0,%r1),%r31 + COPY %r31,%r2 + + LDO -48(%r30),%r20 + EXTRW,U,= %r28,31,1,%r22 + FLDD 0(%r20),%fr7 ; load double arg 1 + EXTRW,U,= %r28,30,1,%r22 + FLDW 8(%r20),%fr5L ; load float arg 1 + EXTRW,U,= %r28,29,1,%r22 + FLDW 4(%r20),%fr6L ; load float arg 2 + EXTRW,U,= %r28,28,1,%r22 + FLDW 0(%r20),%fr7L ; load float arg 3 + + LDW -36-framesz(%r3),%r26 ; load ptr to 'that' + LDW -40(%r30),%r25 ; load the rest of dispatch argument registers + LDW -44(%r30),%r24 + LDW -48(%r30),%r23 + + LDW -36-framesz(%r3),%r20 ; load vtable addr + LDW -40-framesz(%r3),%r28 ; load index + LDW 0(%r20),%r20 ; follow vtable + LDO 16(%r20),%r20 ; offset vtable by 16 bytes (g++: 8, aCC: 16) + SH2ADDL %r28,%r20,%r28 ; add 4*index to vtable entry + LDW 0(%r28),%r22 ; load vtable entry + + B,L .+8,%r2 + ADDIL L'$$dyncall_external-$PIC_pcrel$5+4,%r2,%r1 + LDO R'$$dyncall_external-$PIC_pcrel$6+8(%r1),%r1 +$PIC_pcrel$5 + LDSID (%r1),%r31 +$PIC_pcrel$6 + MTSP %r31,%sr0 + .CALL ARGW0=GR,ARGW1=GR,ARGW2=GR,ARGW3=GR,RTNVAL=GR +;in=22-26;out=28; + BE,L 0(%sr0,%r1),%r31 + COPY %r31,%r2 + + LDW -32(%r30),%r19 + COPY %r3,%r30 ; restore saved stack ptr + + LDW -148(%sp),%rp + BVE (%rp) + .EXIT + LDW,MB -128(%sp),%r3 + + .PROCEND ;in=23,24,25,26; + + .ALIGN 8 + .SPACE $TEXT$ + .SUBSPA $CODE$ + .IMPORT $$dyncall_external,MILLICODE + .IMPORT invoke_count_bytes,CODE + .IMPORT invoke_copy_to_stack,CODE + .EXPORT XPTC_InvokeByIndex,ENTRY,PRIV_LEV=3,ARGW0=GR,ARGW1=GR,ARGW2=GR,ARGW3=GR,RTNVAL=GR,LONG_RETURN + .END + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_aix.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_aix.s new file mode 100644 index 00000000..3684d154 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_aix.s @@ -0,0 +1,146 @@ + # + # -*- 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.1 (the "License"); you may not use this file + # except in compliance with the License. You may obtain a copy of + # the License at http://www.mozilla.org/NPL/ + # + # Software distributed under the License is distributed on an "AS + # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + # implied. See the License for the specific language governing + # rights and limitations under the License. + # + # The Original Code is mozilla.org code. + # + # The Initial Developer of the Original Code is Netscape + # Communications Corporation. Portions created by Netscape are + # Copyright (C) 1999 Netscape Communications Corporation. All + # Rights Reserved. + # + # Contributor(s): + # IBM Corporation + # + +.set r0,0; .set sp,1; .set RTOC,2; .set r3,3; .set r4,4 +.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9 +.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14 +.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19 +.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24 +.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29 +.set r30,30; .set r31,31 +.set f0,0; .set f1,1; .set f2,2; .set f3,3; .set f4,4 +.set f5,5; .set f6,6; .set f7,7; .set f8,8; .set f9,9 +.set f10,10; .set f11,11; .set f12,12; .set f13,13; .set f14,14 +.set f15,15; .set f16,16; .set f17,17; .set f18,18; .set f19,19 +.set f20,20; .set f21,21; .set f22,22; .set f23,23; .set f24,24 +.set f25,25; .set f26,26; .set f27,27; .set f28,28; .set f29,29 +.set f30,30; .set f31,31 +.set BO_IF,12 +.set CR0_EQ,2 + + + + .rename H.10.NO_SYMBOL{PR},"" + .rename H.18.XPTC_InvokeByIndex{TC},"XPTC_InvokeByIndex" + + +# .text section + + .csect H.10.NO_SYMBOL{PR} + .globl .XPTC_InvokeByIndex + .globl XPTC_InvokeByIndex{DS} + .extern .invoke_copy_to_stack + .extern ._ptrgl{PR} + + +# +# XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, +# PRUint32 paramCount, nsXPTCVariant* params) +# + +.XPTC_InvokeByIndex: + mflr r0 + stw r31,-4(sp) +# +# save off the incoming values in the caller's parameter area +# + stw r3,24(sp) # that + stw r4,28(sp) # methodIndex + stw r5,32(sp) # paramCount + stw r6,36(sp) # params + stw r0,8(sp) + stwu sp,-136(sp) # = 24 for linkage area, 8 * 13 for fprData area, 8 for saved registers + +# prepare args for 'invoke_copy_to_stack' call +# + lwz r4,168(sp) # paramCount + lwz r5,172(sp) # params + mr r6,sp # fprData + slwi r3,r4,3 # number of bytes of stack required + # at most 8*paramCount + addi r3,r3,28 # linkage area + mr r31,sp # save original stack top + subfc sp,r3,sp # bump the stack + addi r3,sp,28 # parameter pointer excludes linkage area size + 'this' + + bl .invoke_copy_to_stack + nop + + lfd f1,0(r31) # Restore floating point registers + lfd f2,8(r31) + lfd f3,16(r31) + lfd f4,24(r31) + lfd f5,32(r31) + lfd f6,40(r31) + lfd f7,48(r31) + lfd f8,56(r31) + lfd f9,64(r31) + lfd f10,72(r31) + lfd f11,80(r31) + lfd f12,88(r31) + lfd f13,96(r31) + + lwz r3,160(r31) # that + lwz r4,0(r3) # get vTable from 'that' + lwz r5,164(r31) # methodIndex + slwi r5,r5,3 # methodIndex * 8 + addi r5,r5,8 # step over junk at start of vTable ! + lwzx r11,r5,r4 # get function pointer + + addi r5,r5,4 # We need to manually adjust the 'that' pointer, this is CFRONT based + lwzx r5,r4,r5 # offset = r4(vtable) + r5(methodIndex offset) - 4 + add r3,r5,r3 # adjust 'that' r3 = r3 + r5 + + lwz r4,28(sp) + lwz r5,32(sp) + lwz r6,36(sp) + lwz r7,40(sp) + lwz r8,44(sp) + lwz r9,48(sp) + lwz r10,52(sp) + + bl ._ptrgl{PR} + nop + + mr sp,r31 + lwz r0,144(sp) + addi sp,sp,136 + mtlr r0 + lwz r31,-4(sp) + blr + + +# .data section + + .toc # 0x00000038 +T.18.XPTC_InvokeByIndex: + .tc H.18.XPTC_InvokeByIndex{TC},XPTC_InvokeByIndex{DS} + + .csect XPTC_InvokeByIndex{DS} + .long .XPTC_InvokeByIndex # "\0\0\0\0" + .long TOC{TC0} # "\0\0\0008" + .long 0x00000000 # "\0\0\0\0" +# End csect XPTC_InvokeByIndex{DS} + +# .bss section diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_aix64.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_aix64.s new file mode 100644 index 00000000..a174e424 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_aix64.s @@ -0,0 +1,161 @@ +# ***** BEGIN LICENSE BLOCK ***** +# +# Version: MPL 1.1/LGPL 2.1/GPL 2.0 +# +# The contents of this file are subject to the Mozilla Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is IBM Corporation. +# Portions created by IBM are +# Copyright (C) 2002, International Business Machines Corporation. +# All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the LGPL or the GPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +.set r0,0; .set sp,1; .set RTOC,2; .set r3,3; .set r4,4 +.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9 +.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14 +.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19 +.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24 +.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29 +.set r30,30; .set r31,31 +.set f0,0; .set f1,1; .set f2,2; .set f3,3; .set f4,4 +.set f5,5; .set f6,6; .set f7,7; .set f8,8; .set f9,9 +.set f10,10; .set f11,11; .set f12,12; .set f13,13; .set f14,14 +.set f15,15; .set f16,16; .set f17,17; .set f18,18; .set f19,19 +.set f20,20; .set f21,21; .set f22,22; .set f23,23; .set f24,24 +.set f25,25; .set f26,26; .set f27,27; .set f28,28; .set f29,29 +.set f30,30; .set f31,31 +.set BO_IF,12 +.set CR0_EQ,2 + + .rename H.10.NO_SYMBOL{PR},"" + .rename H.18.XPTC_InvokeByIndex{TC},"XPTC_InvokeByIndex" + + +# .text section + + .csect H.10.NO_SYMBOL{PR} + .globl .XPTC_InvokeByIndex + .globl XPTC_InvokeByIndex{DS} + .extern .invoke_copy_to_stack + .extern ._ptrgl{PR} + +# +# XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, +# PRUint32 paramCount, nsXPTCVariant* params) +# + +.XPTC_InvokeByIndex: + mflr r0 + std r31,-8(sp) +# +# save off the incoming values in the caller's parameter area +# + std r3,48(sp) # that + std r4,56(sp) # methodIndex + std r5,64(sp) # paramCount + std r6,72(sp) # params + std r0,16(sp) + stdu sp,-168(sp) # 2*24=48 for linkage area, + # 8*13=104 for fprData area + # 16 for saved registers + +# prepare args for 'invoke_copy_to_stack' call +# + ld r4,232(sp) # paramCount (168+8+56) + ld r5,240(sp) # params + mr r6,sp # fprData + sldi r3,r4,3 # number of bytes of stack required + # is at most numParams*8 + addi r3,r3,56 # linkage area (48) + this (8) + mr r31,sp # save original stack top + subfc sp,r3,sp # bump the stack + addi r3,sp,56 # parameter pointer excludes linkage area + # size + 'this' + + bl .invoke_copy_to_stack + nop + + lfd f1,0(r31) # Restore floating point registers + lfd f2,8(r31) + lfd f3,16(r31) + lfd f4,24(r31) + lfd f5,32(r31) + lfd f6,40(r31) + lfd f7,48(r31) + lfd f8,56(r31) + lfd f9,64(r31) + lfd f10,72(r31) + lfd f11,80(r31) + lfd f12,88(r31) + lfd f13,96(r31) + + ld r3,216(r31) # that (168+48) + ld r4,0(r3) # get vTable from 'that' + ld r5,224(r31) # methodIndex (168+56) + sldi r5,r5,3 # methodIndex * 8 + # No junk at the start of 64bit vtable !!! + ldx r11,r5,r4 # get function pointer (this jumps + # either to the function if no adjustment + # is needed (displacement = 0), or it + # jumps to the thunk code, which will jump + # to the function at the end) + + # No adjustment of the that pointer in 64bit mode, this is done + # by the thunk code + + ld r4,56(sp) + ld r5,64(sp) + ld r6,72(sp) + ld r7,80(sp) + ld r8,88(sp) + ld r9,96(sp) + ld r10,104(sp) + + bl ._ptrgl{PR} + nop + + mr sp,r31 + ld r0,184(sp) # 168+16 + addi sp,sp,168 + mtlr r0 + ld r31,-8(sp) + blr + +# .data section + + .toc # 0x00000038 +T.18.XPTC_InvokeByIndex: + .tc H.18.XPTC_InvokeByIndex{TC},XPTC_InvokeByIndex{DS} + + .csect XPTC_InvokeByIndex{DS} + .llong .XPTC_InvokeByIndex # "\0\0\0\0" + .llong TOC{TC0} # "\0\0\0008" + .llong 0x00000000 # "\0\0\0\0" +# End csect XPTC_InvokeByIndex{DS} + +# .bss section diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_ibmobj_aix.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_ibmobj_aix.s new file mode 100644 index 00000000..064a73ab --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_ibmobj_aix.s @@ -0,0 +1,140 @@ + # + # -*- 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.1 (the "License"); you may not use this file + # except in compliance with the License. You may obtain a copy of + # the License at http://www.mozilla.org/NPL/ + # + # Software distributed under the License is distributed on an "AS + # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + # implied. See the License for the specific language governing + # rights and limitations under the License. + # + # The Original Code is mozilla.org code. + # + # The Initial Developer of the Original Code is IBM Corporation. + # Portions created by IBM are + # Copyright (C) 2004, International Business Machines Corporation. + # All Rights Reserved. + # + # Contributor(s): + # + +.set r0,0; .set sp,1; .set RTOC,2; .set r3,3; .set r4,4 +.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9 +.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14 +.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19 +.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24 +.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29 +.set r30,30; .set r31,31 +.set f0,0; .set f1,1; .set f2,2; .set f3,3; .set f4,4 +.set f5,5; .set f6,6; .set f7,7; .set f8,8; .set f9,9 +.set f10,10; .set f11,11; .set f12,12; .set f13,13; .set f14,14 +.set f15,15; .set f16,16; .set f17,17; .set f18,18; .set f19,19 +.set f20,20; .set f21,21; .set f22,22; .set f23,23; .set f24,24 +.set f25,25; .set f26,26; .set f27,27; .set f28,28; .set f29,29 +.set f30,30; .set f31,31 +.set BO_IF,12 +.set CR0_EQ,2 + + + + .rename H.10.NO_SYMBOL{PR},"" + .rename H.18.XPTC_InvokeByIndex{TC},"XPTC_InvokeByIndex" + + +# .text section + + .csect H.10.NO_SYMBOL{PR} + .globl .XPTC_InvokeByIndex + .globl XPTC_InvokeByIndex{DS} + .extern .invoke_copy_to_stack + .extern ._ptrgl{PR} + + +# +# XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, +# PRUint32 paramCount, nsXPTCVariant* params) +# + +.XPTC_InvokeByIndex: + mflr r0 + stw r31,-4(sp) +# +# save off the incoming values in the caller's parameter area +# + stw r3,24(sp) # that + stw r4,28(sp) # methodIndex + stw r5,32(sp) # paramCount + stw r6,36(sp) # params + stw r0,8(sp) + stwu sp,-136(sp) # = 24 for linkage area, 8 * 13 for fprData area, 8 for saved registers + +# prepare args for 'invoke_copy_to_stack' call +# + lwz r4,168(sp) # paramCount + lwz r5,172(sp) # params + mr r6,sp # fprData + slwi r3,r4,3 # number of bytes of stack required + # at most 8*paramCount + addi r3,r3,28 # linkage area + mr r31,sp # save original stack top + subfc sp,r3,sp # bump the stack + addi r3,sp,28 # parameter pointer excludes linkage area size + 'this' + + bl .invoke_copy_to_stack + nop + + lfd f1,0(r31) # Restore floating point registers + lfd f2,8(r31) + lfd f3,16(r31) + lfd f4,24(r31) + lfd f5,32(r31) + lfd f6,40(r31) + lfd f7,48(r31) + lfd f8,56(r31) + lfd f9,64(r31) + lfd f10,72(r31) + lfd f11,80(r31) + lfd f12,88(r31) + lfd f13,96(r31) + + lwz r3,160(r31) # that + lwz r4,0(r3) # get vTable from 'that' + lwz r5,164(r31) # methodIndex + slwi r5,r5,2 # methodIndex * 4 + lwzx r11,r5,r4 # get function pointer + + lwz r4,28(sp) + lwz r5,32(sp) + lwz r6,36(sp) + lwz r7,40(sp) + lwz r8,44(sp) + lwz r9,48(sp) + lwz r10,52(sp) + + bl ._ptrgl{PR} + nop + + mr sp,r31 + lwz r0,144(sp) + addi sp,sp,136 + mtlr r0 + lwz r31,-4(sp) + blr + + +# .data section + + .toc # 0x00000038 +T.18.XPTC_InvokeByIndex: + .tc H.18.XPTC_InvokeByIndex{TC},XPTC_InvokeByIndex{DS} + + .csect XPTC_InvokeByIndex{DS} + .long .XPTC_InvokeByIndex # "\0\0\0\0" + .long TOC{TC0} # "\0\0\0008" + .long 0x00000000 # "\0\0\0\0" +# End csect XPTC_InvokeByIndex{DS} + +# .bss section diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_linux.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_linux.s new file mode 100644 index 00000000..b9aaa997 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_linux.s @@ -0,0 +1,113 @@ +// -*- Mode: Asm -*- +// +// The contents of this file are subject to the Netscape Public +// License Version 1.1 (the "License"); you may not use this file +// except in compliance with the License. You may obtain a copy of +// the License at http://www.mozilla.org/NPL/ +// +// Software distributed under the License is distributed on an "AS +// IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +// implied. See the License for the specific language governing +// rights and limitations under the License. +// +// The Original Code is mozilla.org code. +// +// The Initial Developer of the Original Code is Netscape +// Communications Corporation. Portions created by Netscape are +// Copyright (C) 1999 Netscape Communications Corporation. All +// Rights Reserved. +// +// Contributor(s): +// Franz.Sirl-kernel@lauterbach.com (Franz Sirl) +// beard@netscape.com (Patrick Beard) +// waterson@netscape.com (Chris Waterson) +// + +.set r0,0; .set sp,1; .set RTOC,2; .set r3,3; .set r4,4 +.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9 +.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14 +.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19 +.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24 +.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29 +.set r30,30; .set r31,31 +.set f0,0; .set f1,1; .set f2,2; .set f3,3; .set f4,4 +.set f5,5; .set f6,6; .set f7,7; .set f8,8; .set f9,9 +.set f10,10; .set f11,11; .set f12,12; .set f13,13; .set f14,14 +.set f15,15; .set f16,16; .set f17,17; .set f18,18; .set f19,19 +.set f20,20; .set f21,21; .set f22,22; .set f23,23; .set f24,24 +.set f25,25; .set f26,26; .set f27,27; .set f28,28; .set f29,29 +.set f30,30; .set f31,31 + + .section ".text" + .align 2 + .globl XPTC_InvokeByIndex + .type XPTC_InvokeByIndex,@function + +// +// XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, +// PRUint32 paramCount, nsXPTCVariant* params) +// + +XPTC_InvokeByIndex: + stwu sp,-32(sp) // setup standard stack frame + mflr r0 // save LR + stw r3,8(sp) // r3 <= that + stw r4,12(sp) // r4 <= methodIndex + stw r30,16(sp) + stw r31,20(sp) + + stw r0,36(sp) // store LR backchain + mr r31,sp + + rlwinm r10,r5,3,0,27 // r10 = (ParamCount * 2 * 4) & ~0x0f + addi r0,r10,96 // reserve stack for GPR and FPR register save area r0 = r10 + 96 + lwz r9,0(sp) // r9 = backchain + neg r0,r0 + stwux r9,sp,r0 // reserve stack space and save SP backchain + + addi r3,sp,8 // r3 <= args + mr r4,r5 // r4 <= paramCount + mr r5,r6 // r5 <= params + add r6,r3,r10 // r6 <= gpregs ( == args + r10 ) + mr r30,r6 // store in r30 for use later... + addi r7,r6,32 // r7 <= fpregs ( == gpregs + 32 ) + + bl invoke_copy_to_stack@local // (args, paramCount, params, gpregs, fpregs) + + lfd f1,32(r30) // load FP registers with method parameters + lfd f2,40(r30) + lfd f3,48(r30) + lfd f4,56(r30) + lfd f5,64(r30) + lfd f6,72(r30) + lfd f7,80(r30) + lfd f8,88(r30) + + lwz r3,8(r31) // r3 <= that + lwz r4,12(r31) // r4 <= methodIndex + lwz r5,0(r3) // r5 <= vtable ( == *that ) +#if !((__GNUC__ == 3 && __GNUC_MINOR__ < 2) || __GXX_ABI_VERSION >= 100) // G++ pre-V3 ABI + addi r4,r4,2 // skip first two vtable entries +#endif + slwi r4,r4,2 // convert to offset ( *= 4 ) + lwzx r0,r5,r4 // r0 <= methodpointer ( == vtable + offset ) + + lwz r4,4(r30) // load GP regs with method parameters + lwz r5,8(r30) + lwz r6,12(r30) + lwz r7,16(r30) + lwz r8,20(r30) + lwz r9,24(r30) + lwz r10,28(r30) + + mtlr r0 // copy methodpointer to LR + blrl // call method + + lwz r30,16(r31) // restore r30 & r31 + lwz r31,20(r31) + + lwz r11,0(sp) // clean up the stack + lwz r0,4(r11) + mtlr r0 + mr sp,r11 + blr diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_netbsd.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_netbsd.s new file mode 100644 index 00000000..18c775a9 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_netbsd.s @@ -0,0 +1,114 @@ +# -*- Mode: Asm -*- +# +# The contents of this file are subject to the Netscape Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/NPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1999 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): +# Franz.Sirl-kernel@lauterbach.com (Franz Sirl) +# beard@netscape.com (Patrick Beard) +# waterson@netscape.com (Chris Waterson) +# +.set r0,0; .set sp,1; .set RTOC,2; .set r3,3; .set r4,4 +.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9 +.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14 +.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19 +.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24 +.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29 +.set r30,30; .set r31,31 +.set f0,0; .set f1,1; .set f2,2; .set f3,3; .set f4,4 +.set f5,5; .set f6,6; .set f7,7; .set f8,8; .set f9,9 +.set f10,10; .set f11,11; .set f12,12; .set f13,13; .set f14,14 +.set f15,15; .set f16,16; .set f17,17; .set f18,18; .set f19,19 +.set f20,20; .set f21,21; .set f22,22; .set f23,23; .set f24,24 +.set f25,25; .set f26,26; .set f27,27; .set f28,28; .set f29,29 +.set f30,30; .set f31,31 + + .section ".text" + .align 2 + .globl XPTC_InvokeByIndex + .type XPTC_InvokeByIndex,@function + +# +# XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, +# PRUint32 paramCount, nsXPTCVariant* params) +# + +XPTC_InvokeByIndex: + stwu sp,-32(sp) # setup standard stack frame + mflr r0 # save LR + stw r3,8(sp) # r3 <= that + stw r4,12(sp) # r4 <= methodIndex + stw r30,16(sp) + stw r31,20(sp) + + stw r0,36(sp) # store LR backchain + mr r31,sp + + rlwinm r10,r5,3,0,27 # r10 = (ParamCount * 2 * 4) & ~0x0f + addi r0,r10,96 # reserve stack for GPR and FPR register save area r0 = r10 + 96 + lwz r9,0(sp) # r9 = backchain + neg r0,r0 + stwux r9,sp,r0 # reserve stack sapce and save SP backchain + + addi r3,sp,8 # r3 <= args + mr r4,r5 # r4 <= paramCount + mr r5,r6 # r5 <= params + add r6,r3,r10 # r6 <= gpregs ( == args + r10 ) + mr r30,r6 # store in r30 for use later... + addi r7,r6,32 # r7 <= fpregs ( == gpregs + 32 ) + + bl invoke_copy_to_stack@local # (args, paramCount, params, gpregs, fpregs) + + lfd f1,32(r30) # load FP registers with method parameters + lfd f2,40(r30) + lfd f3,48(r30) + lfd f4,56(r30) + lfd f5,64(r30) + lfd f6,72(r30) + lfd f7,80(r30) + lfd f8,88(r30) + + lwz r3,8(r31) # r3 <= that + lwz r4,12(r31) # r4 <= methodIndex + lwz r5,0(r3) # r5 <= vtable ( == *that ) + slwi r4,r4,3 # convert to offset ( *= 8 ) + addi r4,r4,8 # skip first two vtable entries + add r4,r4,r5 + lhz r0,0(r4) # virtual base offset + extsh r0,r0 + add r3,r3,r0 + lwz r0,4(r4) # r0 <= methodpointer ( == vtable + offset ) + + lwz r4,4(r30) # load GP regs with method parameters + lwz r5,8(r30) + lwz r6,12(r30) + lwz r7,16(r30) + lwz r8,20(r30) + lwz r9,24(r30) + lwz r10,28(r30) + + mtlr r0 # copy methodpointer to LR + blrl # call method + + lwz r30,16(r31) # restore r30 & r31 + lwz r31,20(r31) + + lwz r11,0(sp) # clean up the stack + lwz r0,4(r11) + mtlr r0 + mr sp,r11 + blr diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_rhapsody.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_rhapsody.s new file mode 100644 index 00000000..8a5c9afb --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_rhapsody.s @@ -0,0 +1,162 @@ +# +# -*- Mode: Asm -*- +# +# The contents of this file are subject to the Netscape Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/NPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1999 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): +# Patrick C. Beard <beard@netscape.com> +# + +# +# ** Assumed vtable layout (obtained by disassembling with gdb): +# ** 4 bytes per vtable entry, skip 0th and 1st entries, so the mapping +# ** from index to entry is (4 * index) + 8. +# + +.text + .align 2 +# +# XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, +# PRUint32 paramCount, nsXPTCVariant* params) +# + +.globl __XPTC_InvokeByIndex +__XPTC_InvokeByIndex: + mflr r0 + stw r31,-4(r1) +# +# save off the incoming values in the callers parameter area +# + stw r3,24(r1) ; that + stw r4,28(r1) ; methodIndex + stw r5,32(r1) ; paramCount + stw r6,36(r1) ; params + stw r0,8(r1) + stwu r1,-144(r1) ; 24 for linkage area, + ; 8*13 for fprData area, + ; 8 for saved registers, + ; 8 to keep stack 16-byte aligned + +# set up for and call 'invoke_count_words' to get new stack size +# + mr r3,r5 + mr r4,r6 + + stwu r1,-24(r1) + bl L_invoke_count_words$stub + lwz r1,0(r1) + +# prepare args for 'invoke_copy_to_stack' call +# + lwz r4,176(r1) ; paramCount + lwz r5,180(r1) ; params + mr r6,r1 ; fprData + slwi r3,r3,2 ; number of stack bytes required + addi r3,r3,28 ; linkage area + mr r31,r1 ; save original stack top + sub r1,r1,r3 ; bump the stack + clrrwi r1,r1,4 ; keep the stack 16-byte aligned + addi r3,r31,144 ; act like real alloca, so 0(sp) always + stw r3,0(r1) ; points back to previous stack frame + addi r3,r1,28 ; parameter pointer excludes linkage area size + 'this' + +# create "temporary" stack frame for _invoke_copy_to_stack to operate in. + stwu r1,-40(r1) + bl L_invoke_copy_to_stack$stub +# remove temporary stack frame. + lwz r1,0(r1) + + lfd f1,0(r31) + lfd f2,8(r31) + lfd f3,16(r31) + lfd f4,24(r31) + lfd f5,32(r31) + lfd f6,40(r31) + lfd f7,48(r31) + lfd f8,56(r31) + lfd f9,64(r31) + lfd f10,72(r31) + lfd f11,80(r31) + lfd f12,88(r31) + lfd f13,96(r31) + + lwz r3,168(r31) ; that + lwz r4,0(r3) ; get vTable from 'that' + lwz r5,172(r31) ; methodIndex + slwi r5,r5,2 ; methodIndex * 4 +#ifndef HAVE_GCC3_ABI + addi r5,r5,8 ; (methodIndex * 4) + 8 +#endif + lwzx r12,r5,r4 ; get function pointer + + lwz r4,28(r1) + lwz r5,32(r1) + lwz r6,36(r1) + lwz r7,40(r1) + lwz r8,44(r1) + lwz r9,48(r1) + lwz r10,52(r1) + + mtlr r12 + blrl + + mr r1,r31 + lwz r0,152(r1) + addi r1,r1,144 + mtlr r0 + lwz r31,-4(r1) + + blr + +.picsymbol_stub +L_invoke_count_words$stub: + .indirect_symbol _invoke_count_words + mflr r0 + bcl 20,31,L1$pb +L1$pb: + mflr r11 + addis r11,r11,ha16(L1$lz-L1$pb) + mtlr r0 + lwz r12,lo16(L1$lz-L1$pb)(r11) + mtctr r12 + addi r11,r11,lo16(L1$lz-L1$pb) + bctr +.lazy_symbol_pointer +L1$lz: + .indirect_symbol _invoke_count_words + .long dyld_stub_binding_helper + + +.picsymbol_stub +L_invoke_copy_to_stack$stub: + .indirect_symbol _invoke_copy_to_stack + mflr r0 + bcl 20,31,L2$pb +L2$pb: + mflr r11 + addis r11,r11,ha16(L2$lz-L2$pb) + mtlr r0 + lwz r12,lo16(L2$lz-L2$pb)(r11) + mtctr r12 + addi r11,r11,lo16(L2$lz-L2$pb) + bctr +.lazy_symbol_pointer +L2$lz: + .indirect_symbol _invoke_copy_to_stack + .long dyld_stub_binding_helper + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_bsdos.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_bsdos.s new file mode 100644 index 00000000..b744ee9b --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_bsdos.s @@ -0,0 +1,121 @@ +/* -*- 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.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): Chris Torek (torek@bsdi.com), Kurt Lidl (lidl@pix.net) + */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + .global XPTC_InvokeByIndex +/* + XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params); + +*/ +XPTC_InvokeByIndex: + /* regular C/C++ stack frame -- see <machine/frame.h> */ + save %sp, -96, %sp + + /* + * invoke_count_words(paramCount, params) apparently tells us + * how many "32-bit words" are involved in passing the given + * parameters to the target function. + */ + mov %i2, %o0 + call invoke_count_words ! invoke_count_words(paramCount, params) + mov %i3, %o1 + + /* + * ??? Torek wonders: does invoke_count_words always force its + * return value to be even? If not, we would have to adjust + * the return value ... should make it a multiple of 8 anyway, + * for efficiency (32 byte cache lines); will do that here thus: + * + * We already have room (in our callee's "argument dump" area, + * sp->fr_argd) for six parameters, and we are going to use + * five of those (fr_argd[1] through fr_argd[5]) in a moment. + * This space is followed by fr_argx[1], room for a seventh. + * Thus, if invoke_count_words returns a value between 0 and 6 + * inclusive, we do not need any stack adjustment. For values + * from 7 through (7+8) we want to make room for another 8 + * parameters, and so on. Thus, we want to calculate: + * + * n_extra_words = (wordcount + 1) & ~7 + * + * and then make room for that many more 32-bit words. (Normally + * it would be ((w+7)&~7; we just subtract off the room-for-6 we + * already have.) + */ + inc %o0 + andn %o0, 7, %o0 + sll %o0, 2, %o0 ! convert to bytes + sub %sp, %o0, %sp ! and make room for arguments + + /* + * Copy all the arguments to the stack, starting at the argument + * dump area at [%sp + 68], even though the first six arguments + * go in the six %o registers. We will just load up those + * arguments after the copy is done. The first argument to + * any C++ member function is always the "this" parameter so + * we actually start with what will go in %o1, at [%sp + 72]. + */ + add %sp, 72, %o0 ! invoke_copy_to_stack(addr, + mov %i2, %o1 ! paramCount, + call invoke_copy_to_stack + mov %i3, %o2 ! params); + + /* + * This is the only really tricky (compiler-dependent) part + * (everything else here relies only on the V8 SPARC calling + * conventions). "methodIndex" (%i1) is an index into a C++ + * vtable. The word at "*that" points to the vtable, but for + * some reason, the first function (index=0) is at vtable[2*4], + * the second (index 1) at vtable[3*4], the third at vtable[4*4], + * and so on. Thus, we want, in effect: + * + * that->vTable[index + 2] + */ + ld [%i0], %l0 ! vTable = *that + add %i1, 2, %l1 + sll %l1, 2, %l1 + ld [%l0 + %l1], %l0 ! fn = vTable[index + 2] + + /* + * Now load up the various function parameters. We do not know, + * nor really care, how many there are -- we just load five words + * from the stack (there are always at least five such words to + * load, even if some of them are junk) into %o1 through %o5, + * and set %o0 = %i0, to pass "that" to the target member function + * as its C++ "this" parameter. + * + * If there are more than five parameters, any extras go on our + * stack starting at sp->fr_argx ([%sp + 92]), which is of course + * where we have just copied them. + */ + ld [%sp + 72], %o1 + ld [%sp + 76], %o2 + ld [%sp + 80], %o3 + ld [%sp + 84], %o4 + ld [%sp + 88], %o5 + call %l0 ! fn(that, %o1, %o2, %o3, %o4, %o5) + mov %i0, %o0 + + ! return whatever fn() returned + ret + restore %o0, 0, %o0 + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_linux.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_linux.s new file mode 100644 index 00000000..c23fd1e7 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_linux.s @@ -0,0 +1,67 @@ +/* -*- 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.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + .global XPTC_InvokeByIndex +/* + XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params); + +*/ +XPTC_InvokeByIndex: + save %sp,-(64 + 16),%sp ! room for the register window and + ! struct pointer, rounded up to 0 % 16 + mov %i2,%o0 ! paramCount + call invoke_count_words ! returns the required stack size in %o0 + mov %i3,%o1 ! params + + sll %o0,2,%l0 ! number of bytes + sub %sp,%l0,%sp ! create the additional stack space + + mov %sp,%o0 ! pointer for copied args + add %o0,72,%o0 ! step past the register window, the + ! struct result pointer and the 'this' slot + mov %i2,%o1 ! paramCount + call invoke_copy_to_stack + mov %i3,%o2 ! params +! +! calculate the target address from the vtable +! + add %i1,1,%i1 ! vTable is zero-based, index is 1 based (?) + ld [%i0],%l1 ! *that --> vTable + sll %i1,2,%i1 ! 32 bit pointer + add %i1,%l1,%l1 ! vTable[index * 4], l1 now points to vTable entry + ld [%l1 + 4],%l0 ! target address + +.L5: ld [%sp + 88],%o5 +.L4: ld [%sp + 84],%o4 +.L3: ld [%sp + 80],%o3 +.L2: ld [%sp + 76],%o2 +.L1: ld [%sp + 72],%o1 +.L0: + jmpl %l0,%o7 ! call the routine +! always have a 'this', from the incoming 'that' + mov %i0,%o0 + + mov %o0,%i0 ! propagate return value + ret + restore diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_linux_GCC3.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_linux_GCC3.s new file mode 100644 index 00000000..9a6b02ae --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_linux_GCC3.s @@ -0,0 +1,84 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * David S. Miller <davem@redhat.com> (ported to gcc3) + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + */ + +/* + * Platform specific code to invoke XPCOM methods on native objects for + * Linux/Sparc with gcc 3 ABI. + */ + .global XPTC_InvokeByIndex +/* + * XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + * PRUint32 paramCount, nsXPTCVariant* params); + * + */ +XPTC_InvokeByIndex: + save %sp,-(64 + 16),%sp ! room for the register window and + ! struct pointer, rounded up to 0 % 16 + mov %i2,%o0 ! paramCount + call invoke_count_words ! returns the required stack size in %o0 + mov %i3,%o1 ! params + + sll %o0,2,%l0 ! number of bytes + sub %sp,%l0,%sp ! create the additional stack space + + mov %sp,%o0 ! pointer for copied args + add %o0,72,%o0 ! step past the register window, the + ! struct result pointer and the 'this' slot + mov %i2,%o1 ! paramCount + call invoke_copy_to_stack + mov %i3,%o2 ! params +! +! calculate the target address from the vtable +! + ld [%i0],%l1 ! *that --> vTable + sll %i1,2,%i1 ! multiply index by 4 + add %i1,%l1,%l1 ! l1 now points to vTable entry + ld [%l1],%l0 ! target address + +.L5: ld [%sp + 88],%o5 +.L4: ld [%sp + 84],%o4 +.L3: ld [%sp + 80],%o3 +.L2: ld [%sp + 76],%o2 +.L1: ld [%sp + 72],%o1 +.L0: + jmpl %l0,%o7 ! call the routine +! always have a 'this', from the incoming 'that' + mov %i0,%o0 + + mov %o0,%i0 ! propagate return value + ret + restore diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_netbsd.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_netbsd.s new file mode 100644 index 00000000..be0e34a7 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_netbsd.s @@ -0,0 +1,71 @@ +/* -*- 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.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + .global XPTC_InvokeByIndex +/* + XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params); + +*/ +XPTC_InvokeByIndex: + save %sp,-(64 + 16),%sp ! room for the register window and + ! struct pointer, rounded up to 0 % 16 + mov %i2,%o0 ! paramCount + call invoke_count_words ! returns the required stack size in %o0 + mov %i3,%o1 ! params + + sll %o0,2,%l0 ! number of bytes + sub %sp,%l0,%sp ! create the additional stack space + + mov %sp,%o0 ! pointer for copied args + add %o0,72,%o0 ! step past the register window, the + ! struct result pointer and the 'this' slot + mov %i2,%o1 ! paramCount + call invoke_copy_to_stack + mov %i3,%o2 ! params +! +! calculate the target address from the vtable +! + add %i1,1,%i1 ! vTable is zero-based, index is 1 based (?) + ld [%i0],%l1 ! *that --> vTable + sll %i1,3,%i1 + add %i1,%l1,%l1 ! vTable[index * 8], l1 now points to vTable entry + lduh [%l1],%l0 ! this adjustor + sll %l0,16,%l0 ! sign extend to 32 bits + sra %l0,16,%l0 + add %l0,%i0,%i0 ! adjust this + ld [%l1 + 4],%l0 ! target address + +.L5: ld [%sp + 88],%o5 +.L4: ld [%sp + 84],%o4 +.L3: ld [%sp + 80],%o3 +.L2: ld [%sp + 76],%o2 +.L1: ld [%sp + 72],%o1 +.L0: + jmpl %l0,%o7 ! call the routine +! always have a 'this', from the incoming 'that' + mov %i0,%o0 + + mov %o0,%i0 ! propagate return value + ret + restore diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_solaris.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_solaris.s new file mode 100644 index 00000000..be0e34a7 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_solaris.s @@ -0,0 +1,71 @@ +/* -*- 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.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + .global XPTC_InvokeByIndex +/* + XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params); + +*/ +XPTC_InvokeByIndex: + save %sp,-(64 + 16),%sp ! room for the register window and + ! struct pointer, rounded up to 0 % 16 + mov %i2,%o0 ! paramCount + call invoke_count_words ! returns the required stack size in %o0 + mov %i3,%o1 ! params + + sll %o0,2,%l0 ! number of bytes + sub %sp,%l0,%sp ! create the additional stack space + + mov %sp,%o0 ! pointer for copied args + add %o0,72,%o0 ! step past the register window, the + ! struct result pointer and the 'this' slot + mov %i2,%o1 ! paramCount + call invoke_copy_to_stack + mov %i3,%o2 ! params +! +! calculate the target address from the vtable +! + add %i1,1,%i1 ! vTable is zero-based, index is 1 based (?) + ld [%i0],%l1 ! *that --> vTable + sll %i1,3,%i1 + add %i1,%l1,%l1 ! vTable[index * 8], l1 now points to vTable entry + lduh [%l1],%l0 ! this adjustor + sll %l0,16,%l0 ! sign extend to 32 bits + sra %l0,16,%l0 + add %l0,%i0,%i0 ! adjust this + ld [%l1 + 4],%l0 ! target address + +.L5: ld [%sp + 88],%o5 +.L4: ld [%sp + 84],%o4 +.L3: ld [%sp + 80],%o3 +.L2: ld [%sp + 76],%o2 +.L1: ld [%sp + 72],%o1 +.L0: + jmpl %l0,%o7 ! call the routine +! always have a 'this', from the incoming 'that' + mov %i0,%o0 + + mov %o0,%i0 ! propagate return value + ret + restore diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_solaris_GCC.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_solaris_GCC.s new file mode 100644 index 00000000..203e3f1c --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_solaris_GCC.s @@ -0,0 +1,71 @@ +/* -*- 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.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + .global XPTC_InvokeByIndex +/* + XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params); + +*/ +XPTC_InvokeByIndex: + save %sp,-(64 + 32),%sp ! room for the register window and + ! struct pointer, rounded up to 0 % 32 + mov %i2,%o0 ! paramCount + call invoke_count_words ! returns the required stack size in %o0 + mov %i3,%o1 ! params + + sll %o0,2,%l0 ! number of bytes + sub %sp,%l0,%sp ! create the additional stack space + + mov %sp,%o0 ! pointer for copied args + add %o0,72,%o0 ! step past the register window, the + ! struct result pointer and the 'this' slot + mov %i2,%o1 ! paramCount + call invoke_copy_to_stack + mov %i3,%o2 ! params +! +! calculate the target address from the vtable +! + add %i1,1,%i1 ! vTable is zero-based, index is 1 based (?) + ld [%i0],%l1 ! *that --> vTable + sll %i1,3,%i1 + add %i1,%l1,%l1 ! vTable[index * 8], l1 now points to vTable entry + lduh [%l1],%l0 ! this adjustor + sll %l0,16,%l0 ! sign extend to 32 bits + sra %l0,16,%l0 + add %l0,%i0,%i0 ! adjust this + ld [%l1 + 4],%l0 ! target address + +.L5: ld [%sp + 88],%o5 +.L4: ld [%sp + 84],%o4 +.L3: ld [%sp + 80],%o3 +.L2: ld [%sp + 76],%o2 +.L1: ld [%sp + 72],%o1 +.L0: + jmpl %l0,%o7 ! call the routine +! always have a 'this', from the incoming 'that' + mov %i0,%o0 + + mov %o0,%i0 ! propagate return value + ret + restore diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_solaris_GCC3.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_solaris_GCC3.s new file mode 100644 index 00000000..6a2e9606 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_solaris_GCC3.s @@ -0,0 +1,70 @@ +/* -*- 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.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * David Baron <dbaron@dbaron.org> (ported to + * gcc 3/sparc-sun-solaris from gcc 2.x/sparc-sun-solaris) + */ + +/* + * Platform specific code to invoke XPCOM methods on native objects for + * solaris/sparc with gcc 3 ABI. + */ + .global XPTC_InvokeByIndex +/* + * XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + * PRUint32 paramCount, nsXPTCVariant* params); + */ +XPTC_InvokeByIndex: + save %sp,-(64 + 32),%sp ! room for the register window and + ! struct pointer, rounded up to 0 % 32 + mov %i2,%o0 ! paramCount + call invoke_count_words ! returns the required stack size in %o0 + mov %i3,%o1 ! params + + sll %o0,2,%l0 ! number of bytes + sub %sp,%l0,%sp ! create the additional stack space + + mov %sp,%o0 ! pointer for copied args + add %o0,72,%o0 ! step past the register window, the + ! struct result pointer and the 'this' slot + mov %i2,%o1 ! paramCount + call invoke_copy_to_stack + mov %i3,%o2 ! params +! +! calculate the target address from the vtable +! + ld [%i0],%l1 ! *that --> vTable + sll %i1,2,%i1 ! multiply index by 4 + add %i1,%l1,%l1 ! l1 now points to vTable entry + ld [%l1],%l0 ! target address + +.L5: ld [%sp + 88],%o5 +.L4: ld [%sp + 84],%o4 +.L3: ld [%sp + 80],%o3 +.L2: ld [%sp + 76],%o2 +.L1: ld [%sp + 72],%o1 +.L0: + jmpl %l0,%o7 ! call the routine +! always have a 'this', from the incoming 'that' + mov %i0,%o0 + + mov %o0,%i0 ! propagate return value + ret + restore diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_solaris_SUNW.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_solaris_SUNW.s new file mode 100644 index 00000000..b70f1b46 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_solaris_SUNW.s @@ -0,0 +1,72 @@ +/* -*- 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.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + + .global XPTC_InvokeByIndex + .type XPTC_InvokeByIndex, #function +/* + XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params); + +*/ +XPTC_InvokeByIndex: + save %sp,-(64 + 32),%sp ! room for the register window and + ! struct pointer, rounded up to 0 % 32 + sll %i2,3,%l0 ! assume the worst case + ! paramCount * 2 * 4 bytes + cmp %l0, 0 ! are there any args? If not, + be .invoke ! no need to copy args to stack + + sub %sp,%l0,%sp ! create the additional stack space + add %sp,72,%o0 ! step past the register window, the + ! struct result pointer and the 'this' slot + mov %i2,%o1 ! paramCount + call invoke_copy_to_stack + mov %i3,%o2 ! params + +! +! load arguments from stack into the outgoing registers +! + ld [%sp + 72],%o1 + ld [%sp + 76],%o2 + ld [%sp + 80],%o3 + ld [%sp + 84],%o4 + ld [%sp + 88],%o5 + +! +! calculate the target address from the vtable +! +.invoke: + sll %i1,2,%l0 ! index *= 4 + add %l0,8,%l0 ! there are 2 extra entries in the vTable + ld [%i0],%l1 ! *that --> address of vtable + ld [%l0 + %l1],%l0 ! that->vtable[index * 4 + 8] --> address + + jmpl %l0,%o7 ! call the routine + mov %i0,%o0 ! move 'this' pointer to out register + + mov %o0,%i0 ! propagate return value + ret + restore + + .size XPTC_InvokeByIndex, .-XPTC_InvokeByIndex diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparcv9_solaris_SUNW.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparcv9_solaris_SUNW.s new file mode 100644 index 00000000..232ed6bd --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparcv9_solaris_SUNW.s @@ -0,0 +1,103 @@ +/* -*- Mode: asm; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 2001 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Stuart Parmenter <pavlov@netscape.com> + * Chris Seawood <cls@seawood.org> + */ + +/* + Platform specific code to invoke XPCOM methods on native objects + for sparcv9 Solaris. + + See the SPARC Compliance Definition (SCD) Chapter 3 + for more information about what is going on here, including + the use of BIAS (0x7ff). + The SCD is available from http://www.sparc.com/. +*/ + + .global XPTC_InvokeByIndex + .type XPTC_InvokeByIndex, #function + +/* + XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params); + +*/ +XPTC_InvokeByIndex: + save %sp,-(128 + 64),%sp ! room for the register window and + ! struct pointer, rounded up to 0 % 64 + sll %i2,4,%l0 ! assume the worst case + ! paramCount * 2 * 8 bytes + cmp %l0, 0 ! are there any args? If not, + be .invoke ! no need to copy args to stack + + sub %sp,%l0,%sp ! create the additional stack space + add %sp,0x7ff+136,%o0 ! step past the register window, the + ! struct result pointer and the 'this' slot + mov %i2,%o1 ! paramCount + call invoke_copy_to_stack + mov %i3,%o2 ! params + +! +! load arguments from stack into the outgoing registers +! BIAS is 0x7ff (2047) +! + +! load the %o1..5 64bit (extended word) output registers registers + ldx [%sp + 0x7ff + 136],%o1 ! %i1 + ldx [%sp + 0x7ff + 144],%o2 ! %i2 + ldx [%sp + 0x7ff + 152],%o3 ! %i3 + ldx [%sp + 0x7ff + 160],%o4 ! %i4 + ldx [%sp + 0x7ff + 168],%o5 ! %i5 + +! load the even number double registers starting with %d2 + ldd [%sp + 0x7ff + 136],%d2 + ldd [%sp + 0x7ff + 144],%d4 + ldd [%sp + 0x7ff + 152],%d6 + ldd [%sp + 0x7ff + 160],%d8 + ldd [%sp + 0x7ff + 168],%d10 + ldd [%sp + 0x7ff + 176],%d12 + ldd [%sp + 0x7ff + 184],%d14 + ldd [%sp + 0x7ff + 192],%d16 + ldd [%sp + 0x7ff + 200],%d18 + ldd [%sp + 0x7ff + 208],%d20 + ldd [%sp + 0x7ff + 216],%d22 + ldd [%sp + 0x7ff + 224],%d24 + ldd [%sp + 0x7ff + 232],%d26 + ldd [%sp + 0x7ff + 240],%d28 + ldd [%sp + 0x7ff + 248],%d30 + +! +! calculate the target address from the vtable +! +.invoke: + sll %i1,3,%l0 ! index *= 8 + add %l0,16,%l0 ! there are 2 extra entries in the vTable (16bytes) + ldx [%i0],%l1 ! *that --> address of vtable + ldx [%l0 + %l1],%l0 ! that->vtable[index * 8 + 16] --> address + + jmpl %l0,%o7 ! call the routine + mov %i0,%o0 ! move 'this' pointer to out register + + mov %o0,%i0 ! propagate return value + ret + restore + + .size XPTC_InvokeByIndex, .-XPTC_InvokeByIndex diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_gcc_x86_unix.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_gcc_x86_unix.cpp new file mode 100644 index 00000000..79b17ae3 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_gcc_x86_unix.cpp @@ -0,0 +1,215 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + +#ifdef __GNUC__ /* Gnu compiler. */ + +#include "xptcprivate.h" +#include "xptc_platforms_unixish_x86.h" +#include "xptc_gcc_x86_unix.h" + +extern "C" { +#ifndef XP_WIN32 +static +#endif +void ATTRIBUTE_USED __attribute__ ((regparm(3))) +invoke_copy_to_stack(PRUint32 paramCount, nsXPTCVariant* s, PRUint32* d) +{ + for(PRUint32 i = paramCount; i >0; i--, d++, s++) + { + if(s->IsPtrData()) + { + *((void**)d) = s->ptr; + continue; + } + + switch(s->type) + { + case nsXPTType::T_I64 : *((PRInt64*) d) = s->val.i64; d++; break; + case nsXPTType::T_U64 : *((PRUint64*)d) = s->val.u64; d++; break; + case nsXPTType::T_DOUBLE : *((double*) d) = s->val.d; d++; break; + default : *((void**)d) = s->val.p; break; + } + } +} +} // extern "C" + +// NOTE! See xptc_gcc_x86_unix.h for the reason why this function exists. +#if (__GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ == 0)) +PRUint32 +xptc_invoke_copy_to_stack_keeper (void) +{ + PRUint32 dummy1; + void ATTRIBUTE_USED __attribute__ ((regparm(3))) (*dummy2) + (PRUint32, nsXPTCVariant*, PRUint32*) = invoke_copy_to_stack; + +// dummy2 references invoke_copy_to_stack, now we have to "use" it + __asm__ __volatile__ ( + "" + : "=&a" (dummy1) + : "g" (dummy2) + ); + + return dummy1 & 0xF0F00000; +} +#endif + + +/* + XPTC_PUBLIC_API(nsresult) + XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params); + + Each param takes at most two 4-byte words. + It doesn't matter if we push too many words, and calculating the exact + amount takes time. + + that = ebp + 0x08 + methodIndex = ebp + 0x0c + paramCount = ebp + 0x10 + params = ebp + 0x14 + + NOTE NOTE NOTE: + As of 2002-04-29 this function references no global variables nor does + it call non-static functions so preserving and loading the PIC register + is unnecessary. Define MOZ_PRESERVE_PIC if this changes. See mozilla + bug 140412 for details. However, avoid this if you can. It's slower. +*/ +/* + * Hack for gcc for win32. Functions used externally must be + * explicitly dllexported. + * Bug 226609 + */ +#ifdef XP_WIN32 +extern "C" { + nsresult _XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params); + XPTC_PUBLIC_API(nsresult) + XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params) { + return _XPTC_InvokeByIndex(that, methodIndex, paramCount, params); + } +} +#endif + +__asm__ ( + ".text\n\t" +/* alignment here seems unimportant here; this was 16, now it's 2 which + is what xptcstubs uses. */ + ".align 2\n\t" +#ifdef XP_WIN32 + ".globl " SYMBOL_UNDERSCORE "_XPTC_InvokeByIndex\n\t" + ".type " SYMBOL_UNDERSCORE "_XPTC_InvokeByIndex,@function\n" + SYMBOL_UNDERSCORE "_XPTC_InvokeByIndex:\n\t" +#else +#ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP + ".globl " SYMBOL_UNDERSCORE "VBoxNsxpXPTC_InvokeByIndex\n\t" + ".type " SYMBOL_UNDERSCORE "VBoxNsxpXPTC_InvokeByIndex,@function\n" + SYMBOL_UNDERSCORE "VBoxNsxpXPTC_InvokeByIndex:\n\t" +#else + ".globl " SYMBOL_UNDERSCORE "XPTC_InvokeByIndex\n\t" + ".type " SYMBOL_UNDERSCORE "XPTC_InvokeByIndex,@function\n" + SYMBOL_UNDERSCORE "XPTC_InvokeByIndex:\n\t" +#endif +#endif + "pushl %ebp\n\t" + "movl %esp, %ebp\n\t" +#ifdef MOZ_PRESERVE_PIC + "pushl %ebx\n\t" + "call 0f\n\t" + ".subsection 1\n" + "0:\n\t" + "movl (%esp), %ebx\n\t" + "ret\n\t" + ".previous\n\t" + "addl $_GLOBAL_OFFSET_TABLE_, %ebx\n\t" +#endif + "movl 0x10(%ebp), %eax\n\t" + "leal 0(,%eax,8),%edx\n\t" + "movl %esp, %ecx\n\t" + "subl %edx, %ecx\n\t" +/* Since there may be 64-bit data, it occurs to me that aligning this + space might be a performance gain. However, I don't think the rest + of mozilla worries about such things. In any event, do it here. + "andl $0xfffffff8, %ecx\n\t" + */ + "movl %ecx, %esp\n\t" /* make stack space */ + "movl 0x14(%ebp), %edx\n\t" + "call " SYMBOL_UNDERSCORE "invoke_copy_to_stack\n\t" + "movl 0x08(%ebp), %ecx\n\t" /* 'that' */ +#ifdef CFRONT_STYLE_THIS_ADJUST + "movl (%ecx), %edx\n\t" + "movl 0x0c(%ebp), %eax\n\t" /* function index */ + "shll $3, %eax\n\t" /* *= 8 */ + "addl $8, %eax\n\t" /* += 8 skip first entry */ + "addl %eax, %edx\n\t" + "movswl (%edx), %eax\n\t" /* 'this' offset */ + "addl %eax, %ecx\n\t" + "pushl %ecx\n\t" + "addl $4, %edx\n\t" /* += 4, method pointer */ +#else /* THUNK_BASED_THIS_ADJUST */ + "pushl %ecx\n\t" + "movl (%ecx), %edx\n\t" + "movl 0x0c(%ebp), %eax\n\t" /* function index */ +#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */ + "leal (%edx,%eax,4), %edx\n\t" +#else /* not G++ V3 ABI */ + "leal 8(%edx,%eax,4), %edx\n\t" +#endif /* G++ V3 ABI */ +#endif + "call *(%edx)\n\t" +#ifdef MOZ_PRESERVE_PIC + "movl -4(%ebp), %ebx\n\t" +#endif + "movl %ebp, %esp\n\t" + "popl %ebp\n\t" + "ret\n" +#ifdef XP_WIN32 + ".size " SYMBOL_UNDERSCORE "_XPTC_InvokeByIndex, . -" SYMBOL_UNDERSCORE "_XPTC_InvokeByIndex\n\t" +#else +#ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP + ".size " SYMBOL_UNDERSCORE "VBoxNsxpXPTC_InvokeByIndex, . -" SYMBOL_UNDERSCORE "VBoxNsxpXPTC_InvokeByIndex\n\t" +#else + ".size " SYMBOL_UNDERSCORE "XPTC_InvokeByIndex, . -" SYMBOL_UNDERSCORE "XPTC_InvokeByIndex\n\t" +#endif +#endif +); + +#else +#error "can't find a compiler to use" +#endif /* __GNUC__ */ diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ipf32.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ipf32.cpp new file mode 100644 index 00000000..5a959317 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ipf32.cpp @@ -0,0 +1,164 @@ + +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "xptcprivate.h" + +#include <iostream.h> + +// "This code is for IA64 only" + + +/* invoke_copy_to_stack() will copy from variant array 's' to + * the stack argument area 'mloc', the integer register area 'iloc', and + * the float register area 'floc'. + * + */ +extern "C" void +invoke_copy_to_stack(uint64_t* mloc, uint64_t* iloc, uint64_t* floc, + const PRUint32 paramCount, nsXPTCVariant* s) +{ + uint64_t* dest = mloc; + PRUint32 len = paramCount; + nsXPTCVariant* source = s; + + PRUint32 indx; + PRUint32 endlen; + endlen = (len > 7) ? 7 : len; + /* handle the memory arguments */ + for (indx = 7; indx < len; ++indx) + { + if (source[indx].IsPtrData()) + { +#ifdef __LP64__ + /* 64 bit pointer mode */ + *((void**) dest) = source[indx].ptr; +#else + /* 32 bit pointer mode */ + uint32_t* adr = (uint32_t*) dest; + *(adr) = 0; + *(adr+1) = (uint32_t) source[indx].ptr; +#endif + } + else + switch (source[indx].type) + { + case nsXPTType::T_I8 : *(dest) = source[indx].val.i8; break; + case nsXPTType::T_I16 : *(dest) = source[indx].val.i16; break; + case nsXPTType::T_I32 : *(dest) = source[indx].val.i32; break; + case nsXPTType::T_I64 : *(dest) = source[indx].val.i64; break; + case nsXPTType::T_U8 : *(dest) = source[indx].val.u8; break; + case nsXPTType::T_U16 : *(dest) = source[indx].val.u16; break; + case nsXPTType::T_U32 : *(dest) = source[indx].val.u32; break; + case nsXPTType::T_U64 : *(dest) = source[indx].val.u64; break; + case nsXPTType::T_FLOAT : *(dest) = source[indx].val.u32; break; + case nsXPTType::T_DOUBLE: *(dest) = source[indx].val.u64; break; + case nsXPTType::T_BOOL : *(dest) = source[indx].val.b; break; + case nsXPTType::T_CHAR : *(dest) = source[indx].val.c; break; + case nsXPTType::T_WCHAR : *(dest) = source[indx].val.wc; break; + default: + // all the others are plain pointer types +#ifdef __LP64__ + /* 64 bit pointer mode */ + *((void**) dest) = source[indx].val.p; +#else + { + /* 32 bit pointer mode */ + uint32_t* adr = (uint32_t*) dest; + *(adr) = 0; + *(adr+1) = (uint32_t) source[indx].val.p; + } +#endif + } + ++dest; + } + /* process register arguments */ + dest = iloc; + for (indx = 0; indx < endlen; ++indx) + { + if (source[indx].IsPtrData()) + { +#ifdef __LP64__ + /* 64 bit pointer mode */ + *((void**) dest) = source[indx].ptr; +#else + /* 32 bit pointer mode */ + uint32_t* adr = (uint32_t*) dest; + *(adr) = 0; + *(adr+1) = (uint32_t) source[indx].ptr; +#endif + } + else + switch (source[indx].type) + { + case nsXPTType::T_I8 : *(dest) = source[indx].val.i8; break; + case nsXPTType::T_I16 : *(dest) = source[indx].val.i16; break; + case nsXPTType::T_I32 : *(dest) = source[indx].val.i32; break; + case nsXPTType::T_I64 : *(dest) = source[indx].val.i64; break; + case nsXPTType::T_U8 : *(dest) = source[indx].val.u8; break; + case nsXPTType::T_U16 : *(dest) = source[indx].val.u16; break; + case nsXPTType::T_U32 : *(dest) = source[indx].val.u32; break; + case nsXPTType::T_U64 : *(dest) = source[indx].val.u64; break; + case nsXPTType::T_FLOAT : + *((double*) (floc++)) = (double) source[indx].val.f; + break; + case nsXPTType::T_DOUBLE: + *((double*) (floc++)) = source[indx].val.d; + break; + case nsXPTType::T_BOOL : *(dest) = source[indx].val.b; break; + case nsXPTType::T_CHAR : *(dest) = source[indx].val.c; break; + case nsXPTType::T_WCHAR : *(dest) = source[indx].val.wc; break; + default: + // all the others are plain pointer types +#ifdef __LP64__ + /* 64 bit pointer mode */ + *((void**) dest) = source[indx].val.p; +#else + { + /* 32 bit pointer mode */ + uint32_t* adr = (uint32_t*) dest; + *(adr) = 0; + *(adr+1) = (uint32_t) source[indx].val.p; + } +#endif + } + ++dest; + } + +} + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ipf64.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ipf64.cpp new file mode 100644 index 00000000..356c2c7b --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ipf64.cpp @@ -0,0 +1,133 @@ + +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "xptcprivate.h" + +#include <stdint.h> +#include <iostream.h> + +// "This code is for IA64 only" + + +/* invoke_copy_to_stack() will copy from variant array 's' to + * the stack argument area 'mloc', the integer register area 'iloc', and + * the float register area 'floc'. + * + */ +extern "C" void +invoke_copy_to_stack(uint64_t* mloc, uint64_t* iloc, uint64_t* floc, + const PRUint32 paramCount, nsXPTCVariant* s) +{ + uint64_t* dest = mloc; + PRUint32 len = paramCount; + nsXPTCVariant* source = s; + + PRUint32 indx; + PRUint32 endlen; + endlen = (len > 7) ? 7 : len; + /* handle the memory arguments */ + for (indx = 7; indx < len; ++indx) + { + if (source[indx].IsPtrData()) + { + /* 64 bit pointer mode */ + *((void**) dest) = source[indx].ptr; + } + else + switch (source[indx].type) + { + case nsXPTType::T_I8 : *(dest) = source[indx].val.i8; break; + case nsXPTType::T_I16 : *(dest) = source[indx].val.i16; break; + case nsXPTType::T_I32 : *(dest) = source[indx].val.i32; break; + case nsXPTType::T_I64 : *(dest) = source[indx].val.i64; break; + case nsXPTType::T_U8 : *(dest) = source[indx].val.u8; break; + case nsXPTType::T_U16 : *(dest) = source[indx].val.u16; break; + case nsXPTType::T_U32 : *(dest) = source[indx].val.u32; break; + case nsXPTType::T_U64 : *(dest) = source[indx].val.u64; break; + case nsXPTType::T_FLOAT : *(dest) = source[indx].val.u32; break; + case nsXPTType::T_DOUBLE: *(dest) = source[indx].val.u64; break; + case nsXPTType::T_BOOL : *(dest) = source[indx].val.b; break; + case nsXPTType::T_CHAR : *(dest) = source[indx].val.c; break; + case nsXPTType::T_WCHAR : *(dest) = source[indx].val.wc; break; + default: + // all the others are plain pointer types + /* 64 bit pointer mode */ + *((void**) dest) = source[indx].val.p; + } + ++dest; + } + /* process register arguments */ + dest = iloc; + for (indx = 0; indx < endlen; ++indx) + { + if (source[indx].IsPtrData()) + { + /* 64 bit pointer mode */ + *((void**) dest) = source[indx].ptr; + } + else + switch (source[indx].type) + { + case nsXPTType::T_I8 : *(dest) = source[indx].val.i8; break; + case nsXPTType::T_I16 : *(dest) = source[indx].val.i16; break; + case nsXPTType::T_I32 : *(dest) = source[indx].val.i32; break; + case nsXPTType::T_I64 : *(dest) = source[indx].val.i64; break; + case nsXPTType::T_U8 : *(dest) = source[indx].val.u8; break; + case nsXPTType::T_U16 : *(dest) = source[indx].val.u16; break; + case nsXPTType::T_U32 : *(dest) = source[indx].val.u32; break; + case nsXPTType::T_U64 : *(dest) = source[indx].val.u64; break; + case nsXPTType::T_FLOAT : + *((double*) (floc++)) = (double) source[indx].val.f; + break; + case nsXPTType::T_DOUBLE: + *((double*) (floc++)) = source[indx].val.d; + break; + case nsXPTType::T_BOOL : *(dest) = source[indx].val.b; break; + case nsXPTType::T_CHAR : *(dest) = source[indx].val.c; break; + case nsXPTType::T_WCHAR : *(dest) = source[indx].val.wc; break; + default: + // all the others are plain pointer types + /* 64 bit pointer mode */ + *((void**) dest) = source[indx].val.p; + } + ++dest; + } + +} + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_irix.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_irix.cpp new file mode 100644 index 00000000..67aa6144 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_irix.cpp @@ -0,0 +1,173 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + +#include "xptcprivate.h" + +#if (_MIPS_SIM != _ABIN32) +#error "This code is for IRIX N32 only" +#endif + +extern "C" uint32 +invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s) +{ + return(paramCount*2); +} + +extern "C" void +invoke_copy_to_stack(PRUint64* d, PRUint32 paramCount, + nsXPTCVariant* s, PRUint64 *regs) +{ +#define N_ARG_REGS 7 /* 8 regs minus 1 for "this" ptr */ + + for (PRUint32 i = 0; i < paramCount; i++, s++) + { + if (s->IsPtrData()) { + if (i < N_ARG_REGS) + regs[i] = (PRUint64)s->ptr; + else + *d++ = (PRUint64)s->ptr; + continue; + } + switch (s->type) { + // + // signed types first + // + case nsXPTType::T_I8: + if (i < N_ARG_REGS) + ((PRInt64*)regs)[i] = s->val.i8; + else + *d++ = s->val.i8; + break; + case nsXPTType::T_I16: + if (i < N_ARG_REGS) + ((PRInt64*)regs)[i] = s->val.i16; + else + *d++ = s->val.i16; + break; + case nsXPTType::T_I32: + if (i < N_ARG_REGS) + ((PRInt64*)regs)[i] = s->val.i32; + else + *d++ = s->val.i32; + break; + case nsXPTType::T_I64: + if (i < N_ARG_REGS) + ((PRInt64*)regs)[i] = s->val.i64; + else + *d++ = s->val.i64; + break; + // + // unsigned types next + // + case nsXPTType::T_U8: + if (i < N_ARG_REGS) + regs[i] = s->val.u8; + else + *d++ = s->val.u8; + break; + case nsXPTType::T_U16: + if (i < N_ARG_REGS) + regs[i] = s->val.u16; + else + *d++ = s->val.u16; + break; + case nsXPTType::T_U32: + if (i < N_ARG_REGS) + regs[i] = s->val.u32; + else + *d++ = s->val.u32; + break; + case nsXPTType::T_U64: + if (i < N_ARG_REGS) + regs[i] = s->val.u64; + else + *d++ = s->val.u64; + break; + case nsXPTType::T_FLOAT: + if (i < N_ARG_REGS) + // Place a float in least significant bytes. + *(float*)(((char*)®s[i+1]) - sizeof(float)) = s->val.f; + else + *(float*)d++ = s->val.f; + break; + case nsXPTType::T_DOUBLE: + if (i < N_ARG_REGS) + *(double*)®s[i] = s->val.d; + else + *(double*)d++ = s->val.d; + break; + case nsXPTType::T_BOOL: + if (i < N_ARG_REGS) + regs[i] = s->val.b; + else + *d++ = s->val.b; + break; + case nsXPTType::T_CHAR: + if (i < N_ARG_REGS) + regs[i] = s->val.c; + else + *d++ = s->val.c; + break; + case nsXPTType::T_WCHAR: + if (i < N_ARG_REGS) + regs[i] = s->val.wc; + else + *d++ = s->val.wc; + break; + default: + // all the others are plain pointer types + if (i < N_ARG_REGS) + regs[i] = (PRUint64)s->val.p; + else + *d++ = (PRUint64)s->val.p; + break; + } + } +} + +extern "C" nsresult _XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params); + +extern "C" +XPTC_PUBLIC_API(nsresult) +XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params) +{ + return _XPTC_InvokeByIndex(that, methodIndex, paramCount, params); +} diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_alpha.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_alpha.cpp new file mode 100644 index 00000000..7f7d84c3 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_alpha.cpp @@ -0,0 +1,181 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Glen Nakamura <glen@imodulo.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + +#include "xptcprivate.h" + +/* Prototype specifies unmangled function name and disables unused warning */ +static void +invoke_copy_to_stack(PRUint64* d, PRUint32 paramCount, nsXPTCVariant* s) +__asm__("invoke_copy_to_stack") __attribute__((unused)); + +static void +invoke_copy_to_stack(PRUint64* d, PRUint32 paramCount, nsXPTCVariant* s) +{ + const PRUint8 NUM_ARG_REGS = 6-1; // -1 for "this" pointer + + for(PRUint32 i = 0; i < paramCount; i++, d++, s++) + { + if(s->IsPtrData()) + { + *d = (PRUint64)s->ptr; + continue; + } + switch(s->type) + { + case nsXPTType::T_I8 : *d = (PRUint64)s->val.i8; break; + case nsXPTType::T_I16 : *d = (PRUint64)s->val.i16; break; + case nsXPTType::T_I32 : *d = (PRUint64)s->val.i32; break; + case nsXPTType::T_I64 : *d = (PRUint64)s->val.i64; break; + case nsXPTType::T_U8 : *d = (PRUint64)s->val.u8; break; + case nsXPTType::T_U16 : *d = (PRUint64)s->val.u16; break; + case nsXPTType::T_U32 : *d = (PRUint64)s->val.u32; break; + case nsXPTType::T_U64 : *d = (PRUint64)s->val.u64; break; + case nsXPTType::T_FLOAT : + if(i < NUM_ARG_REGS) + { + // convert floats to doubles if they are to be passed + // via registers so we can just deal with doubles later + union { PRUint64 u64; double d; } t; + t.d = (double)s->val.f; + *d = t.u64; + } + else + // otherwise copy to stack normally + *d = (PRUint64)s->val.u32; + break; + case nsXPTType::T_DOUBLE : *d = (PRUint64)s->val.u64; break; + case nsXPTType::T_BOOL : *d = (PRUint64)s->val.b; break; + case nsXPTType::T_CHAR : *d = (PRUint64)s->val.c; break; + case nsXPTType::T_WCHAR : *d = (PRUint64)s->val.wc; break; + default: + // all the others are plain pointer types + *d = (PRUint64)s->val.p; + break; + } + } +} + +/* + * XPTC_PUBLIC_API(nsresult) + * XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + * PRUint32 paramCount, nsXPTCVariant* params) + */ +__asm__( + "#### XPTC_InvokeByIndex ####\n" +".text\n\t" + ".align 5\n\t" + ".globl XPTC_InvokeByIndex\n\t" + ".ent XPTC_InvokeByIndex\n" +"XPTC_InvokeByIndex:\n\t" + ".frame $15,32,$26,0\n\t" + ".mask 0x4008000,-32\n\t" + "ldgp $29,0($27)\n" +"$XPTC_InvokeByIndex..ng:\n\t" + "subq $30,32,$30\n\t" + "stq $26,0($30)\n\t" + "stq $15,8($30)\n\t" + "bis $30,$30,$15\n\t" + ".prologue 1\n\t" + + /* + * Allocate enough stack space to hold the greater of 6 or "paramCount"+1 + * parameters. (+1 for "this" pointer) Room for at least 6 parameters + * is required for storage of those passed via registers. + */ + + "bis $31,5,$2\n\t" /* count = MAX(5, "paramCount") */ + "cmplt $2,$18,$1\n\t" + "cmovne $1,$18,$2\n\t" + "s8addq $2,16,$1\n\t" /* room for count+1 params (8 bytes each) */ + "bic $1,15,$1\n\t" /* stack space is rounded up to 0 % 16 */ + "subq $30,$1,$30\n\t" + + "stq $16,0($30)\n\t" /* save "that" (as "this" pointer) */ + "stq $17,16($15)\n\t" /* save "methodIndex" */ + + "addq $30,8,$16\n\t" /* pass stack pointer */ + "bis $18,$18,$17\n\t" /* pass "paramCount" */ + "bis $19,$19,$18\n\t" /* pass "params" */ + "bsr $26,$invoke_copy_to_stack..ng\n\t" /* call invoke_copy_to_stack */ + + /* + * Copy the first 6 parameters to registers and remove from stack frame. + * Both the integer and floating point registers are set for each parameter + * except the first which is the "this" pointer. (integer only) + * The floating point registers are all set as doubles since the + * invoke_copy_to_stack function should have converted the floats. + */ + "ldq $16,0($30)\n\t" /* integer registers */ + "ldq $17,8($30)\n\t" + "ldq $18,16($30)\n\t" + "ldq $19,24($30)\n\t" + "ldq $20,32($30)\n\t" + "ldq $21,40($30)\n\t" + "ldt $f17,8($30)\n\t" /* floating point registers */ + "ldt $f18,16($30)\n\t" + "ldt $f19,24($30)\n\t" + "ldt $f20,32($30)\n\t" + "ldt $f21,40($30)\n\t" + + "addq $30,48,$30\n\t" /* remove params from stack */ + + /* + * Call the virtual function with the constructed stack frame. + */ + "bis $16,$16,$1\n\t" /* load "this" */ + "ldq $2,16($15)\n\t" /* load "methodIndex" */ + "ldq $1,0($1)\n\t" /* load vtable */ +#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */ + "s8addq $2,$31,$2\n\t" /* vtable index = "methodIndex" * 8 */ +#else /* not G++ V3 ABI */ + "s8addq $2,16,$2\n\t" /* vtable index = "methodIndex" * 8 + 16 */ +#endif /* G++ V3 ABI */ + "addq $1,$2,$1\n\t" + "ldq $27,0($1)\n\t" /* load address of function */ + "jsr $26,($27),0\n\t" /* call virtual function */ + "ldgp $29,0($26)\n\t" + + "bis $15,$15,$30\n\t" + "ldq $26,0($30)\n\t" + "ldq $15,8($30)\n\t" + "addq $30,32,$30\n\t" + "ret $31,($26),1\n\t" + ".end XPTC_InvokeByIndex" + ); diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_m68k.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_m68k.cpp new file mode 100644 index 00000000..363e45e0 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_m68k.cpp @@ -0,0 +1,170 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + +#include "xptcprivate.h" + +// Remember that these 'words' are 32bit DWORDS + +extern "C" { + static PRUint32 + invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s) + { + PRUint32 result = 0; + for(PRUint32 i = 0; i < paramCount; i++, s++) + { + if(s->IsPtrData()) + { + result++; + continue; + } + switch(s->type) + { + case nsXPTType::T_I8 : + case nsXPTType::T_I16 : + case nsXPTType::T_I32 : + result++; + break; + case nsXPTType::T_I64 : + result+=2; + break; + case nsXPTType::T_U8 : + case nsXPTType::T_U16 : + case nsXPTType::T_U32 : + result++; + break; + case nsXPTType::T_U64 : + result+=2; + break; + case nsXPTType::T_FLOAT : + result++; + break; + case nsXPTType::T_DOUBLE : + result+=2; + break; + case nsXPTType::T_BOOL : + case nsXPTType::T_CHAR : + case nsXPTType::T_WCHAR : + result++; + break; + default: + // all the others are plain pointer types + result++; + break; + } + } + return result; + } + + void + invoke_copy_to_stack(PRUint32* d, PRUint32 paramCount, nsXPTCVariant* s) + { + for(PRUint32 i = 0; i < paramCount; i++, d++, s++) + { + if(s->IsPtrData()) + { + *((void**)d) = s->ptr; + continue; + } + switch(s->type) + { + // 8 and 16 bit types should be promoted to 32 bits when copying + // onto the stack. + case nsXPTType::T_I8 : *((PRUint32*)d) = s->val.i8; break; + case nsXPTType::T_I16 : *((PRUint32*)d) = s->val.i16; break; + case nsXPTType::T_I32 : *((PRInt32*) d) = s->val.i32; break; + case nsXPTType::T_I64 : *((PRInt64*) d) = s->val.i64; d++; break; + case nsXPTType::T_U8 : *((PRUint32*)d) = s->val.u8; break; + case nsXPTType::T_U16 : *((PRUint32*)d) = s->val.u16; break; + case nsXPTType::T_U32 : *((PRUint32*)d) = s->val.u32; break; + case nsXPTType::T_U64 : *((PRUint64*)d) = s->val.u64; d++; break; + case nsXPTType::T_FLOAT : *((float*) d) = s->val.f; break; + case nsXPTType::T_DOUBLE : *((double*) d) = s->val.d; d++; break; + case nsXPTType::T_BOOL : *((PRBool*) d) = s->val.b; break; + case nsXPTType::T_CHAR : *((PRUint32*)d) = s->val.c; break; + case nsXPTType::T_WCHAR : *((wchar_t*) d) = s->val.wc; break; + + default: + // all the others are plain pointer types + *((void**)d) = s->val.p; + break; + } + } + } +} + +XPTC_PUBLIC_API(nsresult) +XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params) +{ + PRUint32 result, n; + + n = invoke_count_words(paramCount, params) * 4; + + __asm__ __volatile__( + "subl %5, %/sp\n\t" /* make room for params */ + "movl %/sp, %/a0\n\t" + "movl %4, %/sp@-\n\t" + "movl %3, %/sp@-\n\t" + "movl %/a0, %/sp@-\n\t" + "jbsr invoke_copy_to_stack\n\t" /* copy params */ + "addl #12, %/sp\n\t" + "movl %1, %/a0\n\t" + "movl %/a0, %/sp@-\n\t" + "movl %/a0@, %/a0\n\t" + "movl %2, %/d0\n\t" /* function index */ +#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */ + "movl %/a0@(%/d0:l:4), %/a0\n\t" +#else /* not V3 */ + "movl %/a0@(8,%/d0:l:4), %/a0\n\t" +#endif + "jbsr %/a0@\n\t" /* safe to not cleanup sp */ + "movl %/d0, %0\n\t" + "addql #4, %/sp\n\t" + "addl %5, %/sp" + : "=g" (result) /* %0 */ + : "g" (that), /* %1 */ + "g" (methodIndex), /* %2 */ + "g" (paramCount), /* %3 */ + "g" (params), /* %4 */ + "g" (n) /* %5 */ + : "a0", "a1", "d0", "d1", "memory" + ); + + return result; +} diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_s390.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_s390.cpp new file mode 100644 index 00000000..5da035ca --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_s390.cpp @@ -0,0 +1,254 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + +#include "xptcprivate.h" + + +static PRUint32 +invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s) +{ + PRUint32 overflow = 0, gpr = 1 /*this*/, fpr = 0; + for(PRUint32 i = 0; i < paramCount; i++, s++) + { + if(s->IsPtrData()) + { + if (gpr < 5) gpr++; else overflow++; + continue; + } + switch(s->type) + { + case nsXPTType::T_I8 : + case nsXPTType::T_I16 : + case nsXPTType::T_I32 : + if (gpr < 5) gpr++; else overflow++; + break; + case nsXPTType::T_I64 : + if (gpr < 4) gpr+=2; else gpr=5, overflow+=2; + break; + case nsXPTType::T_U8 : + case nsXPTType::T_U16 : + case nsXPTType::T_U32 : + if (gpr < 5) gpr++; else overflow++; + break; + case nsXPTType::T_U64 : + if (gpr < 4) gpr+=2; else gpr=5, overflow+=2; + break; + case nsXPTType::T_FLOAT : + if (fpr < 2) fpr++; else overflow++; + break; + case nsXPTType::T_DOUBLE : + if (fpr < 2) fpr++; else overflow+=2; + break; + case nsXPTType::T_BOOL : + case nsXPTType::T_CHAR : + case nsXPTType::T_WCHAR : + if (gpr < 5) gpr++; else overflow++; + break; + default: + // all the others are plain pointer types + if (gpr < 5) gpr++; else overflow++; + break; + } + } + /* Round up number of overflow words to ensure stack + stays aligned to 8 bytes. */ + return (overflow + 1) & ~1; +} + +static void +invoke_copy_to_stack(PRUint32 paramCount, nsXPTCVariant* s, PRUint32* d_ov, PRUint32 overflow) +{ + PRUint32 *d_gpr = d_ov + overflow; + PRUint64 *d_fpr = (PRUint64 *)(d_gpr + 4); + PRUint32 gpr = 1 /*this*/, fpr = 0; + + for(PRUint32 i = 0; i < paramCount; i++, s++) + { + if(s->IsPtrData()) + { + if (gpr < 5) + *((void**)d_gpr) = s->ptr, d_gpr++, gpr++; + else + *((void**)d_ov ) = s->ptr, d_ov++; + continue; + } + switch(s->type) + { + case nsXPTType::T_I8 : + if (gpr < 5) + *((PRInt32*) d_gpr) = s->val.i8, d_gpr++, gpr++; + else + *((PRInt32*) d_ov ) = s->val.i8, d_ov++; + break; + case nsXPTType::T_I16 : + if (gpr < 5) + *((PRInt32*) d_gpr) = s->val.i16, d_gpr++, gpr++; + else + *((PRInt32*) d_ov ) = s->val.i16, d_ov++; + break; + case nsXPTType::T_I32 : + if (gpr < 5) + *((PRInt32*) d_gpr) = s->val.i32, d_gpr++, gpr++; + else + *((PRInt32*) d_ov ) = s->val.i32, d_ov++; + break; + case nsXPTType::T_I64 : + if (gpr < 4) + *((PRInt64*) d_gpr) = s->val.i64, d_gpr+=2, gpr+=2; + else + *((PRInt64*) d_ov ) = s->val.i64, d_ov+=2, gpr=5; + break; + case nsXPTType::T_U8 : + if (gpr < 5) + *((PRUint32*) d_gpr) = s->val.u8, d_gpr++, gpr++; + else + *((PRUint32*) d_ov ) = s->val.u8, d_ov++; + break; + case nsXPTType::T_U16 : + if (gpr < 5) + *((PRUint32*)d_gpr) = s->val.u16, d_gpr++, gpr++; + else + *((PRUint32*)d_ov ) = s->val.u16, d_ov++; + break; + case nsXPTType::T_U32 : + if (gpr < 5) + *((PRUint32*)d_gpr) = s->val.u32, d_gpr++, gpr++; + else + *((PRUint32*)d_ov ) = s->val.u32, d_ov++; + break; + case nsXPTType::T_U64 : + if (gpr < 4) + *((PRUint64*)d_gpr) = s->val.u64, d_gpr+=2, gpr+=2; + else + *((PRUint64*)d_ov ) = s->val.u64, d_ov+=2, gpr=5; + break; + case nsXPTType::T_FLOAT : + if (fpr < 2) + *((float*) d_fpr) = s->val.f, d_fpr++, fpr++; + else + *((float*) d_ov ) = s->val.f, d_ov++; + break; + case nsXPTType::T_DOUBLE : + if (fpr < 2) + *((double*) d_fpr) = s->val.d, d_fpr++, fpr++; + else + *((double*) d_ov ) = s->val.d, d_ov+=2; + break; + case nsXPTType::T_BOOL : + if (gpr < 5) + *((PRUint32*)d_gpr) = s->val.b, d_gpr++, gpr++; + else + *((PRUint32*)d_ov ) = s->val.b, d_ov++; + break; + case nsXPTType::T_CHAR : + if (gpr < 5) + *((PRUint32*)d_gpr) = s->val.c, d_gpr++, gpr++; + else + *((PRUint32*)d_ov ) = s->val.c, d_ov++; + break; + case nsXPTType::T_WCHAR : + if (gpr < 5) + *((PRUint32*)d_gpr) = s->val.wc, d_gpr++, gpr++; + else + *((PRUint32*)d_ov ) = s->val.wc, d_ov++; + break; + default: + // all the others are plain pointer types + if (gpr < 5) + *((void**) d_gpr) = s->val.p, d_gpr++, gpr++; + else + *((void**) d_ov ) = s->val.p, d_ov++; + break; + } + } +} + +XPTC_PUBLIC_API(nsresult) +XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params) +{ + PRUint32 *vtable = *(PRUint32 **)that; +#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */ + PRUint32 method = vtable[methodIndex]; +#else /* not G++ V3 ABI */ + PRUint32 method = vtable[methodIndex + 2]; +#endif /* G++ V3 ABI */ + PRUint32 overflow = invoke_count_words (paramCount, params); + PRUint32 result; + + __asm__ __volatile__ + ( + "lr 7,15\n\t" + "ahi 7,-32\n\t" + + "lr 3,%3\n\t" + "sll 3,2\n\t" + "lcr 3,3\n\t" + "l 2,0(15)\n\t" + "la 15,0(3,7)\n\t" + "st 2,0(15)\n\t" + + "lr 2,%1\n\t" + "lr 3,%2\n\t" + "la 4,96(15)\n\t" + "lr 5,%3\n\t" + "basr 14,%4\n\t" + + "lr 2,%5\n\t" + "ld 0,112(7)\n\t" + "ld 2,120(7)\n\t" + "lm 3,6,96(7)\n\t" + "basr 14,%6\n\t" + + "la 15,32(7)\n\t" + + "lr %0,2\n\t" + : "=r" (result) + : "r" (paramCount), + "r" (params), + "r" (overflow), + "a" (invoke_copy_to_stack), + "a" (that), + "a" (method) + : "2", "3", "4", "5", "6", "7", "memory" + ); + + return result; +} diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_s390x.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_s390x.cpp new file mode 100644 index 00000000..5a4268b6 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_s390x.cpp @@ -0,0 +1,250 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + +#include "xptcprivate.h" + + +static PRUint32 +invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s) +{ + PRUint32 overflow = 0, gpr = 1 /*this*/, fpr = 0; + for(PRUint32 i = 0; i < paramCount; i++, s++) + { + if(s->IsPtrData()) + { + if (gpr < 5) gpr++; else overflow++; + continue; + } + switch(s->type) + { + case nsXPTType::T_I8 : + case nsXPTType::T_I16 : + case nsXPTType::T_I32 : + case nsXPTType::T_I64 : + if (gpr < 5) gpr++; else overflow++; + break; + case nsXPTType::T_U8 : + case nsXPTType::T_U16 : + case nsXPTType::T_U32 : + case nsXPTType::T_U64 : + if (gpr < 5) gpr++; else overflow++; + break; + case nsXPTType::T_FLOAT : + case nsXPTType::T_DOUBLE : + if (fpr < 4) fpr++; else overflow++; + break; + case nsXPTType::T_BOOL : + case nsXPTType::T_CHAR : + case nsXPTType::T_WCHAR : + if (gpr < 5) gpr++; else overflow++; + break; + default: + // all the others are plain pointer types + if (gpr < 5) gpr++; else overflow++; + break; + } + } + /* Round up number of overflow words to ensure stack + stays aligned to 8 bytes. */ + return (overflow + 1) & ~1; +} + +static void +invoke_copy_to_stack(PRUint32 paramCount, nsXPTCVariant* s, PRUint64* d_ov, PRUint32 overflow) +{ + PRUint64 *d_gpr = d_ov + overflow; + PRUint64 *d_fpr = (PRUint64 *)(d_gpr + 4); + PRUint32 gpr = 1 /*this*/, fpr = 0; + + for(PRUint32 i = 0; i < paramCount; i++, s++) + { + if(s->IsPtrData()) + { + if (gpr < 5) + *((void**)d_gpr) = s->ptr, d_gpr++, gpr++; + else + *((void**)d_ov ) = s->ptr, d_ov++; + continue; + } + switch(s->type) + { + case nsXPTType::T_I8 : + if (gpr < 5) + *((PRInt64*) d_gpr) = s->val.i8, d_gpr++, gpr++; + else + *((PRInt64*) d_ov ) = s->val.i8, d_ov++; + break; + case nsXPTType::T_I16 : + if (gpr < 5) + *((PRInt64*) d_gpr) = s->val.i16, d_gpr++, gpr++; + else + *((PRInt64*) d_ov ) = s->val.i16, d_ov++; + break; + case nsXPTType::T_I32 : + if (gpr < 5) + *((PRInt64*) d_gpr) = s->val.i32, d_gpr++, gpr++; + else + *((PRInt64*) d_ov ) = s->val.i32, d_ov++; + break; + case nsXPTType::T_I64 : + if (gpr < 5) + *((PRInt64*) d_gpr) = s->val.i64, d_gpr++, gpr++; + else + *((PRInt64*) d_ov ) = s->val.i64, d_ov++; + break; + case nsXPTType::T_U8 : + if (gpr < 5) + *((PRUint64*) d_gpr) = s->val.u8, d_gpr++, gpr++; + else + *((PRUint64*) d_ov ) = s->val.u8, d_ov++; + break; + case nsXPTType::T_U16 : + if (gpr < 5) + *((PRUint64*)d_gpr) = s->val.u16, d_gpr++, gpr++; + else + *((PRUint64*)d_ov ) = s->val.u16, d_ov++; + break; + case nsXPTType::T_U32 : + if (gpr < 5) + *((PRUint64*)d_gpr) = s->val.u32, d_gpr++, gpr++; + else + *((PRUint64*)d_ov ) = s->val.u32, d_ov++; + break; + case nsXPTType::T_U64 : + if (gpr < 5) + *((PRUint64*)d_gpr) = s->val.u64, d_gpr++, gpr++; + else + *((PRUint64*)d_ov ) = s->val.u64, d_ov++; + break; + case nsXPTType::T_FLOAT : + if (fpr < 4) + *((float*) d_fpr) = s->val.f, d_fpr++, fpr++; + else + *(((float*) d_ov )+1) = s->val.f, d_ov++; + break; + case nsXPTType::T_DOUBLE : + if (fpr < 4) + *((double*) d_fpr) = s->val.d, d_fpr++, fpr++; + else + *((double*) d_ov ) = s->val.d, d_ov++; + break; + case nsXPTType::T_BOOL : + if (gpr < 5) + *((PRUint64*)d_gpr) = s->val.b, d_gpr++, gpr++; + else + *((PRUint64*)d_ov ) = s->val.b, d_ov++; + break; + case nsXPTType::T_CHAR : + if (gpr < 5) + *((PRUint64*)d_gpr) = s->val.c, d_gpr++, gpr++; + else + *((PRUint64*)d_ov ) = s->val.c, d_ov++; + break; + case nsXPTType::T_WCHAR : + if (gpr < 5) + *((PRUint64*)d_gpr) = s->val.wc, d_gpr++, gpr++; + else + *((PRUint64*)d_ov ) = s->val.wc, d_ov++; + break; + default: + // all the others are plain pointer types + if (gpr < 5) + *((void**) d_gpr) = s->val.p, d_gpr++, gpr++; + else + *((void**) d_ov ) = s->val.p, d_ov++; + break; + } + } +} + +XPTC_PUBLIC_API(nsresult) +XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params) +{ + PRUint64 *vtable = *(PRUint64 **)that; +#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */ + PRUint64 method = vtable[methodIndex]; +#else /* not G++ V3 ABI */ + PRUint64 method = vtable[methodIndex + 2]; +#endif /* G++ V3 ABI */ + PRUint64 overflow = invoke_count_words (paramCount, params); + PRUint64 result; + + __asm__ __volatile__ + ( + "lgr 7,15\n\t" + "aghi 7,-64\n\t" + + "lgr 3,%3\n\t" + "sllg 3,3,3\n\t" + "lcgr 3,3\n\t" + "lg 2,0(15)\n\t" + "la 15,0(3,7)\n\t" + "stg 2,0(15)\n\t" + + "lgr 2,%1\n\t" + "lgr 3,%2\n\t" + "la 4,160(15)\n\t" + "lgr 5,%3\n\t" + "basr 14,%4\n\t" + + "lgr 2,%5\n\t" + "ld 0,192(7)\n\t" + "ld 2,200(7)\n\t" + "ld 4,208(7)\n\t" + "ld 6,216(7)\n\t" + "lmg 3,6,160(7)\n\t" + "basr 14,%6\n\t" + + "la 15,64(7)\n\t" + + "lgr %0,2\n\t" + : "=r" (result) + : "r" ((PRUint64)paramCount), + "r" (params), + "r" (overflow), + "a" (invoke_copy_to_stack), + "a" (that), + "a" (method) + : "2", "3", "4", "5", "6", "7", "memory" + ); + + return result; +} diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_mips.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_mips.cpp new file mode 100644 index 00000000..a73e4327 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_mips.cpp @@ -0,0 +1,122 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * Version: MPL 1.1 + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corp, Inc. + * Portions created by the Initial Developer are Copyright (C) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Stuart Parmenter <pavlov@netscape.com> + * Brendan Eich <brendan@mozilla.org> + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* This code is for MIPS using the O32 ABI. */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + +#include "xptcprivate.h" + + +extern "C" uint32 +invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s) +{ + // Count a word for a0 even though it's never stored or loaded + // We do this only for alignment of register pairs. + PRUint32 result = 1; + for (PRUint32 i = 0; i < paramCount; i++, s++) + { + result++; + + if (s->IsPtrData()) + continue; + + switch(s->type) + { + case nsXPTType::T_I64 : + case nsXPTType::T_U64 : + case nsXPTType::T_DOUBLE : + if (result & 1) + result++; + result++; + break; + } + } + return (result + 1) & ~(PRUint32)1; +} + +extern "C" void +invoke_copy_to_stack(PRUint32* d, PRUint32 paramCount, + nsXPTCVariant* s) +{ + // Skip the unused a0 slot, which we keep only for register pair alignment. + d++; + + for (PRUint32 i = 0; i < paramCount; i++, d++, s++) + { + if (s->IsPtrData()) + { + *((void**)d) = s->ptr; + continue; + } + + *((void**)d) = s->val.p; + + switch(s->type) + { + case nsXPTType::T_I64 : + if ((PRWord)d & 4) d++; + *((PRInt64*) d) = s->val.i64; d++; + break; + case nsXPTType::T_U64 : + if ((PRWord)d & 4) d++; + *((PRUint64*) d) = s->val.u64; d++; + break; + case nsXPTType::T_DOUBLE : + if ((PRWord)d & 4) d++; + *((double*) d) = s->val.d; d++; + break; + } + } +} + +extern "C" nsresult _XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, + nsXPTCVariant* params); + +extern "C" +XPTC_PUBLIC_API(nsresult) +XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params) +{ + return _XPTC_InvokeByIndex(that, methodIndex, paramCount, params); +} + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_netbsd_m68k.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_netbsd_m68k.cpp new file mode 100644 index 00000000..65bf8f0c --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_netbsd_m68k.cpp @@ -0,0 +1,175 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + +#include "xptcprivate.h" + +// Remember that these 'words' are 32bit DWORDS + +#if !defined(__NetBSD__) || !defined(__m68k__) +#error This code is for NetBSD/m68k only +#endif + +extern "C" { + static PRUint32 + invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s) + { + PRUint32 result = 0; + for(PRUint32 i = 0; i < paramCount; i++, s++) + { + if(s->IsPtrData()) + { + result++; + continue; + } + switch(s->type) + { + case nsXPTType::T_I8 : + case nsXPTType::T_I16 : + case nsXPTType::T_I32 : + result++; + break; + case nsXPTType::T_I64 : + result+=2; + break; + case nsXPTType::T_U8 : + case nsXPTType::T_U16 : + case nsXPTType::T_U32 : + result++; + break; + case nsXPTType::T_U64 : + result+=2; + break; + case nsXPTType::T_FLOAT : + result++; + break; + case nsXPTType::T_DOUBLE : + result+=2; + break; + case nsXPTType::T_BOOL : + case nsXPTType::T_CHAR : + case nsXPTType::T_WCHAR : + result++; + break; + default: + // all the others are plain pointer types + result++; + break; + } + } + return result; + } + + static void + invoke_copy_to_stack(PRUint32* d, PRUint32 paramCount, nsXPTCVariant* s) + { + for(PRUint32 i = 0; i < paramCount; i++, d++, s++) + { + if(s->IsPtrData()) + { + *((void**)d) = s->ptr; + continue; + } + switch(s->type) + { + // 8 and 16 bit types should be promoted to 32 bits when copying + // onto the stack. + case nsXPTType::T_I8 : *((PRUint32*)d) = s->val.i8; break; + case nsXPTType::T_I16 : *((PRUint32*)d) = s->val.i16; break; + case nsXPTType::T_I32 : *((PRInt32*) d) = s->val.i32; break; + case nsXPTType::T_I64 : *((PRInt64*) d) = s->val.i64; d++; break; + case nsXPTType::T_U8 : *((PRUint32*)d) = s->val.u8; break; + case nsXPTType::T_U16 : *((PRUint32*)d) = s->val.u16; break; + case nsXPTType::T_U32 : *((PRUint32*)d) = s->val.u32; break; + case nsXPTType::T_U64 : *((PRUint64*)d) = s->val.u64; d++; break; + case nsXPTType::T_FLOAT : *((float*) d) = s->val.f; break; + case nsXPTType::T_DOUBLE : *((double*) d) = s->val.d; d++; break; + case nsXPTType::T_BOOL : *((PRBool*) d) = s->val.b; break; + case nsXPTType::T_CHAR : *((PRUint32*)d) = s->val.c; break; + // wchar_t is an int (32 bits) on NetBSD + case nsXPTType::T_WCHAR : *((wchar_t*) d) = s->val.wc; break; + default: + // all the others are plain pointer types + *((void**)d) = s->val.p; + break; + } + } + } +} + +XPTC_PUBLIC_API(nsresult) +XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params) +{ + PRUint32 result; + + __asm__ __volatile__( + "movl %4, sp@-\n\t" + "movl %3, sp@-\n\t" + "jbsr _invoke_count_words\n\t" /* count words */ + "addql #8, sp\n\t" + "lsll #2, d0\n\t" /* *= 4 */ + "movl sp, a2\n\t" /* save original sp */ + "subl d0, sp\n\t" /* make room for params */ + "movl sp, a0\n\t" + "movl %4, sp@-\n\t" + "movl %3, sp@-\n\t" + "movl a0, sp@-\n\t" + "jbsr _invoke_copy_to_stack\n\t" /* copy params */ + "addl #12, sp\n\t" + "movl %1, a0\n\t" + "movl a0@, a1\n\t" + "movl %2, d0\n\t" /* function index */ + "movl a0, d1\n\t" + "movw a1@(8,d0:l:8), a0\n\t" + "addl a0, d1\n\t" + "movl a1@(12,d0:l:8), a1\n\t" + "movl d1, sp@-\n\t" + "jbsr a1@\n\t" + "movl a2, sp\n\t" /* restore original sp */ + "movl d0, %0\n\t" + : "=g" (result) /* %0 */ + : "g" (that), /* %1 */ + "g" (methodIndex), /* %2 */ + "g" (paramCount), /* %3 */ + "g" (params) /* %4 */ + : "a0", "a1", "a2", "d0", "d1", "memory" + ); + + return result; +} diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_openvms_alpha.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_openvms_alpha.cpp new file mode 100644 index 00000000..ae22a48c --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_openvms_alpha.cpp @@ -0,0 +1,107 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + +#include "xptcprivate.h" + +extern "C" { + +/* This is in the ASM file */ +XPTC_PUBLIC_API(nsresult) +XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params); + + +void +invoke_copy_to_stack(PRUint64* d, PRUint32 paramCount, nsXPTCVariant* s) +{ + const PRUint8 NUM_ARG_REGS = 6-1; // -1 for "this" pointer + + for(PRUint32 i = 0; i < paramCount; i++, d++, s++) + { + if(s->IsPtrData()) + { + *d = (PRUint64)s->ptr; + continue; + } + switch(s->type) + { + /* + ** The line for T_U32 may look wrong (we use signed value for an + ** unsigned data type), but it is right. Why? The Alpha calling + ** standard is defined to sign extend all 32-bit values, regardless + ** of whether they are int, unsigned int, or 32-bit pointer. The + ** caller must "sign-extend" it by replicating bit 31 in bits 32 + ** thru 63 (yes, even for unsigned). This is the format that results + ** naturally from the LDL instruction, the ADDL instruction, etc. + */ + case nsXPTType::T_I8 : *d = (PRUint64)s->val.i8; break; + case nsXPTType::T_I16 : *d = (PRUint64)s->val.i16; break; + case nsXPTType::T_I32 : *d = (PRUint64)s->val.i32; break; + case nsXPTType::T_I64 : *d = (PRUint64)s->val.i64; break; + case nsXPTType::T_U8 : *d = (PRUint64)s->val.u8; break; + case nsXPTType::T_U16 : *d = (PRUint64)s->val.u16; break; + case nsXPTType::T_U32 : *d = (PRUint64)s->val.i32; break; + case nsXPTType::T_U64 : *d = (PRUint64)s->val.u64; break; + case nsXPTType::T_FLOAT : + if(i < NUM_ARG_REGS) + { + // convert floats to doubles if they are to be passed + // via registers so we can just deal with doubles later + union { PRUint64 u64; double d; } t; + t.d = (double)s->val.f; + *d = t.u64; + } + else + // otherwise copy to stack normally + *d = (PRUint64)s->val.u32; + break; + case nsXPTType::T_DOUBLE : *d = (PRUint64)s->val.u64; break; + case nsXPTType::T_BOOL : *d = (PRUint64)s->val.b; break; + case nsXPTType::T_CHAR : *d = (PRUint64)s->val.c; break; + case nsXPTType::T_WCHAR : *d = (PRUint64)s->val.wc; break; + default: + // all the others are plain pointer types + *d = (PRUint64)s->val.p; + break; + } + } +} + +} + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_osf1_alpha.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_osf1_alpha.cpp new file mode 100644 index 00000000..13c3b23d --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_osf1_alpha.cpp @@ -0,0 +1,93 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + +/* contributed by Steve Streeter <Stephen.Streeter@Compaq.com> */ + +#include "xptcprivate.h" + +/* Prototype specifies unmangled function name */ +extern "C" void +invoke_copy_to_stack(PRUint64* d, PRUint32 paramCount, nsXPTCVariant* s); + +extern "C" void +invoke_copy_to_stack(PRUint64* d, PRUint32 paramCount, nsXPTCVariant* s) +{ + const PRUint8 NUM_ARG_REGS = 6-1; // -1 for "this" pointer + + for(PRUint32 i = 0; i < paramCount; i++, d++, s++) + { + if(s->IsPtrData()) + { + *d = (PRUint64)s->ptr; + continue; + } + switch(s->type) + { + case nsXPTType::T_I8 : *d = (PRUint64)s->val.i8; break; + case nsXPTType::T_I16 : *d = (PRUint64)s->val.i16; break; + case nsXPTType::T_I32 : *d = (PRUint64)s->val.i32; break; + case nsXPTType::T_I64 : *d = (PRUint64)s->val.i64; break; + case nsXPTType::T_U8 : *d = (PRUint64)s->val.u8; break; + case nsXPTType::T_U16 : *d = (PRUint64)s->val.u16; break; + case nsXPTType::T_U32 : *d = (PRUint64)s->val.u32; break; + case nsXPTType::T_U64 : *d = (PRUint64)s->val.u64; break; + case nsXPTType::T_FLOAT : + if(i < NUM_ARG_REGS) + { + // convert floats to doubles if they are to be passed + // via registers so we can just deal with doubles later + union { PRUint64 u64; double d; } t; + t.d = (double)s->val.f; + *d = t.u64; + } + else + // otherwise copy to stack normally + *d = (PRUint64)s->val.u32; + break; + case nsXPTType::T_DOUBLE : *d = (PRUint64)s->val.u64; break; + case nsXPTType::T_BOOL : *d = (PRUint64)s->val.b; break; + case nsXPTType::T_CHAR : *d = (PRUint64)s->val.c; break; + case nsXPTType::T_WCHAR : *d = (PRUint64)s->val.wc; break; + default: + // all the others are plain pointer types + *d = (PRUint64)s->val.p; + break; + } + } +} diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_pa32.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_pa32.cpp new file mode 100644 index 00000000..c6208a50 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_pa32.cpp @@ -0,0 +1,181 @@ + +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "xptcprivate.h" + +#if _HPUX +#error "This code is for HP-PA RISC 32 bit mode only" +#endif + +#include <alloca.h> + +typedef unsigned nsXPCVariant; + +extern "C" PRInt32 +invoke_count_bytes(nsISupports* that, const PRUint32 methodIndex, + const PRUint32 paramCount, const nsXPTCVariant* s) +{ + PRInt32 result = 4; /* variant records do not include self pointer */ + + /* counts the number of bytes required by the argument stack, + 64 bit integer, and double requires 8 bytes. All else requires + 4 bytes. + */ + + { + PRUint32 indx; + for (indx = paramCount; indx > 0; --indx, ++s) + { + if (! s->IsPtrData()) + { + if (s->type == nsXPTType::T_I64 || s->type == nsXPTType::T_U64 || + s->type == nsXPTType::T_DOUBLE) + { + /* 64 bit integer and double aligned on 8 byte boundaries */ + result += (result & 4) + 8; + continue; + } + } + result += 4; /* all other cases use 4 bytes */ + } + } + result -= 72; /* existing stack buffer is 72 bytes */ + if (result < 0) + return 0; + { + /* round up to 64 bytes boundary */ + PRInt32 remainder = result & 63; + return (remainder == 0) ? result : (result + 64 - remainder); + } +} + +extern "C" PRUint32 +invoke_copy_to_stack(PRUint32* d, + const PRUint32 paramCount, nsXPTCVariant* s) +{ + + typedef struct + { + PRUint32 hi; + PRUint32 lo; + } DU; + + PRUint32* dest = d; + nsXPTCVariant* source = s; + /* we clobber param vars by copying stuff on stack, have to use local var */ + + PRUint32 floatflags = 0; + /* flag indicating which floating point registers to load */ + + PRUint32 regwords = 1; /* register 26 is reserved for ptr to 'that' */ + PRUint32 indx; + + for (indx = paramCount; indx > 0; --indx, --dest, ++source) + { + if (source->IsPtrData()) + { + *((void**) dest) = source->ptr; + ++regwords; + continue; + } + switch (source->type) + { + case nsXPTType::T_I8 : *((PRInt32*) dest) = source->val.i8; break; + case nsXPTType::T_I16 : *((PRInt32*) dest) = source->val.i16; break; + case nsXPTType::T_I32 : *((PRInt32*) dest) = source->val.i32; break; + case nsXPTType::T_I64 : + case nsXPTType::T_U64 : + if (regwords & 1) + { + /* align on double word boundary */ + --dest; + ++regwords; + } + *((uint32*) dest) = ((DU *) source)->lo; + *((uint32*) --dest) = ((DU *) source)->hi; + /* big endian - hi word in low addr */ + regwords += 2; + continue; + case nsXPTType::T_DOUBLE : + if (regwords & 1) + { + /* align on double word boundary */ + --dest; + ++regwords; + } + switch (regwords) /* load double precision float register */ + { + case 2: + floatflags |= 1; + } + *((uint32*) dest) = ((DU *) source)->lo; + *((uint32*) --dest) = ((DU *) source)->hi; + /* big endian - hi word in low addr */ + regwords += 2; + continue; + case nsXPTType::T_FLOAT : + switch (regwords) /* load single precision float register */ + { + case 1: + floatflags |= 2; + break; + case 2: + floatflags |= 4; + break; + case 3: + floatflags |= 8; + } + *((float*) dest) = source->val.f; + break; + case nsXPTType::T_U8 : *((PRUint32*) (dest)) = source->val.u8; break; + case nsXPTType::T_U16 : *((PRUint32*) (dest)) = source->val.u16; break; + case nsXPTType::T_U32 : *((PRUint32*) (dest)) = source->val.u32; break; + case nsXPTType::T_BOOL : *((PRBool*) (dest)) = source->val.b; break; + case nsXPTType::T_CHAR : *((PRUint32*) (dest)) = source->val.c; break; + case nsXPTType::T_WCHAR : *((PRInt32*) (dest)) = source->val.wc; break; + + default: + // all the others are plain pointer types + *((void**) dest) = source->val.p; + } + ++regwords; + } + return floatflags; +} + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_aix.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_aix.cpp new file mode 100644 index 00000000..d353063c --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_aix.cpp @@ -0,0 +1,106 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + +#include "xptcprivate.h" + +#ifndef AIX +#error "This code is for PowerPC only" +#endif + +extern "C" void +invoke_copy_to_stack(PRUint32* d, PRUint32 paramCount, nsXPTCVariant* s, double *fprData) +{ +/* + We need to copy the parameters for this function to locals and use them + from there since the parameters occupy the same stack space as the stack + we're trying to populate. +*/ + PRUint32 *l_d = d; + nsXPTCVariant *l_s = s; + PRUint32 l_paramCount = paramCount, fpCount = 0; + double *l_fprData = fprData; + + typedef struct { + uint32 hi; + uint32 lo; + } DU; // have to move 64 bit entities as 32 bit halves since + // stack slots are not guaranteed 16 byte aligned + + for(uint32 i = 0; i < l_paramCount; i++, l_d++, l_s++) + { + if(l_s->IsPtrData()) + { + *((void**)l_d) = l_s->ptr; + continue; + } + switch(l_s->type) + { + case nsXPTType::T_I8 : *((int32*) l_d) = l_s->val.i8; break; + case nsXPTType::T_I16 : *((int32*) l_d) = l_s->val.i16; break; + case nsXPTType::T_I32 : *((int32*) l_d) = l_s->val.i32; break; + case nsXPTType::T_I64 : + case nsXPTType::T_U64 : + *((uint32*) l_d++) = ((DU *)l_s)->hi; + *((uint32*) l_d) = ((DU *)l_s)->lo; + break; + case nsXPTType::T_DOUBLE : + *((uint32*) l_d++) = ((DU *)l_s)->hi; + *((uint32*) l_d) = ((DU *)l_s)->lo; + if(fpCount < 13) + l_fprData[fpCount++] = l_s->val.d; + break; + case nsXPTType::T_U8 : *((uint32*) l_d) = l_s->val.u8; break; + case nsXPTType::T_U16 : *((uint32*) l_d) = l_s->val.u16; break; + case nsXPTType::T_U32 : *((uint32*) l_d) = l_s->val.u32; break; + case nsXPTType::T_FLOAT : + *((float*) l_d) = l_s->val.f; + if(fpCount < 13) + l_fprData[fpCount++] = l_s->val.f; + break; + case nsXPTType::T_BOOL : *((PRBool*) l_d) = l_s->val.b; break; + case nsXPTType::T_CHAR : *((uint32*) l_d) = l_s->val.c; break; + case nsXPTType::T_WCHAR : *((int32*) l_d) = l_s->val.wc; break; + default: + // all the others are plain pointer types + *((void**)l_d) = l_s->val.p; + break; + } + } +} + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_aix64.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_aix64.cpp new file mode 100644 index 00000000..a42611b8 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_aix64.cpp @@ -0,0 +1,95 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/LGPL 2.1/GPL 2.0 + * + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is IBM Corporation. + * Portions created by IBM are + * Copyright (C) 2002, International Business Machines Corporation. + * All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the LGPL or the GPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + +#include "xptcprivate.h" + +#ifdef _AIX + +extern "C" void +invoke_copy_to_stack(PRUint64* d, PRUint32 paramCount, nsXPTCVariant* s, double *fprData) +{ +/* + We need to copy the parameters for this function to locals and use them + from there since the parameters occupy the same stack space as the stack + we're trying to populate. +*/ + PRUint64 *l_d = d; + nsXPTCVariant *l_s = s; + PRUint32 l_paramCount = paramCount, fpCount = 0; + double *l_fprData = fprData; + + for(PRUint32 i = 0; i < l_paramCount; i++, l_d++, l_s++) + { + if(l_s->IsPtrData()) + { + *l_d = (PRUint64)l_s->ptr; + continue; + } + switch(l_s->type) + { + case nsXPTType::T_I8: *l_d = (PRUint64)l_s->val.i8; break; + case nsXPTType::T_I16: *l_d = (PRUint64)l_s->val.i16; break; + case nsXPTType::T_I32: *l_d = (PRUint64)l_s->val.i32; break; + case nsXPTType::T_I64: *l_d = (PRUint64)l_s->val.i64; break; + case nsXPTType::T_U8: *l_d = (PRUint64)l_s->val.u8; break; + case nsXPTType::T_U16: *l_d = (PRUint64)l_s->val.u16; break; + case nsXPTType::T_U32: *l_d = (PRUint64)l_s->val.u32; break; + case nsXPTType::T_U64: *l_d = (PRUint64)l_s->val.u64; break; + case nsXPTType::T_BOOL: *l_d = (PRUint64)l_s->val.b; break; + case nsXPTType::T_CHAR: *l_d = (PRUint64)l_s->val.c; break; + case nsXPTType::T_WCHAR: *l_d = (PRUint64)l_s->val.wc; break; + + case nsXPTType::T_DOUBLE: + *((double*)l_d) = l_s->val.d; + if(fpCount < 13) + l_fprData[fpCount++] = l_s->val.d; + break; + case nsXPTType::T_FLOAT: + *((float*)l_d) = l_s->val.f; + if(fpCount < 13) + l_fprData[fpCount++] = l_s->val.f; + break; + default: + // all the others are plain pointer types + *l_d = (PRUint64)l_s->val.p; + break; + } + } +} +#endif + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_linux.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_linux.cpp new file mode 100644 index 00000000..7303045a --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_linux.cpp @@ -0,0 +1,141 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Franz.Sirl-kernel@lauterbach.com (Franz Sirl) + * beard@netscape.com (Patrick Beard) + * waterson@netscape.com (Chris Waterson) + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +// Platform specific code to invoke XPCOM methods on native objects + +// The purpose of XPTC_InvokeByIndex() is to map a platform +// indepenpent call to the platform ABI. To do that, +// XPTC_InvokeByIndex() has to determine the method to call via vtable +// access. The parameters for the method are read from the +// nsXPTCVariant* and prepared for th native ABI. For the Linux/PPC +// ABI this means that the first 8 integral and floating point +// parameters are passed in registers. + +#include "xptcprivate.h" + +// 8 integral parameters are passed in registers +#define GPR_COUNT 8 + +// 8 floating point parameters are passed in registers, floats are +// promoted to doubles when passed in registers +#define FPR_COUNT 8 + +extern "C" PRUint32 +invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s) +{ + return PRUint32(((paramCount * 2) + 3) & ~3); +} + +extern "C" void +invoke_copy_to_stack(PRUint32* d, + PRUint32 paramCount, + nsXPTCVariant* s, + PRUint32* gpregs, + double* fpregs) +{ + PRUint32 gpr = 1; // skip one GP reg for 'that' + PRUint32 fpr = 0; + PRUint32 tempu32; + PRUint64 tempu64; + + for(uint32 i = 0; i < paramCount; i++, s++) { + if(s->IsPtrData()) + tempu32 = (PRUint32) s->ptr; + else { + switch(s->type) { + case nsXPTType::T_FLOAT: break; + case nsXPTType::T_DOUBLE: break; + case nsXPTType::T_I8: tempu32 = s->val.i8; break; + case nsXPTType::T_I16: tempu32 = s->val.i16; break; + case nsXPTType::T_I32: tempu32 = s->val.i32; break; + case nsXPTType::T_I64: tempu64 = s->val.i64; break; + case nsXPTType::T_U8: tempu32 = s->val.u8; break; + case nsXPTType::T_U16: tempu32 = s->val.u16; break; + case nsXPTType::T_U32: tempu32 = s->val.u32; break; + case nsXPTType::T_U64: tempu64 = s->val.u64; break; + case nsXPTType::T_BOOL: tempu32 = s->val.b; break; + case nsXPTType::T_CHAR: tempu32 = s->val.c; break; + case nsXPTType::T_WCHAR: tempu32 = s->val.wc; break; + default: tempu32 = (PRUint32) s->val.p; break; + } + } + + if (!s->IsPtrData() && s->type == nsXPTType::T_DOUBLE) { + if (fpr < FPR_COUNT) + fpregs[fpr++] = s->val.d; + else { + if ((PRUint32) d & 4) d++; // doubles are 8-byte aligned on stack + *((double*) d) = s->val.d; + d += 2; + } + } + else if (!s->IsPtrData() && s->type == nsXPTType::T_FLOAT) { + if (fpr < FPR_COUNT) + fpregs[fpr++] = s->val.f; // if passed in registers, floats are promoted to doubles + else + *((float*) d++) = s->val.f; + } + else if (!s->IsPtrData() && (s->type == nsXPTType::T_I64 + || s->type == nsXPTType::T_U64)) { + if ((gpr + 1) < GPR_COUNT) { + if (gpr & 1) gpr++; // longlongs are aligned in odd/even register pairs, eg. r5/r6 + *((PRUint64*) &gpregs[gpr]) = tempu64; + gpr += 2; + } + else { + if ((PRUint32) d & 4) d++; // longlongs are 8-byte aligned on stack + *((PRUint64*) d) = tempu64; + d += 2; + } + } + else { + if (gpr < GPR_COUNT) + gpregs[gpr++] = tempu32; + else + *d++ = tempu32; + } + + } +} + +extern "C" +XPTC_PUBLIC_API(nsresult) +XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params); diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_netbsd.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_netbsd.cpp new file mode 100644 index 00000000..0de8ea62 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_netbsd.cpp @@ -0,0 +1,147 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Franz.Sirl-kernel@lauterbach.com (Franz Sirl) + * beard@netscape.com (Patrick Beard) + * waterson@netscape.com (Chris Waterson) + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +// Platform specific code to invoke XPCOM methods on native objects + +// The purpose of XPTC_InvokeByIndex() is to map a platform +// indepenpent call to the platform ABI. To do that, +// XPTC_InvokeByIndex() has to determine the method to call via vtable +// access. The parameters for the method are read from the +// nsXPTCVariant* and prepared for th native ABI. For the Linux/PPC +// ABI this means that the first 8 integral and floating point +// parameters are passed in registers. + +#include "xptcprivate.h" + +// 8 integral parameters are passed in registers +#define GPR_COUNT 8 + +// 8 floating point parameters are passed in registers, floats are +// promoted to doubles when passed in registers +#define FPR_COUNT 8 + +extern "C" PRUint32 +invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s) +{ + return PRUint32(((paramCount * 2) + 3) & ~3); +} + +extern "C" void +invoke_copy_to_stack(PRUint32* d, + PRUint32 paramCount, + nsXPTCVariant* s, + PRUint32* gpregs, + double* fpregs) +{ + PRUint32 gpr = 1; // skip one GP reg for 'that' + PRUint32 fpr = 0; + PRUint32 tempu32; + PRUint64 tempu64; + + for(uint32 i = 0; i < paramCount; i++, s++) { + if(s->IsPtrData()) + tempu32 = (PRUint32) s->ptr; + else { + switch(s->type) { + case nsXPTType::T_FLOAT: break; + case nsXPTType::T_DOUBLE: break; + case nsXPTType::T_I8: tempu32 = s->val.i8; break; + case nsXPTType::T_I16: tempu32 = s->val.i16; break; + case nsXPTType::T_I32: tempu32 = s->val.i32; break; + case nsXPTType::T_I64: tempu64 = s->val.i64; break; + case nsXPTType::T_U8: tempu32 = s->val.u8; break; + case nsXPTType::T_U16: tempu32 = s->val.u16; break; + case nsXPTType::T_U32: tempu32 = s->val.u32; break; + case nsXPTType::T_U64: tempu64 = s->val.u64; break; + case nsXPTType::T_BOOL: tempu32 = s->val.b; break; + case nsXPTType::T_CHAR: tempu32 = s->val.c; break; + case nsXPTType::T_WCHAR: tempu32 = s->val.wc; break; + default: tempu32 = (PRUint32) s->val.p; break; + } + } + + if (!s->IsPtrData() && s->type == nsXPTType::T_DOUBLE) { + if (fpr < FPR_COUNT) + fpregs[fpr++] = s->val.d; + else { + if ((PRUint32) d & 4) d++; // doubles are 8-byte aligned on stack + *((double*) d) = s->val.d; + d += 2; + if (gpr < GPR_COUNT) + gpr += 2; + } + } + else if (!s->IsPtrData() && s->type == nsXPTType::T_FLOAT) { + if (fpr < FPR_COUNT) + fpregs[fpr++] = s->val.f; // if passed in registers, floats are promoted to doubles + else { + *((float*) d) = s->val.f; + d += 1; + if (gpr < GPR_COUNT) + gpr += 1; + } + } + else if (!s->IsPtrData() && (s->type == nsXPTType::T_I64 + || s->type == nsXPTType::T_U64)) { + if ((gpr + 1) < GPR_COUNT) { + if (gpr & 1) gpr++; // longlongs are aligned in odd/even register pairs, eg. r5/r6 + *((PRUint64*) &gpregs[gpr]) = tempu64; + gpr += 2; + } + else { + if ((PRUint32) d & 4) d++; // longlongs are 8-byte aligned on stack + *((PRUint64*) d) = tempu64; + d += 2; + } + } + else { + if (gpr < GPR_COUNT) + gpregs[gpr++] = tempu32; + else + *d++ = tempu32; + } + + } +} + +extern "C" +XPTC_PUBLIC_API(nsresult) +XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params); diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_rhapsody.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_rhapsody.cpp new file mode 100644 index 00000000..9a08acfd --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_rhapsody.cpp @@ -0,0 +1,145 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + +#include "xptcprivate.h" + +extern "C" uint32 +invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s) +{ + PRUint32 result = 0; + /* fprintf(stderr,"invoke_count_words(%d,%p)\n",paramCount, s);*/ + + for(PRUint32 i = 0; i < paramCount; i++, s++) + { + if(s->IsPtrData()) + { + result++; + continue; + } + switch(s->type) + { + case nsXPTType::T_I8 : + case nsXPTType::T_I16 : + case nsXPTType::T_I32 : + result++; + break; + case nsXPTType::T_I64 : + result+=2; + break; + case nsXPTType::T_U8 : + case nsXPTType::T_U16 : + case nsXPTType::T_U32 : + result++; + break; + case nsXPTType::T_U64 : + result+=2; + break; + case nsXPTType::T_FLOAT : + result++; + break; + case nsXPTType::T_DOUBLE : + result+=2; + break; + case nsXPTType::T_BOOL : + case nsXPTType::T_CHAR : + case nsXPTType::T_WCHAR : + result++; + break; + default: + // all the others are plain pointer types + result++; + break; + } + } + return result; +} + +extern "C" void +invoke_copy_to_stack(PRUint32* d, PRUint32 paramCount, nsXPTCVariant* s, double *fprData) +{ + PRUint32 fpCount = 0; + + /* fprintf(stderr,"invoke_copy_to_stack(%p, %d, %p, %p)\n", d, paramCount, s, fprData);*/ + + for(PRUint32 i = 0; i < paramCount; i++, d++, s++) + { + if(s->IsPtrData()) + { + *((void**)d) = s->ptr; + continue; + } + switch(s->type) + { + case nsXPTType::T_I8 : *((PRInt32*) d) = s->val.i8; break; + case nsXPTType::T_I16 : *((PRInt32*) d) = s->val.i16; break; + case nsXPTType::T_I32 : *((PRInt32*) d) = s->val.i32; break; + case nsXPTType::T_I64 : *((PRInt64*) d) = s->val.i64; d++; break; + case nsXPTType::T_U8 : *((PRUint32*) d) = s->val.u8; break; + case nsXPTType::T_U16 : *((PRUint32*)d) = s->val.u16; break; + case nsXPTType::T_U32 : *((PRUint32*)d) = s->val.u32; break; + case nsXPTType::T_U64 : *((PRUint64*)d) = s->val.u64; d++; break; + case nsXPTType::T_FLOAT : *((float*) d) = s->val.f; + if (fpCount < 13) + fprData[fpCount++] = s->val.f; + break; + case nsXPTType::T_DOUBLE : *((double*) d) = s->val.d; d++; + if (fpCount < 13) + fprData[fpCount++] = s->val.d; + break; + case nsXPTType::T_BOOL : *((PRBool*) d) = s->val.b; break; + case nsXPTType::T_CHAR : *((PRInt32*) d) = s->val.c; break; + case nsXPTType::T_WCHAR : *((PRUint32*) d) = s->val.wc; break; + default: + // all the others are plain pointer types + *((void**)d) = s->val.p; + break; + } + } +} + +extern "C" nsresult _XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params); + +extern "C" +XPTC_PUBLIC_API(nsresult) +XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params) +{ + return _XPTC_InvokeByIndex(that, methodIndex, paramCount, params); +} diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_sparc_netbsd.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_sparc_netbsd.cpp new file mode 100644 index 00000000..fb2af366 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_sparc_netbsd.cpp @@ -0,0 +1,156 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + +#include "xptcprivate.h" + +/* solaris defines __sparc for workshop compilers and + linux defines __sparc__ */ + +#if !defined(__sparc) && !defined(__sparc__) +#error "This code is for Sparc only" +#endif + +typedef unsigned nsXPCVariant; + +extern "C" PRUint32 +invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s) +{ + PRUint32 result = 0; + for(PRUint32 i = 0; i < paramCount; i++, s++) + { + if(s->IsPtrData()) + { + result++; + continue; + } + switch(s->type) + { + case nsXPTType::T_I8 : + case nsXPTType::T_I16 : + case nsXPTType::T_I32 : + result++; + break; + case nsXPTType::T_I64 : + result+=2; + break; + case nsXPTType::T_U8 : + case nsXPTType::T_U16 : + case nsXPTType::T_U32 : + result++; + break; + case nsXPTType::T_U64 : + result+=2; + break; + case nsXPTType::T_FLOAT : + result++; + break; + case nsXPTType::T_DOUBLE : + result+=2; + break; + case nsXPTType::T_BOOL : + case nsXPTType::T_CHAR : + case nsXPTType::T_WCHAR : + result++; + break; + default: + // all the others are plain pointer types + result++; + break; + } + } + // nuts, I know there's a cooler way of doing this, but it's late + // now and it'll probably come to me in the morning. + if (result & 0x3) result += 4 - (result & 0x3); // ensure q-word alignment + return result; +} + +extern "C" PRUint32 +invoke_copy_to_stack(PRUint32* d, PRUint32 paramCount, nsXPTCVariant* s) +{ +/* + We need to copy the parameters for this function to locals and use them + from there since the parameters occupy the same stack space as the stack + we're trying to populate. +*/ + uint32 *l_d = d; + nsXPTCVariant *l_s = s; + uint32 l_paramCount = paramCount; + uint32 regCount = 0; // return the number of registers to load from the stack + + typedef struct { + uint32 hi; + uint32 lo; + } DU; // have to move 64 bit entities as 32 bit halves since + // stack slots are not guaranteed 16 byte aligned + + for(uint32 i = 0; i < l_paramCount; i++, l_d++, l_s++) + { + if (regCount < 5) regCount++; + if(l_s->IsPtrData()) + { + *((void**)l_d) = l_s->ptr; + continue; + } + switch(l_s->type) + { + case nsXPTType::T_I8 : *((int32*) l_d) = l_s->val.i8; break; + case nsXPTType::T_I16 : *((int32*) l_d) = l_s->val.i16; break; + case nsXPTType::T_I32 : *((int32*) l_d) = l_s->val.i32; break; + case nsXPTType::T_I64 : + case nsXPTType::T_U64 : + case nsXPTType::T_DOUBLE : *((uint32*) l_d++) = ((DU *)l_s)->hi; + if (regCount < 5) regCount++; + *((uint32*) l_d) = ((DU *)l_s)->lo; + break; + case nsXPTType::T_U8 : *((uint32*) l_d) = l_s->val.u8; break; + case nsXPTType::T_U16 : *((uint32*) l_d) = l_s->val.u16; break; + case nsXPTType::T_U32 : *((uint32*) l_d) = l_s->val.u32; break; + case nsXPTType::T_FLOAT : *((float*) l_d) = l_s->val.f; break; + case nsXPTType::T_BOOL : *((PRBool*) l_d) = l_s->val.b; break; + case nsXPTType::T_CHAR : *((uint32*) l_d) = l_s->val.c; break; + case nsXPTType::T_WCHAR : *((int32*)l_d) = l_s->val.wc; break; + default: + // all the others are plain pointer types + *((void**)l_d) = l_s->val.p; + break; + } + } + return regCount; +} + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_sparc_solaris.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_sparc_solaris.cpp new file mode 100644 index 00000000..fb2af366 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_sparc_solaris.cpp @@ -0,0 +1,156 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + +#include "xptcprivate.h" + +/* solaris defines __sparc for workshop compilers and + linux defines __sparc__ */ + +#if !defined(__sparc) && !defined(__sparc__) +#error "This code is for Sparc only" +#endif + +typedef unsigned nsXPCVariant; + +extern "C" PRUint32 +invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s) +{ + PRUint32 result = 0; + for(PRUint32 i = 0; i < paramCount; i++, s++) + { + if(s->IsPtrData()) + { + result++; + continue; + } + switch(s->type) + { + case nsXPTType::T_I8 : + case nsXPTType::T_I16 : + case nsXPTType::T_I32 : + result++; + break; + case nsXPTType::T_I64 : + result+=2; + break; + case nsXPTType::T_U8 : + case nsXPTType::T_U16 : + case nsXPTType::T_U32 : + result++; + break; + case nsXPTType::T_U64 : + result+=2; + break; + case nsXPTType::T_FLOAT : + result++; + break; + case nsXPTType::T_DOUBLE : + result+=2; + break; + case nsXPTType::T_BOOL : + case nsXPTType::T_CHAR : + case nsXPTType::T_WCHAR : + result++; + break; + default: + // all the others are plain pointer types + result++; + break; + } + } + // nuts, I know there's a cooler way of doing this, but it's late + // now and it'll probably come to me in the morning. + if (result & 0x3) result += 4 - (result & 0x3); // ensure q-word alignment + return result; +} + +extern "C" PRUint32 +invoke_copy_to_stack(PRUint32* d, PRUint32 paramCount, nsXPTCVariant* s) +{ +/* + We need to copy the parameters for this function to locals and use them + from there since the parameters occupy the same stack space as the stack + we're trying to populate. +*/ + uint32 *l_d = d; + nsXPTCVariant *l_s = s; + uint32 l_paramCount = paramCount; + uint32 regCount = 0; // return the number of registers to load from the stack + + typedef struct { + uint32 hi; + uint32 lo; + } DU; // have to move 64 bit entities as 32 bit halves since + // stack slots are not guaranteed 16 byte aligned + + for(uint32 i = 0; i < l_paramCount; i++, l_d++, l_s++) + { + if (regCount < 5) regCount++; + if(l_s->IsPtrData()) + { + *((void**)l_d) = l_s->ptr; + continue; + } + switch(l_s->type) + { + case nsXPTType::T_I8 : *((int32*) l_d) = l_s->val.i8; break; + case nsXPTType::T_I16 : *((int32*) l_d) = l_s->val.i16; break; + case nsXPTType::T_I32 : *((int32*) l_d) = l_s->val.i32; break; + case nsXPTType::T_I64 : + case nsXPTType::T_U64 : + case nsXPTType::T_DOUBLE : *((uint32*) l_d++) = ((DU *)l_s)->hi; + if (regCount < 5) regCount++; + *((uint32*) l_d) = ((DU *)l_s)->lo; + break; + case nsXPTType::T_U8 : *((uint32*) l_d) = l_s->val.u8; break; + case nsXPTType::T_U16 : *((uint32*) l_d) = l_s->val.u16; break; + case nsXPTType::T_U32 : *((uint32*) l_d) = l_s->val.u32; break; + case nsXPTType::T_FLOAT : *((float*) l_d) = l_s->val.f; break; + case nsXPTType::T_BOOL : *((PRBool*) l_d) = l_s->val.b; break; + case nsXPTType::T_CHAR : *((uint32*) l_d) = l_s->val.c; break; + case nsXPTType::T_WCHAR : *((int32*)l_d) = l_s->val.wc; break; + default: + // all the others are plain pointer types + *((void**)l_d) = l_s->val.p; + break; + } + } + return regCount; +} + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_sparcv9_solaris.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_sparcv9_solaris.cpp new file mode 100644 index 00000000..83b28ebb --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_sparcv9_solaris.cpp @@ -0,0 +1,107 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Stuart Parmenter <pavlov@netscape.com> + * Chris Seawood <cls@seawood.org> + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + + +/* Platform specific code to invoke XPCOM methods on native objects */ + +#include "xptcprivate.h" + +#if !defined(__sparc) && !defined(__sparc__) +#error "This code is for Sparc only" +#endif + +/* Prototype specifies unmangled function name */ +extern "C" PRUint64 +invoke_copy_to_stack(PRUint64* d, PRUint32 paramCount, nsXPTCVariant* s); + +extern "C" PRUint64 +invoke_copy_to_stack(PRUint64* d, PRUint32 paramCount, nsXPTCVariant* s) +{ + /* + We need to copy the parameters for this function to locals and use them + from there since the parameters occupy the same stack space as the stack + we're trying to populate. + */ + PRUint64 *l_d = d; + nsXPTCVariant *l_s = s; + PRUint64 l_paramCount = paramCount; + PRUint64 regCount = 0; // return the number of registers to load from the stack + + for(PRUint64 i = 0; i < l_paramCount; i++, l_d++, l_s++) + { + if (regCount < 5) regCount++; + + if (l_s->IsPtrData()) + { + *l_d = (PRUint64)l_s->ptr; + continue; + } + switch (l_s->type) + { + case nsXPTType::T_I8 : *((PRInt64*)l_d) = l_s->val.i8; break; + case nsXPTType::T_I16 : *((PRInt64*)l_d) = l_s->val.i16; break; + case nsXPTType::T_I32 : *((PRInt64*)l_d) = l_s->val.i32; break; + case nsXPTType::T_I64 : *((PRInt64*)l_d) = l_s->val.i64; break; + + case nsXPTType::T_U8 : *((PRUint64*)l_d) = l_s->val.u8; break; + case nsXPTType::T_U16 : *((PRUint64*)l_d) = l_s->val.u16; break; + case nsXPTType::T_U32 : *((PRUint64*)l_d) = l_s->val.u32; break; + case nsXPTType::T_U64 : *((PRUint64*)l_d) = l_s->val.u64; break; + + /* in the case of floats, we want to put the bits in to the + 64bit space right justified... floats in the paramter array on + sparcv9 use odd numbered registers.. %f1, %f3, so we have to skip + the space that would be occupied by %f0, %f2, etc. + */ + case nsXPTType::T_FLOAT : *(((float*)l_d) + 1) = l_s->val.f; break; + case nsXPTType::T_DOUBLE: *((double*)l_d) = l_s->val.d; break; + case nsXPTType::T_BOOL : *((PRBool*)l_d) = l_s->val.b; break; + case nsXPTType::T_CHAR : *((PRUint64*)l_d) = l_s->val.c; break; + case nsXPTType::T_WCHAR : *((PRInt64*)l_d) = l_s->val.wc; break; + + default: + // all the others are plain pointer types + *((void**)l_d) = l_s->val.p; + break; + } + } + + return regCount; +} diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unixish_x86.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unixish_x86.cpp new file mode 100644 index 00000000..76445fa4 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unixish_x86.cpp @@ -0,0 +1,187 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Mark Mentovai <mark@moxienet.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + +#include "xptcprivate.h" +#include "xptc_platforms_unixish_x86.h" + +extern "C" { + +static void +invoke_copy_to_stack(PRUint32 paramCount, nsXPTCVariant* s, PRUint32* d) +{ + for(PRUint32 i = paramCount; i >0; i--, d++, s++) + { + if(s->IsPtrData()) + { + *((void**)d) = s->ptr; + continue; + } + +/* XXX: the following line is here (rather than as the default clause in + * the following switch statement) so that the Sun native compiler + * will generate the correct assembly code on the Solaris Intel + * platform. See the comments in bug #28817 for more details. + */ + + *((void**)d) = s->val.p; + + switch(s->type) + { + case nsXPTType::T_I64 : *((PRInt64*) d) = s->val.i64; d++; break; + case nsXPTType::T_U64 : *((PRUint64*)d) = s->val.u64; d++; break; + case nsXPTType::T_DOUBLE : *((double*) d) = s->val.d; d++; break; + } + } +} + +} + +XPTC_PUBLIC_API(nsresult) +XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params) +{ +#ifdef __GNUC__ /* Gnu compiler. */ + PRUint32 result; + /* Each param takes at most 2, 4-byte words + It doesn't matter if we push too many words, and calculating the exact + amount takes time. */ + PRUint32 n = paramCount << 3; + void (*fn_copy) (unsigned int, nsXPTCVariant *, PRUint32 *) = invoke_copy_to_stack; + int temp1, temp2; + + /* These are only significant when KEEP_STACK_16_BYTE_ALIGNED is + defined. Otherwise, they're just placeholders to keep the parameter + indices the same for aligned and unaligned users in the inline asm + block. */ + unsigned int saved_esp; + + __asm__ __volatile__( +#ifdef KEEP_STACK_16_BYTE_ALIGNED + "movl %%esp, %3\n\t" +#endif + "subl %8, %%esp\n\t" /* make room for params */ +#ifdef KEEP_STACK_16_BYTE_ALIGNED + /* For the second CALL, there will be one parameter before the ones + copied by invoke_copy_to_stack. Make sure that the stack will be + aligned for that CALL. */ + "subl $4, %%esp\n\t" + "andl $0xfffffff0, %%esp\n\t" + /* For the first CALL, there are three parameters. Leave padding to + ensure alignment. */ + "subl $4, %%esp\n\t" + /* The third parameter to invoke_copy_to_stack is the destination pointer. + It needs to point into the parameter area prepared for the second CALL, + leaving room for the |that| parameter. This reuses |n|, which was + the stack space to reserve, but that's OK because it's no longer needed + if the stack is being kept aligned. */ + "leal 8(%%esp), %8\n\t" + "pushl %8\n\t" +#else + "pushl %%esp\n\t" +#endif + "pushl %7\n\t" + "pushl %6\n\t" + "call *%9\n\t" /* copy params */ +#ifdef KEEP_STACK_16_BYTE_ALIGNED + /* The stack is still aligned from the first CALL. Keep it aligned for + the next one by popping past the parameters from the first CALL and + leaving space for the first (|that|) parameter for the second CALL. */ + "addl $0x14, %%esp\n\t" +#else + "addl $0xc, %%esp\n\t" +#endif + "movl %4, %%ecx\n\t" +#ifdef CFRONT_STYLE_THIS_ADJUST + "movl (%%ecx), %%edx\n\t" + "movl %5, %%eax\n\t" /* function index */ + "shl $3, %%eax\n\t" /* *= 8 */ + "addl $8, %%eax\n\t" /* += 8 skip first entry */ + "addl %%eax, %%edx\n\t" + "movswl (%%edx), %%eax\n\t" /* 'this' offset */ + "addl %%eax, %%ecx\n\t" + "pushl %%ecx\n\t" + "addl $4, %%edx\n\t" /* += 4, method pointer */ +#else /* THUNK_BASED_THIS_ADJUST */ + "pushl %%ecx\n\t" + "movl (%%ecx), %%edx\n\t" + "movl %5, %%eax\n\t" /* function index */ +#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */ + "leal (%%edx,%%eax,4), %%edx\n\t" +#else /* not G++ V3 ABI */ + "leal 8(%%edx,%%eax,4), %%edx\n\t" +#endif /* G++ V3 ABI */ +#endif + "call *(%%edx)\n\t" /* safe to not cleanup esp */ +#ifdef KEEP_STACK_16_BYTE_ALIGNED + "movl %3, %%esp\n\t" +#else + "addl $4, %%esp\n\t" + "addl %8, %%esp" +#endif + : "=a" (result), /* %0 */ + "=c" (temp1), /* %1 */ + "=d" (temp2), /* %2 */ +#ifdef KEEP_STACK_16_BYTE_ALIGNED + "=&g" (saved_esp) /* %3 */ +#else + /* Don't waste a register, this isn't used if alignment is unimportant */ + "=m" (saved_esp) /* %3 */ +#endif + : "g" (that), /* %4 */ + "g" (methodIndex), /* %5 */ + "1" (paramCount), /* %6 */ + "2" (params), /* %7 */ +#ifdef KEEP_STACK_16_BYTE_ALIGNED + /* Must be in a register, it's the target of an LEA instruction */ + "r" (n), /* %8 */ +#else + "g" (n), /* %8 */ +#endif + "0" (fn_copy) /* %9 */ + : "memory" + ); + + return result; + +#else +#error "can't find a compiler to use" +#endif /* __GNUC__ */ + +} diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unsupported.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unsupported.cpp new file mode 100644 index 00000000..88219d8d --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unsupported.cpp @@ -0,0 +1,48 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + +#include "xptcprivate.h" + +XPTC_PUBLIC_API(nsresult) +XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params) +{ + NS_ASSERTION(0,"XPTC_InvokeByIndex called on unsupported platform"); + return NS_ERROR_NOT_IMPLEMENTED; +} diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_linux.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_linux.cpp new file mode 100644 index 00000000..b017c741 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_linux.cpp @@ -0,0 +1,227 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org Code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +// Platform specific code to invoke XPCOM methods on native objects + +#include "xptcprivate.h" + +// 6 integral parameters are passed in registers +const PRUint32 GPR_COUNT = 6; + +// 8 floating point parameters are passed in SSE registers +const PRUint32 FPR_COUNT = 8; + +// Remember that these 'words' are 64-bit long +static inline void +invoke_count_words(PRUint32 paramCount, nsXPTCVariant * s, + PRUint32 & nr_gpr, PRUint32 & nr_fpr, PRUint32 & nr_stack) +{ + nr_gpr = 1; // skip one GP register for 'that' + nr_fpr = 0; + nr_stack = 0; + + /* Compute number of eightbytes of class MEMORY. */ + for (uint32 i = 0; i < paramCount; i++, s++) { + if (!s->IsPtrData() + && (s->type == nsXPTType::T_FLOAT || s->type == nsXPTType::T_DOUBLE)) { + if (nr_fpr < FPR_COUNT) + nr_fpr++; + else + nr_stack++; + } + else { + if (nr_gpr < GPR_COUNT) + nr_gpr++; + else + nr_stack++; + } + } +} + +static void +invoke_copy_to_stack(PRUint64 * d, PRUint32 paramCount, nsXPTCVariant * s, + PRUint64 * gpregs, double * fpregs) +{ + PRUint32 nr_gpr = 1; // skip one GP register for 'that' + PRUint32 nr_fpr = 0; + PRUint64 value; + + for (uint32 i = 0; i < paramCount; i++, s++) { + if (s->IsPtrData()) + value = (PRUint64) s->ptr; + else { + switch (s->type) { + case nsXPTType::T_FLOAT: break; + case nsXPTType::T_DOUBLE: break; + case nsXPTType::T_I8: value = s->val.i8; break; + case nsXPTType::T_I16: value = s->val.i16; break; + case nsXPTType::T_I32: value = s->val.i32; break; + case nsXPTType::T_I64: value = s->val.i64; break; + case nsXPTType::T_U8: value = s->val.u8; break; + case nsXPTType::T_U16: value = s->val.u16; break; + case nsXPTType::T_U32: value = s->val.u32; break; + case nsXPTType::T_U64: value = s->val.u64; break; + case nsXPTType::T_BOOL: value = s->val.b; break; + case nsXPTType::T_CHAR: value = s->val.c; break; + case nsXPTType::T_WCHAR: value = s->val.wc; break; + default: value = (PRUint64) s->val.p; break; + } + } + + if (!s->IsPtrData() && s->type == nsXPTType::T_DOUBLE) { + if (nr_fpr < FPR_COUNT) + fpregs[nr_fpr++] = s->val.d; + else { + *((double *)d) = s->val.d; + d++; + } + } + else if (!s->IsPtrData() && s->type == nsXPTType::T_FLOAT) { + if (nr_fpr < FPR_COUNT) + // The value in %xmm register is already prepared to + // be retrieved as a float. Therefore, we pass the + // value verbatim, as a double without conversion. + fpregs[nr_fpr++] = s->val.d; + else { + *((float *)d) = s->val.f; + d++; + } + } + else { + if (nr_gpr < GPR_COUNT) + gpregs[nr_gpr++] = value; + else + *d++ = value; + } + } +} + +extern "C" +XPTC_PUBLIC_API(nsresult) +XPTC_InvokeByIndex(nsISupports * that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant * params) +{ + PRUint32 nr_gpr, nr_fpr, nr_stack; + invoke_count_words(paramCount, params, nr_gpr, nr_fpr, nr_stack); + + // Stack, if used, must be 16-bytes aligned + if (nr_stack) + nr_stack = (nr_stack + 1) & ~1; + +#ifndef VBOX_WITH_GCC_SANITIZER + // Load parameters to stack, if necessary + PRUint64 *stack = (PRUint64 *) __builtin_alloca(nr_stack * 8); +#else + typedef struct { PRUint64 stack[20]; } methodStack; + if (nr_stack > 20) + return NS_ERROR_CALL_FAILED; + methodStack stack; +#endif + PRUint64 gpregs[GPR_COUNT]; + double fpregs[FPR_COUNT]; +#ifndef VBOX_WITH_GCC_SANITIZER + invoke_copy_to_stack(stack, paramCount, params, gpregs, fpregs); +#else + invoke_copy_to_stack(stack.stack, paramCount, params, gpregs, fpregs); +#endif + + // Load FPR registers from fpregs[] + register double d0 asm("xmm0"); + register double d1 asm("xmm1"); + register double d2 asm("xmm2"); + register double d3 asm("xmm3"); + register double d4 asm("xmm4"); + register double d5 asm("xmm5"); + register double d6 asm("xmm6"); + register double d7 asm("xmm7"); + + switch (nr_fpr) { +#define ARG_FPR(N) \ + case N+1: d##N = fpregs[N]; + ARG_FPR(7); + ARG_FPR(6); + ARG_FPR(5); + ARG_FPR(4); + ARG_FPR(3); + ARG_FPR(2); + ARG_FPR(1); + ARG_FPR(0); + case 0:; +#undef ARG_FPR + } + + // Load GPR registers from gpregs[] + register PRUint64 a0 asm("rdi"); + register PRUint64 a1 asm("rsi"); + register PRUint64 a2 asm("rdx"); + register PRUint64 a3 asm("rcx"); + register PRUint64 a4 asm("r8"); + register PRUint64 a5 asm("r9"); + + switch (nr_gpr) { +#define ARG_GPR(N) \ + case N+1: a##N = gpregs[N]; + ARG_GPR(5); + ARG_GPR(4); + ARG_GPR(3); + ARG_GPR(2); + ARG_GPR(1); + case 1: a0 = (PRUint64) that; + case 0:; +#undef ARG_GPR + } + + // Ensure that assignments to SSE registers won't be optimized away + asm("" :: + "x" (d0), "x" (d1), "x" (d2), "x" (d3), + "x" (d4), "x" (d5), "x" (d6), "x" (d7)); + + // Get pointer to method + PRUint64 methodAddress = *((PRUint64 *)that); + methodAddress += 8 * methodIndex; + methodAddress = *((PRUint64 *)methodAddress); + +#ifndef VBOX_WITH_GCC_SANITIZER + typedef PRUint32 (*Method)(PRUint64, PRUint64, PRUint64, PRUint64, PRUint64, PRUint64); + PRUint32 result = ((Method)methodAddress)(a0, a1, a2, a3, a4, a5); +#else + typedef PRUint32 (*Method)(PRUint64, PRUint64, PRUint64, PRUint64, PRUint64, PRUint64, methodStack); + PRUint32 result = ((Method)methodAddress)(a0, a1, a2, a3, a4, a5, stack); +#endif + return result; +} diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_solaris.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_solaris.cpp new file mode 100644 index 00000000..14ecb2d8 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_solaris.cpp @@ -0,0 +1,285 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org Code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + +#include "xptcprivate.h" +#include "xptc_platforms_unixish_x86.h" +#ifdef VBOX +# include <iprt/alloca.h> +#endif + +extern "C" { + +// Remember that these 'words' are 32bit DWORDS + +static PRUint32 +invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s) +{ + PRUint32 result = 0; + for(PRUint32 i = 0; i < paramCount; i++, s++) + { + if(s->IsPtrData()) + { + result++; + continue; + } + result++; + switch(s->type) + { + case nsXPTType::T_I64 : + case nsXPTType::T_U64 : + case nsXPTType::T_DOUBLE : + result++; + break; + } + } + return result; +} + +static void +invoke_copy_to_stack(PRUint32 paramCount, nsXPTCVariant* s, PRUint32* d) +{ + for(PRUint32 i = 0; i < paramCount; i++, d++, s++) + { + if(s->IsPtrData()) + { + *((void**)d) = s->ptr; + continue; + } + +/* XXX: the following line is here (rather than as the default clause in + * the following switch statement) so that the Sun native compiler + * will generate the correct assembly code on the Solaris Intel + * platform. See the comments in bug #28817 for more details. + */ + + *((void**)d) = s->val.p; + + switch(s->type) + { + case nsXPTType::T_I64 : *((PRInt64*) d) = s->val.i64; d++; break; + case nsXPTType::T_U64 : *((PRUint64*)d) = s->val.u64; d++; break; + case nsXPTType::T_DOUBLE : *((double*) d) = s->val.d; d++; break; + } + } +} + +} + +XPTC_PUBLIC_API(nsresult) +XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params) +{ +#ifdef __GNUC__ /* Gnu compiler. */ + PRUint32 result; + PRUint32 n = invoke_count_words (paramCount, params) * 4; + int temp1, temp2, temp3; + +# ifdef VBOX + /* This is for dealing with gcc 4.5.2 not using registers for 'g' parameters + and instead trying to get things like 'that' via %esp after we've changed it. */ +# if 1 /* safe version. */ + void (*fn_copy) (unsigned int, nsXPTCVariant *, PRUint32 *) = invoke_copy_to_stack; + struct Combined + { + PRUint32 that; /* offset: 0 */ + PRUint32 pfn; /* offset: 4 */ + PRUint32 savedEsp; /* offset: 8 */ + PRUint32 paramCount; /* offset: 12 */ + PRUint32 params; /* offset: 16 */ + } Combined; +# ifdef CFRONT_STYLE_THIS_ADJUST + struct CFRONTVTE { uintptr_t off, pfn } *pVtab = *(struct CFRONTVTE **)that; + Combined.that = (uintptr_t)that + pVtab[methodIndex + 1].off; + Combined.pfn = pVtab[methodIndex + 1].pfn; +# elif defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */ + Combined.that = (uintptr_t)that; + Combined.pfn = (*(uintptr_t **)that)[methodIndex]; +# else /* not G++ V3 ABI */ + Combined.that = (uintptr_t)that; + Combined.pfn = (*(uintptr_t **)that)[2 + methodIndex]; +# endif /* G++ V3 ABI */ + Combined.paramCount = paramCount; + Combined.params = (uintptr_t)params; + + __asm__ __volatile__( + "mov %%esp, 8(%%esi)\n\t" /* savedEsp = %esp */ + "subl %1, %%esp\n\t" /* make room for params */ + + /* Call invoke_count_words to copy the parameters. */ + "pushl %%esp\n\t" /* arg2: dest */ + "pushl 16(%%esi)\n\t" /* arg1: params */ + "pushl 12(%%esi)\n\t" /* arg0: paramCount */ + "call *%0\n\t" + "addl $0xc, %%esp\n\t" + + /* Push the this pointer. */ + "pushl (%%esi)\n\t" /* that */ + "call *4(%%esi)\n\t" + "mov 8(%%esi), %%esp\n\t" + : "=a" (result), /* %0 */ + "=c" (temp1), /* %1 */ + "=d" (temp2) /* %2 */ + : "S" (&Combined), /* %3 */ + "0" (fn_copy), + "1" (n) + : "memory" + ); + +# else /* Small version; ASSUMES nothing important gets put on the stack after the the alloca. */ + uintptr_t *pauStack = (uintptr_t *)alloca(n + sizeof(uintptr_t)); + invoke_copy_to_stack(paramCount, params, &pauStack[1]); +# ifdef CFRONT_STYLE_THIS_ADJUST + struct CFRONTVTE { uintptr_t off, pfn } *pVtab = *(struct CFRONTVTE **)that; + pauStack[0] = (uintptr_t)that + pVtab[methodIndex + 1].off; + uintptr_t pfn = pVtab[methodIndex + 1].pfn; +# elif defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */ + pauStack[0] = (uintptr_t)that; + uintptr_t pfn = (*(uintptr_t **)that)[methodIndex]; +# else /* not G++ V3 ABI */ + pauStack[0] = (uintptr_t)that; + uintptr_t pfn = (*(uintptr_t **)that)[2 + methodIndex]; +# endif /* G++ V3 ABI */ + + __asm__ __volatile__( + "xchg %%esp, %3\n\t" /* save+load %esp */ + "call *%0\n\t" + "xchg %%esp, %3\n\t" /* restore %esp */ + : "=a" (result), /* %0 */ + "=c" (temp1), /* %1 */ + "=d" (temp2) /* %2 */ + : "S" (pauStack), /* %3 */ + "0" (pfn) + : "memory" + ); +# endif + +# else /* !VBOX */ + void (*fn_copy) (unsigned int, nsXPTCVariant *, PRUint32 *) = invoke_copy_to_stack; + __asm__ __volatile__( + "subl %8, %%esp\n\t" /* make room for params */ + "pushl %%esp\n\t" + "pushl %7\n\t" + "pushl %6\n\t" + "call *%0\n\t" /* copy params */ + "addl $0xc, %%esp\n\t" + "movl %4, %%ecx\n\t" +#ifdef CFRONT_STYLE_THIS_ADJUST + "movl (%%ecx), %%edx\n\t" + "movl %5, %%eax\n\t" /* function index */ + "shl $3, %%eax\n\t" /* *= 8 */ + "addl $8, %%eax\n\t" /* += 8 skip first entry */ + "addl %%eax, %%edx\n\t" + "movswl (%%edx), %%eax\n\t" /* 'this' offset */ + "addl %%eax, %%ecx\n\t" + "pushl %%ecx\n\t" + "addl $4, %%edx\n\t" /* += 4, method pointer */ +#else /* THUNK_BASED_THIS_ADJUST */ + "pushl %%ecx\n\t" + "movl (%%ecx), %%edx\n\t" + "movl %5, %%eax\n\t" /* function index */ +#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */ + "leal (%%edx,%%eax,4), %%edx\n\t" +#else /* not G++ V3 ABI */ + "leal 8(%%edx,%%eax,4), %%edx\n\t" +#endif /* G++ V3 ABI */ +#endif + "call *(%%edx)\n\t" /* safe to not cleanup esp */ + "addl $4, %%esp\n\t" + "addl %8, %%esp" + : "=a" (result), /* %0 */ + "=c" (temp1), /* %1 */ + "=d" (temp2), /* %2 */ + "=g" (temp3) /* %3 */ + : "g" (that), /* %4 */ + "g" (methodIndex), /* %5 */ + "1" (paramCount), /* %6 */ + "2" (params), /* %7 */ + "g" (n), /* %8 */ + "0" (fn_copy) /* %3 */ + : "memory" + ); +# endif /* !VBOX */ + + return result; +#elif defined(__SUNPRO_CC) /* Sun Workshop Compiler. */ + +asm( + "\n\t /: PRUint32 n = invoke_count_words (paramCount, params) * 4;" + + "\n\t pushl %ebx / preserve ebx" + "\n\t pushl %esi / preserve esi" + "\n\t movl %esp, %ebx / save address of pushed esi and ebx" + + "\n\t pushl 20(%ebp) / \"params\"" + "\n\t pushl 16(%ebp) / \"paramCount\"" + "\n\t call invoke_count_words" + "\n\t mov %ebx, %esp / restore esp" + + "\n\t sall $2,%eax" + "\n\t subl %eax, %esp / make room for arguments" + "\n\t movl %esp, %esi / save new esp" + + "\n\t pushl %esp" + "\n\t pushl 20(%ebp) / \"params\"" + "\n\t pushl 16(%ebp) / \"paramCount\"" + "\n\t call invoke_copy_to_stack / copy params" + "\n\t movl %esi, %esp / restore new esp" + + "\n\t movl 8(%ebp),%ecx / \"that\"" + "\n\t pushl %ecx / \"that\"" + "\n\t movl (%ecx), %edx" + "\n\t movl 12(%ebp), %eax / function index: \"methodIndex\"" + "\n\t movl 8(%edx,%eax,4), %edx" + + "\n\t call *%edx" + "\n\t mov %ebx, %esp" + "\n\t popl %esi" + "\n\t popl %ebx" +); + +/* result == %eax */ + if(0) /* supress "*** is expected to return a value." error */ + return 0; + +#else +#error "can't find a compiler to use" +#endif /* __GNUC__ */ + +} diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_amd64_darwin.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_amd64_darwin.cpp new file mode 100644 index 00000000..5b55c930 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_amd64_darwin.cpp @@ -0,0 +1,243 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org Code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +// Implement shared vtbl methods. + +#include "xptcprivate.h" + +// The Linux/x86-64 ABI passes the first 6 integer parameters and the +// first 8 floating point parameters in registers (rdi, rsi, rdx, rcx, +// r8, r9 and xmm0-xmm7), no stack space is allocated for these by the +// caller. The rest of the parameters are passed in the callers stack +// area. + +const PRUint32 PARAM_BUFFER_COUNT = 16; +const PRUint32 GPR_COUNT = 6; +const PRUint32 FPR_COUNT = 8; + +// PrepareAndDispatch() is called by SharedStub() and calls the actual method. +// +// - 'args[]' contains the arguments passed on stack +// - 'gpregs[]' contains the arguments passed in integer registers +// - 'fpregs[]' contains the arguments passed in floating point registers +// +// The parameters are mapped into an array of type 'nsXPTCMiniVariant' +// and then the method gets called. + +extern "C" nsresult +PrepareAndDispatch(nsXPTCStubBase * self, PRUint32 methodIndex, + PRUint64 * args, PRUint64 * gpregs, double *fpregs) +{ + nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT]; + nsXPTCMiniVariant* dispatchParams = NULL; + nsIInterfaceInfo* iface_info = NULL; + const nsXPTMethodInfo* info = NULL; + PRUint32 paramCount; + PRUint32 i; + nsresult result = NS_ERROR_FAILURE; + + NS_ASSERTION(self,"no self"); + + self->GetInterfaceInfo(&iface_info); + NS_ASSERTION(iface_info,"no interface info"); + if (!iface_info) + return NS_ERROR_UNEXPECTED; + + iface_info->GetMethodInfo(PRUint16(methodIndex), &info); + NS_ASSERTION(info,"no method info"); + if (!info) + return NS_ERROR_UNEXPECTED; + + 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"); + if (!dispatchParams) + return NS_ERROR_OUT_OF_MEMORY; + + PRUint64* ap = args; + PRUint32 nr_gpr = 1; // skip one GPR register for 'that' + PRUint32 nr_fpr = 0; + PRUint64 value; + + for (i = 0; i < paramCount; i++) { + const nsXPTParamInfo& param = info->GetParam(i); + const nsXPTType& type = param.GetType(); + nsXPTCMiniVariant* dp = &dispatchParams[i]; + + if (!param.IsOut() && type == nsXPTType::T_DOUBLE) { + if (nr_fpr < FPR_COUNT) + dp->val.d = fpregs[nr_fpr++]; + else + dp->val.d = *(double*) ap++; + continue; + } + else if (!param.IsOut() && type == nsXPTType::T_FLOAT) { + if (nr_fpr < FPR_COUNT) + // The value in %xmm register is already prepared to + // be retrieved as a float. Therefore, we pass the + // value verbatim, as a double without conversion. + dp->val.d = *(double*) ap++; + else + dp->val.f = *(float*) ap++; + continue; + } + else { + if (nr_gpr < GPR_COUNT) + value = gpregs[nr_gpr++]; + else + value = *ap++; + } + + if (param.IsOut() || !type.IsArithmetic()) { + dp->val.p = (void*) value; + continue; + } + + switch (type) { + case nsXPTType::T_I8: dp->val.i8 = (PRInt8) value; break; + case nsXPTType::T_I16: dp->val.i16 = (PRInt16) value; break; + case nsXPTType::T_I32: dp->val.i32 = (PRInt32) value; break; + case nsXPTType::T_I64: dp->val.i64 = (PRInt64) value; break; + case nsXPTType::T_U8: dp->val.u8 = (PRUint8) value; break; + case nsXPTType::T_U16: dp->val.u16 = (PRUint16) value; break; + case nsXPTType::T_U32: dp->val.u32 = (PRUint32) value; break; + case nsXPTType::T_U64: dp->val.u64 = (PRUint64) value; break; + case nsXPTType::T_BOOL: dp->val.b = (PRBool) value; break; + case nsXPTType::T_CHAR: dp->val.c = (char) value; break; + case nsXPTType::T_WCHAR: dp->val.wc = (wchar_t) value; 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; +} + +#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */ +// Darwin/AMD64 uses gcc >= 3.1 +#define STUB_ENTRY(n) \ +asm(".text\n\t" \ + ".align 2\n\t" \ + ".if " #n " < 10\n\t" \ + ".globl __ZN14nsXPTCStubBase5Stub" #n "Ev\n\t" \ + /*".type __ZN14nsXPTCStubBase5Stub" #n "Ev,@function\n"*/ \ + "__ZN14nsXPTCStubBase5Stub" #n "Ev:\n\t" \ + ".elseif " #n " < 100\n\t" \ + ".globl __ZN14nsXPTCStubBase6Stub" #n "Ev\n\t" \ + /*".type __ZN14nsXPTCStubBase6Stub" #n "Ev,@function\n"*/ \ + "__ZN14nsXPTCStubBase6Stub" #n "Ev:\n\t" \ + ".elseif " #n " < 1000\n\t" \ + ".globl __ZN14nsXPTCStubBase7Stub" #n "Ev\n\t" \ + /*".type __ZN14nsXPTCStubBase7Stub" #n "Ev,@function\n"*/ \ + "__ZN14nsXPTCStubBase7Stub" #n "Ev:\n\t" \ + ".else\n\t" \ + ".err \"stub number " #n " >= 1000 not yet supported\"\n\t" \ + ".endif\n\t" \ + "movl $" #n ", %eax\n\t" \ + "jmp SharedStub\n\t" \ + ".if " #n " < 10\n\t" \ + /*".size __ZN14nsXPTCStubBase5Stub" #n "Ev,.-__ZN14nsXPTCStubBase5Stub" #n "Ev\n\t"*/ \ + ".elseif " #n " < 100\n\t" \ + /*".size __ZN14nsXPTCStubBase6Stub" #n "Ev,.-__ZN14nsXPTCStubBase6Stub" #n "Ev\n\t"*/ \ + ".else\n\t" \ + /*".size __ZN14nsXPTCStubBase7Stub" #n "Ev,.-__ZN14nsXPTCStubBase7Stub" #n "Ev\n\t"*/ \ + ".endif"); + +// static nsresult SharedStub(PRUint32 methodIndex) [methodIndex is in eax]. +asm(".text\n\t" + ".align 2\n\t" +/* ".type SharedStub,@function\n\t" */ + "SharedStub:\n\t" + // make room for gpregs (48), fpregs (64) + "pushq %rbp\n\t" + "movq %rsp,%rbp\n\t" + "subq $112,%rsp\n\t" + // save GP registers + "movq %rdi,-112(%rbp)\n\t" + "movq %rsi,-104(%rbp)\n\t" + "movq %rdx, -96(%rbp)\n\t" + "movq %rcx, -88(%rbp)\n\t" + "movq %r8 , -80(%rbp)\n\t" + "movq %r9 , -72(%rbp)\n\t" + "leaq -112(%rbp),%rcx\n\t" + // save FP registers + "movsd %xmm0,-64(%rbp)\n\t" + "movsd %xmm1,-56(%rbp)\n\t" + "movsd %xmm2,-48(%rbp)\n\t" + "movsd %xmm3,-40(%rbp)\n\t" + "movsd %xmm4,-32(%rbp)\n\t" + "movsd %xmm5,-24(%rbp)\n\t" + "movsd %xmm6,-16(%rbp)\n\t" + "movsd %xmm7, -8(%rbp)\n\t" + "leaq -64(%rbp),%r8\n\t" + // rdi has the 'self' pointer already + "movl %eax,%esi\n\t" + "leaq 16(%rbp),%rdx\n\t" + "call _PrepareAndDispatch\n\t" + "leave\n\t" + "ret\n\t" +/* ".size SharedStub,.-SharedStub" */ + ); + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" + +#else +#error "Unsupported compiler. Use gcc >= 3.1 for Darwin/AMD64." +#endif /* __GNUC__ */ diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_arm.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_arm.cpp new file mode 100644 index 00000000..fc90ecea --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_arm.cpp @@ -0,0 +1,244 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Russell King <rmk@arm.linux.org.uk> + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Implement shared vtbl methods. */ + +#include "xptcprivate.h" + +#if !defined(LINUX) || !defined(__arm__) +#error "This code is for Linux ARM only. Please check if it works for you, too.\nDepends strongly on gcc behaviour." +#endif + +/* Specify explicitly a symbol for this function, don't try to guess the c++ mangled symbol. */ +static nsresult PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, PRUint32* args) asm("_PrepareAndDispatch"); + +static nsresult +PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, PRUint32* 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; +} + +/* + * This is our shared stub. + * + * r0 = Self. + * + * The Rules: + * We pass an (undefined) number of arguments into this function. + * The first 3 C++ arguments are in r1 - r3, the rest are built + * by the calling function on the stack. + * + * We are allowed to corrupt r0 - r3, ip, and lr. + * + * Other Info: + * We pass the stub number in using `ip'. + * + * Implementation: + * - We save r1 to r3 inclusive onto the stack, which will be + * immediately below the caller saved arguments. + * - setup r2 (PrepareAndDispatch's args pointer) to point at + * the base of all these arguments + * - Save LR (for the return address) + * - Set r1 (PrepareAndDispatch's methodindex argument) from ip + * - r0 is passed through (self) + * - Call PrepareAndDispatch + * - When the call returns, we return by loading the PC off the + * stack, and undoing the stack (one instruction)! + * + */ +__asm__ ("\n\ +SharedStub: \n\ + stmfd sp!, {r1, r2, r3} \n\ + mov r2, sp \n\ + str lr, [sp, #-4]! \n\ + mov r1, ip \n\ + bl _PrepareAndDispatch \n\ + ldr pc, [sp], #16"); + +/* + * Create sets of stubs to call the SharedStub. + * We don't touch the stack here, nor any registers, other than IP. + * IP is defined to be corruptable by a called function, so we are + * safe to use it. + * + * This will work with or without optimisation. + */ +#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */ +/* + * Note : As G++3 ABI contains the length of the functionname in the + * mangled name, it is difficult to get a generic assembler mechanism like + * in the G++ 2.95 case. + * Create names would be like : + * _ZN14nsXPTCStubBase5Stub9Ev + * _ZN14nsXPTCStubBase6Stub13Ev + * _ZN14nsXPTCStubBase7Stub144Ev + * Use the assembler directives to get the names right... + */ + +#define STUB_ENTRY(n) \ + __asm__( \ + ".section \".text\"\n" \ +" .align 2\n" \ +" .iflt ("#n" - 10)\n" \ +" .globl _ZN14nsXPTCStubBase5Stub"#n"Ev\n" \ +" .type _ZN14nsXPTCStubBase5Stub"#n"Ev,#function\n" \ +"_ZN14nsXPTCStubBase5Stub"#n"Ev:\n" \ +" .else\n" \ +" .iflt ("#n" - 100)\n" \ +" .globl _ZN14nsXPTCStubBase6Stub"#n"Ev\n" \ +" .type _ZN14nsXPTCStubBase6Stub"#n"Ev,#function\n" \ +"_ZN14nsXPTCStubBase6Stub"#n"Ev:\n" \ +" .else\n" \ +" .iflt ("#n" - 1000)\n" \ +" .globl _ZN14nsXPTCStubBase7Stub"#n"Ev\n" \ +" .type _ZN14nsXPTCStubBase7Stub"#n"Ev,#function\n" \ +"_ZN14nsXPTCStubBase7Stub"#n"Ev:\n" \ +" .else\n" \ +" .err \"stub number "#n"> 1000 not yet supported\"\n" \ +" .endif\n" \ +" .endif\n" \ +" .endif\n" \ +" mov ip, #"#n"\n" \ +" b SharedStub\n\t"); + +#if 0 +/* + * This part is left in as comment : this is how the method definition + * should look like. + */ + +#define STUB_ENTRY(n) \ +nsresult nsXPTCStubBase::Stub##n () \ +{ \ + __asm__ ( \ +" mov ip, #"#n"\n" \ +" b SharedStub\n\t"); \ + return 0; /* avoid warnings */ \ +} +#endif + +#else /* G++2.95 ABI */ + +#define STUB_ENTRY(n) \ + __asm__( \ + ".section \".text\"\n" \ +" .align\n" \ +" .globl Stub"#n"__14nsXPTCStubBase\n" \ +" .type Stub"#n"__14nsXPTCStubBase,#function\n\n" \ +"Stub"#n"__14nsXPTCStubBase:\n" \ +" mov ip, #"#n"\n" \ +" b SharedStub\n\t"); + +#endif + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_arm_netbsd.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_arm_netbsd.cpp new file mode 100644 index 00000000..47c09a42 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_arm_netbsd.cpp @@ -0,0 +1,145 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Implement shared vtbl methods. */ + +#include "xptcprivate.h" + +nsresult +PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, PRUint32* 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; +} + +/* + * These stubs move just move the values passed in registers onto the stack, + * so they are contiguous with values passed on the stack, and then calls + * PrepareAndDispatch() to do the dirty work. + */ + +#define STUB_ENTRY(n) \ +__asm__( \ + ".global _Stub"#n"__14nsXPTCStubBase\n\t" \ +"_Stub"#n"__14nsXPTCStubBase:\n\t" \ + "stmfd sp!, {r1, r2, r3} \n\t" \ + "mov ip, sp \n\t" \ + "stmfd sp!, {fp, ip, lr, pc} \n\t" \ + "sub fp, ip, #4 \n\t" \ + "mov r1, #"#n" \n\t" /* = methodIndex */ \ + "add r2, sp, #16 \n\t" \ + "bl _PrepareAndDispatch__FP14nsXPTCStubBaseUiPUi \n\t" \ + "ldmea fp, {fp, sp, lr} \n\t" \ + "add sp, sp, #12 \n\t" \ + "mov pc, lr \n\t" \ +); + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ipf32.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ipf32.s new file mode 100644 index 00000000..591e88e5 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ipf32.s @@ -0,0 +1,124 @@ + +// Select C numeric constant + .radix C + .psr abi32 + .psr msb +// Section has executable code + .section .text, "ax","progbits" +// procedure named 'SharedStub' + .proc SharedStub +// manual bundling + .explicit + + .global PrepareAndDispatch +// .exclass PrepareAndDispatch, @fullyvisible + .type PrepareAndDispatch,@function + +SharedStub:: +// 9 arguments, first 8 are the input arguments of previous +// function call. The last one is methodIndex, and is passed in memory + .prologue + .save ar.pfs , r41 +// allocate 8 input args, 4 local args, and 5 output args + alloc r41 = ar.pfs, 8, 4, 5, 0 // M + .save rp, r40 + mov r40 = rp // I + nop.i 0 ;; // I + + .save ar.unat, r42 + mov r42 = ar.unat // M + .fframe 144 + add sp = -144, sp // A +// unwind table already knows gp, don't need to specify anything + add r43 = 0, gp ;; // A + +// We have possible 8 integer registers and 8 float registers that could +// be arguments. We also have a stack region from the previous +// stack frame that may hold some stack arguments. +// We need to write the integer registers to a memory region, write +// the float registers to a memory region (making sure we don't step +// on NAT while touching the registers). We also mark the memory +// address of the stack arguments. +// We then call PrepareAndDispatch() specifying the three memory +// region pointers. + + + .body + add out0 = 0, in0 // A move self ptr +// 144 bytes = 16 byte stack header + 64 byte int space + 64 byte float space +// current frame is 144 bytes, previous frame is 112 bytes +// restarg is at 144 + 112 + 16 bytes away from current sp +// (current frame + previous frame + previous previous frame header) +// methodIndex is at 144 + 16 bytes away from current sp +// (current frame + previous frame header) + add out4 = 192, sp // A restarg address + add r11 = 160, sp ;; // A address of methodIndex + + ld8 out1 = [r11] // M load methodIndex +// sp + 16 is the start of intargs + add out2 = 16, sp // A address of intargs +// the intargs take up 64 bytes, so sp + 16 + 64 is the start of floatargs + add out3 = 80, sp ;; // A address of floatargs + + add r11 = 0, out2 ;; // A + st8.spill [r11] = in1, 8 // M + add r10 = 0, out3 ;; // A + + st8.spill [r11] = in2, 8 ;; // M + st8.spill [r11] = in3, 8 // M + nop.i 0 ;; // I + + st8.spill [r11] = in4, 8 ;; // M + st8.spill [r11] = in5, 8 // M + nop.i 0 ;; // I + + st8.spill [r11] = in6, 8 ;; // M + st8.spill [r11] = in7 // M + fclass.nm p14,p15 = f8,@nat ;; // F + +(p14) stfd [r10] = f8, 8 // M +(p15) add r10 = 8, r10 // A + fclass.nm p12,p13 = f9,@nat ;; // F + +(p12) stfd [r10] = f9, 8 // M +(p13) add r10 = 8, r10 // A + fclass.nm p14,p15 =f10,@nat ;; // F + +(p14) stfd [r10] = f10, 8 // M +(p15) add r10 = 8, r10 // A + fclass.nm p12,p13 =f11,@nat ;; // F + +(p12) stfd [r10] = f11, 8 // M +(p13) add r10 = 8, r10 // A + fclass.nm p14,p15 =f12,@nat ;; // F + +(p14) stfd [r10] = f12, 8 // M +(p15) add r10 = 8, r10 // A + fclass.nm p12,p13 =f13,@nat ;; // F + +(p12) stfd [r10] = f13, 8 // M +(p13) add r10 = 8, r10 // A + fclass.nm p14,p15 =f14,@nat ;; // F + +(p14) stfd [r10] = f14, 8 // M +(p15) add r10 = 8, r10 // A + fclass.nm p12,p13 =f15,@nat ;; // F + +(p12) stfd [r10] = f15, 8 // M +(p13) add r10 = 8, r10 // A + +// branch to PrepareAndDispatch + br.call.dptk.few rp = PrepareAndDispatch ;; // B + +// epilog + mov ar.unat = r42 // M + mov ar.pfs = r41 // I + mov rp = r40 ;; // I + + add gp = 0, r43 // A + add sp = 144, sp // A + br.ret.dptk.few rp ;; // B + + .endp + + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ipf64.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ipf64.s new file mode 100644 index 00000000..177b2646 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ipf64.s @@ -0,0 +1,124 @@ + +// Select C numeric constant + .radix C + .psr abi64 + .psr lsb +// Section has executable code + .section .text, "ax","progbits" +// procedure named 'SharedStub' + .proc SharedStub +// manual bundling + .explicit + + .global PrepareAndDispatch +// .exclass PrepareAndDispatch, @fullyvisible + .type PrepareAndDispatch,@function + +SharedStub:: +// 9 arguments, first 8 are the input arguments of previous +// function call. The last one is methodIndex, and is passed in memory + .prologue + .save ar.pfs , r41 +// allocate 8 input args, 4 local args, and 5 output args + alloc r41 = ar.pfs, 8, 4, 5, 0 // M + .save rp, r40 + mov r40 = rp // I + nop.i 0 ;; // I + + .save ar.unat, r42 + mov r42 = ar.unat // M + .fframe 144 + add sp = -144, sp // A +// unwind table already knows gp, don't need to specify anything + add r43 = 0, gp ;; // A + +// We have possible 8 integer registers and 8 float registers that could +// be arguments. We also have a stack region from the previous +// stack frame that may hold some stack arguments. +// We need to write the integer registers to a memory region, write +// the float registers to a memory region (making sure we don't step +// on NAT while touching the registers). We also mark the memory +// address of the stack arguments. +// We then call PrepareAndDispatch() specifying the three memory +// region pointers. + + + .body + add out0 = 0, in0 // A move self ptr +// 144 bytes = 16 byte stack header + 64 byte int space + 64 byte float space +// current frame is 144 bytes, previous frame is 112 bytes +// restarg is at 144 + 112 + 16 bytes away from current sp +// (current frame + previous frame + previous previous frame header) +// methodIndex is at 144 + 16 bytes away from current sp +// (current frame + previous frame header) + add out4 = 192, sp // A restarg address + add r11 = 160, sp ;; // A address of methodIndex + + ld8 out1 = [r11] // M load methodIndex +// sp + 16 is the start of intargs + add out2 = 16, sp // A address of intargs +// the intargs take up 64 bytes, so sp + 16 + 64 is the start of floatargs + add out3 = 80, sp ;; // A address of floatargs + + add r11 = 0, out2 ;; // A + st8.spill [r11] = in1, 8 // M + add r10 = 0, out3 ;; // A + + st8.spill [r11] = in2, 8 ;; // M + st8.spill [r11] = in3, 8 // M + nop.i 0 ;; // I + + st8.spill [r11] = in4, 8 ;; // M + st8.spill [r11] = in5, 8 // M + nop.i 0 ;; // I + + st8.spill [r11] = in6, 8 ;; // M + st8.spill [r11] = in7 // M + fclass.nm p14,p15 = f8,@nat ;; // F + +(p14) stfd [r10] = f8, 8 // M +(p15) add r10 = 8, r10 // A + fclass.nm p12,p13 = f9,@nat ;; // F + +(p12) stfd [r10] = f9, 8 // M +(p13) add r10 = 8, r10 // A + fclass.nm p14,p15 =f10,@nat ;; // F + +(p14) stfd [r10] = f10, 8 // M +(p15) add r10 = 8, r10 // A + fclass.nm p12,p13 =f11,@nat ;; // F + +(p12) stfd [r10] = f11, 8 // M +(p13) add r10 = 8, r10 // A + fclass.nm p14,p15 =f12,@nat ;; // F + +(p14) stfd [r10] = f12, 8 // M +(p15) add r10 = 8, r10 // A + fclass.nm p12,p13 =f13,@nat ;; // F + +(p12) stfd [r10] = f13, 8 // M +(p13) add r10 = 8, r10 // A + fclass.nm p14,p15 =f14,@nat ;; // F + +(p14) stfd [r10] = f14, 8 // M +(p15) add r10 = 8, r10 // A + fclass.nm p12,p13 =f15,@nat ;; // F + +(p12) stfd [r10] = f15, 8 // M +(p13) add r10 = 8, r10 // A + +// branch to PrepareAndDispatch + br.call.dptk.few rp = PrepareAndDispatch ;; // B + +// epilog + mov ar.unat = r42 // M + mov ar.pfs = r41 // I + mov rp = r40 ;; // I + + add gp = 0, r43 // A + add sp = 144, sp // A + br.ret.dptk.few rp ;; // B + + .endp + + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_irix.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_irix.s new file mode 100644 index 00000000..4ca1e542 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_irix.s @@ -0,0 +1,97 @@ + +#include <sys/regdef.h> +#include <sys/asm.h> + + .text + .globl PrepareAndDispatch + +LOCALSZ=16 +FRAMESZ=(((NARGSAVE+LOCALSZ)*SZREG)+ALSZ)&ALMASK + +A1OFF=FRAMESZ-(9*SZREG) +A2OFF=FRAMESZ-(8*SZREG) +A3OFF=FRAMESZ-(7*SZREG) +A4OFF=FRAMESZ-(6*SZREG) +A5OFF=FRAMESZ-(5*SZREG) +A6OFF=FRAMESZ-(4*SZREG) +A7OFF=FRAMESZ-(3*SZREG) +GPOFF=FRAMESZ-(2*SZREG) +RAOFF=FRAMESZ-(1*SZREG) + +F13OFF=FRAMESZ-(16*SZREG) +F14OFF=FRAMESZ-(15*SZREG) +F15OFF=FRAMESZ-(14*SZREG) +F16OFF=FRAMESZ-(13*SZREG) +F17OFF=FRAMESZ-(12*SZREG) +F18OFF=FRAMESZ-(11*SZREG) +F19OFF=FRAMESZ-(10*SZREG) + +#define SENTINEL_ENTRY(nn) /* defined in cpp file, not here */ + +#ifdef __GNUC__ +#define STUB_ENTRY(nn) MAKE_STUB(nn, Stub/**/nn/**/__14nsXPTCStubBase) +#else +#define STUB_ENTRY(nn) MAKE_STUB(nn, Stub/**/nn/**/__14nsXPTCStubBaseGv) +#endif + +#define MAKE_STUB(nn, name) \ +NESTED(name, FRAMESZ, ra); \ + SETUP_GP; \ + PTR_SUBU sp, FRAMESZ; \ + SETUP_GP64(GPOFF, name); \ + SAVE_GP(GPOFF); \ + li t0, nn; \ + b sharedstub; \ +.end name; \ + +#include "xptcstubsdef.inc" + + .globl sharedstub + .ent sharedstub +sharedstub: + + REG_S a1, A1OFF(sp) + REG_S a2, A2OFF(sp) + REG_S a3, A3OFF(sp) + REG_S a4, A4OFF(sp) + REG_S a5, A5OFF(sp) + REG_S a6, A6OFF(sp) + REG_S a7, A7OFF(sp) + REG_S ra, RAOFF(sp) + + s.d $f13, F13OFF(sp) + s.d $f14, F14OFF(sp) + s.d $f15, F15OFF(sp) + s.d $f16, F16OFF(sp) + s.d $f17, F17OFF(sp) + s.d $f18, F18OFF(sp) + s.d $f19, F19OFF(sp) + + # t0 is methodIndex + move a1, t0 + + # a2 is stack address where extra function params + # are stored that do not fit in registers + move a2, sp + addi a2, FRAMESZ + + # a3 is stack address of a1..a7 + move a3, sp + addi a3, A1OFF + + # a4 is stack address of f13..f19 + move a4, sp + addi a4, F13OFF + + # PrepareAndDispatch(that, methodIndex, args, gprArgs, fpArgs) + # a0 a1 a2 a3 a4 + # + jal PrepareAndDispatch + + REG_L ra, RAOFF(sp) + REG_L gp, GPOFF(sp) + + PTR_ADDU sp, FRAMESZ + j ra + +.end sharedstub diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_mips.s.m4 b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_mips.s.m4 new file mode 100644 index 00000000..f327adfb --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_mips.s.m4 @@ -0,0 +1,109 @@ +/* -*- Mode: asm; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * Version: MPL 1.1 + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corp, Inc. + * Portions created by the Initial Developer are Copyright (C) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Stuart Parmenter <pavlov@netscape.com> + * Chris Waterson <waterson@netscape.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* This code is for MIPS using the O32 ABI. */ + +#include <sys/regdef.h> +#include <sys/asm.h> + + .text + .globl PrepareAndDispatch + +NARGSAVE=4 # extra space for the callee to use. gccism + # we can put our a0-a3 in our callers space. +LOCALSZ=2 # gp, ra +FRAMESZ=(((NARGSAVE+LOCALSZ)*SZREG)+ALSZ)&ALMASK + +define(STUB_NAME, `Stub'$1`__14nsXPTCStubBase') + +define(STUB_ENTRY, +` .globl 'STUB_NAME($1)` + .align 2 + .type 'STUB_NAME($1)`,@function + .ent 'STUB_NAME($1)`, 0 +'STUB_NAME($1)`: + .frame sp, FRAMESZ, ra + .set noreorder + .cpload t9 + .set reorder + subu sp, FRAMESZ + .cprestore 16 + li t0, '$1` + b sharedstub +.end 'STUB_NAME($1)` + +') + +define(SENTINEL_ENTRY, `') + +include(xptcstubsdef.inc) + + .globl sharedstub + .ent sharedstub +sharedstub: + + REG_S ra, 20(sp) + + REG_S a0, 24(sp) + REG_S a1, 28(sp) + REG_S a2, 32(sp) + REG_S a3, 36(sp) + + # t0 is methodIndex + move a1, t0 + + # put the start of a1, a2, a3, and stack + move a2, sp + addi a2, 24 # have a2 point to sp + 24 (where a0 is) + + # PrepareAndDispatch(that, methodIndex, args) + # a0 a1 a2 + # + jal PrepareAndDispatch + + REG_L ra, 20(sp) + REG_L a1, 28(sp) + REG_L a2, 32(sp) + + addu sp, FRAMESZ + j ra + +.end sharedstub diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_openvms_alpha.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_openvms_alpha.s new file mode 100644 index 00000000..9f04d4c4 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_openvms_alpha.s @@ -0,0 +1,115 @@ +;* -*- 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.1 (the "License"); you may not use this file +;* except in compliance with the License. You may obtain a copy of +;* the License at http://www.mozilla.org/NPL/ +;* +;* Software distributed under the License is distributed on an "AS +;* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +;* implied. See the License for the specific language governing +;* rights and limitations under the License. +;* +;* The Original Code is mozilla.org code. +;* +;* The Initial Developer of the Original Code is Netscape +;* Communications Corporation. Portions created by Netscape are +;* Copyright (C) 1999 Netscape Communications Corporation. All +;* Rights Reserved. +;* +;* Contributor(s): +;*/ + +; Implement shared vtbl methods. + + .title "STUBS" "Stub Code" + + MBIT = "__14nsXPTCStubBasexv" ; this is the mangled part of the name + +; The layout of the linkage section is important. First comes +; PrepareAndDispatch, and then the Procedure Descriptors for the stubs. Each +; is known to be 16 bytes long, and we use this fact to be able to locate the +; PrepareAndDispatch linkage pair from any of the stubs. + + .PSECT $LINK$, OCTA, NOPIC, CON, REL, LCL, NOSHR, NOEXE, RD, NOWRT + .LINKAGE_PAIR PrepareAndDispatch + LINKOFF = 16 ; first stub lp will be 16 bytes away + +; STUB_ENTRY createa a routine nsXPTCStubBase::Stub<n>() where n is the +; argument passed in to STUB_ENTRY. It puts its stub number into R1 and then +; jumps into SharedStub. It does it this way because we don't want to mess +; up the arguments that may be on the stack. In order that we can find +; our way around the linkage section, we subtract our offset from the +; start of the linkage section (LINKOFF) from our own PV, thus giving +; us the PV os the first entry in the linkage section (this should be +; PrepareAndDispatch); + + .macro STUB_ENTRY n + $routine Stub'n%MBIT%, kind=null + mov LINKOFF, r1 ; distance from lp for PrepareAndDispatch + subq r27,r1,r27 ; subtract it from address of our proc desc + mov n,r1 ; stub number is passed in r1 + br SharedStub ; off to common code + $end_routine + LINKOFF = LINKOFF + 16 ; we just put 16 bytes into linkage section + .endm STUB_ENTRY + +; SENTINEL_ENTRY is in the C++ module. We need to define a empty macro +; here to keep the assembler happy. + .macro SENTINEL_ENTRY n + .endm SENTINEL_ENTRY + + .PSECT $CODE$, OCTA, PIC, CON, REL, LCL, SHR, EXE, NORD, NOWRT + +; +; SharedStub() +; Collects arguments and calls PrepareAndDispatch. +; +; r1 - The "methodIndex" +; r27 - points to the first entry in the linkage section, which by design +; is the linkage pair for PrepareAndDispatch. +; +; Arguments are passed in a non-standard way so that we don't disturb the +; original arguments that were passed in to the stub. Since some args (if +; there were more than 6) will already be on the stack, the stub had to not +; only preserve R16-R21, but also preserve the stack too. +; + +SharedStub:: + subq sp,96,sp ; get some stack space for the args and saves + stq r26,0(sp) ; save r26 (the return address) + + ; + ; Store arguments passed via registers to the stack. + ; Floating point registers are stored as doubles and converted + ; to floats in PrepareAndDispatch if necessary. + ; + stt f17,16(sp) ; floating point registers + stt f18,24(sp) + stt f19,32(sp) + stt f20,40(sp) + stt f21,48(sp) + stq r17,56(sp) ; integer registers + stq r18,64(sp) + stq r19,72(sp) + stq r20,80(sp) + stq r21,88(sp) + + ; + ; Call PrepareAndDispatch function. + ; + mov r1,r17 ; pass "methodIndex" + addq sp,16,r18 ; pass "args" + mov 3,r25 ; number of args into AI + + LDQ R26, 0(R27) ; get entry point address from linkage pair + LDQ R27, 8(R27) ; get procedure descriptor address from lp + JSR R26, R26 + + ldq r26, 0(sp) ; restore return address + addq sp,96,sp ; return stack space + ret r26 ; and we're outta here + + .include "xptcstubsdef_asm.vms" + + .end diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_osf1_alpha.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_osf1_alpha.s new file mode 100644 index 00000000..3bef9b1b --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_osf1_alpha.s @@ -0,0 +1,75 @@ + .text + .align 5 + .globl SharedStub + .ent SharedStub +SharedStub: + .frame $30, 96, $26, 0 + .mask 0x4000000,-96 + ldgp $29,0($27) +SharedStubXv: + subq $30,96,$30 + stq $26,0($30) + .prologue 1 + stt $f17,16($30) + stt $f18,24($30) + stt $f19,32($30) + stt $f20,40($30) + stt $f21,48($30) + stq $17,56($30) + stq $18,64($30) + stq $19,72($30) + stq $20,80($30) + stq $21,88($30) + bis $1,$1,$17 + addq $30,16,$18 + bsr $26,PrepareAndDispatch + ldq $26,0($30) + addq $30,96,$30 + ret $31,($26),1 + .end SharedStub + +/* + The C preprocessor doesn't handle # and ## if run with -std or -std0. + + If -std then __STDC__ is 0 [default] (K&R behavior) + If -std0 then __STDC__ is undefined (K&R behavior) + If -std1 then __STDC__ is 1 (ANSI preprocessor) +*/ + +#if __STDC__ +#define STUB_ENTRY(n) ;\ + .text ;\ + .align 5 ;\ + .globl Stub##n##__14nsXPTCStubBase ;\ + .globl Stub##n##__14nsXPTCStubBaseXv ;\ + .ent Stub##n##__14nsXPTCStubBase ;\ +Stub##n##__14nsXPTCStubBase: ;\ + .frame $30,0,$26,0 ;\ + ldgp $29,0($27) ;\ + .prologue 1 ;\ +Stub##n##__14nsXPTCStubBaseXv: ;\ + lda $1,n ;\ + br $31,SharedStubXv ;\ + .end Stub##n##__14nsXPTCStubBase \ + +#else +#define STUB_ENTRY(n) ;\ + .text ;\ + .align 5 ;\ + .globl Stub/**/n/**/__14nsXPTCStubBase ;\ + .globl Stub/**/n/**/__14nsXPTCStubBaseXv ;\ + .ent Stub/**/n/**/__14nsXPTCStubBase ;\ +Stub/**/n/**/__14nsXPTCStubBase: ;\ + .frame $30,0,$26,0 ;\ + ldgp $29,0($27) ;\ + .prologue 1 ;\ +Stub/**/n/**/__14nsXPTCStubBaseXv: ;\ + lda $1,n ;\ + br $31,SharedStubXv ;\ + .end Stub/**/n/**/__14nsXPTCStubBase \ + +#endif + +#define SENTINEL_ENTRY(n) \ + +#include "xptcstubsdef.inc" diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_pa32.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_pa32.s new file mode 100644 index 00000000..9e86848f --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_pa32.s @@ -0,0 +1,68 @@ + .LEVEL 1.1 + +curframesz .EQU 128 +; SharedStub has stack size of 128 bytes + +lastframesz .EQU 64 +; the StubN C++ function has a small stack size of 64 bytes + + .SPACE $TEXT$,SORT=8 + .SUBSPA $CODE$,QUAD=0,ALIGN=4,ACCESS=0x2c,CODE_ONLY,SORT=24 +SharedStub + .PROC + .CALLINFO CALLER,FRAME=80,SAVE_RP,ARGS_SAVED + + .ENTRY + STW %rp,-20(%sp) + LDO 128(%sp),%sp + + STW %r19,-32(%r30) + STW %r26,-36-curframesz(%r30) ; save arg0 in previous frame + + LDO -80(%r30),%r28 + FSTD,MA %fr5,8(%r28) ; save darg0 + FSTD,MA %fr7,8(%r28) ; save darg1 + FSTW,MA %fr4L,4(%r28) ; save farg0 + FSTW,MA %fr5L,4(%r28) ; save farg1 + FSTW,MA %fr6L,4(%r28) ; save farg2 + FSTW,MA %fr7L,4(%r28) ; save farg3 + + ; Former value of register 26 is already properly saved by StubN, + ; but register 25-23 are not because of the arguments mismatch + STW %r25,-40-curframesz-lastframesz(%r30) ; save r25 + STW %r24,-44-curframesz-lastframesz(%r30) ; save r24 + STW %r23,-48-curframesz-lastframesz(%r30) ; save r23 + COPY %r26,%r25 ; method index is arg1 + LDW -36-curframesz-lastframesz(%r30),%r26 ; self is arg0 + LDO -40-curframesz-lastframesz(%r30),%r24 ; normal args is arg2 + LDO -80(%r30),%r23 ; floating args is arg3 + + BL .+8,%r2 + ADDIL L'PrepareAndDispatch-$PIC_pcrel$0+4,%r2 + LDO R'PrepareAndDispatch-$PIC_pcrel$1+8(%r1),%r1 +$PIC_pcrel$0 + LDSID (%r1),%r31 +$PIC_pcrel$1 + MTSP %r31,%sr0 + .CALL ARGW0=GR,ARGW1=GR,ARGW2=GR,ARGW3=GR,RTNVAL=GR +;in=23-26;out=28; + BLE 0(%sr0,%r1) + COPY %r31,%r2 + + LDW -32(%r30),%r19 + + LDW -148(%sp),%rp + BVE (%rp) + .EXIT + LDO -128(%sp),%sp + + + .PROCEND ;in=26;out=28; + + .ALIGN 8 + .SPACE $TEXT$ + .SUBSPA $CODE$ + .IMPORT PrepareAndDispatch,CODE + .EXPORT SharedStub,ENTRY,PRIV_LEV=3,ARGW0=GR,RTNVAL=GR,LONG_RETURN + .END + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_aix.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_aix.s new file mode 100644 index 00000000..667da705 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_aix.s @@ -0,0 +1,117 @@ + # + # -*- 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.1 (the "License"); you may not use this file + # except in compliance with the License. You may obtain a copy of + # the License at http://www.mozilla.org/NPL/ + # + # Software distributed under the License is distributed on an "AS + # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + # implied. See the License for the specific language governing + # rights and limitations under the License. + # + # The Original Code is mozilla.org code. + # + # The Initial Developer of the Original Code is Netscape + # Communications Corporation. Portions created by Netscape are + # Copyright (C) 1999 Netscape Communications Corporation. All + # Rights Reserved. + # + # Contributor(s): + # + +.set r0,0; .set sp,1; .set RTOC,2; .set r3,3; .set r4,4 +.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9 +.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14 +.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19 +.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24 +.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29 +.set r30,30; .set r31,31 +.set f0,0; .set f1,1; .set f2,2; .set f3,3; .set f4,4 +.set f5,5; .set f6,6; .set f7,7; .set f8,8; .set f9,9 +.set f10,10; .set f11,11; .set f12,12; .set f13,13; .set f14,14 +.set f15,15; .set f16,16; .set f17,17; .set f18,18; .set f19,19 +.set f20,20; .set f21,21; .set f22,22; .set f23,23; .set f24,24 +.set f25,25; .set f26,26; .set f27,27; .set f28,28; .set f29,29 +.set f30,30; .set f31,31 + + + + .rename H.10.NO_SYMBOL{PR},"" + .rename H.18.SharedStub{TC},"SharedStub" + + +# .text section + + .csect H.10.NO_SYMBOL{PR} + .globl .SharedStub + .globl SharedStub{DS} + .extern .PrepareAndDispatch + + +#jimbo csect CODE{PR} +# +# on entry SharedStub has the method selector in r12, the rest of the original +# parameters are in r3 thru r10 and f1 thru f13 +# +#jimbo import .PrepareAndDispatch + +.SharedStub: + mflr r0 + stw r0,8(sp) + + mr r12,r3 # Move methodIndex into r12 for LATER + lwz r3,104(sp) # Get the 'original' r3 + + stwu sp,-176(sp) # room for linkage (24), fprData (104), gprData(28) + # outgoing params to PrepareAndDispatch (20) + + stw r4,44(sp) + stw r5,48(sp) + stw r6,52(sp) + stw r7,56(sp) + stw r8,60(sp) + stw r9,64(sp) + stw r10,68(sp) + stfd f1,72(sp) + stfd f2,80(sp) + stfd f3,88(sp) + stfd f4,96(sp) + stfd f5,104(sp) + stfd f6,112(sp) + stfd f7,120(sp) + stfd f8,128(sp) + stfd f9,136(sp) + stfd f10,144(sp) + stfd f11,152(sp) + stfd f12,156(sp) + stfd f13,164(sp) + + addi r6,sp,44 # gprData + addi r7,sp,72 # fprData + # r3 has the 'self' pointer already + mr r4,r12 # methodIndex selector (it is now LATER) + addi r5,sp,312 # pointer to callers args area, beyond r3-r10 mapped range + + bl .PrepareAndDispatch + nop + + lwz r0,184(sp) + addi sp,sp,176 + mtlr r0 + blr + +# .data section + + .toc # 0x00000038 +T.18.SharedStub: + .tc H.18.SharedStub{TC},SharedStub{DS} + + .csect SharedStub{DS} + .long .SharedStub # "\0\0\0\0" + .long TOC{TC0} # "\0\0\0008" + .long 0x00000000 # "\0\0\0\0" +# End csect SharedStub{DS} + +# .bss section diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_aix64.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_aix64.s new file mode 100644 index 00000000..94245d5e --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_aix64.s @@ -0,0 +1,137 @@ +# ***** BEGIN LICENSE BLOCK ***** +# +# Version: MPL 1.1/LGPL 2.1/GPL 2.0 +# +# The contents of this file are subject to the Mozilla Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is IBM Corporation. +# Portions created by IBM are +# Copyright (C) 2002, International Business Machines Corporation. +# All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the LGPL or the GPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +.set r0,0; .set sp,1; .set RTOC,2; .set r3,3; .set r4,4 +.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9 +.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14 +.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19 +.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24 +.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29 +.set r30,30; .set r31,31 +.set f0,0; .set f1,1; .set f2,2; .set f3,3; .set f4,4 +.set f5,5; .set f6,6; .set f7,7; .set f8,8; .set f9,9 +.set f10,10; .set f11,11; .set f12,12; .set f13,13; .set f14,14 +.set f15,15; .set f16,16; .set f17,17; .set f18,18; .set f19,19 +.set f20,20; .set f21,21; .set f22,22; .set f23,23; .set f24,24 +.set f25,25; .set f26,26; .set f27,27; .set f28,28; .set f29,29 +.set f30,30; .set f31,31 + + + .rename H.10.NO_SYMBOL{PR},"" + .rename H.18.SharedStub{TC},"SharedStub" + + +# .text section + + .csect H.10.NO_SYMBOL{PR} + .globl .SharedStub + .globl SharedStub{DS} + .extern .PrepareAndDispatch + + +#jimbo csect CODE{PR} +# +# on entry SharedStub has the method selector in r12, the rest of the original +# parameters are in r3 thru r10 and f1 thru f13 +# +#jimbo import .PrepareAndDispatch + +.SharedStub: + mflr r0 + std r0,16(sp) + + mr r12,r3 # Move methodIndex into r12 for LATER + ld r3,176(sp) # Get the 'original' r3 (load 'this' into r3) + + stdu sp,-248(sp) # room for linkage (24*2), fprData (104), + # gprData(28*2), outgoing params to + # PrepareAndDispatch (40) + + std r4,88(sp) # link area (48) + PrepareAndDispatch parms (40) + std r5,96(sp) + std r6,104(sp) + std r7,112(sp) + std r8,120(sp) + std r9,128(sp) + std r10,136(sp) + stfd f1,144(sp) + stfd f2,152(sp) + stfd f3,160(sp) + stfd f4,168(sp) + stfd f5,176(sp) + stfd f6,184(sp) + stfd f7,192(sp) + stfd f8,200(sp) + stfd f9,208(sp) + stfd f10,216(sp) + stfd f11,224(sp) + stfd f12,232(sp) + stfd f13,240(sp) + + addi r6,sp,88 # gprData + addi r7,sp,144 # fprData + # r3 has the 'self' pointer already + mr r4,r12 # methodIndex selector (it is now LATER) + addi r5,sp,488 # pointer to callers args area, beyond r3-r10 + # mapped range + # 32bit: 176 (stack-distance) 64bit: 248 (stack-distance) + # 104 (this ptr offset) 176 + # 32 (8*4 for r3-r10) 64 (8*8) + # --- --- + # 312 488 + + bl .PrepareAndDispatch + nop + + ld r0,264(sp) # 248+16 + addi sp,sp,248 + mtlr r0 + blr + +# .data section + + .toc # 0x00000038 +T.18.SharedStub: + .tc H.18.SharedStub{TC},SharedStub{DS} + + .csect SharedStub{DS} + .llong .SharedStub # "\0\0\0\0" + .llong TOC{TC0} # "\0\0\0008" + .llong 0x00000000 # "\0\0\0\0" +# End csect SharedStub{DS} + +# .bss section diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_darwin.s.m4 b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_darwin.s.m4 new file mode 100644 index 00000000..60dbd7c3 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_darwin.s.m4 @@ -0,0 +1,126 @@ +/* -*- Mode: asm; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License") ; you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999-2002 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + + .text + .globl _SharedStub + +define(STUB_MANGLED_ENTRY, +` .globl '$2` + .align 2 +'$2`: + addi r12, 0, '$1` + b _SharedStub +') + +define(STUB_ENTRY, +`#ifdef HAVE_GCC3_ABI + .if '$1` < 10 +STUB_MANGLED_ENTRY('$1`, `__ZN14nsXPTCStubBase5Stub'$1`Ev') + .elseif '$1` < 100 +STUB_MANGLED_ENTRY('$1`, `__ZN14nsXPTCStubBase6Stub'$1`Ev') + .elseif '$1` < 1000 +STUB_MANGLED_ENTRY('$1`, `__ZN14nsXPTCStubBase7Stub'$1`Ev') + .else + .err "Stub'$1` >= 1000 not yet supported." + .endif +#else /* !defined(HAVE_GCC3_ABI) */ +STUB_MANGLED_ENTRY('$1`, `_Stub'$1`__14nsXPTCStubBase') +#endif /* !defined(HAVE_GCC3_ABI) */ +') + +define(SENTINEL_ENTRY, `') + +include(xptcstubsdef.inc) + +_SharedStub: + mflr r0 + stw r0,8(r1) + + stwu r1,-176(r1) + + stw r4,44(r1) + stw r5,48(r1) + stw r6,52(r1) + stw r7,56(r1) + stw r8,60(r1) + stw r9,64(r1) + stw r10,68(r1) + stfd f1,72(r1) + stfd f2,80(r1) + stfd f3,88(r1) + stfd f4,96(r1) + stfd f5,104(r1) + stfd f6,112(r1) + stfd f7,120(r1) + stfd f8,128(r1) + stfd f9,136(r1) + stfd f10,144(r1) + stfd f11,152(r1) + stfd f12,156(r1) + stfd f13,164(r1) + + addi r6,r1,44 + addi r7,r1,72 + + mr r4,r12 + addi r5,r1,232 + + bl L_PrepareAndDispatch$stub + nop + + lwz r0,184(r1) + addi r1,r1,176 + mtlr r0 + blr + +.picsymbol_stub +L_PrepareAndDispatch$stub: + .indirect_symbol _PrepareAndDispatch + mflr r0 + bcl 20,31,L1$pb +L1$pb: + mflr r11 + addis r11,r11,ha16(L1$lz-L1$pb) + mtlr r0 + lwz r12,lo16(L1$lz-L1$pb)(r11) + mtctr r12 + addi r11,r11,lo16(L1$lz-L1$pb) + bctr +.lazy_symbol_pointer +L1$lz: + .indirect_symbol _PrepareAndDispatch + .long dyld_stub_binding_helper diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_linux.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_linux.s new file mode 100644 index 00000000..fc85bdb9 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_linux.s @@ -0,0 +1,89 @@ +// -*- Mode: Asm -*- +// +// The contents of this file are subject to the Netscape Public +// License Version 1.1 (the "License"); you may not use this file +// except in compliance with the License. You may obtain a copy of +// the License at http://www.mozilla.org/NPL/ +// +// Software distributed under the License is distributed on an "AS +// IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +// implied. See the License for the specific language governing +// rights and limitations under the License. +// +// The Original Code is mozilla.org code. +// +// The Initial Developer of the Original Code is Netscape +// Communications Corporation. Portions created by Netscape are +// Copyright (C) 1999 Netscape Communications Corporation. All +// Rights Reserved. +// +// Contributor(s): +// Franz.Sirl-kernel@lauterbach.com (Franz Sirl) +// beard@netscape.com (Patrick Beard) +// waterson@netscape.com (Chris Waterson) +// + +.set r0,0; .set sp,1; .set RTOC,2; .set r3,3; .set r4,4 +.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9 +.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14 +.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19 +.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24 +.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29 +.set r30,30; .set r31,31 +.set f0,0; .set f1,1; .set f2,2; .set f3,3; .set f4,4 +.set f5,5; .set f6,6; .set f7,7; .set f8,8; .set f9,9 +.set f10,10; .set f11,11; .set f12,12; .set f13,13; .set f14,14 +.set f15,15; .set f16,16; .set f17,17; .set f18,18; .set f19,19 +.set f20,20; .set f21,21; .set f22,22; .set f23,23; .set f24,24 +.set f25,25; .set f26,26; .set f27,27; .set f28,28; .set f29,29 +.set f30,30; .set f31,31 + + .section ".text" + .align 2 + .globl SharedStub + .type SharedStub,@function + +SharedStub: + stwu sp,-112(sp) // room for + // linkage (8), + // gprData (32), + // fprData (64), + // stack alignment(8) + mflr r0 + stw r0,116(sp) // save LR backchain + + stw r4,12(sp) // save GP registers + stw r5,16(sp) // (n.b. that we don't save r3 + stw r6,20(sp) // because PrepareAndDispatch() is savvy) + stw r7,24(sp) + stw r8,28(sp) + stw r9,32(sp) + stw r10,36(sp) + + stfd f1,40(sp) // save FP registers + stfd f2,48(sp) + stfd f3,56(sp) + stfd f4,64(sp) + stfd f5,72(sp) + stfd f6,80(sp) + stfd f7,88(sp) + stfd f8,96(sp) + + // r3 has the 'self' pointer already + + mr r4,r11 // r4 <= methodIndex selector, passed + // via r11 in the nsXPTCStubBase::StubXX() call + + addi r5,sp,120 // r5 <= pointer to callers args area, + // beyond r3-r10/f1-f8 mapped range + + addi r6,sp,8 // r6 <= gprData + addi r7,sp,40 // r7 <= fprData + + bl PrepareAndDispatch@local // Go! + + lwz r0,116(sp) // restore LR + mtlr r0 + la sp,112(sp) // clean up the stack + blr + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_netbsd.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_netbsd.s new file mode 100644 index 00000000..f94aac4f --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_netbsd.s @@ -0,0 +1,89 @@ +# -*- Mode: Asm -*- +# +# The contents of this file are subject to the Netscape Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/NPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1999 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): +# Franz.Sirl-kernel@lauterbach.com (Franz Sirl) +# beard@netscape.com (Patrick Beard) +# waterson@netscape.com (Chris Waterson) +# + +.set r0,0; .set sp,1; .set RTOC,2; .set r3,3; .set r4,4 +.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9 +.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14 +.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19 +.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24 +.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29 +.set r30,30; .set r31,31 +.set f0,0; .set f1,1; .set f2,2; .set f3,3; .set f4,4 +.set f5,5; .set f6,6; .set f7,7; .set f8,8; .set f9,9 +.set f10,10; .set f11,11; .set f12,12; .set f13,13; .set f14,14 +.set f15,15; .set f16,16; .set f17,17; .set f18,18; .set f19,19 +.set f20,20; .set f21,21; .set f22,22; .set f23,23; .set f24,24 +.set f25,25; .set f26,26; .set f27,27; .set f28,28; .set f29,29 +.set f30,30; .set f31,31 + + .section ".text" + .align 2 + .globl SharedStub + .type SharedStub,@function + +SharedStub: + stwu sp,-112(sp) # room for + # linkage (8), + # gprData (32), + # fprData (64), + # stack alignment(8) + mflr r0 + stw r0,116(sp) # save LR backchain + + stw r4,12(sp) # save GP registers + stw r5,16(sp) # (n.b. that we don't save r3 + stw r6,20(sp) # because PrepareAndDispatch() is savvy) + stw r7,24(sp) + stw r8,28(sp) + stw r9,32(sp) + stw r10,36(sp) + + stfd f1,40(sp) # save FP registers + stfd f2,48(sp) + stfd f3,56(sp) + stfd f4,64(sp) + stfd f5,72(sp) + stfd f6,80(sp) + stfd f7,88(sp) + stfd f8,96(sp) + + # r3 has the 'self' pointer already + + mr r4,r11 # r4 <= methodIndex selector, passed + # via r11 in the nsXPTCStubBase::StubXX() call + + addi r5,sp,120 # r5 <= pointer to callers args area, + # beyond r3-r10/f1-f8 mapped range + + addi r6,sp,8 # r6 <= gprData + addi r7,sp,40 # r7 <= fprData + + bl PrepareAndDispatch@local # Go! + + lwz r0,116(sp) # restore LR + mtlr r0 + la sp,112(sp) # clean up the stack + blr + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_sparc_netbsd.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_sparc_netbsd.s new file mode 100644 index 00000000..4a8a4698 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_sparc_netbsd.s @@ -0,0 +1,65 @@ +/* -*- 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.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1999 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + + .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 + 32),%sp ! room for the register window and + ! struct pointer, rounded up to 0 % 32 +! 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 ! propagate return value + b .LL1 + nop +.LL1: + ret + restore + + .size SharedStub, .-SharedStub + .type SharedStub, #function diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_sparc_solaris.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_sparc_solaris.s new file mode 100644 index 00000000..4a8a4698 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_sparc_solaris.s @@ -0,0 +1,65 @@ +/* -*- 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.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1999 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + + .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 + 32),%sp ! room for the register window and + ! struct pointer, rounded up to 0 % 32 +! 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 ! propagate return value + b .LL1 + nop +.LL1: + ret + restore + + .size SharedStub, .-SharedStub + .type SharedStub, #function diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_sparcv9_solaris.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_sparcv9_solaris.s new file mode 100644 index 00000000..e3bbcf8b --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_sparcv9_solaris.s @@ -0,0 +1,67 @@ +/* -*- Mode: asm; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 2001 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Stuart Parmenter <pavlov@netscape.com> + */ + + .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, 0x7ff + 136, %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 + stx %i1, [%fp + 0x7ff + 136] + stx %i2, [%fp + 0x7ff + 144] + stx %i3, [%fp + 0x7ff + 152] + stx %i4, [%fp + 0x7ff + 160] + stx %i5, [%fp + 0x7ff + 168] +! now we can build our own stack frame + save %sp,-(128 + 64),%sp ! room for the register window and + ! struct pointer, rounded up to 0 % 64 +! 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 ! propagate return value + b .LL1 + nop +.LL1: + ret + restore + + .size SharedStub, .-SharedStub + .type SharedStub, #function diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_gcc_x86_unix.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_gcc_x86_unix.cpp new file mode 100644 index 00000000..351ee512 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_gcc_x86_unix.cpp @@ -0,0 +1,202 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Implement shared vtbl methods. */ + +#ifdef __GNUC__ /* Gnu Compiler. */ + +#include "xptcprivate.h" +#include "xptc_platforms_unixish_x86.h" +#include "xptc_gcc_x86_unix.h" + +extern "C" { +static nsresult ATTRIBUTE_USED +__attribute__ ((regparm (3))) +PrepareAndDispatch(uint32 methodIndex, nsXPTCStubBase* self, PRUint32* args) +{ +#define PARAM_BUFFER_COUNT 16 + + nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT]; + nsXPTCMiniVariant* dispatchParams = NULL; + nsIInterfaceInfo* iface_info = NULL; + const nsXPTMethodInfo* info = NULL; + 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"); + if (!iface_info) + return NS_ERROR_UNEXPECTED; + + iface_info->GetMethodInfo(PRUint16(methodIndex), &info); + NS_ASSERTION(info,"no method info"); + if (!info) + return NS_ERROR_UNEXPECTED; + + 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"); + if (!dispatchParams) + return NS_ERROR_OUT_OF_MEMORY; + + 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 + dp->val.p = (void*) *ap; + switch(type) + { + case nsXPTType::T_I64 : dp->val.i64 = *((PRInt64*) ap); ap++; break; + case nsXPTType::T_U64 : dp->val.u64 = *((PRUint64*)ap); ap++; break; + case nsXPTType::T_DOUBLE : dp->val.d = *((double*) ap); ap++; break; + } + } + + result = self->CallMethod((PRUint16)methodIndex, info, dispatchParams); + + NS_RELEASE(iface_info); + + if(dispatchParams != paramBuffer) + delete [] dispatchParams; + + return result; +} +} // extern "C" + +// NOTE! See xptc_gcc_x86_unix.h for the reason this function exists. +#if (__GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ == 0)) +PRUint32 +xptc_PrepareAndDispatch_keeper (void) +{ + PRUint32 dummy1; + nsresult ATTRIBUTE_USED __attribute__ ((regparm (3))) (*dummy2) + (uint32, nsXPTCStubBase *, PRUint32*) = PrepareAndDispatch; +// dummy2 references PrepareAndDispatch, now "use" it + __asm__ __volatile__ ( + "" + : "=&a" (dummy1) + : "g" (dummy2) + ); + return dummy1 & 0xF0F00000; +} +#endif + +#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */ +// gcc3 mangling tends to insert the length of the method name +#define STUB_ENTRY(n) \ +asm(".text\n\t" \ + ".align 2\n\t" \ + ".if " #n " < 10\n\t" \ + ".globl " SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase5Stub" #n "Ev\n\t" \ + ".type " SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase5Stub" #n "Ev,@function\n" \ + SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase5Stub" #n "Ev:\n\t" \ + ".elseif " #n " < 100\n\t" \ + ".globl " SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase6Stub" #n "Ev\n\t" \ + ".type " SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase6Stub" #n "Ev,@function\n" \ + SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase6Stub" #n "Ev:\n\t" \ + ".elseif " #n " < 1000\n\t" \ + ".globl " SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase7Stub" #n "Ev\n\t" \ + ".type " SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase7Stub" #n "Ev,@function\n" \ + SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase7Stub" #n "Ev:\n\t" \ + ".else\n\t" \ + ".err \"stub number " #n " >= 1000 not yet supported\"\n\t" \ + ".endif\n\t" \ + "movl $" #n ", %eax\n\t" \ + "jmp " SYMBOL_UNDERSCORE "SharedStub\n\t" \ + ".if " #n " < 10\n\t" \ + ".size " SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase5Stub" #n "Ev,.-" SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase5Stub" #n "Ev\n\t" \ + ".elseif " #n " < 100\n\t" \ + ".size " SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase6Stub" #n "Ev,.-" SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase6Stub" #n "Ev\n\t" \ + ".else\n\t" \ + ".size " SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase7Stub" #n "Ev,.-" SYMBOL_UNDERSCORE "_ZN14nsXPTCStubBase7Stub" #n "Ev\n\t" \ + ".endif"); +#else +#define STUB_ENTRY(n) \ +asm(".text\n\t" \ + ".align 2\n\t" \ + ".globl " SYMBOL_UNDERSCORE "Stub" #n "__14nsXPTCStubBase\n\t" \ + ".type " SYMBOL_UNDERSCORE "Stub" #n "__14nsXPTCStubBase,@function\n" \ + SYMBOL_UNDERSCORE "Stub" #n "__14nsXPTCStubBase:\n\t" \ + "movl $" #n ", %eax\n\t" \ + "jmp " SYMBOL_UNDERSCORE "SharedStub\n\t" \ + ".size " SYMBOL_UNDERSCORE "Stub" #n "__14nsXPTCStubBase,.-" SYMBOL_UNDERSCORE "Stub" #n "__14nsXPTCStubBase"); +#endif + +// static nsresult SharedStub(PRUint32 methodIndex) __attribute__((regparm(1))) +asm(".text\n\t" + ".align 2\n\t" + ".type " SYMBOL_UNDERSCORE "SharedStub,@function\n\t" + SYMBOL_UNDERSCORE "SharedStub:\n\t" + "leal 0x08(%esp), %ecx\n\t" + "movl 0x04(%esp), %edx\n\t" + "jmp " SYMBOL_UNDERSCORE "PrepareAndDispatch\n\t" + ".size " SYMBOL_UNDERSCORE "SharedStub,.-" SYMBOL_UNDERSCORE "SharedStub"); + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" + +void +xptc_dummy() +{ +} + +#else +#error "can't find a compiler to use" +#endif /* __GNUC__ */ diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ipf32.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ipf32.cpp new file mode 100644 index 00000000..844f55dd --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ipf32.cpp @@ -0,0 +1,185 @@ + +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + + +#include "xptcprivate.h" + +#include <stddef.h> +#include <stdlib.h> + +// "This code is for IA64 only" + +/* Implement shared vtbl methods. */ + +extern "C" nsresult +PrepareAndDispatch(nsXPTCStubBase* self, PRUint32 methodIndex, + uint64_t* intargs, uint64_t* floatargs, uint64_t* restargs) +{ + +#define PARAM_BUFFER_COUNT 16 + + nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT]; + nsXPTCMiniVariant* dispatchParams = NULL; + nsIInterfaceInfo* iface_info = NULL; + const nsXPTMethodInfo* info; + nsresult result = NS_ERROR_FAILURE; + uint64_t* iargs = intargs; + uint64_t* fargs = floatargs; + PRUint8 paramCount; + PRUint8 i; + + 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"); + + for(i = 0; i < paramCount; ++i) + { + int isfloat = 0; + const nsXPTParamInfo& param = info->GetParam(i); + const nsXPTType& type = param.GetType(); + nsXPTCMiniVariant* dp = &dispatchParams[i]; + + if(param.IsOut() || !type.IsArithmetic()) + { +#ifdef __LP64__ + /* 64 bit pointer mode */ + dp->val.p = (void*) *iargs; +#else + /* 32 bit pointer mode */ + uint32_t* adr = (uint32_t*) iargs; + dp->val.p = (void*) (*(adr+1)); +#endif + } + else + switch(type) + { + case nsXPTType::T_I8 : dp->val.i8 = *(iargs); break; + case nsXPTType::T_I16 : dp->val.i16 = *(iargs); break; + case nsXPTType::T_I32 : dp->val.i32 = *(iargs); break; + case nsXPTType::T_I64 : dp->val.i64 = *(iargs); break; + case nsXPTType::T_U8 : dp->val.u8 = *(iargs); break; + case nsXPTType::T_U16 : dp->val.u16 = *(iargs); break; + case nsXPTType::T_U32 : dp->val.u32 = *(iargs); break; + case nsXPTType::T_U64 : dp->val.u64 = *(iargs); break; + case nsXPTType::T_FLOAT : + isfloat = 1; + if (i < 7) + dp->val.f = (float) *((double*) fargs); /* register */ + else + dp->val.u32 = *(fargs); /* memory */ + break; + case nsXPTType::T_DOUBLE : + isfloat = 1; + dp->val.u64 = *(fargs); + break; + case nsXPTType::T_BOOL : dp->val.b = *(iargs); break; + case nsXPTType::T_CHAR : dp->val.c = *(iargs); break; + case nsXPTType::T_WCHAR : dp->val.wc = *(iargs); break; + default: + NS_ASSERTION(0, "bad type"); + break; + } + if (i < 7) + { + /* we are parsing register arguments */ + if (i == 6) + { + // run out of register arguments, move on to memory arguments + iargs = restargs; + fargs = restargs; + } + else + { + ++iargs; // advance one integer register slot + if (isfloat) ++fargs; // advance float register slot if isfloat + } + } + else + { + /* we are parsing memory arguments */ + ++iargs; + ++fargs; + } + } + + result = self->CallMethod((PRUint16) methodIndex, info, dispatchParams); + + NS_RELEASE(iface_info); + + if(dispatchParams != paramBuffer) + delete [] dispatchParams; + + return result; +} + +extern "C" int SharedStub(PRUint64,PRUint64,PRUint64,PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); + +/* Variable a0-a7 were put there so we can have access to the 8 input + registers on Stubxyz entry */ + +#define STUB_ENTRY(n) \ +nsresult nsXPTCStubBase::Stub##n(PRUint64 a1, \ +PRUint64 a2,PRUint64 a3,PRUint64 a4,PRUint64 a5,PRUint64 a6,PRUint64 a7) \ +{ uint64_t a0 = (uint64_t) this; \ + return SharedStub(a0,a1,a2,a3,a4,a5,a6,a7,(PRUint64) n); \ +} + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ipf64.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ipf64.cpp new file mode 100644 index 00000000..6a11f692 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ipf64.cpp @@ -0,0 +1,186 @@ + +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + + +#include "xptcprivate.h" + +#include <stddef.h> +#include <stdlib.h> +#include <stdint.h> + +// "This code is for IA64 only" + +/* Implement shared vtbl methods. */ + +extern "C" nsresult +PrepareAndDispatch(nsXPTCStubBase* self, PRUint32 methodIndex, + uint64_t* intargs, uint64_t* floatargs, uint64_t* restargs) +{ + +#define PARAM_BUFFER_COUNT 16 + + nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT]; + nsXPTCMiniVariant* dispatchParams = NULL; + nsIInterfaceInfo* iface_info = NULL; + const nsXPTMethodInfo* info; + nsresult result = NS_ERROR_FAILURE; + uint64_t* iargs = intargs; + uint64_t* fargs = floatargs; + PRUint8 paramCount; + PRUint8 i; + + 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"); + + for(i = 0; i < paramCount; ++i) + { + int isfloat = 0; + const nsXPTParamInfo& param = info->GetParam(i); + const nsXPTType& type = param.GetType(); + nsXPTCMiniVariant* dp = &dispatchParams[i]; + + if(param.IsOut() || !type.IsArithmetic()) + { +#ifdef __LP64__ + /* 64 bit pointer mode */ + dp->val.p = (void*) *iargs; +#else + /* 32 bit pointer mode */ + uint32_t* adr = (uint32_t*) iargs; + dp->val.p = (void*) (*(adr+1)); +#endif + } + else + switch(type) + { + case nsXPTType::T_I8 : dp->val.i8 = *(iargs); break; + case nsXPTType::T_I16 : dp->val.i16 = *(iargs); break; + case nsXPTType::T_I32 : dp->val.i32 = *(iargs); break; + case nsXPTType::T_I64 : dp->val.i64 = *(iargs); break; + case nsXPTType::T_U8 : dp->val.u8 = *(iargs); break; + case nsXPTType::T_U16 : dp->val.u16 = *(iargs); break; + case nsXPTType::T_U32 : dp->val.u32 = *(iargs); break; + case nsXPTType::T_U64 : dp->val.u64 = *(iargs); break; + case nsXPTType::T_FLOAT : + isfloat = 1; + if (i < 7) + dp->val.f = (float) *((double*) fargs); /* register */ + else + dp->val.u32 = *(fargs); /* memory */ + break; + case nsXPTType::T_DOUBLE : + isfloat = 1; + dp->val.u64 = *(fargs); + break; + case nsXPTType::T_BOOL : dp->val.b = *(iargs); break; + case nsXPTType::T_CHAR : dp->val.c = *(iargs); break; + case nsXPTType::T_WCHAR : dp->val.wc = *(iargs); break; + default: + NS_ASSERTION(0, "bad type"); + break; + } + if (i < 7) + { + /* we are parsing register arguments */ + if (i == 6) + { + // run out of register arguments, move on to memory arguments + iargs = restargs; + fargs = restargs; + } + else + { + ++iargs; // advance one integer register slot + if (isfloat) ++fargs; // advance float register slot if isfloat + } + } + else + { + /* we are parsing memory arguments */ + ++iargs; + ++fargs; + } + } + + result = self->CallMethod((PRUint16) methodIndex, info, dispatchParams); + + NS_RELEASE(iface_info); + + if(dispatchParams != paramBuffer) + delete [] dispatchParams; + + return result; +} + +extern "C" int SharedStub(PRUint64,PRUint64,PRUint64,PRUint64, + PRUint64,PRUint64,PRUint64,PRUint64,PRUint64); + +/* Variable a0-a7 were put there so we can have access to the 8 input + registers on Stubxyz entry */ + +#define STUB_ENTRY(n) \ +nsresult nsXPTCStubBase::Stub##n(PRUint64 a1, \ +PRUint64 a2,PRUint64 a3,PRUint64 a4,PRUint64 a5,PRUint64 a6,PRUint64 a7) \ +{ uint64_t a0 = (uint64_t) this; \ + return SharedStub(a0,a1,a2,a3,a4,a5,a6,a7,(PRUint64) n); \ +} + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_irix.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_irix.cpp new file mode 100644 index 00000000..556b5bbe --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_irix.cpp @@ -0,0 +1,226 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "xptcprivate.h" + +#if defined(IRIX) + +#if (_MIPS_SIM != _ABIN32) +#error "This code is for IRIX N32 only" +#endif + +/* + * This is for IRIX N32 ABI + * + * When we're called, the "gp" registers are stored in gprData and + * the "fp" registers are stored in fprData. There are 8 regs + * available which coorespond to the first 7 parameters of the + * function and the "this" pointer. If there are additional parms, + * they are stored on the stack at address "args". + * + */ +extern "C" nsresult +PrepareAndDispatch(nsXPTCStubBase* self, PRUint32 methodIndex, PRUint64* args, + PRUint64 *gprData, double *fprData) +{ +#define PARAM_BUFFER_COUNT 16 +#define PARAM_GPR_COUNT 7 +#define PARAM_FPR_COUNT 7 + + 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"); + + PRUint64* ap = args; + PRUint32 iCount = 0; + for(i = 0; i < paramCount; i++) + { + const nsXPTParamInfo& param = info->GetParam(i); + const nsXPTType& type = param.GetType(); + nsXPTCMiniVariant* dp = &dispatchParams[i]; + + if(param.IsOut() || !type.IsArithmetic()) + { + if (iCount < PARAM_GPR_COUNT) + dp->val.p = (void*)gprData[iCount++]; + else + dp->val.p = (void*)*ap++; + continue; + } + // else + switch(type) + { + case nsXPTType::T_I8: + if (iCount < PARAM_GPR_COUNT) + dp->val.i8 = (PRInt8)gprData[iCount++]; + else + dp->val.i8 = (PRInt8)*ap++; + break; + + case nsXPTType::T_I16: + if (iCount < PARAM_GPR_COUNT) + dp->val.i16 = (PRInt16)gprData[iCount++]; + else + dp->val.i16 = (PRInt16)*ap++; + break; + + case nsXPTType::T_I32: + if (iCount < PARAM_GPR_COUNT) + dp->val.i32 = (PRInt32)gprData[iCount++]; + else + dp->val.i32 = (PRInt32)*ap++; + break; + + case nsXPTType::T_I64: + if (iCount < PARAM_GPR_COUNT) + dp->val.i64 = (PRInt64)gprData[iCount++]; + else + dp->val.i64 = (PRInt64)*ap++; + break; + + case nsXPTType::T_U8: + if (iCount < PARAM_GPR_COUNT) + dp->val.u8 = (PRUint8)gprData[iCount++]; + else + dp->val.u8 = (PRUint8)*ap++; + break; + + case nsXPTType::T_U16: + if (iCount < PARAM_GPR_COUNT) + dp->val.u16 = (PRUint16)gprData[iCount++]; + else + dp->val.u16 = (PRUint16)*ap++; + break; + + case nsXPTType::T_U32: + if (iCount < PARAM_GPR_COUNT) + dp->val.u32 = (PRUint32)gprData[iCount++]; + else + dp->val.u32 = (PRUint32)*ap++; + break; + + case nsXPTType::T_U64: + if (iCount < PARAM_GPR_COUNT) + dp->val.u64 = (PRUint64)gprData[iCount++]; + else + dp->val.u64 = (PRUint64)*ap++; + break; + + case nsXPTType::T_FLOAT: + if (iCount < PARAM_FPR_COUNT) + dp->val.f = (double)fprData[iCount++]; + else + dp->val.f = *((double*)ap++); + break; + + case nsXPTType::T_DOUBLE: + if (iCount < PARAM_FPR_COUNT) + dp->val.d = (double)fprData[iCount++]; + else + dp->val.d = *((double*)ap++); + break; + + case nsXPTType::T_BOOL: + if (iCount < PARAM_GPR_COUNT) + dp->val.b = (PRBool)gprData[iCount++]; + else + dp->val.b = (PRBool)*ap++; + break; + + case nsXPTType::T_CHAR: + if (iCount < PARAM_GPR_COUNT) + dp->val.c = (char)gprData[iCount++]; + else + dp->val.c = (char)*ap++; + break; + + case nsXPTType::T_WCHAR: + if (iCount < PARAM_GPR_COUNT) + dp->val.wc = (wchar_t)gprData[iCount++]; + else + 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; +} + +#define STUB_ENTRY(n) /* defined in the assembly file */ + +#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/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_alpha.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_alpha.cpp new file mode 100644 index 00000000..e5b1c642 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_alpha.cpp @@ -0,0 +1,236 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Glen Nakamura <glen@imodulo.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Implement shared vtbl methods. */ + +#include "xptcprivate.h" + +/* Prototype specifies unmangled function name and disables unused warning */ +static nsresult +PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, PRUint64* args) +__asm__("PrepareAndDispatch") __attribute__((unused)); + +static nsresult +PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, PRUint64* args) +{ + const PRUint8 PARAM_BUFFER_COUNT = 16; + const PRUint8 NUM_ARG_REGS = 6-1; // -1 for "this" pointer + + 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"); + + // args[0] to args[NUM_ARG_REGS] hold floating point register values + PRUint64* ap = args + NUM_ARG_REGS; + 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; 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; break; + case nsXPTType::T_FLOAT : + if(i < NUM_ARG_REGS) + { + // floats passed via registers are stored as doubles + // in the first NUM_ARG_REGS entries in args + dp->val.u64 = (PRUint64) args[i]; + dp->val.f = (float) dp->val.d; // convert double to float + } + else + dp->val.u32 = (PRUint32) *ap; + break; + case nsXPTType::T_DOUBLE : + // doubles passed via registers are also stored + // in the first NUM_ARG_REGS entries in args + dp->val.u64 = (i < NUM_ARG_REGS) ? args[i] : *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 = (PRUnichar) *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; +} + +/* + * SharedStub() + * Collects arguments and calls PrepareAndDispatch. The "methodIndex" is + * passed to this function via $1 to preserve the argument registers. + */ +__asm__( + "#### SharedStub ####\n" +".text\n\t" + ".align 5\n\t" + ".ent SharedStub\n" +"SharedStub:\n\t" + ".frame $30,96,$26,0\n\t" + ".mask 0x4000000,-96\n\t" + "ldgp $29,0($27)\n" +"$SharedStub..ng:\n\t" + "subq $30,96,$30\n\t" + "stq $26,0($30)\n\t" + ".prologue 1\n\t" + + /* + * Store arguments passed via registers to the stack. + * Floating point registers are stored as doubles and converted + * to floats in PrepareAndDispatch if necessary. + */ + "stt $f17,16($30)\n\t" /* floating point registers */ + "stt $f18,24($30)\n\t" + "stt $f19,32($30)\n\t" + "stt $f20,40($30)\n\t" + "stt $f21,48($30)\n\t" + "stq $17,56($30)\n\t" /* integer registers */ + "stq $18,64($30)\n\t" + "stq $19,72($30)\n\t" + "stq $20,80($30)\n\t" + "stq $21,88($30)\n\t" + + /* + * Call PrepareAndDispatch function. + */ + "bis $1,$1,$17\n\t" /* pass "methodIndex" */ + "addq $30,16,$18\n\t" /* pass "args" */ + "bsr $26,$PrepareAndDispatch..ng\n\t" + + "ldq $26,0($30)\n\t" + "addq $30,96,$30\n\t" + "ret $31,($26),1\n\t" + ".end SharedStub" + ); + +/* + * nsresult nsXPTCStubBase::Stub##n() + * Sets register $1 to "methodIndex" and jumps to SharedStub. + */ +#define STUB_MANGLED_ENTRY(n, symbol) \ + "#### Stub"#n" ####" "\n\t" \ + ".text" "\n\t" \ + ".align 5" "\n\t" \ + ".globl " symbol "\n\t" \ + ".ent " symbol "\n" \ +symbol ":" "\n\t" \ + ".frame $30,0,$26,0" "\n\t" \ + "ldgp $29,0($27)" "\n" \ +"$" symbol "..ng:" "\n\t" \ + ".prologue 1" "\n\t" \ + "lda $1,"#n "\n\t" \ + "br $31,$SharedStub..ng" "\n\t" \ + ".end " symbol + +#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */ + +#define STUB_ENTRY(n) \ +__asm__( \ + ".if "#n" < 10" "\n\t" \ + STUB_MANGLED_ENTRY(n, "_ZN14nsXPTCStubBase5Stub"#n"Ev") "\n\t" \ + ".elseif "#n" < 100" "\n\t" \ + STUB_MANGLED_ENTRY(n, "_ZN14nsXPTCStubBase6Stub"#n"Ev") "\n\t" \ + ".elseif "#n" < 1000" "\n\t" \ + STUB_MANGLED_ENTRY(n, "_ZN14nsXPTCStubBase7Stub"#n"Ev") "\n\t" \ + ".else" "\n\t" \ + ".err \"Stub"#n" >= 1000 not yet supported.\"" "\n\t" \ + ".endif" \ + ); + +#else /* not G++ V3 ABI */ + +#define STUB_ENTRY(n) \ +__asm__( \ + STUB_MANGLED_ENTRY(n, "Stub"#n"__14nsXPTCStubBase") \ + ); + +#endif /* G++ V3 ABI */ + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_m68k.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_m68k.cpp new file mode 100644 index 00000000..eb094762 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_m68k.cpp @@ -0,0 +1,146 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Implement shared vtbl methods. */ + +#include "xptcprivate.h" + +extern "C" { + 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; + } + + switch(type) + { + // the 8 and 16 bit types will have been promoted to 32 bits before + // being pushed onto the stack. Since the 68k is big endian, we + // need to skip over the leading high order bytes. + case nsXPTType::T_I8 : dp->val.i8 = *(((PRInt8*) ap) + 3); break; + case nsXPTType::T_I16 : dp->val.i16 = *(((PRInt16*) ap) + 1); 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) + 3); break; + case nsXPTType::T_U16 : dp->val.u16 = *(((PRUint16*)ap) + 1); 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) + 3); 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; + } +} + +#define STUB_ENTRY(n) \ +nsresult nsXPTCStubBase::Stub##n() \ +{ \ + register nsresult result; \ + __asm__ __volatile__( \ + "lea %/a6@(12), %/a0\n\t" /* args */ \ + "movl %/a0, %/sp@-\n\t" \ + "movl #"#n", %/sp@-\n\t" /* method index */ \ + "movl %/a6@(8), %/sp@-\n\t" /* this */ \ + "jbsr PrepareAndDispatch\n\t" \ + "movl %/d0, %0\n\t" \ + "addl #12, %/sp" \ + : "=d" (result) /* %0 */ \ + : \ + : "a0", "a1", "d0", "d1", "memory" ); \ + return result; \ +} + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_s390.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_s390.cpp new file mode 100644 index 00000000..0f8502cd --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_s390.cpp @@ -0,0 +1,220 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Implement shared vtbl methods. */ + +#include "xptcprivate.h" + +static nsresult +PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, + PRUint32* a_gpr, PRUint64 *a_fpr, PRUint32 *a_ov) +{ +#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 gpr = 1, fpr = 0; + + for(i = 0; i < paramCount; i++) + { + const nsXPTParamInfo& param = info->GetParam(i); + const nsXPTType& type = param.GetType(); + nsXPTCMiniVariant* dp = &dispatchParams[i]; + + if(param.IsOut() || !type.IsArithmetic()) + { + if (gpr < 5) + dp->val.p = (void*) *a_gpr++, gpr++; + else + dp->val.p = (void*) *a_ov++; + continue; + } + // else + switch(type) + { + case nsXPTType::T_I8 : + if (gpr < 5) + dp->val.i8 = *((PRInt32*) a_gpr), a_gpr++, gpr++; + else + dp->val.i8 = *((PRInt32*) a_ov ), a_ov++; + break; + case nsXPTType::T_I16 : + if (gpr < 5) + dp->val.i16 = *((PRInt32*) a_gpr), a_gpr++, gpr++; + else + dp->val.i16 = *((PRInt32*) a_ov ), a_ov++; + break; + case nsXPTType::T_I32 : + if (gpr < 5) + dp->val.i32 = *((PRInt32*) a_gpr), a_gpr++, gpr++; + else + dp->val.i32 = *((PRInt32*) a_ov ), a_ov++; + break; + case nsXPTType::T_I64 : + if (gpr < 4) + dp->val.i64 = *((PRInt64*) a_gpr), a_gpr+=2, gpr+=2; + else + dp->val.i64 = *((PRInt64*) a_ov ), a_ov+=2, gpr=5; + break; + case nsXPTType::T_U8 : + if (gpr < 5) + dp->val.u8 = *((PRUint32*)a_gpr), a_gpr++, gpr++; + else + dp->val.u8 = *((PRUint32*)a_ov ), a_ov++; + break; + case nsXPTType::T_U16 : + if (gpr < 5) + dp->val.u16 = *((PRUint32*)a_gpr), a_gpr++, gpr++; + else + dp->val.u16 = *((PRUint32*)a_ov ), a_ov++; + break; + case nsXPTType::T_U32 : + if (gpr < 5) + dp->val.u32 = *((PRUint32*)a_gpr), a_gpr++, gpr++; + else + dp->val.u32 = *((PRUint32*)a_ov ), a_ov++; + break; + case nsXPTType::T_U64 : + if (gpr < 4) + dp->val.u64 = *((PRUint64*)a_gpr), a_gpr+=2, gpr+=2; + else + dp->val.u64 = *((PRUint64*)a_ov ), a_ov+=2, gpr=5; + break; + case nsXPTType::T_FLOAT : + if (fpr < 2) + dp->val.f = *((float*) a_fpr), a_fpr++, fpr++; + else + dp->val.f = *((float*) a_ov ), a_ov++; + break; + case nsXPTType::T_DOUBLE : + if (fpr < 2) + dp->val.d = *((double*) a_fpr), a_fpr++, fpr++; + else + dp->val.d = *((double*) a_ov ), a_ov+=2; + break; + case nsXPTType::T_BOOL : + if (gpr < 5) + dp->val.b = *((PRUint32*)a_gpr), a_gpr++, gpr++; + else + dp->val.b = *((PRUint32*)a_ov ), a_ov++; + break; + case nsXPTType::T_CHAR : + if (gpr < 5) + dp->val.c = *((PRUint32*)a_gpr), a_gpr++, gpr++; + else + dp->val.c = *((PRUint32*)a_ov ), a_ov++; + break; + case nsXPTType::T_WCHAR : + if (gpr < 5) + dp->val.wc = *((PRUint32*)a_gpr), a_gpr++, gpr++; + else + dp->val.wc = *((PRUint32*)a_ov ), a_ov++; + 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; +} + +#define STUB_ENTRY(n) \ +nsresult nsXPTCStubBase::Stub##n() \ +{ \ + PRUint32 a_gpr[4]; \ + PRUint64 a_fpr[2]; \ + PRUint32 *a_ov; \ + \ + __asm__ __volatile__ \ + ( \ + "l %0,0(15)\n\t" \ + "ahi %0,96\n\t" \ + "stm 3,6,0(%3)\n\t" \ + "std 0,%1\n\t" \ + "std 2,%2\n\t" \ + : "=&a" (a_ov), \ + "=m" (a_fpr[0]), \ + "=m" (a_fpr[1]) \ + : "a" (a_gpr) \ + : "memory", "cc", \ + "3", "4", "5", "6" \ + ); \ + \ + return PrepareAndDispatch(this, n, a_gpr, a_fpr, a_ov); \ +} + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_s390x.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_s390x.cpp new file mode 100644 index 00000000..9a645dd1 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_s390x.cpp @@ -0,0 +1,224 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Implement shared vtbl methods. */ + +#include "xptcprivate.h" + +static nsresult +PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, + PRUint64* a_gpr, PRUint64 *a_fpr, PRUint64 *a_ov) +{ +#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 gpr = 1, fpr = 0; + + for(i = 0; i < paramCount; i++) + { + const nsXPTParamInfo& param = info->GetParam(i); + const nsXPTType& type = param.GetType(); + nsXPTCMiniVariant* dp = &dispatchParams[i]; + + if(param.IsOut() || !type.IsArithmetic()) + { + if (gpr < 5) + dp->val.p = (void*) *a_gpr++, gpr++; + else + dp->val.p = (void*) *a_ov++; + continue; + } + // else + switch(type) + { + case nsXPTType::T_I8 : + if (gpr < 5) + dp->val.i8 = *((PRInt64*) a_gpr), a_gpr++, gpr++; + else + dp->val.i8 = *((PRInt64*) a_ov ), a_ov++; + break; + case nsXPTType::T_I16 : + if (gpr < 5) + dp->val.i16 = *((PRInt64*) a_gpr), a_gpr++, gpr++; + else + dp->val.i16 = *((PRInt64*) a_ov ), a_ov++; + break; + case nsXPTType::T_I32 : + if (gpr < 5) + dp->val.i32 = *((PRInt64*) a_gpr), a_gpr++, gpr++; + else + dp->val.i32 = *((PRInt64*) a_ov ), a_ov++; + break; + case nsXPTType::T_I64 : + if (gpr < 5) + dp->val.i64 = *((PRInt64*) a_gpr), a_gpr++, gpr++; + else + dp->val.i64 = *((PRInt64*) a_ov ), a_ov++; + break; + case nsXPTType::T_U8 : + if (gpr < 5) + dp->val.u8 = *((PRUint64*)a_gpr), a_gpr++, gpr++; + else + dp->val.u8 = *((PRUint64*)a_ov ), a_ov++; + break; + case nsXPTType::T_U16 : + if (gpr < 5) + dp->val.u16 = *((PRUint64*)a_gpr), a_gpr++, gpr++; + else + dp->val.u16 = *((PRUint64*)a_ov ), a_ov++; + break; + case nsXPTType::T_U32 : + if (gpr < 5) + dp->val.u32 = *((PRUint64*)a_gpr), a_gpr++, gpr++; + else + dp->val.u32 = *((PRUint64*)a_ov ), a_ov++; + break; + case nsXPTType::T_U64 : + if (gpr < 5) + dp->val.u64 = *((PRUint64*)a_gpr), a_gpr++, gpr++; + else + dp->val.u64 = *((PRUint64*)a_ov ), a_ov++; + break; + case nsXPTType::T_FLOAT : + if (fpr < 4) + dp->val.f = *((float*) a_fpr), a_fpr++, fpr++; + else + dp->val.f = *(((float*) a_ov )+1), a_ov++; + break; + case nsXPTType::T_DOUBLE : + if (fpr < 4) + dp->val.d = *((double*) a_fpr), a_fpr++, fpr++; + else + dp->val.d = *((double*) a_ov ), a_ov++; + break; + case nsXPTType::T_BOOL : + if (gpr < 5) + dp->val.b = *((PRUint64*)a_gpr), a_gpr++, gpr++; + else + dp->val.b = *((PRUint64*)a_ov ), a_ov++; + break; + case nsXPTType::T_CHAR : + if (gpr < 5) + dp->val.c = *((PRUint64*)a_gpr), a_gpr++, gpr++; + else + dp->val.c = *((PRUint64*)a_ov ), a_ov++; + break; + case nsXPTType::T_WCHAR : + if (gpr < 5) + dp->val.wc = *((PRUint64*)a_gpr), a_gpr++, gpr++; + else + dp->val.wc = *((PRUint64*)a_ov ), a_ov++; + 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; +} + +#define STUB_ENTRY(n) \ +nsresult nsXPTCStubBase::Stub##n() \ +{ \ + PRUint64 a_gpr[4]; \ + PRUint64 a_fpr[4]; \ + PRUint64 *a_ov; \ + \ + __asm__ __volatile__ \ + ( \ + "lg %0,0(15)\n\t" \ + "aghi %0,160\n\t" \ + "stmg 3,6,0(%5)\n\t"\ + "std 0,%1\n\t" \ + "std 2,%2\n\t" \ + "std 4,%3\n\t" \ + "std 6,%4\n\t" \ + : "=&a" (a_ov), \ + "=m" (a_fpr[0]), \ + "=m" (a_fpr[1]), \ + "=m" (a_fpr[2]), \ + "=m" (a_fpr[3]) \ + : "a" (a_gpr) \ + : "memory", "cc", \ + "3", "4", "5", "6" \ + ); \ + \ + return PrepareAndDispatch(this, n, a_gpr, a_fpr, a_ov); \ +} + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_mips.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_mips.cpp new file mode 100644 index 00000000..4d60f7be --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_mips.cpp @@ -0,0 +1,131 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * Version: MPL 1.1 + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corp, Inc. + * Portions created by the Initial Developer are Copyright (C) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Stuart Parmenter <pavlov@netscape.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "xptcprivate.h" + +/* + * This is for MIPS O32 ABI + * Args contains a0-3 and then the stack. + * Because a0 is 'this', we want to skip it + */ +extern "C" nsresult +PrepareAndDispatch(nsXPTCStubBase* self, PRUint32 methodIndex, PRUint32* args) +{ + args++; // always skip over a0 + +#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; + } + + dp->val.p = (void*) *ap; + + switch(type) + { + case nsXPTType::T_I64 : + if ((PRWord)ap & 4) ap++; + dp->val.i64 = *((PRInt64*) ap); ap++; + break; + case nsXPTType::T_U64 : + if ((PRWord)ap & 4) ap++; + dp->val.u64 = *((PRInt64*) ap); ap++; + break; + case nsXPTType::T_DOUBLE: + if ((PRWord)ap & 4) ap++; + dp->val.d = *((double*) ap); ap++; + break; + } + } + + result = self->CallMethod((PRUint16)methodIndex, info, dispatchParams); + + NS_RELEASE(iface_info); + + if(dispatchParams != paramBuffer) + delete [] dispatchParams; + + return result; +} + +#define STUB_ENTRY(n) // done in the .s file + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_netbsd_m68k.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_netbsd_m68k.cpp new file mode 100644 index 00000000..4069a6bc --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_netbsd_m68k.cpp @@ -0,0 +1,147 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Implement shared vtbl methods. */ + +#include "xptcprivate.h" + +#if !defined(__NetBSD__) || !defined(__m68k__) +#error This code is for NetBSD/m68k only +#endif + +extern "C" { + 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; + } + + switch(type) + { + // the 8 and 16 bit types will have been promoted to 32 bits before + // being pushed onto the stack. Since the 68k is big endian, we + // need to skip over the leading high order bytes. + case nsXPTType::T_I8 : dp->val.i8 = *(((PRInt8*) ap) + 3); break; + case nsXPTType::T_I16 : dp->val.i16 = *(((PRInt16*) ap) + 1); 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) + 3); break; + case nsXPTType::T_U16 : dp->val.u16 = *(((PRUint16*)ap) + 1); 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) + 3); break; + // wchar_t is an int (32 bits) on NetBSD + 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; + } +} + +#define STUB_ENTRY(n) \ +__asm__( \ + ".global _Stub"#n"__14nsXPTCStubBase\n\t" \ +"_Stub"#n"__14nsXPTCStubBase:\n\t" \ + "link a6,#0 \n\t" \ + "lea a6@(12), a0 \n\t" /* pointer to args */ \ + "movl a0, sp@- \n\t" \ + "movl #"#n", sp@- \n\t" /* method index */ \ + "movl a6@(8), sp@- \n\t" /* this */ \ + "jbsr _PrepareAndDispatch \n\t" \ + "unlk a6 \n\t" \ + "rts \n\t" \ +); + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_openvms_alpha.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_openvms_alpha.cpp new file mode 100644 index 00000000..c4d1b364 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_openvms_alpha.cpp @@ -0,0 +1,147 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Implement shared vtbl methods. */ + +#include "xptcprivate.h" + +extern "C" { + +nsresult +PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, PRUint64* args) +{ + const PRUint8 PARAM_BUFFER_COUNT = 16; + const PRUint8 NUM_ARG_REGS = 6-1; // -1 for "this" pointer + + 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"); + + // args[0] to args[NUM_ARG_REGS] hold floating point register values + PRUint64* ap = args + NUM_ARG_REGS; + 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; 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; break; + case nsXPTType::T_FLOAT : + if(i < NUM_ARG_REGS) + { + // floats passed via registers are stored as doubles + // in the first NUM_ARG_REGS entries in args + dp->val.u64 = (PRUint64) args[i]; + dp->val.f = (float) dp->val.d; // convert double to float + } + else + dp->val.u32 = (PRUint32) *ap; + break; + case nsXPTType::T_DOUBLE : + // doubles passed via registers are also stored + // in the first NUM_ARG_REGS entries in args + dp->val.u64 = (i < NUM_ARG_REGS) ? args[i] : *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 = (PRUnichar) *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; +} + +} + +#define STUB_ENTRY(n) /* This is in the ASM file */ + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" + + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_osf1_alpha.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_osf1_alpha.cpp new file mode 100644 index 00000000..cd8fe40b --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_osf1_alpha.cpp @@ -0,0 +1,149 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Implement shared vtbl methods. */ + +/* contributed by Glen Nakamura <glen.nakamura@usa.net> */ + +#include "xptcprivate.h" + +extern "C" nsresult +PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, PRUint64* args) +{ + const PRUint8 PARAM_BUFFER_COUNT = 16; + const PRUint8 NUM_ARG_REGS = 6-1; // -1 for "this" pointer + + 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"); + + // args[0] to args[NUM_ARG_REGS] hold floating point register values + PRUint64* ap = args + NUM_ARG_REGS; + 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; 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; break; + case nsXPTType::T_FLOAT : + if(i < NUM_ARG_REGS) + { + // floats passed via registers are stored as doubles + // in the first NUM_ARG_REGS entries in args + dp->val.u64 = (PRUint64) args[i]; + dp->val.f = (float) dp->val.d; // convert double to float + } + else + dp->val.u32 = (PRUint32) *ap; + break; + case nsXPTType::T_DOUBLE : + // doubles passed via registers are also stored + // in the first NUM_ARG_REGS entries in args + dp->val.u64 = (i < NUM_ARG_REGS) ? args[i] : *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 = (PRUnichar) *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; +} + +/* + * nsresult nsXPTCStubBase::Stub##n() ;\ + * Sets arguments to registers and calls PrepareAndDispatch. + * This is defined in the ASM file. + */ +#define STUB_ENTRY(n) \ + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_pa32.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_pa32.cpp new file mode 100644 index 00000000..b3a42442 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_pa32.cpp @@ -0,0 +1,176 @@ + +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Implement shared vtbl methods. */ + +#include "xptcprivate.h" + +#if _HPUX +#error "This code is for HP-PA RISC 32 bit mode only" +#endif + +extern "C" nsresult +PrepareAndDispatch(nsXPTCStubBase* self, PRUint32 methodIndex, + PRUint32* args, PRUint32* floatargs) +{ + + typedef struct { + uint32 hi; + uint32 lo; + } DU; + +#define PARAM_BUFFER_COUNT 16 + + nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT]; + nsXPTCMiniVariant* dispatchParams = NULL; + nsIInterfaceInfo* iface_info = NULL; + const nsXPTMethodInfo* info; + PRInt32 regwords = 1; /* self pointer is not in the variant records */ + nsresult result = NS_ERROR_FAILURE; + PRUint8 paramCount; + PRUint8 i; + + 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"); + + for(i = 0; i < paramCount; ++i, --args) + { + const nsXPTParamInfo& param = info->GetParam(i); + const nsXPTType& type = param.GetType(); + nsXPTCMiniVariant* dp = &dispatchParams[i]; + + if(param.IsOut() || !type.IsArithmetic()) + { + dp->val.p = (void*) *args; + ++regwords; + continue; + } + switch(type) + { + case nsXPTType::T_I8 : dp->val.i8 = *((PRInt32*) args); break; + case nsXPTType::T_I16 : dp->val.i16 = *((PRInt32*) args); break; + case nsXPTType::T_I32 : dp->val.i32 = *((PRInt32*) args); break; + case nsXPTType::T_DOUBLE : + if (regwords & 1) + { + ++regwords; /* align on double word */ + --args; + } + if (regwords == 0 || regwords == 2) + { + dp->val.d=*((double*) (floatargs + regwords)); + --args; + } + else + { + dp->val.d = *((double*) --args); + } + regwords += 2; + continue; + case nsXPTType::T_U64 : + case nsXPTType::T_I64 : + if (regwords & 1) + { + ++regwords; /* align on double word */ + --args; + } + ((DU *)dp)->lo = *((PRUint32*) args); + ((DU *)dp)->hi = *((PRUint32*) --args); + regwords += 2; + continue; + case nsXPTType::T_FLOAT : + if (regwords >= 4) + dp->val.f = *((float*) args); + else + dp->val.f = *((float*) floatargs+4+regwords); + break; + case nsXPTType::T_U8 : dp->val.u8 = *((PRUint32*) args); break; + case nsXPTType::T_U16 : dp->val.u16 = *((PRUint32*) args); break; + case nsXPTType::T_U32 : dp->val.u32 = *((PRUint32*) args); break; + case nsXPTType::T_BOOL : dp->val.b = *((PRBool*) args); break; + case nsXPTType::T_CHAR : dp->val.c = *((PRUint32*) args); break; + case nsXPTType::T_WCHAR : dp->val.wc = *((PRInt32*) args); break; + default: + NS_ASSERTION(0, "bad type"); + break; + } + ++regwords; + } + + 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" + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_aix.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_aix.cpp new file mode 100644 index 00000000..870669d7 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_aix.cpp @@ -0,0 +1,228 @@ +/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Implement shared vtbl methods. */ + +#include "xptcprivate.h" + +#if defined(AIX) + +/* + For PPC (AIX & MAC), the first 8 integral and the first 13 f.p. parameters + arrive in a separate chunk of data that has been loaded from the registers. + The args pointer has been set to the start of the parameters BEYOND the ones + arriving in registers +*/ +extern "C" nsresult +PrepareAndDispatch(nsXPTCStubBase* self, PRUint32 methodIndex, PRUint32* args, PRUint32 *gprData, double *fprData) +{ + typedef struct { + uint32 hi; + uint32 lo; // have to move 64 bit entities as 32 bit halves since + } DU; // stack slots are not guaranteed 16 byte aligned + +#define PARAM_BUFFER_COUNT 16 +#define PARAM_GPR_COUNT 7 + + 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; + PRUint32 iCount = 0; + PRUint32 fpCount = 0; + for(i = 0; i < paramCount; i++) + { + const nsXPTParamInfo& param = info->GetParam(i); + const nsXPTType& type = param.GetType(); + nsXPTCMiniVariant* dp = &dispatchParams[i]; + + if(param.IsOut() || !type.IsArithmetic()) + { + if (iCount < PARAM_GPR_COUNT) + dp->val.p = (void*) gprData[iCount++]; + else + dp->val.p = (void*) *ap++; + continue; + } + // else + switch(type) + { + case nsXPTType::T_I8 : if (iCount < PARAM_GPR_COUNT) + dp->val.i8 = (PRInt8) gprData[iCount++]; + else + dp->val.i8 = (PRInt8) *ap++; + break; + case nsXPTType::T_I16 : if (iCount < PARAM_GPR_COUNT) + dp->val.i16 = (PRInt16) gprData[iCount++]; + else + dp->val.i16 = (PRInt16) *ap++; + break; + case nsXPTType::T_I32 : if (iCount < PARAM_GPR_COUNT) + dp->val.i32 = (PRInt32) gprData[iCount++]; + else + dp->val.i32 = (PRInt32) *ap++; + break; + case nsXPTType::T_I64 : if (iCount < PARAM_GPR_COUNT) + ((DU *)dp)->hi = (PRInt32) gprData[iCount++]; + else + ((DU *)dp)->hi = (PRInt32) *ap++; + if (iCount < PARAM_GPR_COUNT) + ((DU *)dp)->lo = (PRUint32) gprData[iCount++]; + else + ((DU *)dp)->lo = (PRUint32) *ap++; + break; + case nsXPTType::T_U8 : if (iCount < PARAM_GPR_COUNT) + dp->val.u8 = (PRUint8) gprData[iCount++]; + else + dp->val.u8 = (PRUint8) *ap++; + break; + case nsXPTType::T_U16 : if (iCount < PARAM_GPR_COUNT) + dp->val.u16 = (PRUint16) gprData[iCount++]; + else + dp->val.u16 = (PRUint16) *ap++; + break; + case nsXPTType::T_U32 : if (iCount < PARAM_GPR_COUNT) + dp->val.u32 = (PRUint32) gprData[iCount++]; + else + dp->val.u32 = (PRUint32) *ap++; + break; + case nsXPTType::T_U64 : if (iCount < PARAM_GPR_COUNT) + ((DU *)dp)->hi = (PRUint32) gprData[iCount++]; + else + ((DU *)dp)->hi = (PRUint32) *ap++; + if (iCount < PARAM_GPR_COUNT) + ((DU *)dp)->lo = (PRUint32) gprData[iCount++]; + else + ((DU *)dp)->lo = (PRUint32) *ap++; + break; + case nsXPTType::T_FLOAT : if (fpCount < 13) { + dp->val.f = (float) fprData[fpCount++]; + if (iCount < PARAM_GPR_COUNT) + ++iCount; + else + ++ap; + } + else + dp->val.f = *((float*) ap++); + break; + case nsXPTType::T_DOUBLE : if (fpCount < 13) { + dp->val.d = (double) fprData[fpCount++]; + if (iCount < PARAM_GPR_COUNT) + ++iCount; + else + ++ap; + if (iCount < PARAM_GPR_COUNT) + ++iCount; + else + ++ap; + } + else { + dp->val.f = *((double*) ap); + ap += 2; + } + break; + case nsXPTType::T_BOOL : if (iCount < PARAM_GPR_COUNT) + dp->val.b = (PRBool) gprData[iCount++]; + else + dp->val.b = (PRBool) *ap++; + break; + case nsXPTType::T_CHAR : if (iCount < PARAM_GPR_COUNT) + dp->val.c = (char) gprData[iCount++]; + else + dp->val.c = (char) *ap++; + break; + case nsXPTType::T_WCHAR : if (iCount < PARAM_GPR_COUNT) + dp->val.wc = (wchar_t) gprData[iCount++]; + else + 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 /* AIX */ diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_aix64.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_aix64.cpp new file mode 100644 index 00000000..cf2ddba9 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_aix64.cpp @@ -0,0 +1,215 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/LGPL 2.1/GPL 2.0 + * + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is IBM Corporation. + * Portions created by IBM are + * Copyright (C) 2002, International Business Machines Corporation. + * All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the LGPL or the GPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Implement shared vtbl methods. */ + +#include "xptcprivate.h" + +#if defined(AIX) + +/* + For PPC (AIX & MAC), the first 8 integral and the first 13 f.p. parameters + arrive in a separate chunk of data that has been loaded from the registers. + The args pointer has been set to the start of the parameters BEYOND the ones + arriving in registers +*/ +extern "C" nsresult +PrepareAndDispatch(nsXPTCStubBase* self, PRUint64 methodIndex, PRUint64* args, PRUint64 *gprData, double *fprData) +{ + +#define PARAM_BUFFER_COUNT 16 +#define PARAM_GPR_COUNT 7 + + 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"); + + PRUint64* ap = args; + PRUint32 iCount = 0; + PRUint32 fpCount = 0; + for(i = 0; i < paramCount; i++) + { + const nsXPTParamInfo& param = info->GetParam(i); + const nsXPTType& type = param.GetType(); + nsXPTCMiniVariant* dp = &dispatchParams[i]; + + if(param.IsOut() || !type.IsArithmetic()) + { + if (iCount < PARAM_GPR_COUNT) + dp->val.p = (void*) gprData[iCount++]; + else + dp->val.p = (void*) *ap++; + continue; + } + // else + switch(type) + { + case nsXPTType::T_I8 : if (iCount < PARAM_GPR_COUNT) + dp->val.i8 = (PRInt8) gprData[iCount++]; + else + dp->val.i8 = (PRInt8) *ap++; + break; + case nsXPTType::T_I16 : if (iCount < PARAM_GPR_COUNT) + dp->val.i16 = (PRInt16) gprData[iCount++]; + else + dp->val.i16 = (PRInt16) *ap++; + break; + case nsXPTType::T_I32 : if (iCount < PARAM_GPR_COUNT) + dp->val.i32 = (PRInt32) gprData[iCount++]; + else + dp->val.i32 = (PRInt32) *ap++; + break; + case nsXPTType::T_I64 : if (iCount < PARAM_GPR_COUNT) + dp->val.i64 = (PRInt64) gprData[iCount++]; + else + dp->val.i64 = (PRInt64) *ap++; + break; + case nsXPTType::T_U8 : if (iCount < PARAM_GPR_COUNT) + dp->val.u8 = (PRUint8) gprData[iCount++]; + else + dp->val.u8 = (PRUint8) *ap++; + break; + case nsXPTType::T_U16 : if (iCount < PARAM_GPR_COUNT) + dp->val.u16 = (PRUint16) gprData[iCount++]; + else + dp->val.u16 = (PRUint16) *ap++; + break; + case nsXPTType::T_U32 : if (iCount < PARAM_GPR_COUNT) + dp->val.u32 = (PRUint32) gprData[iCount++]; + else + dp->val.u32 = (PRUint32) *ap++; + break; + case nsXPTType::T_U64 : if (iCount < PARAM_GPR_COUNT) + dp->val.u64 = (PRUint64) gprData[iCount++]; + else + dp->val.u64 = (PRUint64) *ap++; + break; + case nsXPTType::T_FLOAT : if (fpCount < 13) { + dp->val.f = (float) fprData[fpCount++]; + if (iCount < PARAM_GPR_COUNT) + ++iCount; + else + ++ap; + } + else + dp->val.f = *((float*) ap++); + break; + case nsXPTType::T_DOUBLE : if (fpCount < 13) { + dp->val.d = (double) fprData[fpCount++]; + if (iCount < PARAM_GPR_COUNT) + ++iCount; + else + ++ap; + if (iCount < PARAM_GPR_COUNT) + ++iCount; + else + ++ap; + } + else { + dp->val.f = *((double*) ap); + ap += 2; + } + break; + case nsXPTType::T_BOOL : if (iCount < PARAM_GPR_COUNT) + dp->val.b = (PRBool) gprData[iCount++]; + else + dp->val.b = (PRBool) *ap++; + break; + case nsXPTType::T_CHAR : if (iCount < PARAM_GPR_COUNT) + dp->val.c = (char) gprData[iCount++]; + else + dp->val.c = (char) *ap++; + break; + case nsXPTType::T_WCHAR : if (iCount < PARAM_GPR_COUNT) + dp->val.wc = (wchar_t) gprData[iCount++]; + else + 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 /* AIX */ diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_linux.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_linux.cpp new file mode 100644 index 00000000..b1c98571 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_linux.cpp @@ -0,0 +1,253 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Franz.Sirl-kernel@lauterbach.com (Franz Sirl) + * beard@netscape.com (Patrick Beard) + * waterson@netscape.com (Chris Waterson) + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +// Implement shared vtbl methods. + +#include "xptcprivate.h" + +// The Linux/PPC ABI (aka PPC/SYSV ABI) passes the first 8 integral +// parameters and the first 8 floating point parameters in registers +// (r3-r10 and f1-f8), no stack space is allocated for these by the +// caller. The rest of the parameters are passed in the callers stack +// area. The stack pointer has to retain 16-byte alignment, longlongs +// and doubles are aligned on 8-byte boundaries. + +#define PARAM_BUFFER_COUNT 16 +#define GPR_COUNT 8 +#define FPR_COUNT 8 + +// PrepareAndDispatch() is called by SharedStub() and calls the actual method. +// +// - 'args[]' contains the arguments passed on stack +// - 'gprData[]' contains the arguments passed in integer registers +// - 'fprData[]' contains the arguments passed in floating point registers +// +// The parameters are mapped into an array of type 'nsXPTCMiniVariant' +// and then the method gets called. + +extern "C" nsresult +PrepareAndDispatch(nsXPTCStubBase* self, + PRUint32 methodIndex, + PRUint32* args, + PRUint32 *gprData, + double *fprData) +{ + nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT]; + nsXPTCMiniVariant* dispatchParams = NULL; + nsIInterfaceInfo* iface_info = NULL; + const nsXPTMethodInfo* info; + PRUint32 paramCount; + PRUint32 i; + nsresult result = NS_ERROR_FAILURE; + + NS_ASSERTION(self,"no self"); + + self->GetInterfaceInfo(&iface_info); + NS_ASSERTION(iface_info,"no interface info"); + if (! iface_info) + return NS_ERROR_UNEXPECTED; + + iface_info->GetMethodInfo(PRUint16(methodIndex), &info); + NS_ASSERTION(info,"no method info"); + if (! info) + return NS_ERROR_UNEXPECTED; + + 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"); + if (! dispatchParams) + return NS_ERROR_OUT_OF_MEMORY; + + PRUint32* ap = args; + PRUint32 gpr = 1; // skip one GPR register + PRUint32 fpr = 0; + PRUint32 tempu32; + PRUint64 tempu64; + + for(i = 0; i < paramCount; i++) { + const nsXPTParamInfo& param = info->GetParam(i); + const nsXPTType& type = param.GetType(); + nsXPTCMiniVariant* dp = &dispatchParams[i]; + + if (!param.IsOut() && type == nsXPTType::T_DOUBLE) { + if (fpr < FPR_COUNT) + dp->val.d = fprData[fpr++]; + else { + if ((PRUint32) ap & 4) ap++; // doubles are 8-byte aligned on stack + dp->val.d = *(double*) ap; + ap += 2; + } + continue; + } + else if (!param.IsOut() && type == nsXPTType::T_FLOAT) { + if (fpr < FPR_COUNT) + dp->val.f = (float) fprData[fpr++]; // in registers floats are passed as doubles + else + dp->val.f = *(float*) ap++; + continue; + } + else if (!param.IsOut() && (type == nsXPTType::T_I64 + || type == nsXPTType::T_U64)) { + if (gpr & 1) gpr++; // longlongs are aligned in odd/even register pairs, eg. r5/r6 + if ((gpr + 1) < GPR_COUNT) { + tempu64 = *(PRUint64*) &gprData[gpr]; + gpr += 2; + } + else { + if ((PRUint32) ap & 4) ap++; // longlongs are 8-byte aligned on stack + tempu64 = *(PRUint64*) ap; + ap += 2; + } + } + else { + if (gpr < GPR_COUNT) + tempu32 = gprData[gpr++]; + else + tempu32 = *ap++; + } + + if(param.IsOut() || !type.IsArithmetic()) { + dp->val.p = (void*) tempu32; + continue; + } + + switch(type) { + case nsXPTType::T_I8: dp->val.i8 = (PRInt8) tempu32; break; + case nsXPTType::T_I16: dp->val.i16 = (PRInt16) tempu32; break; + case nsXPTType::T_I32: dp->val.i32 = (PRInt32) tempu32; break; + case nsXPTType::T_I64: dp->val.i64 = (PRInt64) tempu64; break; + case nsXPTType::T_U8: dp->val.u8 = (PRUint8) tempu32; break; + case nsXPTType::T_U16: dp->val.u16 = (PRUint16) tempu32; break; + case nsXPTType::T_U32: dp->val.u32 = (PRUint32) tempu32; break; + case nsXPTType::T_U64: dp->val.u64 = (PRUint64) tempu64; break; + case nsXPTType::T_BOOL: dp->val.b = (PRBool) tempu32; break; + case nsXPTType::T_CHAR: dp->val.c = (char) tempu32; break; + case nsXPTType::T_WCHAR: dp->val.wc = (wchar_t) tempu32; 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; +} + +// Load r11 with the constant 'n' and branch to SharedStub(). +// +// XXX Yes, it's ugly that we're relying on gcc's name-mangling here; +// however, it's quick, dirty, and'll break when the ABI changes on +// us, which is what we want ;-). + +#if __GXX_ABI_VERSION < 100 +// gcc-2 version +# define STUB_ENTRY(n) \ +__asm__ ( \ + ".section \".text\" \n\t" \ + ".align 2 \n\t" \ + ".globl Stub"#n"__14nsXPTCStubBase \n\t" \ + ".type Stub"#n"__14nsXPTCStubBase,@function \n\n" \ + \ +"Stub"#n"__14nsXPTCStubBase: \n\t" \ + "li 11,"#n" \n\t" \ + "b SharedStub@local \n" \ +); +#else +// gcc-3 version +// +// As G++3 ABI contains the length of the functionname in the mangled +// name, it is difficult to get a generic assembler mechanism like +// in the G++ 2.95 case. +// Create names would be like: +// _ZN14nsXPTCStubBase5Stub1Ev +// _ZN14nsXPTCStubBase6Stub12Ev +// _ZN14nsXPTCStubBase7Stub123Ev +// _ZN14nsXPTCStubBase8Stub1234Ev +// etc. +// Use assembler directives to get the names right... + +# define STUB_ENTRY(n) \ +__asm__ ( \ + ".align 2 \n\t" \ + ".if "#n" < 10 \n\t" \ + ".globl _ZN14nsXPTCStubBase5Stub"#n"Ev \n\t" \ + ".type _ZN14nsXPTCStubBase5Stub"#n"Ev,@function \n\n" \ +"_ZN14nsXPTCStubBase5Stub"#n"Ev: \n\t" \ + \ + ".elseif "#n" < 100 \n\t" \ + ".globl _ZN14nsXPTCStubBase6Stub"#n"Ev \n\t" \ + ".type _ZN14nsXPTCStubBase6Stub"#n"Ev,@function \n\n" \ +"_ZN14nsXPTCStubBase6Stub"#n"Ev: \n\t" \ + \ + ".elseif "#n" < 1000 \n\t" \ + ".globl _ZN14nsXPTCStubBase7Stub"#n"Ev \n\t" \ + ".type _ZN14nsXPTCStubBase7Stub"#n"Ev,@function \n\n" \ +"_ZN14nsXPTCStubBase7Stub"#n"Ev: \n\t" \ + \ + ".else \n\t" \ + ".err \"stub number "#n" >= 1000 not yet supported\"\n" \ + ".endif \n\t" \ + \ + "li 11,"#n" \n\t" \ + "b SharedStub@local \n" \ +); +#endif + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_netbsd.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_netbsd.cpp new file mode 100644 index 00000000..68d572ca --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_netbsd.cpp @@ -0,0 +1,217 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Franz.Sirl-kernel@lauterbach.com (Franz Sirl) + * beard@netscape.com (Patrick Beard) + * waterson@netscape.com (Chris Waterson) + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +// Implement shared vtbl methods. + +#include "xptcprivate.h" + +// The Linux/PPC ABI (aka PPC/SYSV ABI) passes the first 8 integral +// parameters and the first 8 floating point parameters in registers +// (r3-r10 and f1-f8), no stack space is allocated for these by the +// caller. The rest of the parameters are passed in the callers stack +// area. The stack pointer has to retain 16-byte alignment, longlongs +// and doubles are aligned on 8-byte boundaries. + +#define PARAM_BUFFER_COUNT 16 +#define GPR_COUNT 8 +#define FPR_COUNT 8 + +// PrepareAndDispatch() is called by SharedStub() and calls the actual method. +// +// - 'args[]' contains the arguments passed on stack +// - 'gprData[]' contains the arguments passed in integer registers +// - 'fprData[]' contains the arguments passed in floating point registers +// +// The parameters are mapped into an array of type 'nsXPTCMiniVariant' +// and then the method gets called. + +extern "C" nsresult +PrepareAndDispatch(nsXPTCStubBase* self, + PRUint32 methodIndex, + PRUint32* args, + PRUint32 *gprData, + double *fprData) +{ + nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT]; + nsXPTCMiniVariant* dispatchParams = NULL; + nsIInterfaceInfo* iface_info = NULL; + const nsXPTMethodInfo* info; + PRUint32 paramCount; + PRUint32 i; + nsresult result = NS_ERROR_FAILURE; + + NS_ASSERTION(self,"no self"); + + self->GetInterfaceInfo(&iface_info); + NS_ASSERTION(iface_info,"no interface info"); + if (! iface_info) + return NS_ERROR_UNEXPECTED; + + iface_info->GetMethodInfo(PRUint16(methodIndex), &info); + NS_ASSERTION(info,"no method info"); + if (! info) + return NS_ERROR_UNEXPECTED; + + 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"); + if (! dispatchParams) + return NS_ERROR_OUT_OF_MEMORY; + + PRUint32* ap = args; + PRUint32 gpr = 1; // skip one GPR register + PRUint32 fpr = 0; + PRUint32 tempu32; + PRUint64 tempu64; + + for(i = 0; i < paramCount; i++) { + const nsXPTParamInfo& param = info->GetParam(i); + const nsXPTType& type = param.GetType(); + nsXPTCMiniVariant* dp = &dispatchParams[i]; + + if (!param.IsOut() && type == nsXPTType::T_DOUBLE) { + if (fpr < FPR_COUNT) + dp->val.d = fprData[fpr++]; + else { + if ((PRUint32) ap & 4) ap++; // doubles are 8-byte aligned on stack + dp->val.d = *(double*) ap; + ap += 2; + if (gpr < GPR_COUNT) + gpr += 2; + } + continue; + } + else if (!param.IsOut() && type == nsXPTType::T_FLOAT) { + if (fpr < FPR_COUNT) + dp->val.f = (float) fprData[fpr++]; // in registers floats are passed as doubles + else { + dp->val.f = *(float*) ap; + ap += 1; + if (gpr < GPR_COUNT) + gpr += 1; + } + continue; + } + else if (!param.IsOut() && (type == nsXPTType::T_I64 + || type == nsXPTType::T_U64)) { + if (gpr & 1) gpr++; // longlongs are aligned in odd/even register pairs, eg. r5/r6 + if ((gpr + 1) < GPR_COUNT) { + tempu64 = *(PRUint64*) &gprData[gpr]; + gpr += 2; + } + else { + if ((PRUint32) ap & 4) ap++; // longlongs are 8-byte aligned on stack + tempu64 = *(PRUint64*) ap; + ap += 2; + } + } + else { + if (gpr < GPR_COUNT) + tempu32 = gprData[gpr++]; + else + tempu32 = *ap++; + } + + if(param.IsOut() || !type.IsArithmetic()) { + dp->val.p = (void*) tempu32; + continue; + } + + switch(type) { + case nsXPTType::T_I8: dp->val.i8 = (PRInt8) tempu32; break; + case nsXPTType::T_I16: dp->val.i16 = (PRInt16) tempu32; break; + case nsXPTType::T_I32: dp->val.i32 = (PRInt32) tempu32; break; + case nsXPTType::T_I64: dp->val.i64 = (PRInt64) tempu64; break; + case nsXPTType::T_U8: dp->val.u8 = (PRUint8) tempu32; break; + case nsXPTType::T_U16: dp->val.u16 = (PRUint16) tempu32; break; + case nsXPTType::T_U32: dp->val.u32 = (PRUint32) tempu32; break; + case nsXPTType::T_U64: dp->val.u64 = (PRUint64) tempu64; break; + case nsXPTType::T_BOOL: dp->val.b = (PRBool) tempu32; break; + case nsXPTType::T_CHAR: dp->val.c = (char) tempu32; break; + case nsXPTType::T_WCHAR: dp->val.wc = (wchar_t) tempu32; 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; +} + +// Load r11 with the constant 'n' and branch to SharedStub(). +// +// XXX Yes, it's ugly that we're relying on gcc's name-mangling here; +// however, it's quick, dirty, and'll break when the ABI changes on +// us, which is what we want ;-). + +#define STUB_ENTRY(n) \ +__asm__ ( \ + ".section \".text\" \n\t" \ + ".align 2 \n\t" \ + ".globl Stub"#n"__14nsXPTCStubBase \n\t" \ + ".type Stub"#n"__14nsXPTCStubBase,@function \n\n" \ + \ +"Stub"#n"__14nsXPTCStubBase: \n\t" \ + "li 11,"#n" \n\t" \ + "b SharedStub@local \n" \ +); + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_rhapsody.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_rhapsody.cpp new file mode 100644 index 00000000..fcf96d4f --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_rhapsody.cpp @@ -0,0 +1,254 @@ +/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Implement shared vtbl methods. */ + +#include "xptcprivate.h" + +/* + For mac, the first 8 integral and the first 13 f.p. parameters arrive + in a separate chunk of data that has been loaded from the registers. The + args pointer has been set to the start of the parameters BEYOND the ones + arriving in registers +*/ +extern "C" nsresult +PrepareAndDispatch(nsXPTCStubBase* self, PRUint32 methodIndex, PRUint32* args, PRUint32 *gprData, double *fprData) +{ +#define PARAM_BUFFER_COUNT 16 +#define PARAM_GPR_COUNT 7 + + // fprintf(stderr, "PrepareAndDispatch %p, %d, %p, %p, %p\n", self, methodIndex, args, gprData, fprData); + + 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; + PRUint32 iCount = 0; + PRUint32 fpCount = 0; + for(i = 0; i < paramCount; i++) + { + const nsXPTParamInfo& param = info->GetParam(i); + const nsXPTType& type = param.GetType(); + nsXPTCMiniVariant* dp = &dispatchParams[i]; + + if(param.IsOut() || !type.IsArithmetic()) + { + if (iCount < PARAM_GPR_COUNT) + dp->val.p = (void*) gprData[iCount++]; + else + dp->val.p = (void*) *ap++; + continue; + } + // else + switch(type) + { + case nsXPTType::T_I8 : if (iCount < PARAM_GPR_COUNT) + dp->val.i8 = (PRInt8) gprData[iCount++]; + else + dp->val.i8 = (PRInt8) *ap++; + break; + case nsXPTType::T_I16 : if (iCount < PARAM_GPR_COUNT) + dp->val.i16 = (PRInt16) gprData[iCount++]; + else + dp->val.i16 = (PRInt16) *ap++; + break; + case nsXPTType::T_I32 : if (iCount < PARAM_GPR_COUNT) + dp->val.i32 = (PRInt32) gprData[iCount++]; + else + dp->val.i32 = (PRInt32) *ap++; + break; + + case nsXPTType::T_I64 : + { + PRUint64 tempu64; + if (iCount & 1) iCount++; // longlongs are aligned in odd/even register pairs, eg. r5/r6 + if ((iCount + 1) < PARAM_GPR_COUNT) { + tempu64 = *(PRUint64*) &gprData[iCount]; + iCount += 2; + } + else { + if ((PRUint32) ap & 4) ap++; // longlongs are 8-byte aligned on stack + tempu64 = *(PRUint64*) ap; + ap += 2; + } + dp->val.i64 = (PRUint64)tempu64; + } + break; + +#if 0 + case nsXPTType::T_I64 : if (iCount < PARAM_GPR_COUNT) + dp->val.i64.hi = (PRInt32) gprData[iCount++]; + else + dp->val.i64.hi = (PRInt32) *ap++; + if (iCount < PARAM_GPR_COUNT) + dp->val.i64.lo = (PRUint32) gprData[iCount++]; + else + dp->val.i64.lo = (PRUint32) *ap++; + break; +#endif + case nsXPTType::T_U8 : if (iCount < PARAM_GPR_COUNT) + dp->val.i8 = (PRUint8) gprData[iCount++]; + else + dp->val.i8 = (PRUint8) *ap++; + break; + case nsXPTType::T_U16 : if (iCount < PARAM_GPR_COUNT) + dp->val.i16 = (PRUint16) gprData[iCount++]; + else + dp->val.i16 = (PRUint16) *ap++; + break; + case nsXPTType::T_U32 : if (iCount < PARAM_GPR_COUNT) + dp->val.i32 = (PRUint32) gprData[iCount++]; + else + dp->val.i32 = (PRUint32) *ap++; + break; + + case nsXPTType::T_U64 : +#if 0 + if (iCount < PARAM_GPR_COUNT) + dp->val.i64.hi = (PRUint32) gprData[iCount++]; + else + dp->val.i64.hi = (PRUint32) *ap++; + if (iCount < PARAM_GPR_COUNT) + dp->val.i64.lo = (PRUint32) gprData[iCount++]; + else + dp->val.i64.lo = (PRUint32) *ap++; +#endif + { + PRUint64 tempu64; + if (iCount & 1) iCount++; // longlongs are aligned in odd/even register pairs, eg. r5/r6 + if ((iCount + 1) < PARAM_GPR_COUNT) { + tempu64 = *(PRUint64*) &gprData[iCount]; + iCount += 2; + } + else { + if ((PRUint32) ap & 4) ap++; // longlongs are 8-byte aligned on stack + tempu64 = *(PRUint64*) ap; + ap += 2; + } + dp->val.i64 = (PRUint64)tempu64; + } + break; + case nsXPTType::T_FLOAT : if (fpCount < 13) { + dp->val.f = (float) fprData[fpCount++]; + if (iCount < PARAM_GPR_COUNT) + ++iCount; + else + ++ap; + } + else + dp->val.f = *((float*) ap++); + break; + case nsXPTType::T_DOUBLE : if (fpCount < 13) { + dp->val.d = (double) fprData[fpCount++]; + if (iCount < PARAM_GPR_COUNT) + ++iCount; + else + ++ap; + if (iCount < PARAM_GPR_COUNT) + ++iCount; + else + ++ap; + } + else { + dp->val.f = *((double*) ap); + ap += 2; + } + break; + case nsXPTType::T_BOOL : if (iCount < PARAM_GPR_COUNT) + dp->val.b = (PRBool) gprData[iCount++]; + else + dp->val.b = (PRBool) *ap++; + break; + case nsXPTType::T_CHAR : if (iCount < PARAM_GPR_COUNT) + dp->val.c = (char) gprData[iCount++]; + else + dp->val.c = (char) *ap++; + break; + case nsXPTType::T_WCHAR : if (iCount < PARAM_GPR_COUNT) + dp->val.wc = (wchar_t) gprData[iCount++]; + else + 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; +} + + +#define STUB_ENTRY(n) +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + + +#include "xptcstubsdef.inc" diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_sparc_netbsd.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_sparc_netbsd.cpp new file mode 100644 index 00000000..cbed6041 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_sparc_netbsd.cpp @@ -0,0 +1,146 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Implement shared vtbl methods. */ + +#include "xptcprivate.h" + +#if defined(sparc) || defined(__sparc__) + +extern "C" nsresult +PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, uint32* args) +{ + + typedef struct { + uint32 hi; + uint32 lo; + } DU; // have to move 64 bit entities as 32 bit halves since + // stack slots are not guaranteed 16 byte aligned + +#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 = *((PRInt32*) ap); break; + case nsXPTType::T_I16 : dp->val.i16 = *((PRInt32*) ap); break; + case nsXPTType::T_I32 : dp->val.i32 = *((PRInt32*) ap); break; + case nsXPTType::T_DOUBLE : + case nsXPTType::T_U64 : + case nsXPTType::T_I64 : ((DU *)dp)->hi = ((DU *)ap)->hi; + ((DU *)dp)->lo = ((DU *)ap)->lo; + ap++; + break; + case nsXPTType::T_U8 : dp->val.u8 = *((PRUint32*) ap); break; + case nsXPTType::T_U16 : dp->val.u16 = *((PRUint32*)ap); break; + case nsXPTType::T_U32 : dp->val.u32 = *((PRUint32*)ap); break; + case nsXPTType::T_FLOAT : dp->val.f = *((float*) ap); break; + case nsXPTType::T_BOOL : dp->val.b = *((PRBool*) ap); break; + case nsXPTType::T_CHAR : dp->val.c = *((PRUint32*) ap); break; + case nsXPTType::T_WCHAR : dp->val.wc = *((PRInt32*) 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, int*); + +#define STUB_ENTRY(n) \ +nsresult nsXPTCStubBase::Stub##n() \ +{ \ + int dummy; /* defeat tail-call optimization */ \ + return SharedStub(n, &dummy); \ +} + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" + +#endif /* sparc || __sparc__ */ diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_sparc_solaris.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_sparc_solaris.cpp new file mode 100644 index 00000000..cbed6041 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_sparc_solaris.cpp @@ -0,0 +1,146 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Implement shared vtbl methods. */ + +#include "xptcprivate.h" + +#if defined(sparc) || defined(__sparc__) + +extern "C" nsresult +PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, uint32* args) +{ + + typedef struct { + uint32 hi; + uint32 lo; + } DU; // have to move 64 bit entities as 32 bit halves since + // stack slots are not guaranteed 16 byte aligned + +#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 = *((PRInt32*) ap); break; + case nsXPTType::T_I16 : dp->val.i16 = *((PRInt32*) ap); break; + case nsXPTType::T_I32 : dp->val.i32 = *((PRInt32*) ap); break; + case nsXPTType::T_DOUBLE : + case nsXPTType::T_U64 : + case nsXPTType::T_I64 : ((DU *)dp)->hi = ((DU *)ap)->hi; + ((DU *)dp)->lo = ((DU *)ap)->lo; + ap++; + break; + case nsXPTType::T_U8 : dp->val.u8 = *((PRUint32*) ap); break; + case nsXPTType::T_U16 : dp->val.u16 = *((PRUint32*)ap); break; + case nsXPTType::T_U32 : dp->val.u32 = *((PRUint32*)ap); break; + case nsXPTType::T_FLOAT : dp->val.f = *((float*) ap); break; + case nsXPTType::T_BOOL : dp->val.b = *((PRBool*) ap); break; + case nsXPTType::T_CHAR : dp->val.c = *((PRUint32*) ap); break; + case nsXPTType::T_WCHAR : dp->val.wc = *((PRInt32*) 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, int*); + +#define STUB_ENTRY(n) \ +nsresult nsXPTCStubBase::Stub##n() \ +{ \ + int dummy; /* defeat tail-call optimization */ \ + return SharedStub(n, &dummy); \ +} + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" + +#endif /* sparc || __sparc__ */ diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_sparcv9_solaris.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_sparcv9_solaris.cpp new file mode 100644 index 00000000..f64b309e --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_sparcv9_solaris.cpp @@ -0,0 +1,139 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Stuart Parmenter <pavlov@netscape.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Implement shared vtbl methods. */ + +#include "xptcprivate.h" + +#if defined(sparc) || defined(__sparc__) + +extern "C" nsresult +PrepareAndDispatch(nsXPTCStubBase* self, PRUint64 methodIndex, PRUint64* 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"); + + PRUint64* 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 = *((PRInt32*) ap); break; + case nsXPTType::T_I16 : dp->val.i16 = *((PRInt32*) ap); break; + case nsXPTType::T_I32 : dp->val.i32 = *((PRInt32*) ap); break; + case nsXPTType::T_DOUBLE : dp->val.d = *((double*) ap); break; + case nsXPTType::T_U64 : dp->val.u64 = *((PRUint64*) ap); break; + case nsXPTType::T_I64 : dp->val.i64 = *((PRInt64*) ap); break; + case nsXPTType::T_U8 : dp->val.u8 = *((PRUint32*) ap); break; + case nsXPTType::T_U16 : dp->val.u16 = *((PRUint32*)ap); break; + case nsXPTType::T_U32 : dp->val.u32 = *((PRUint32*)ap); break; + case nsXPTType::T_FLOAT : dp->val.f = *((float*) ap); break; + case nsXPTType::T_BOOL : dp->val.b = *((PRBool*) ap); break; + case nsXPTType::T_CHAR : dp->val.c = *((PRUint32*) ap); break; + case nsXPTType::T_WCHAR : dp->val.wc = *((PRInt32*) 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, int*); + +#define STUB_ENTRY(n) \ +nsresult nsXPTCStubBase::Stub##n() \ +{ \ + int dummy; /* defeat tail-call optimization */ \ + return SharedStub(n, &dummy); \ +} + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" + +#endif /* sparc || __sparc__ */ diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_unixish_x86.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_unixish_x86.cpp new file mode 100644 index 00000000..91c5c5db --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_unixish_x86.cpp @@ -0,0 +1,188 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Implement shared vtbl methods. */ + +#include "xptcprivate.h" +#include "xptc_platforms_unixish_x86.h" +/*#include "xptiprivate.h"*/ + +static nsresult +PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, PRUint32* args) +{ +#define PARAM_BUFFER_COUNT 16 + + nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT]; + nsXPTCMiniVariant* dispatchParams = NULL; + nsIInterfaceInfo* iface_info = NULL; + const nsXPTMethodInfo* info = NULL; + 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"); + if (!iface_info) + return NS_ERROR_UNEXPECTED; + + iface_info->GetMethodInfo(PRUint16(methodIndex), &info); + NS_ASSERTION(info,"no method info"); + if (!info) + return NS_ERROR_UNEXPECTED; + + 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"); + if (!dispatchParams) + return NS_ERROR_OUT_OF_MEMORY; + + 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 + dp->val.p = (void*) *ap; + switch(type) + { + case nsXPTType::T_I64 : dp->val.i64 = *((PRInt64*) ap); ap++; break; + case nsXPTType::T_U64 : dp->val.u64 = *((PRUint64*)ap); ap++; break; + case nsXPTType::T_DOUBLE : dp->val.d = *((double*) ap); ap++; break; + } + } + + result = self->CallMethod((PRUint16)methodIndex, info, dispatchParams); + + NS_RELEASE(iface_info); + + if(dispatchParams != paramBuffer) + delete [] dispatchParams; + + return result; +} + +#ifdef __GNUC__ /* Gnu Compiler. */ + +#ifdef KEEP_STACK_16_BYTE_ALIGNED +/* Make sure the stack is 16-byte aligned. Do that by aligning to 16 bytes and + * then subtracting 4 so the three subsequent pushes result in a 16-byte aligned + * stack. */ +#define ALIGN_STACK_DECL \ + unsigned int saved_esp = 0; /* VBOX: Initialize it to shut up half a million gcc warnings on darwin. + * ALIGN_STACK_REGS_OUT/IN are a bit bogus, so the warning is probably correct. */ + +#define ALIGN_STACK_SAVE \ + "movl %%esp, %3\n\t" + +#define ALIGN_STACK_ALIGN \ + "addl $0x4, %%esp\n\t" \ + "andl $0xfffffff0, %%esp\n\t" \ + "subl $0x4, %%esp\n\t" + +#define STACK_RESTORE \ + "movl %3, %%esp\n" + +#define ALIGN_STACK_REGS_IN \ + , "=r"(saved_esp) /* 3 */ + +#define ALIGN_STACK_REGS_OUT \ + , "3"(saved_esp) + +#else +#define ALIGN_STACK_DECL +#define ALIGN_STACK_SAVE +#define ALIGN_STACK_ALIGN +#define STACK_RESTORE \ + "addl $12, %%esp\n" +#define ALIGN_STACK_REGS_IN +#define ALIGN_STACK_REGS_OUT +#endif + +#define STUB_ENTRY(n) \ +nsresult nsXPTCStubBase::Stub##n() \ +{ \ + register nsresult (*method) (nsXPTCStubBase *, uint32, PRUint32 *) = PrepareAndDispatch; \ + int temp0, temp1; \ + register nsresult result; \ + ALIGN_STACK_DECL \ + __asm__ __volatile__( \ + ALIGN_STACK_SAVE \ + ALIGN_STACK_ALIGN \ + "leal 0x0c(%%ebp), %%ecx\n\t" /* args */ \ + "pushl %%ecx\n\t" \ + "pushl $"#n"\n\t" /* method index */ \ + "movl 0x08(%%ebp), %%ecx\n\t" /* this */ \ + "pushl %%ecx\n\t" \ + "call *%%edx\n\t" /* PrepareAndDispatch */ \ + STACK_RESTORE /* "addl $12, %%esp" or restore saved */ \ + : "=a" (result), /* %0 */ \ + "=&c" (temp0), /* %1 */ \ + "=d" (temp1) /* %2 */ \ + ALIGN_STACK_REGS_IN \ + : "2" (method) /* %2 */ \ + ALIGN_STACK_REGS_OUT \ + : "memory" \ + ); \ + return result; \ +} + +#else +#error "can't find a compiler to use" +#endif /* __GNUC__ */ + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_unsupported.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_unsupported.cpp new file mode 100644 index 00000000..0eea6567 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_unsupported.cpp @@ -0,0 +1,56 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Implement shared vtbl methods. */ + +#include "xptcprivate.h" + +#define STUB_ENTRY(n) \ +nsresult nsXPTCStubBase::Stub##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Stub called on unsupported platform"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_linux.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_linux.cpp new file mode 100644 index 00000000..3381c48e --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_linux.cpp @@ -0,0 +1,242 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org Code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +// Implement shared vtbl methods. + +#include "xptcprivate.h" + +// The Linux/x86-64 ABI passes the first 6 integer parameters and the +// first 8 floating point parameters in registers (rdi, rsi, rdx, rcx, +// r8, r9 and xmm0-xmm7), no stack space is allocated for these by the +// caller. The rest of the parameters are passed in the callers stack +// area. + +const PRUint32 PARAM_BUFFER_COUNT = 16; +const PRUint32 GPR_COUNT = 6; +const PRUint32 FPR_COUNT = 8; + +// PrepareAndDispatch() is called by SharedStub() and calls the actual method. +// +// - 'args[]' contains the arguments passed on stack +// - 'gpregs[]' contains the arguments passed in integer registers +// - 'fpregs[]' contains the arguments passed in floating point registers +// +// The parameters are mapped into an array of type 'nsXPTCMiniVariant' +// and then the method gets called. + +extern "C" nsresult +PrepareAndDispatch(nsXPTCStubBase * self, PRUint32 methodIndex, + PRUint64 * args, PRUint64 * gpregs, double *fpregs) +{ + nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT]; + nsXPTCMiniVariant* dispatchParams = NULL; + nsIInterfaceInfo* iface_info = NULL; + const nsXPTMethodInfo* info = NULL; + PRUint32 paramCount; + PRUint32 i; + nsresult result = NS_ERROR_FAILURE; + + NS_ASSERTION(self,"no self"); + + self->GetInterfaceInfo(&iface_info); + NS_ASSERTION(iface_info,"no interface info"); + if (!iface_info) + return NS_ERROR_UNEXPECTED; + + iface_info->GetMethodInfo(PRUint16(methodIndex), &info); + NS_ASSERTION(info,"no method info"); + if (!info) + return NS_ERROR_UNEXPECTED; + + 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"); + if (!dispatchParams) + return NS_ERROR_OUT_OF_MEMORY; + + PRUint64* ap = args; + PRUint32 nr_gpr = 1; // skip one GPR register for 'that' + PRUint32 nr_fpr = 0; + PRUint64 value; + + for (i = 0; i < paramCount; i++) { + const nsXPTParamInfo& param = info->GetParam(i); + const nsXPTType& type = param.GetType(); + nsXPTCMiniVariant* dp = &dispatchParams[i]; + + if (!param.IsOut() && type == nsXPTType::T_DOUBLE) { + if (nr_fpr < FPR_COUNT) + dp->val.d = fpregs[nr_fpr++]; + else + dp->val.d = *(double*) ap++; + continue; + } + else if (!param.IsOut() && type == nsXPTType::T_FLOAT) { + if (nr_fpr < FPR_COUNT) + // The value in %xmm register is already prepared to + // be retrieved as a float. Therefore, we pass the + // value verbatim, as a double without conversion. + dp->val.d = *(double*) ap++; + else + dp->val.f = *(float*) ap++; + continue; + } + else { + if (nr_gpr < GPR_COUNT) + value = gpregs[nr_gpr++]; + else + value = *ap++; + } + + if (param.IsOut() || !type.IsArithmetic()) { + dp->val.p = (void*) value; + continue; + } + + switch (type) { + case nsXPTType::T_I8: dp->val.i8 = (PRInt8) value; break; + case nsXPTType::T_I16: dp->val.i16 = (PRInt16) value; break; + case nsXPTType::T_I32: dp->val.i32 = (PRInt32) value; break; + case nsXPTType::T_I64: dp->val.i64 = (PRInt64) value; break; + case nsXPTType::T_U8: dp->val.u8 = (PRUint8) value; break; + case nsXPTType::T_U16: dp->val.u16 = (PRUint16) value; break; + case nsXPTType::T_U32: dp->val.u32 = (PRUint32) value; break; + case nsXPTType::T_U64: dp->val.u64 = (PRUint64) value; break; + case nsXPTType::T_BOOL: dp->val.b = (PRBool) value; break; + case nsXPTType::T_CHAR: dp->val.c = (char) value; break; + case nsXPTType::T_WCHAR: dp->val.wc = (wchar_t) value; 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; +} + +#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */ +// Linux/x86-64 uses gcc >= 3.1 +#define STUB_ENTRY(n) \ +asm(".section \".text\"\n\t" \ + ".align 2\n\t" \ + ".if " #n " < 10\n\t" \ + ".globl _ZN14nsXPTCStubBase5Stub" #n "Ev\n\t" \ + ".type _ZN14nsXPTCStubBase5Stub" #n "Ev,@function\n" \ + "_ZN14nsXPTCStubBase5Stub" #n "Ev:\n\t" \ + ".elseif " #n " < 100\n\t" \ + ".globl _ZN14nsXPTCStubBase6Stub" #n "Ev\n\t" \ + ".type _ZN14nsXPTCStubBase6Stub" #n "Ev,@function\n" \ + "_ZN14nsXPTCStubBase6Stub" #n "Ev:\n\t" \ + ".elseif " #n " < 1000\n\t" \ + ".globl _ZN14nsXPTCStubBase7Stub" #n "Ev\n\t" \ + ".type _ZN14nsXPTCStubBase7Stub" #n "Ev,@function\n" \ + "_ZN14nsXPTCStubBase7Stub" #n "Ev:\n\t" \ + ".else\n\t" \ + ".err \"stub number " #n " >= 1000 not yet supported\"\n\t" \ + ".endif\n\t" \ + "movl $" #n ", %eax\n\t" \ + "jmp SharedStub\n\t" \ + ".if " #n " < 10\n\t" \ + ".size _ZN14nsXPTCStubBase5Stub" #n "Ev,.-_ZN14nsXPTCStubBase5Stub" #n "Ev\n\t" \ + ".elseif " #n " < 100\n\t" \ + ".size _ZN14nsXPTCStubBase6Stub" #n "Ev,.-_ZN14nsXPTCStubBase6Stub" #n "Ev\n\t" \ + ".else\n\t" \ + ".size _ZN14nsXPTCStubBase7Stub" #n "Ev,.-_ZN14nsXPTCStubBase7Stub" #n "Ev\n\t" \ + ".endif"); + +// static nsresult SharedStub(PRUint32 methodIndex) +asm(".section \".text\"\n\t" + ".align 2\n\t" + ".type SharedStub,@function\n\t" + "SharedStub:\n\t" + // make room for gpregs (48), fpregs (64) + "pushq %rbp\n\t" + "movq %rsp,%rbp\n\t" + "subq $112,%rsp\n\t" + // save GP registers + "movq %rdi,-112(%rbp)\n\t" + "movq %rsi,-104(%rbp)\n\t" + "movq %rdx, -96(%rbp)\n\t" + "movq %rcx, -88(%rbp)\n\t" + "movq %r8 , -80(%rbp)\n\t" + "movq %r9 , -72(%rbp)\n\t" + "leaq -112(%rbp),%rcx\n\t" + // save FP registers + "movsd %xmm0,-64(%rbp)\n\t" + "movsd %xmm1,-56(%rbp)\n\t" + "movsd %xmm2,-48(%rbp)\n\t" + "movsd %xmm3,-40(%rbp)\n\t" + "movsd %xmm4,-32(%rbp)\n\t" + "movsd %xmm5,-24(%rbp)\n\t" + "movsd %xmm6,-16(%rbp)\n\t" + "movsd %xmm7, -8(%rbp)\n\t" + "leaq -64(%rbp),%r8\n\t" + // rdi has the 'self' pointer already + "movl %eax,%esi\n\t" + "leaq 16(%rbp),%rdx\n\t" + "call PrepareAndDispatch@plt\n\t" + "leave\n\t" + "ret\n\t" + ".size SharedStub,.-SharedStub"); + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" + +#else +#error "Unsupported compiler. Use gcc >= 3.1 for Linux/x86-64." +#endif /* __GNUC__ */ diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_solaris.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_solaris.cpp new file mode 100644 index 00000000..59e0202f --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_solaris.cpp @@ -0,0 +1,271 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org Code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +// Implement shared vtbl methods. + +#include "xptcprivate.h" + +// The Linux/x86-64 ABI passes the first 6 integer parameters and the +// first 8 floating point parameters in registers (rdi, rsi, rdx, rcx, +// r8, r9 and xmm0-xmm7), no stack space is allocated for these by the +// caller. The rest of the parameters are passed in the callers stack +// area. +// Solaris does the same, just the assembler may differ. + +const PRUint32 PARAM_BUFFER_COUNT = 16; +const PRUint32 GPR_COUNT = 6; +const PRUint32 FPR_COUNT = 8; + +// PrepareAndDispatch() is called by SharedStub() and calls the actual method. +// +// - 'args[]' contains the arguments passed on stack +// - 'gpregs[]' contains the arguments passed in integer registers +// - 'fpregs[]' contains the arguments passed in floating point registers +// +// The parameters are mapped into an array of type 'nsXPTCMiniVariant' +// and then the method gets called. + +extern "C" nsresult +PrepareAndDispatch(nsXPTCStubBase * self, PRUint32 methodIndex, + PRUint64 * args, PRUint64 * gpregs, double *fpregs) +{ + nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT]; + nsXPTCMiniVariant* dispatchParams = NULL; + nsIInterfaceInfo* iface_info = NULL; + const nsXPTMethodInfo* info; + PRUint32 paramCount; + PRUint32 i; + nsresult result = NS_ERROR_FAILURE; + + NS_ASSERTION(self,"no self"); + + self->GetInterfaceInfo(&iface_info); + NS_ASSERTION(iface_info,"no interface info"); + if (!iface_info) + return NS_ERROR_UNEXPECTED; + + iface_info->GetMethodInfo(PRUint16(methodIndex), &info); + NS_ASSERTION(info,"no method info"); + if (!info) + return NS_ERROR_UNEXPECTED; + + 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"); + if (!dispatchParams) + return NS_ERROR_OUT_OF_MEMORY; + + PRUint64* ap = args; + PRUint32 nr_gpr = 1; // skip one GPR register for 'that' + PRUint32 nr_fpr = 0; + PRUint64 value; + + for (i = 0; i < paramCount; i++) { + const nsXPTParamInfo& param = info->GetParam(i); + const nsXPTType& type = param.GetType(); + nsXPTCMiniVariant* dp = &dispatchParams[i]; + + if (!param.IsOut() && type == nsXPTType::T_DOUBLE) { + if (nr_fpr < FPR_COUNT) + dp->val.d = fpregs[nr_fpr++]; + else + dp->val.d = *(double*) ap++; + continue; + } + else if (!param.IsOut() && type == nsXPTType::T_FLOAT) { + if (nr_fpr < FPR_COUNT) + // The value in %xmm register is already prepared to + // be retrieved as a float. Therefore, we pass the + // value verbatim, as a double without conversion. + dp->val.d = *(double*) ap++; + else + dp->val.f = *(float*) ap++; + continue; + } + else { + if (nr_gpr < GPR_COUNT) + value = gpregs[nr_gpr++]; + else + value = *ap++; + } + + if (param.IsOut() || !type.IsArithmetic()) { + dp->val.p = (void*) value; + continue; + } + + switch (type) { + case nsXPTType::T_I8: dp->val.i8 = (PRInt8) value; break; + case nsXPTType::T_I16: dp->val.i16 = (PRInt16) value; break; + case nsXPTType::T_I32: dp->val.i32 = (PRInt32) value; break; + case nsXPTType::T_I64: dp->val.i64 = (PRInt64) value; break; + case nsXPTType::T_U8: dp->val.u8 = (PRUint8) value; break; + case nsXPTType::T_U16: dp->val.u16 = (PRUint16) value; break; + case nsXPTType::T_U32: dp->val.u32 = (PRUint32) value; break; + case nsXPTType::T_U64: dp->val.u64 = (PRUint64) value; break; + case nsXPTType::T_BOOL: dp->val.b = (PRBool) value; break; + case nsXPTType::T_CHAR: dp->val.c = (char) value; break; + case nsXPTType::T_WCHAR: dp->val.wc = (wchar_t) value; 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; +} + +#include <iprt/cdefs.h> + +#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */ +// Solaris/x86-64 uses gcc >= 3.1 +#define STUB_ENTRY(n,m) \ +asm(".section .text\n\t" \ + ".align 2\n\t" \ + ".globl _ZN14nsXPTCStubBase" #m "Stub" #n "Ev\n\t" \ + ".type _ZN14nsXPTCStubBase" #m "Stub" #n "Ev,@function\n" \ + "_ZN14nsXPTCStubBase" #m "Stub" #n "Ev:\n\t" \ + "movl $" #n ", %eax\n\t" \ + "jmp SharedStub\n\t" \ + ".size _ZN14nsXPTCStubBase" #m "Stub" #n "Ev,.-_ZN14nsXPTCStubBase" #m "Stub" #n "Ev\n\t" \ + ) + +#define STUB_ENTRY_10(n10,m) \ + STUB_ENTRY(n10##0,m); \ + STUB_ENTRY(n10##1,m); \ + STUB_ENTRY(n10##2,m); \ + STUB_ENTRY(n10##3,m); \ + STUB_ENTRY(n10##4,m); \ + STUB_ENTRY(n10##5,m); \ + STUB_ENTRY(n10##6,m); \ + STUB_ENTRY(n10##7,m); \ + STUB_ENTRY(n10##8,m); \ + STUB_ENTRY(n10##9,m) +STUB_ENTRY_10(,5); +STUB_ENTRY_10(1,6); +STUB_ENTRY_10(2,6); +STUB_ENTRY_10(3,6); +STUB_ENTRY_10(4,6); +STUB_ENTRY_10(5,6); +STUB_ENTRY_10(6,6); +STUB_ENTRY_10(7,6); +STUB_ENTRY_10(8,6); +STUB_ENTRY_10(9,6); +STUB_ENTRY_10(10,7); +STUB_ENTRY_10(11,7); +STUB_ENTRY_10(12,7); +STUB_ENTRY_10(13,7); +STUB_ENTRY_10(14,7); +STUB_ENTRY_10(15,7); +STUB_ENTRY_10(16,7); +STUB_ENTRY_10(17,7); +STUB_ENTRY_10(18,7); +STUB_ENTRY_10(19,7); +STUB_ENTRY_10(20,7); +STUB_ENTRY_10(21,7); +STUB_ENTRY_10(22,7); +STUB_ENTRY_10(23,7); +STUB_ENTRY_10(24,7); + + +// static nsresult SharedStub(PRUint32 methodIndex) +asm(".section .text\n\t" + ".align 2\n\t" + ".type SharedStub,@function\n\t" + "SharedStub:\n\t" + // make room for gpregs (48), fpregs (64) + "pushq %rbp\n\t" + "movq %rsp,%rbp\n\t" + "subq $112,%rsp\n\t" + // save GP registers + "movq %rdi,-112(%rbp)\n\t" + "movq %rsi,-104(%rbp)\n\t" + "movq %rdx, -96(%rbp)\n\t" + "movq %rcx, -88(%rbp)\n\t" + "movq %r8 , -80(%rbp)\n\t" + "movq %r9 , -72(%rbp)\n\t" + "leaq -112(%rbp),%rcx\n\t" + // save FP registers + "movsd %xmm0,-64(%rbp)\n\t" + "movsd %xmm1,-56(%rbp)\n\t" + "movsd %xmm2,-48(%rbp)\n\t" + "movsd %xmm3,-40(%rbp)\n\t" + "movsd %xmm4,-32(%rbp)\n\t" + "movsd %xmm5,-24(%rbp)\n\t" + "movsd %xmm6,-16(%rbp)\n\t" + "movsd %xmm7, -8(%rbp)\n\t" + "leaq -64(%rbp),%r8\n\t" + // rdi has the 'self' pointer already + "movl %eax,%esi\n\t" + "leaq 16(%rbp),%rdx\n\t" + "call PrepareAndDispatch@plt\n\t" + "leave\n\t" + "ret\n\t" + ".size SharedStub,.-SharedStub"); + + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +SENTINEL_ENTRY(0) +SENTINEL_ENTRY(1) +SENTINEL_ENTRY(2) +SENTINEL_ENTRY(3) +SENTINEL_ENTRY(4) + +#else +#error "Unsupported compiler. Use gcc >= 3.1 for Linux/x86-64." +#endif /* __GNUC__ */ diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_solaris.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_solaris.cpp new file mode 100644 index 00000000..d4ae7667 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_solaris.cpp @@ -0,0 +1,165 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org Code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Implement shared vtbl methods. */ + +#include "xptcprivate.h" +#include "xptc_platforms_unixish_x86.h" + +static nsresult +PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, PRUint32* args) +{ +#define PARAM_BUFFER_COUNT 16 + + nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT]; + nsXPTCMiniVariant* dispatchParams = NULL; + nsIInterfaceInfo* iface_info = NULL; + const nsXPTMethodInfo* info = NULL; + 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"); + if (!iface_info) + return NS_ERROR_UNEXPECTED; + + iface_info->GetMethodInfo(PRUint16(methodIndex), &info); + NS_ASSERTION(info,"no method info"); + if (!info) + return NS_ERROR_UNEXPECTED; + + 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"); + if (!dispatchParams) + return NS_ERROR_OUT_OF_MEMORY; + + 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 + dp->val.p = (void*) *ap; + switch(type) + { + case nsXPTType::T_I64 : dp->val.i64 = *((PRInt64*) ap); ap++; break; + case nsXPTType::T_U64 : dp->val.u64 = *((PRUint64*)ap); ap++; break; + case nsXPTType::T_DOUBLE : dp->val.d = *((double*) ap); ap++; break; + } + } + + result = self->CallMethod((PRUint16)methodIndex, info, dispatchParams); + + NS_RELEASE(iface_info); + + if(dispatchParams != paramBuffer) + delete [] dispatchParams; + + return result; +} + +#ifdef __GNUC__ /* Gnu Compiler. */ +#define STUB_ENTRY(n) \ +nsresult nsXPTCStubBase::Stub##n() \ +{ \ + register nsresult (*method) (nsXPTCStubBase *, uint32, PRUint32 *) = PrepareAndDispatch; \ + int temp0, temp1; \ + register nsresult result; \ + __asm__ __volatile__( \ + "leal 0x0c(%%ebp), %%ecx\n\t" /* args */ \ + "pushl %%ecx\n\t" \ + "pushl $"#n"\n\t" /* method index */ \ + "movl 0x08(%%ebp), %%ecx\n\t" /* this */ \ + "pushl %%ecx\n\t" \ + "call *%%edx\n\t" /* PrepareAndDispatch */ \ + "addl $12, %%esp" \ + : "=a" (result), /* %0 */ \ + "=&c" (temp0), /* %1 */ \ + "=d" (temp1) /* %2 */ \ + : "2" (method) /* %2 */ \ + : "memory" ); \ + return result; \ +} + +#elif defined(__SUNPRO_CC) /* Sun Workshop Compiler. */ + +#define STUB_ENTRY(n) \ +nsresult nsXPTCStubBase::Stub##n() \ +{ \ + asm ( \ + "\n\t leal 0x0c(%ebp), %ecx\t / args" \ + "\n\t pushl %ecx" \ + "\n\t pushl $"#n"\t / method index" \ + "\n\t movl 0x08(%ebp), %ecx\t / this" \ + "\n\t pushl %ecx" \ + "\n\t call __1cSPrepareAndDispatch6FpnOnsXPTCStubBase_IpI_I_\t / PrepareAndDispatch" \ + "\n\t addl $12, %esp" \ + ); \ +/* result == %eax */ \ + if(0) /* supress "*** is expected to return a value." error */ \ + return 0; \ +} + +#else +#error "can't find a compiler to use" +#endif /* __GNUC__ */ + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/win32/.cvsignore b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/win32/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/win32/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/win32/Makefile.in b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/win32/Makefile.in new file mode 100644 index 00000000..0de74ee2 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/win32/Makefile.in @@ -0,0 +1,82 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1998 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = ../../../../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = xpcom +LIBRARY_NAME = xptcmd + +# +# The default is this buildable, but non-functioning code. +# +ifdef GNU_CXX +CPPSRCS = \ + ../unix/xptcinvoke_gcc_x86_unix.cpp \ + xptcstubs.cpp \ + $(NULL) +LOCAL_INCLUDES = -I$(srcdir)/../unix +DEFINES += -DMOZ_USE_STDCALL -DMOZ_NEED_LEADING_UNDERSCORE +else +CPPSRCS = xptcinvoke.cpp xptcstubs.cpp +endif + + +# Force use of PIC +FORCE_USE_PIC = 1 + +include $(topsrcdir)/config/config.mk + +ifeq ($(CPU),ALPHA) +CPPSRCS := xptcinvoke_alpha.cpp xptcstubs_alpha.cpp +ASFILES := xptcinvoke_asm_alpha.s xptcstubs_asm_alpha.s +AS := asaxp +ASFLAGS += /I../../..public +endif + +# we don't want the shared lib, but we want to force the creation of a static lib. +FORCE_STATIC_LIB = 1 + +include $(topsrcdir)/config/rules.mk + +DEFINES += -DEXPORT_XPTC_API -D_IMPL_NS_COM -D_IMPL_NS_BASE + +LOCAL_INCLUDES += -I$(srcdir)/../.. diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/win32/xptcinvoke.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/win32/xptcinvoke.cpp new file mode 100644 index 00000000..9fbf2f94 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/win32/xptcinvoke.cpp @@ -0,0 +1,107 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + +#include "xptcprivate.h" + +#ifndef WIN32 +#error "This code is for Win32 only" +#endif + +static void __fastcall +invoke_copy_to_stack(PRUint32* d, PRUint32 paramCount, nsXPTCVariant* s) +{ + for(; paramCount > 0; paramCount--, d++, s++) + { + if(s->IsPtrData()) + { + *((void**)d) = s->ptr; + continue; + } + switch(s->type) + { + case nsXPTType::T_I8 : *((PRInt8*) d) = s->val.i8; break; + case nsXPTType::T_I16 : *((PRInt16*) d) = s->val.i16; break; + case nsXPTType::T_I32 : *((PRInt32*) d) = s->val.i32; break; + case nsXPTType::T_I64 : *((PRInt64*) d) = s->val.i64; d++; break; + case nsXPTType::T_U8 : *((PRUint8*) d) = s->val.u8; break; + case nsXPTType::T_U16 : *((PRUint16*)d) = s->val.u16; break; + case nsXPTType::T_U32 : *((PRUint32*)d) = s->val.u32; break; + case nsXPTType::T_U64 : *((PRUint64*)d) = s->val.u64; d++; break; + case nsXPTType::T_FLOAT : *((float*) d) = s->val.f; break; + case nsXPTType::T_DOUBLE : *((double*) d) = s->val.d; d++; break; + case nsXPTType::T_BOOL : *((PRBool*) d) = s->val.b; break; + case nsXPTType::T_CHAR : *((char*) d) = s->val.c; break; + case nsXPTType::T_WCHAR : *((wchar_t*) d) = s->val.wc; break; + default: + // all the others are plain pointer types + *((void**)d) = s->val.p; + break; + } + } +} + +#pragma warning(disable : 4035) // OK to have no return value +__declspec(naked) XPTC_PUBLIC_API(nsresult) +XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params) +{ + __asm { + push ebp + mov ebp,esp + mov edx,paramCount // Save paramCount for later + test edx,edx // maybe we don't have any params to copy + jz noparams + mov eax,edx + shl eax,3 // *= 8 (max possible param size) + sub esp,eax // make space for params + mov ecx,esp + push params + call invoke_copy_to_stack // fastcall, ecx = d, edx = paramCount, params is on the stack +noparams: + mov ecx,that // instance in ecx + push ecx // push this + mov edx,[ecx] // vtable in edx + mov eax,methodIndex + call [edx][eax*4] // stdcall, i.e. callee cleans up stack. + mov esp,ebp + pop ebp + ret + } +} +#pragma warning(default : 4035) // restore default diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/win32/xptcinvoke_alpha.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/win32/xptcinvoke_alpha.cpp new file mode 100644 index 00000000..06334ac0 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/win32/xptcinvoke_alpha.cpp @@ -0,0 +1,171 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + +/* contributed by bob meader <bob@guiduck.com> */ + +#include "xptcprivate.h" + +extern "C" uint32 +invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s) +{ + return(paramCount*2); +} + +extern "C" void +invoke_copy_to_stack(PRUint64* d, PRUint32 paramCount, + nsXPTCVariant* s, PRUint64 *regs) +{ +#define N_ARG_REGS 5 /* 6 regs minus 1 for "this" ptr */ + + for (PRUint32 i = 0; i < paramCount; i++, s++) + { + if (s->IsPtrData()) { + if (i < N_ARG_REGS) + regs[i] = (PRUint32)s->ptr; + else + *((PRUint32*)d++) = (PRUint32)s->ptr; + continue; + } + switch (s->type) { + // + // signed types first + // + case nsXPTType::T_I8: + if (i < N_ARG_REGS) + ((PRInt64*)regs)[i] = s->val.i8; + else + *((PRInt8 *)d++) = s->val.i8; + break; + case nsXPTType::T_I16: + if (i < N_ARG_REGS) + ((PRInt64*)regs)[i] = s->val.i16; + else + *((PRInt16 *)d++) = s->val.i16; + break; + case nsXPTType::T_I32: + if (i < N_ARG_REGS) + ((PRInt64*)regs)[i] = s->val.i32; + else + *((PRUint32*)d++) = s->val.i32; + break; + case nsXPTType::T_I64: + if (i < N_ARG_REGS) + ((PRInt64*)regs)[i] = s->val.i64; + else + *((PRInt64*)d++) = s->val.i64; + break; + // + // unsigned types next + // + case nsXPTType::T_U8: + if (i < N_ARG_REGS) + regs[i] = s->val.u8; + else + *((PRUint8 *)d++) = s->val.u8; + break; + case nsXPTType::T_U16: + if (i < N_ARG_REGS) + regs[i] = s->val.u16; + else + *((PRUint16 *)d++) = s->val.u16; + break; + case nsXPTType::T_U32: + if (i < N_ARG_REGS) + regs[i] = s->val.u32; + else + *((PRUint32*)d++) = s->val.u32; + break; + case nsXPTType::T_U64: + if (i < N_ARG_REGS) + regs[i] = s->val.u64; + else + *((PRUint64*)d++) = s->val.u64; + break; + case nsXPTType::T_FLOAT: + if (i < N_ARG_REGS) + ((double*)regs)[i] = s->val.f; + else + *((float*)d++) = s->val.f; + break; + case nsXPTType::T_DOUBLE: + if (i < N_ARG_REGS) + ((double*)regs)[i] = s->val.d; + else + *((double*)d++) = s->val.d; + break; + case nsXPTType::T_BOOL: + if (i < N_ARG_REGS) + regs[i] = s->val.b; + else + *((PRBool*)d++) = s->val.b; + break; + case nsXPTType::T_CHAR: + if (i < N_ARG_REGS) + regs[i] = s->val.c; + else + *((char*)d++) = s->val.c; + break; + case nsXPTType::T_WCHAR: + if (i < N_ARG_REGS) + regs[i] = s->val.wc; + else + *((wchar_t*)d++) = s->val.wc; + break; + default: + // all the others are plain pointer types + if (i < N_ARG_REGS) + regs[i] = (PRUint32)s->val.p; + else + *((PRUint32*)d++) = (PRUint32)s->val.p; + break; + } + } +} + +extern "C" nsresult XPTC__InvokebyIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params); + +extern "C" +XPTC_PUBLIC_API(nsresult) +XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params) +{ + return XPTC__InvokebyIndex(that, methodIndex, paramCount, params); +} + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/win32/xptcinvoke_asm_alpha.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/win32/xptcinvoke_asm_alpha.s new file mode 100644 index 00000000..7f8b343b --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/win32/xptcinvoke_asm_alpha.s @@ -0,0 +1,128 @@ +.text +.globl invoke_count_words +.globl invoke_copy_to_stack + +#define v0 $0 +#define t0 $1 +#define t1 $2 +#define t2 $3 +#define t3 $4 +#define s0 $9 +#define fp $15 +#define a0 $16 +#define a1 $17 +#define a2 $18 +#define a3 $19 +#define a4 $20 +#define a5 $21 +#define t9 $23 +#define ra $26 +#define gp $29 +#define sp $30 +#define zero $31 +#define f0 $f0 + +#define LOCALSZ 7 +#define NARG 2 +#define SZREG 8 +#define FRAMESZ ((NARG+LOCALSZ)*SZREG) +RAOFF=FRAMESZ-(1*SZREG) +A0OFF=FRAMESZ-(2*SZREG) +A1OFF=FRAMESZ-(3*SZREG) +A2OFF=FRAMESZ-(4*SZREG) +A3OFF=FRAMESZ-(5*SZREG) +S0OFF=FRAMESZ-(6*SZREG) +GPOFF=FRAMESZ-(7*SZREG) + +// +// Nested +// XPTC__InvokebyIndex( that, methodIndex, paramCount, params) +// a0 a1 a2 a3 +// + .text + .align 4 + .globl XPTC__InvokebyIndex + .ent XPTC__InvokebyIndex,0 +XPTC__InvokebyIndex: + .frame sp, FRAMESZ, ra + subl sp,FRAMESZ,sp // allocate stack space for structure + stq ra, RAOFF(sp) + stq a0, A0OFF(sp) + stq a1, A1OFF(sp) + stq a2, A2OFF(sp) + stq a3, A3OFF(sp) + stq s0, S0OFF(sp) +// stq gp, GPOFF(sp) Don't think I am to save gp + + // invoke_count_words(paramCount, params) + bis a2,zero,a0 // move a2 into a0 + bis a3,zero,a1 // move a3 into a1 + bsr ra,invoke_count_words + + // invoke_copy_to_stack + ldq a1, A2OFF(sp) // a1 = paramCount + ldq a2, A3OFF(sp) // a2 = params + + // save sp before we copy the params to the stack + bis sp,zero,t0 // t0 = sp + + // assume full size of 8 bytes per param to be safe + sll v0,4,v0 //v0 = 8 bytes * num params + subl sp,v0,sp //sp = sp - v0 + bis sp,zero,a0 //a0 = param stack address + + // create temporary stack space to write int and fp regs + subl sp,64,sp //sp = sp -64 // (64 = 8 regs of eight bytes) + bis sp,zero,a3 // a3 = sp + + // save the old sp and save the arg stack + subl sp,16,sp //sp = sp -16 + stq t0,0(sp) + stq a0,8(sp) + // copy the param into the stack areas + bsr ra,invoke_copy_to_stack + + ldq t3,8(sp) // get previous a0 + ldq sp,0(sp) // get orig sp back + + ldq a0,A0OFF(sp) // a0 = that + ldq a1,A1OFF(sp) // a1 = methodIndex + + // calculate jmp address from method index + ldl t1,0(a0) // t1 = *that + sll a1,2,a1 // a1 = 4*index + addl t1,a1,t9 + ldl t9,0(t9) // t9=*(that + 4*index) + + // get register save area from invoke_copy_to_stack + subl t3,64,t1 + + // a1..a5 and f17..f21 should now be set to what + // invoke_copy_to_stack told us. skip a0 and f16 + // because that's the "this" pointer + + ldq a1,0(t1) + ldq a2,8(t1) + ldq a3,16(t1) + ldq a4,24(t1) + ldq a5,32(t1) + + ldt $f17,0(t1) + ldt $f18,8(t1) + ldt $f19,16(t1) + ldt $f20,24(t1) + ldt $f21,32(t1) + + // save away our stack point and create + // the stack pointer for the function + bis sp,zero,s0 + bis t3,zero,sp + jsr ra,(t9) + bis s0,zero,sp + ldq ra,RAOFF(sp) + ldq s0,S0OFF(sp) + addl sp,FRAMESZ,sp + ret + +.end XPTC__InvokebyIndex + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/win32/xptcstubs.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/win32/xptcstubs.cpp new file mode 100644 index 00000000..bd5ab975 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/win32/xptcstubs.cpp @@ -0,0 +1,202 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Implement shared vtbl methods. */ + +#include "xptcprivate.h" + +#ifndef WIN32 +#error "This code is for Win32 only" +#endif + +extern "C" { + +static nsresult __stdcall +PrepareAndDispatch(nsXPTCStubBase* self, PRUint32 methodIndex, + PRUint32* args, PRUint32* stackBytesToPop) +{ +#define PARAM_BUFFER_COUNT 16 + + nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT]; + nsXPTCMiniVariant* dispatchParams = NULL; + nsIInterfaceInfo* iface_info = NULL; + const nsXPTMethodInfo* info = NULL; + PRUint8 paramCount; + PRUint8 i; + nsresult result = NS_ERROR_FAILURE; + + // If anything fails before stackBytesToPop can be set then + // the failure is completely catastrophic! + + 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; + } + } + *stackBytesToPop = ((PRUint32)ap) - ((PRUint32)args); + + result = self->CallMethod((PRUint16)methodIndex, info, dispatchParams); + + NS_RELEASE(iface_info); + + if(dispatchParams != paramBuffer) + delete [] dispatchParams; + + return result; +} + +} // extern "C" + +// declspec(naked) is broken in gcc +#ifndef __GNUC__ +static +__declspec(naked) +void SharedStub(void) +{ + __asm { + push ebp // set up simple stack frame + mov ebp, esp // stack has: ebp/vtbl_index/retaddr/this/args + push ecx // make room for a ptr + lea eax, [ebp-4] // pointer to stackBytesToPop + push eax + lea eax, [ebp+12] // pointer to args + push eax + push ecx // vtbl_index + mov eax, [ebp+8] // this + push eax + call PrepareAndDispatch + mov edx, [ebp+4] // return address + mov ecx, [ebp-4] // stackBytesToPop + add ecx, 8 // for 'this' and return address + mov esp, ebp + pop ebp + add esp, ecx // fix up stack pointer + jmp edx // simulate __stdcall return + } +} + +// these macros get expanded (many times) in the file #included below +#define STUB_ENTRY(n) \ +__declspec(naked) nsresult __stdcall nsXPTCStubBase::Stub##n() \ +{ __asm mov ecx, n __asm jmp SharedStub } + +#else + +#define STUB_ENTRY(n) \ +nsresult __stdcall nsXPTCStubBase::Stub##n() \ +{ \ + PRUint32 *args, stackBytesToPop = 0; \ + nsresult result = 0; \ + nsXPTCStubBase *obj; \ + __asm__ __volatile__ ( \ + "leal 0x0c(%%ebp), %%ecx\n\t" /* args */ \ + "movl 0x08(%%ebp), %%edx\n\t" /* this */ \ + : "=c" (args), \ + "=d" (obj)); \ + result = PrepareAndDispatch(obj, n, args, &stackBytesToPop); \ + return result; \ +} + +#endif /* __GNUC__ */ + +#define SENTINEL_ENTRY(n) \ +nsresult __stdcall nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#ifdef _MSC_VER +#pragma warning(disable : 4035) // OK to have no return value +#endif +#include "xptcstubsdef.inc" +#ifdef _MSC_VER +#pragma warning(default : 4035) // restore default +#endif + +void +#ifdef __GNUC__ +__cdecl +#endif +xptc_dummy() +{ +} diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/win32/xptcstubs_alpha.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/win32/xptcstubs_alpha.cpp new file mode 100644 index 00000000..69a10e70 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/win32/xptcstubs_alpha.cpp @@ -0,0 +1,228 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Implement shared vtbl methods. */ + +#include "xptcprivate.h" + +/* contributed by bob meader <bob@guiduck.com> */ + +/* + * This is for Alpha /NT 32 bits + * + * When we're called, the "gp" registers are stored in gprData and + * the "fp" registers are stored in fprData. There are 6 regs + * available which coorespond to the first 5 parameters of the + * function and the "this" pointer. If there are additional parms, + * they are stored on the stack at address "args". + * + */ +extern "C" nsresult +PrepareAndDispatch(nsXPTCStubBase* self, PRUint32 methodIndex, PRUint64* args, + PRUint64 *gprData, double *fprData) +{ +#define PARAM_BUFFER_COUNT 16 +#define PARAM_GPR_COUNT 5 +#define PARAM_FPR_COUNT 5 + + 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"); + + PRUint64* ap = args; + PRUint32 iCount = 0; + for(i = 0; i < paramCount; i++) + { + const nsXPTParamInfo& param = info->GetParam(i); + const nsXPTType& type = param.GetType(); + nsXPTCMiniVariant* dp = &dispatchParams[i]; + + if(param.IsOut() || !type.IsArithmetic()) + { + if (iCount < PARAM_GPR_COUNT) + dp->val.p = (void*)gprData[iCount++]; + else + dp->val.p = (void*)ap++; + continue; + } + // else + switch(type) + { + case nsXPTType::T_I8: + if (iCount < PARAM_GPR_COUNT) + dp->val.i8 = (PRInt8)gprData[iCount++]; + else + dp->val.i8 = *((PRInt8*)ap++); + break; + + case nsXPTType::T_I16: + if (iCount < PARAM_GPR_COUNT) + dp->val.i16 = (PRInt16)gprData[iCount++]; + else + dp->val.i16 = *((PRInt16*)ap++); + break; + + case nsXPTType::T_I32: + if (iCount < PARAM_GPR_COUNT) + dp->val.i32 = (PRInt32)gprData[iCount++]; + else + dp->val.i32 = *((PRInt32*)ap++); + break; + + case nsXPTType::T_I64: + if (iCount < PARAM_GPR_COUNT) + dp->val.i64 = (PRInt64)gprData[iCount++]; + else + dp->val.i64 = *((PRInt64*)ap++); + break; + + case nsXPTType::T_U8: + if (iCount < PARAM_GPR_COUNT) + dp->val.u8 = (PRUint8)gprData[iCount++]; + else + dp->val.u8 = *((PRUint8*)ap++); + break; + + case nsXPTType::T_U16: + if (iCount < PARAM_GPR_COUNT) + dp->val.u16 = (PRUint16)gprData[iCount++]; + else + dp->val.u16 = *((PRUint16*)ap++); + break; + + case nsXPTType::T_U32: + if (iCount < PARAM_GPR_COUNT) + dp->val.u32 = (PRUint32)gprData[iCount++]; + else + dp->val.u32 = *((PRUint32*)ap++); + break; + + case nsXPTType::T_U64: + if (iCount < PARAM_GPR_COUNT) + dp->val.u64 = (PRUint64)gprData[iCount++]; + else + dp->val.u64 = (PRUint64)*ap++; + break; + + case nsXPTType::T_FLOAT: + if (iCount < PARAM_FPR_COUNT) + dp->val.f = (float)fprData[iCount++]; + else + dp->val.f = *((float*)ap++); + break; + + case nsXPTType::T_DOUBLE: + if (iCount < PARAM_FPR_COUNT) + dp->val.d = (double)fprData[iCount++]; + else + dp->val.d = *((double*)ap++); + break; + + case nsXPTType::T_BOOL: + if (iCount < PARAM_GPR_COUNT) + dp->val.b = (PRBool)gprData[iCount++]; + else + dp->val.b = *((PRBool*)ap++); + break; + + case nsXPTType::T_CHAR: + if (iCount < PARAM_GPR_COUNT) + dp->val.c = (char)gprData[iCount++]; + else + dp->val.c = *((char*)ap++); + break; + + case nsXPTType::T_WCHAR: + if (iCount < PARAM_GPR_COUNT) + dp->val.wc = (wchar_t)gprData[iCount++]; + else + 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; +} + +#define STUB_ENTRY(n) /* defined in the assembly file */ + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" + +void +xptc_dummy() +{ +} + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/win32/xptcstubs_asm_alpha.s b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/win32/xptcstubs_asm_alpha.s new file mode 100644 index 00000000..5f8f861d --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/win32/xptcstubs_asm_alpha.s @@ -0,0 +1,120 @@ + +#define v0 $0 // return value register +#define t0 $1 // caller saved (temporary) registers +#define t1 $2 // +#define t2 $3 // +#define t3 $4 // +#define t4 $5 // +#define t5 $6 // +#define t6 $7 // +#define t7 $8 // +#define s0 $9 // callee saved (nonvolatile) registers +#define a0 $16 // argument registers +#define a1 $17 // +#define a2 $18 // +#define a3 $19 // +#define a4 $20 // +#define a5 $21 // +#define t8 $22 // caller saved (temporary) registers +#define t9 $23 // +#define t10 $24 // +#define t11 $25 // +#define ra $26 // return address register +#define sp $30 // stack pointer register +#define zero $31 // zero register +#define f16 $f16 // argument registers +#define f17 $f17 // +#define f18 $f18 // +#define f19 $f19 // +#define f20 $f20 // +#define f21 $f21 // + +#define NARGSAVE 2 +#define LOCALSZ 16 +#define SZREG 8 +#define FRAMESZ (NARGSAVE+LOCALSZ)*SZREG + + .text + .globl PrepareAndDispatch + +A1OFF=FRAMESZ-(9*SZREG) +A2OFF=FRAMESZ-(8*SZREG) +A3OFF=FRAMESZ-(7*SZREG) +A4OFF=FRAMESZ-(6*SZREG) +A5OFF=FRAMESZ-(5*SZREG) +A6OFF=FRAMESZ-(4*SZREG) //not used +A7OFF=FRAMESZ-(3*SZREG) //not used +GPOFF=FRAMESZ-(2*SZREG) //not used +RAOFF=FRAMESZ-(1*SZREG) + +F16OFF=FRAMESZ-(16*SZREG) //not used +F17OFF=FRAMESZ-(15*SZREG) +F18OFF=FRAMESZ-(14*SZREG) +F19OFF=FRAMESZ-(13*SZREG) +F20OFF=FRAMESZ-(12*SZREG) +F21OFF=FRAMESZ-(11*SZREG) +F22OFF=FRAMESZ-(10*SZREG) // not used + +#define NESTED_ENTRY(Name, fsize, retrg) \ + .text; \ + .align 4; \ + .globl Name; \ + .ent Name, 0; \ +Name:; \ + .frame sp, fsize, retrg; + +#define SENTINEL_ENTRY(nn) +#define STUB_ENTRY(nn) MAKE_PART(nn,@nsXPTCStubBase@@UAAIXZ ) + +#define MAKE_PART(aa, bb) MAKE_STUB(aa, ?Stub##aa##bb ) + +#define MAKE_STUB(nn, name) \ +NESTED_ENTRY(name, FRAMESZ,ra); \ + subl sp,FRAMESZ,sp; \ + mov nn,t0; \ + jmp sharedstub; \ +.end name; + +#include "xptcstubsdef.inc" + + .globl sharedstub + .ent sharedstub +sharedstub: + stq a1,A1OFF(sp) + stq a2,A2OFF(sp) + stq a3,A3OFF(sp) + stq a4,A4OFF(sp) + stq a5,A5OFF(sp) + stq ra,RAOFF(sp) + + stt f17,F17OFF(sp) + stt f18,F18OFF(sp) + stt f19,F19OFF(sp) + stt f20,F20OFF(sp) + stt f21,F21OFF(sp) + + // t0 is methodIndex + bis t0,zero,a1 // a1 = methodIndex + + // a2 is stack address where extra function params + // are stored that do not fit in registers + bis sp,zero,a2 //a2 = sp + addl a2,FRAMESZ,a2 //a2+=FRAMESZ + + // a3 is stack addrss of a1..a5 + bis sp,zero,a3 //a3 = sp + addl a3,A1OFF,a3 //a3+=A1OFF + + // a4 is stack address of f17..f21 + bis sp,zero,a4 //a4 = sp + addl a4,F17OFF,a4 //a4+=F17OFF + + // PrepareAndDispatch(that, methodIndex, args, gprArgs, fpArgs) + // a0 a1 a2 a3 a4 + bsr PrepareAndDispatch + ldq ra,RAOFF(sp) + addl sp,FRAMESZ,sp + ret + +.end sharedstub + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/xptcall.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/xptcall.cpp new file mode 100644 index 00000000..f25a94e5 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/xptcall.cpp @@ -0,0 +1,62 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* entry point wrappers. */ + +#if defined(XP_MAC) +#pragma export on +#endif + +#include "xptcprivate.h" + +// This method is never called and is only here so the compiler +// will generate a vtbl for this class. +// *Needed by the Irix implementation.* +NS_IMETHODIMP nsXPTCStubBase::QueryInterface(REFNSIID aIID, + void** aInstancePtr) +{ + NS_ASSERTION(0,"wowa! nsXPTCStubBase::QueryInterface called"); + return NS_ERROR_FAILURE; +} +#if defined(XP_MAC) +#pragma export off +#endif + +void +xptc_dummy2() +{ +} diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/xptcprivate.h b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/xptcprivate.h new file mode 100644 index 00000000..3691fa0a --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/xptcprivate.h @@ -0,0 +1,45 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* All the xptcall private declarations - only include locally. */ + +#ifndef xptcprivate_h___ +#define xptcprivate_h___ + +#include "xptcall.h" + +#endif /* xptcprivate_h___ */ diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/status.html b/src/libs/xpcom18a4/xpcom/reflect/xptcall/status.html new file mode 100644 index 00000000..e3686999 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/status.html @@ -0,0 +1,404 @@ +<html> +<head> +<title>xptcall Porting Status</title> +</head> +<body bgcolor = "white"> +<h2><center>xptcall Porting Status</center></h2> + +<h3>What is this?</h3> + +This is a status page for the multiplatform porting of xptcall. +xptcall has a +<a href="http://www.mozilla.org/scriptable/xptcall-faq.html">FAQ</a> +and a +<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/porting.html">Porting Guide</a>. + +<p> + +This is being maintained by <a href="mailto:jband@netscape.com">John Bandhauer <jband@netscape.com></a>. +Feel free to email me with questions or to volunteer to contribute xptcall code for any platform. + +<p> + +<a href="mailto:shaver@mozilla.org">Mike Shaver <shaver@mozilla.org></a> +is the best contact regarding 'nix (Unix, Linux, Finux, etc.) ports of xptcall. + +<h3>Status</h3> + +<table BORDER="1"> +<TR align="left" BGCOLOR="yellow"> +<TH>Status</TH> +<TH>Platform</TH> +<TH><img src="http://tinderbox.mozilla.org/star.gif">Contributors and <font color="red"><b>?</b></font> Possible Contributors</TH> +<TH>Notes</TH> +</TR> + +<TR> +<TD bgcolor="green"><font color="white"><b>Done</b></font></TD> +<TD>Win32 x86</TD> +<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:jband@netscape.com">John Bandhauer <jband@netscape.com></a> +</TD> +<TD> +<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/win32">win32</a></TD> +</TR> + +<TR> +<TD bgcolor="green"><font color="white"><b>Done</b></font></TD> +<TD>Linux x86</TD> +<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:jband@netscape.com">John Bandhauer <jband@netscape.com></a><br> +<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:drepper@cygnus.com">Ulrich Drepper <drepper@cygnus.com></a> +</TD> +<TD><a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/unix">unix</a> +</TD> +</TR> + +<TR> +<TD bgcolor="green"><font color="white"><b>Done</b></font></TD> +<TD>FreeBSD and NetBSD x86</TD> +<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:toshok@hungry.com">Christoph Toshok <toshok@hungry.com></a>,<BR> +<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:jband@netscape.com">John Bandhauer <jband@netscape.com></a></TD> +<TD><a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/unix">unix</a> (same as Linux 86 code)</TD> +</TR> + +<TR> +<TD bgcolor="green"><font color="white"><b>Done</b></font></TD> +<TD>BSD/OS x86</TD> +<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:bert_driehuis@nl.compuware.com">Bert Driehuis <bert_driehuis@nl.compuware.com></a></TD> +<TD><a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/unix">unix</a> (same as Linux 86 code) +Bert contributed patches that *should* do the right thing for all the unixish-x86 +versions of this code for GCC 2.7 or 2.8 vs. EGCS 1.1. He notes that the vtbl +scheme is different. He is hoping that others will help test the changes using +these two compilers on the various platforms where this same code is used. +<a href="news://news.mozilla.org/372DD257.4248C821%40nl.compuware.com">Bert's details</a> +</TD> +</TR> + +<TR> +<TD bgcolor="green"><font color="white"><b>Done</b></font></TD> +<TD>Mac PPC</TD> +<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> + <a href="mailto:rogerl@netscape.com">Roger Lawrence <rogerl@netscape.com></a>,<BR> +<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:beard@netscape.com">Patrick Beard <beard@netscape.com></a> +</TD> +<TD><a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/mac">mac</a> (passing tests and checked in)</TD> +</TR> + +<TR> +<TD bgcolor="green"><font color="white"><b>Done</b></font></TD> +<TD>Solaris Sparc</TD> +<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:rogerl@netscape.com">Roger Lawrence <rogerl@netscape.com></a>,<BR> +<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:mcafee@netscape.com">Chris McAfee <mcafee@netscape.com></a> +</TD> +<TD><a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/unix">unix</a> This is checked in and working.</TD> +</TR> + +<TR> +<TD bgcolor="green"><font color="white"><b>Done</b></font></TD> +<TD>Solaris Sparc v9 (64bit)</TD> +<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:pavlov@netscape.com">Stuart Parmenter <pavlov@netscape.com></a>,<BR> +<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:cls@seawood.org">Chris Seawood <cls@seawood.org></a> +</TD> +<TD><a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/unix">unix</a> This is checked in and (pavlov claims!) working.</TD> +</TR> + +<TR> +<TD bgcolor="green"><font color="white"><b>Done</b></font></TD> +<TD>OS/2</TD> +<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:mjf35@cam.ac.uk">John Fairhurst <mjf35@cam.ac.uk></a></TD> +<TD>I never heard exactly who did what. But mozilla has been working on OS/2 +for a long time now. +</TD> +</TR> + +<TR> +<TD bgcolor="green"><font color="white"><b>Done</b></font></TD> +<TD>OpenVMS Alpha</TD> +<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:colin@theblakes.com">Colin R. Blake <colin@theblakes.com></a></TD> +<TD> +Colin says this is passing all the tests on OpenVMS Alpha! +</TD> +</TR> + +<TR> +<TD bgcolor="green"><font color="white"><b>Done</b></font></TD> +<TD>NT Alpha</TD> +<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:bob@guiduck.com">bob meader <bob@guiduck.com></a></TD> +<TD> +bob writes:<br> +Enclosed is xptcall for alpha/nt target.. +<p> +It is a variation of the IRIS port (only targeted for win32). +<p> +Notice the last 2 files (the change to mozilla\xpcom\build\makefile.win and +mozilla\xpcom\build) are needed because I was unable to figure how to do a +"declspecexport" from the assembler ASAXP ... if some knows how to do that then +those last 2 files won't be needed. +<p> +I have had someone look over this code at bridge.com (the entry point to +compaq/gem compiler team) and this code was given the OK. I consider it "done". +<p> +This code lives in the files where the name includes 'alpha' in the <a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/win32">win32</a> directory.<BR> +</TD> +</TR> + +<TR> +<TD bgcolor="green"><font color="white"><b>Done</b></font></TD> +<TD>Linux ARM</TD> +<TD><img alt="Started" title="Started" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:sh990154@mail.uni-greifswald.de">Stefan Hanske<sh990154@mail.uni-greifswald.de></a><BR> +<font color="red"><b>?</b></font> +<a href="mailto:willy@bofh.ai">Matthew Wilcox <willy@bofh.ai></a></TD> +<TD> +Stefan's code is checked in and he says it is working. +</TD> +</TR> + +<TR> +<TD bgcolor="green"><font color="white"><b>Done</b></font></TD> +<TD>Linux Sparc</TD> +<TD> +<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:anton@progsoc.uts.edu.au">Anton Blanchard <anton@progsoc.uts.edu.au></a>, +<BR> +<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:rogerl@netscape.com">Roger Lawrence <rogerl@netscape.com></a>, +<BR> +<img alt="Maybe" title="Maybe" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:ehle.3@osu.eduehle.3@osu.edu">Brandon Ehle <ehle.3@osu.edu></a> +</TD> +<TD> +Anton contributed patches to Roger's Sparc code. Anton says it works and passes the tests!<b> +(24-Aug-1999) Brandon writes: I've finished testing XPTCALL Sparc Linux on 12 different Sparc machines and it checks out good. +</TD> +</TR> + +<TR> +<TD bgcolor="green"><font color="white"><b>Done</b></font></TD> +<TD>Linux PPC</TD> +<TD> +<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:beard@netscape.com">Patrick Beard <beard@netscape.com></a><BR> +<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:waterson@netscape.com">Chris Waterson <waterson@netscape.com></a><BR> +<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:Franz.Sirl-kernel@lauterbach.com">Franz Sirl <Franz.Sirl-kernel@lauterbach.com></a><BR> +<font color="red"><b>?</b></font> +<a href="mailto:jsproul@condor.fddi.wesleyan.edu">Jason Y. Sproul <jsproul@condor.fddi.wesleyan.edu></a><BR> + <font color="red"><b>?</b></font> + <a href="mailto:darkmane@w-link.net">Sean Chitwood <darkmane@w-link.net></a></TD> +<TD> +waterson said: <b>Mozilla runs on Linux/PPC</b> +</TD> +</TR> + +<TR> +<TD bgcolor="green"><font color="white"><b>Done</b></font></TD> +<TD>Linux Alpha</TD> +<TD> +<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:glen.nakamura@usa.net">Glen Nakamura <glen.nakamura@usa.net></a><BR> +<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:morrildl@nycap.rr.com">Dan Morril <morrildl@nycap.rr.com></a><BR> +</TD> +<TD> +Glen writes: +<p> +I am attaching a patch which contains my Linux Alpha xptcall code. +It passes TestXPTCInvoke and TestXPC on my machine which runs +kernel 2.2.7, glibc 2.1.1, and egcs 1.1.2. I have not tested it +with older GNU compilers such as gcc 2.8.x. From looking at the +Linux x86 code, I gather that the vtable layout is a little different +for those compilers and the code will need minor modifications +in order to work properly. +<p> +I am not sure how much of the code can be used for OpenVMS Alpha +and/or Digital UNIX. Currently the code is dependent on the g++ +name mangling convention and a few GNU extensions so I'm not sure +how useful it will be for the other systems. Hopefully the +comments in the code are detailed enough to help people attempting +a port. +<p> +</TD> +</TR> + +<TR> +<TD bgcolor="green"><font color="white"><b>Done</b></font></TD> +<TD>SunOS x86</TD> +<TD> +<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:aljones@lbl.gov">Arthur Jones <aljones@lbl.gov></a><BR> +<font color="red"><b>?</b></font> +<a href="mailto:ppokorny@mindspring.com">Philip Pokorny <ppokorny@mindspring.com></a><BR> +</TD> +<TD> +The word I hear is that this is working and done +</TD> +</TR> + +<TR> +<TD bgcolor="green"><font color="white"><b>Done</b></font></TD> +<TD>HP-UX</TD> +<TD> +<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:wang@cup.hp.com">Thomas Wang <wang@cup.hp.com></a><BR> +<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:mgleeson1@netscape.com">Mike Gleeson <mgleeson1@netscape.com></a> +</TD> +<TD>I hear that this code is checked in and working. Though, there is some +doubt - see bug +#<a href="http://bugzilla.mozilla.org/show_bug.cgi?id=17997">17997</a> +</TD> +</TR> + +<TR> +<TD bgcolor="green"><font color="white"><b>Done</b></font></TD> +<TD>AIX PPC</TD> +<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:jdunn@netscape.com">Jim Dunn <jdunn@netscape.com></a></TD> +<TD>Philip K. Warren writes: <BR> + +We have gone through several releases of AIX without any problems. +</TD> +</TR> + +<TR> +<TD bgcolor="green"><font color="white"><b>Done</b></font></TD> +<TD>Irix</TD> +<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:jasonh@m7.engr.sgi.com">Jason Heirtzler <jasonh@m7.engr.sgi.com></a><BR> +</TD> +<TD>Jason has declared this done. Jason is no longer working at SGI and will +not be maintaining this code. There is some doubt as to whether or not this is +working for everyone - see bug +#<a href="http://bugzilla.mozilla.org/show_bug.cgi?id=10061">10061</a>. +<a href="mailto:shaver@mozilla.org">Mike Shaver <shaver@mozilla.org></a> +is the interim maintainer until someone more suitable can be found. +</TD> +</TR> + +<TR> +<TD bgcolor="green"><font color="white"><b>Done</b></font></TD> +<TD>BeOS x86</TD> +<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:duncan@be.com">Duncan Wilcox <duncan@be.com></a><BR> +</TD> +<TD> +<a href="http://lxr.mozilla.org/mozilla/source/xpcom/reflect/xptcall/src/md/unix">unix</a> (yet another reuse of the Linux 86 code!)<BR> +Duncan says this is all working. He did the code for old cfront style 'this' adjustment for others to use too! +</TD> +</TR> + +<TR> +<TD bgcolor="red"><font color="white"><b>HELP!</b></font></TD> +<TD>BeOS PPC</TD> +<TD align="center">-</TD> +<TD align="center">-</TD> +</TR> + +<TR> +<TD bgcolor="green"><font color="white"><b>Done</b></font></TD> +<TD>Compaq Tru64 UNIX (Digital UNIX)</TD> +<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:streeter@zk3.dec.com">Steve Streeter <streeter@zk3.dec.com></a><BR> +</TD> +<TD>Code passes the tests and is checked in.</TD> +</TR> + +<TR> +<TD bgcolor="khaki"><font color="black"><b>Working</b></font></TD> +<TD>Neutrio x86</TD> +<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:Jerry.Kirk@Nexwarecorp.com">Jerry L. Kirk <Jerry.Kirk@Nexwarecorp.com></a><BR> +</TD> +<TD> +Patches for xptc*_unixish_x86.cpp checked in. Waiting for verification that this is really finished. +</TD> +</TR> + +<TR> +<TD bgcolor="khaki"><font color="black"><b>Investigating</b></font></TD> +<TD>SCO UW7 and OSR5</TD> +<TD> +<img alt="Investigating" title="Investigating" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:jkj@sco.com">J. Kean Johnston <jkj@sco.com></a><BR> +<img alt="Investigating" title="Investigating" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:evanh@sco.com">Evan Hunt <evanh@sco.com></a><BR> +</TD> +<TD>Recent (Feb-2001) email from jkj@sco.com suggests that work will be occuring soon.</TD> +</TR> + +<TR> +<TD bgcolor="khaki"><font color="black"><b>Works</b></font></TD> +<TD>NetBSD/m68k</TD> +<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:khym@bga.com">Dave Huang <khym@bga.com></a><BR> +</TD> +<TD> +Dave's changes are in the tree. Waiting for verification that it is really finished.</TD> +</TR> + +<TR> +<TD bgcolor="khaki"><font color="black"><b>Partially Working</b></font></TD> +<TD>NetBSD/arm32</TD> +<TD><img alt="Investigating" title="Investigating" src="http://tinderbox.mozilla.org/star.gif"> +<a href="mailto:mpumford@black-star.demon.co.uk">Mike Pumford <mpumford@black-star.demon.co.uk></a> +</TD> +<TD>Mike writes:<BR> +I have started porting to the platform based on the code for Linux ARM. The +InvokeByIndex code works correctly when used with TestXPTCInvoke. I am +currently working on making TestXPC function correctly. +<P> +I am doing the porting work with egcs-1.1.2 on NetBSD 1.4P (NetBSD-current +snapshot from a couple of days ago). +</TD> +</TR> + +<TR> +<TD bgcolor="red"><font color="white"><b>HELP!</b></font></TD> +<TD>linux/ia64</TD> +<TD align="center">-</TD> +<TD>bug <a href="http://bugzilla.mozilla.org/show_bug.cgi?id=40950">40950</a></TD> +</TR> + + +<TR> +<TD bgcolor="red"><font color="white"><b>HELP!</b></font></TD> +<TD>All others!</TD> +<TD align="center">-</TD> +<TD align="center">-</TD> +</TR> + + +</table> + +<p> + +<b>Note:</b> I've used the symbol (<font color="red"><b>?</b></font>) to +indicate people who have expressed an interest in <i>possibly</i> contributing code. +Just because these people are listed here does not mean that they have commited +themselves to do the work. If <b>you</b> would like to contribute then let me +know. Feel free to email these folks and offer to help or find out what's going +on. We're all in this together. + +<p> + +<hr> +<b>Author:</b> <a href="mailto:jband@netscape.com">John Bandhauer <jband@netscape.com></a><br> +<b>Last modified:</b> 3 February 2003 + +</body> +</html> diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/tests/.cvsignore b/src/libs/xpcom18a4/xpcom/reflect/xptcall/tests/.cvsignore new file mode 100644 index 00000000..177fd905 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/tests/.cvsignore @@ -0,0 +1,2 @@ +Makefile +TestXPTCInvoke diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/tests/Makefile.in b/src/libs/xpcom18a4/xpcom/reflect/xptcall/tests/Makefile.in new file mode 100644 index 00000000..a1bf16ca --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/tests/Makefile.in @@ -0,0 +1,64 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1998 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = ../../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = TestXPTC +SIMPLE_PROGRAMS = TestXPTCInvoke$(BIN_SUFFIX) +REQUIRES = xpcom \ + $(NULL) + +CPPSRCS = TestXPTCInvoke.cpp + +LIBS = \ + $(XPCOM_LIBS) \ + $(NSPR_LIBS) \ + $(NULL) + +include $(topsrcdir)/config/rules.mk + +# For _write(). +ifeq ($(OS_ARCH),BSD_OS) +OS_LIBS += -lgcc +endif + + diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/tests/TestXPTCInvoke.cpp b/src/libs/xpcom18a4/xpcom/reflect/xptcall/tests/TestXPTCInvoke.cpp new file mode 100644 index 00000000..f5faee70 --- /dev/null +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/tests/TestXPTCInvoke.cpp @@ -0,0 +1,1369 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Pierre Phaneuf <pp@ludusdesign.com> + * Stuart Parmenter <pavlov@netscape.com> + * Chris Seawood <cls@seawood.org> + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* Invoke tests xptcall. */ + +#include <stdio.h> +#include "xptcall.h" +#include "prlong.h" +#include "prinrval.h" +#include "nsMemory.h" + +// forward declration +static void DoMultipleInheritenceTest(); +static void DoMultipleInheritenceTest2(); +static void DoSpeedTest(); + +// {AAC1FB90-E099-11d2-984E-006008962422} +#define INVOKETESTTARGET_IID \ +{ 0xaac1fb90, 0xe099, 0x11d2, \ + { 0x98, 0x4e, 0x0, 0x60, 0x8, 0x96, 0x24, 0x22 } } + + +class InvokeTestTargetInterface : public nsISupports +{ +public: + NS_DEFINE_STATIC_IID_ACCESSOR(INVOKETESTTARGET_IID) + NS_IMETHOD AddTwoInts(PRInt32 p1, PRInt32 p2, PRInt32* retval) = 0; + NS_IMETHOD MultTwoInts(PRInt32 p1, PRInt32 p2, PRInt32* retval) = 0; + NS_IMETHOD AddTwoLLs(PRInt64 p1, PRInt64 p2, PRInt64* retval) = 0; + NS_IMETHOD MultTwoLLs(PRInt64 p1, PRInt64 p2, PRInt64* retval) = 0; + + NS_IMETHOD AddManyInts(PRInt32 p1, PRInt32 p2, PRInt32 p3, PRInt32 p4, + PRInt32 p5, PRInt32 p6, PRInt32 p7, PRInt32 p8, + PRInt32 p9, PRInt32 p10, PRInt32* retval) = 0; + + NS_IMETHOD AddTwoFloats(float p1, float p2, float* retval) = 0; + + NS_IMETHOD AddManyDoubles(double p1, double p2, double p3, double p4, + double p5, double p6, double p7, double p8, + double p9, double p10, double* retval) = 0; + + NS_IMETHOD AddManyFloats(float p1, float p2, float p3, float p4, + float p5, float p6, float p7, float p8, + float p9, float p10, float* retval) = 0; + + NS_IMETHOD AddManyManyFloats(float p1, float p2, float p3, float p4, + float p5, float p6, float p7, float p8, + float p9, float p10, float p11, float p12, + float p13, float p14, float p15, float p16, + float p17, float p18, float p19, float p20, + float *retval) = 0; + + NS_IMETHOD AddMixedInts(PRInt64 p1, PRInt32 p2, PRInt64 p3, PRInt32 p4, + PRInt32 p5, PRInt64 p6, PRInt32 p7, PRInt32 p8, + PRInt64 p9, PRInt32 p10, PRInt64* retval) = 0; + + NS_IMETHOD AddMixedInts2(PRInt32 p1, PRInt64 p2, PRInt32 p3, PRInt64 p4, + PRInt64 p5, PRInt32 p6, PRInt64 p7, PRInt64 p8, + PRInt32 p9, PRInt64 p10, PRInt64* retval) = 0; + + NS_IMETHOD AddMixedFloats(float p1, float p2, double p3, double p4, + float p5, float p6, double p7, double p8, + float p9, double p10, float p11, + double *retval) = 0; + + NS_IMETHOD PassTwoStrings(const char* s1, const char* s2, char** retval) = 0; + +}; + +class InvokeTestTarget : public InvokeTestTargetInterface +{ +public: + NS_DECL_ISUPPORTS + NS_IMETHOD AddTwoInts(PRInt32 p1, PRInt32 p2, PRInt32* retval); + NS_IMETHOD MultTwoInts(PRInt32 p1, PRInt32 p2, PRInt32* retval); + NS_IMETHOD AddTwoLLs(PRInt64 p1, PRInt64 p2, PRInt64* retval); + NS_IMETHOD MultTwoLLs(PRInt64 p1, PRInt64 p2, PRInt64* retval); + + NS_IMETHOD AddManyInts(PRInt32 p1, PRInt32 p2, PRInt32 p3, PRInt32 p4, + PRInt32 p5, PRInt32 p6, PRInt32 p7, PRInt32 p8, + PRInt32 p9, PRInt32 p10, PRInt32* retval); + + NS_IMETHOD AddTwoFloats(float p1, float p2, float* retval); + + NS_IMETHOD AddManyDoubles(double p1, double p2, double p3, double p4, + double p5, double p6, double p7, double p8, + double p9, double p10, double* retval); + + NS_IMETHOD AddManyFloats(float p1, float p2, float p3, float p4, + float p5, float p6, float p7, float p8, + float p9, float p10, float* retval); + + NS_IMETHOD AddMixedInts(PRInt64 p1, PRInt32 p2, PRInt64 p3, PRInt32 p4, + PRInt32 p5, PRInt64 p6, PRInt32 p7, PRInt32 p8, + PRInt64 p9, PRInt32 p10, PRInt64* retval); + + NS_IMETHOD AddMixedInts2(PRInt32 p1, PRInt64 p2, PRInt32 p3, PRInt64 p4, + PRInt64 p5, PRInt32 p6, PRInt64 p7, PRInt64 p8, + PRInt32 p9, PRInt64 p10, PRInt64* retval); + + NS_IMETHOD AddMixedFloats(float p1, float p2, double p3, double p4, + float p5, float p6, double p7, double p8, + float p9, double p10, float p11, + double *retval); + + NS_IMETHOD AddManyManyFloats(float p1, float p2, float p3, float p4, + float p5, float p6, float p7, float p8, + float p9, float p10, float p11, float p12, + float p13, float p14, float p15, float p16, + float p17, float p18, float p19, float p20, + float *retval); + + NS_IMETHOD PassTwoStrings(const char* s1, const char* s2, char** retval); + + InvokeTestTarget(); +}; + +NS_IMPL_ISUPPORTS1(InvokeTestTarget, InvokeTestTargetInterface) + +InvokeTestTarget::InvokeTestTarget() +{ + NS_ADDREF_THIS(); +} + +NS_IMETHODIMP +InvokeTestTarget::AddTwoInts(PRInt32 p1, PRInt32 p2, PRInt32* retval) +{ + *retval = p1 + p2; + return NS_OK; +} + +NS_IMETHODIMP +InvokeTestTarget::MultTwoInts(PRInt32 p1, PRInt32 p2, PRInt32* retval) +{ + *retval = p1 * p2; + return NS_OK; +} + +NS_IMETHODIMP +InvokeTestTarget::AddTwoLLs(PRInt64 p1, PRInt64 p2, PRInt64* retval) +{ + LL_ADD(*retval, p1, p2); + return NS_OK; +} + +NS_IMETHODIMP +InvokeTestTarget::MultTwoLLs(PRInt64 p1, PRInt64 p2, PRInt64* retval) +{ + LL_MUL(*retval, p1, p2); + return NS_OK; +} + +NS_IMETHODIMP +InvokeTestTarget::AddManyInts(PRInt32 p1, PRInt32 p2, PRInt32 p3, PRInt32 p4, + PRInt32 p5, PRInt32 p6, PRInt32 p7, PRInt32 p8, + PRInt32 p9, PRInt32 p10, PRInt32* retval) +{ +#ifdef DEBUG_TESTINVOKE + printf("%d, %d, %d, %d, %d, %d, %d, %d, %d, %d\n", + p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); +#endif + *retval = p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9 + p10; + return NS_OK; +} + +NS_IMETHODIMP +InvokeTestTarget::AddTwoFloats(float p1, float p2, float *retval) +{ +#ifdef DEBUG_TESTINVOKE + printf("%f, %f\n", p1, p2); +#endif + *retval = p1 + p2; + return NS_OK; +} + +NS_IMETHODIMP +InvokeTestTarget::AddManyDoubles(double p1, double p2, double p3, double p4, + double p5, double p6, double p7, double p8, + double p9, double p10, double* retval) +{ +#ifdef DEBUG_TESTINVOKE + printf("%lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf\n", + p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); +#endif + *retval = p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9 + p10; + return NS_OK; +} + +NS_IMETHODIMP +InvokeTestTarget::AddManyFloats(float p1, float p2, float p3, float p4, + float p5, float p6, float p7, float p8, + float p9, float p10, float* retval) +{ +#ifdef DEBUG_TESTINVOKE + printf("%f, %f, %f, %f, %f, %f, %f, %f, %f, %f\n", + p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); +#endif + *retval = p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9 + p10; + return NS_OK; +} + +NS_IMETHODIMP +InvokeTestTarget::AddMixedFloats(float p1, float p2, double p3, double p4, + float p5, float p6, double p7, double p8, + float p9, double p10, float p11, + double *retval) +{ +#ifdef DEBUG_TESTINVOKE + printf("%f, %f, %lf, %lf, %f, %f, %lf, %lf, %f, %lf, %f\n", + p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); +#endif + *retval = p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9 + p10 + p11; + return NS_OK; +} + +NS_IMETHODIMP +InvokeTestTarget::AddManyManyFloats(float p1, float p2, float p3, float p4, + float p5, float p6, float p7, float p8, + float p9, float p10, float p11, float p12, + float p13, float p14, float p15, float p16, + float p17, float p18, float p19, float p20, + float *retval) +{ +#ifdef DEBUG_TESTINVOKE + printf("%f, %f, %f, %f, %f, %f, %f, %f, %f, %f, " + "%f, %f, %f, %f, %f, %f, %f, %f, %f, %f\n", + p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, + p11, p12, p13, p14, p15, p16, p17, p18, p19, p20); +#endif + *retval = p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9 + p10 + + p11 + p12 + p13 + p14 + p15 + p16 + p17 + p18 + p19 + p20; + return NS_OK; +} + +NS_IMETHODIMP +InvokeTestTarget::AddMixedInts(PRInt64 p1, PRInt32 p2, PRInt64 p3, PRInt32 p4, + PRInt32 p5, PRInt64 p6, PRInt32 p7, PRInt32 p8, + PRInt64 p9, PRInt32 p10, PRInt64* retval) +{ + *retval = p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9 + p10; + return NS_OK; +} + +NS_IMETHODIMP +InvokeTestTarget::AddMixedInts2(PRInt32 p1, PRInt64 p2, PRInt32 p3, PRInt64 p4, + PRInt64 p5, PRInt32 p6, PRInt64 p7, PRInt64 p8, + PRInt32 p9, PRInt64 p10, PRInt64* retval) +{ + *retval = p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9 + p10; + return NS_OK; +} + +NS_IMETHODIMP +InvokeTestTarget::PassTwoStrings(const char* s1, const char* s2, char** retval) +{ + const char milk[] = "milk"; + char *ret = (char*)nsMemory::Alloc(sizeof(milk)); + if (!ret) + return NS_ERROR_OUT_OF_MEMORY; + strncpy(ret, milk, sizeof(milk)); + printf("\t%s %s", s1, s2); + *retval = ret; + return NS_OK; +} + +int main() +{ + InvokeTestTarget *test = new InvokeTestTarget(); + + /* here we make the global 'check for alloc failure' checker happy */ + if(!test) + return 1; + + PRInt32 out, tmp32 = 0; + PRInt64 out64; + printf("calling direct:\n"); + if(NS_SUCCEEDED(test->AddTwoInts(1,1,&out))) + printf("\t1 + 1 = %d\n", out); + else + printf("\tFAILED"); + PRInt64 one, two; + LL_I2L(one, 1); + LL_I2L(two, 2); + if(NS_SUCCEEDED(test->AddTwoLLs(one,one,&out64))) + { + LL_L2I(tmp32, out64); + printf("\t1L + 1L = %d\n", (int)tmp32); + } + else + printf("\tFAILED"); + if(NS_SUCCEEDED(test->MultTwoInts(2,2,&out))) + printf("\t2 * 2 = %d\n", out); + else + printf("\tFAILED"); + if(NS_SUCCEEDED(test->MultTwoLLs(two,two,&out64))) + { + LL_L2I(tmp32, out64); + printf("\t2L * 2L = %d\n", (int)tmp32); + } + else + printf("\tFAILED"); + + double outD; + float outF; + PRInt32 outI; + char *outS; + + if(NS_SUCCEEDED(test->AddManyInts(1,2,3,4,5,6,7,8,9,10,&outI))) + printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %d\n", outI); + else + printf("\tFAILED"); + + if(NS_SUCCEEDED(test->AddTwoFloats(1,2,&outF))) + printf("\t1 + 2 = %ff\n", (double)outF); + else + printf("\tFAILED"); + + if(NS_SUCCEEDED(test->AddManyDoubles(1,2,3,4,5,6,7,8,9,10,&outD))) + printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %f\n", outD); + else + printf("\tFAILED"); + + if(NS_SUCCEEDED(test->AddManyFloats(1,2,3,4,5,6,7,8,9,10,&outF))) + printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %ff\n", (double)outF); + else + printf("\tFAILED"); + + if(NS_SUCCEEDED(test->AddManyManyFloats(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,&outF))) + printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 +1 15 + 16 + 17 + 18 + 19 + 20 = %ff\n", (double)outF); + else + printf("\tFAILED"); + + if(NS_SUCCEEDED(test->AddMixedInts(1,2,3,4,5,6,7,8,9,10,&out64))) + { + LL_L2I(tmp32, out64); + printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %d\n", (int)tmp32); + } + else + printf("\tFAILED"); + + if(NS_SUCCEEDED(test->AddMixedInts2(1,2,3,4,5,6,7,8,9,10,&out64))) + { + LL_L2I(tmp32, out64); + printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %d\n", (int)tmp32); + } + else + printf("\tFAILED"); + + if(NS_SUCCEEDED(test->AddMixedFloats(1,2,3,4,5,6,7,8,9,10,11,&outD))) + printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 = %f\n", (double)outD); + else + printf("\tFAILED"); + + if (NS_SUCCEEDED(test->PassTwoStrings("moo","cow",&outS))) { + printf(" = %s\n", outS); + nsMemory::Free(outS); + } else + printf("\tFAILED"); + + printf("calling via invoke:\n"); + + nsXPTCVariant var[21]; + + var[0].val.i32 = 1; + var[0].type = nsXPTType::T_I32; + var[0].flags = 0; + + var[1].val.i32 = 1; + var[1].type = nsXPTType::T_I32; + var[1].flags = 0; + + var[2].val.i32 = 0; + var[2].type = nsXPTType::T_I32; + var[2].flags = nsXPTCVariant::PTR_IS_DATA; + var[2].ptr = &var[2].val.i32; + + if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 3, 3, var))) + printf("\t1 + 1 = %d\n", var[2].val.i32); + else + printf("\tFAILED"); + + LL_I2L(var[0].val.i64, 1); + var[0].type = nsXPTType::T_I64; + var[0].flags = 0; + + LL_I2L(var[1].val.i64, 1); + var[1].type = nsXPTType::T_I64; + var[1].flags = 0; + + LL_I2L(var[2].val.i64, 0); + var[2].type = nsXPTType::T_I64; + var[2].flags = nsXPTCVariant::PTR_IS_DATA; + var[2].ptr = &var[2].val.i64; + + if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 5, 3, var))) + printf("\t1L + 1L = %d\n", (int)var[2].val.i64); + else + printf("\tFAILED"); + + var[0].val.i32 = 2; + var[0].type = nsXPTType::T_I32; + var[0].flags = 0; + + var[1].val.i32 = 2; + var[1].type = nsXPTType::T_I32; + var[1].flags = 0; + + var[2].val.i32 = 0; + var[2].type = nsXPTType::T_I32; + var[2].flags = nsXPTCVariant::PTR_IS_DATA; + var[2].ptr = &var[2].val.i32; + + if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 4, 3, var))) + printf("\t2 * 2 = %d\n", var[2].val.i32); + else + printf("\tFAILED"); + + LL_I2L(var[0].val.i64,2); + var[0].type = nsXPTType::T_I64; + var[0].flags = 0; + + LL_I2L(var[1].val.i64,2); + var[1].type = nsXPTType::T_I64; + var[1].flags = 0; + + LL_I2L(var[2].val.i64,0); + var[2].type = nsXPTType::T_I64; + var[2].flags = nsXPTCVariant::PTR_IS_DATA; + var[2].ptr = &var[2].val.i64; + + if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 6, 3, var))) + printf("\t2L * 2L = %d\n", (int)var[2].val.i64); + else + printf("\tFAILED"); + + var[0].val.i32 = 1; + var[0].type = nsXPTType::T_I32; + var[0].flags = 0; + + var[1].val.i32 = 2; + var[1].type = nsXPTType::T_I32; + var[1].flags = 0; + + var[2].val.i32 = 3; + var[2].type = nsXPTType::T_I32; + var[2].flags = 0; + + var[3].val.i32 = 4; + var[3].type = nsXPTType::T_I32; + var[3].flags = 0; + + var[4].val.i32 = 5; + var[4].type = nsXPTType::T_I32; + var[4].flags = 0; + + var[5].val.i32 = 6; + var[5].type = nsXPTType::T_I32; + var[5].flags = 0; + + var[6].val.i32 = 7; + var[6].type = nsXPTType::T_I32; + var[6].flags = 0; + + var[7].val.i32 = 8; + var[7].type = nsXPTType::T_I32; + var[7].flags = 0; + + var[8].val.i32 = 9; + var[8].type = nsXPTType::T_I32; + var[8].flags = 0; + + var[9].val.i32 = 10; + var[9].type = nsXPTType::T_I32; + var[9].flags = 0; + + var[10].val.i32 = 0; + var[10].type = nsXPTType::T_I32; + var[10].flags = nsXPTCVariant::PTR_IS_DATA; + var[10].ptr = &var[10].val.i32; + + if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 7, 11, var))) + printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %d\n", + var[10].val.i32); + + var[0].val.f = 1.0f; + var[0].type = nsXPTType::T_FLOAT; + var[0].flags = 0; + + var[1].val.f = 2.0f; + var[1].type = nsXPTType::T_FLOAT; + var[1].flags = 0; + + var[2].val.f = 0.0f; + var[2].type = nsXPTType::T_FLOAT; + var[2].flags = nsXPTCVariant::PTR_IS_DATA; + var[2].ptr = &var[2].val.f; + + if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 8, 3, var))) + printf("\t1 + 2 = %ff\n", + (double) var[2].val.f); + + + var[0].val.d = 1.0; + var[0].type = nsXPTType::T_DOUBLE; + var[0].flags = 0; + + var[1].val.d = 2.0; + var[1].type = nsXPTType::T_DOUBLE; + var[1].flags = 0; + + var[2].val.d = 3.0; + var[2].type = nsXPTType::T_DOUBLE; + var[2].flags = 0; + + var[3].val.d = 4.0; + var[3].type = nsXPTType::T_DOUBLE; + var[3].flags = 0; + + var[4].val.d = 5.0; + var[4].type = nsXPTType::T_DOUBLE; + var[4].flags = 0; + + var[5].val.d = 6.0; + var[5].type = nsXPTType::T_DOUBLE; + var[5].flags = 0; + + var[6].val.d = 7.0; + var[6].type = nsXPTType::T_DOUBLE; + var[6].flags = 0; + + var[7].val.d = 8.0; + var[7].type = nsXPTType::T_DOUBLE; + var[7].flags = 0; + + var[8].val.d = 9.0; + var[8].type = nsXPTType::T_DOUBLE; + var[8].flags = 0; + + var[9].val.d = 10.0; + var[9].type = nsXPTType::T_DOUBLE; + var[9].flags = 0; + + var[10].val.d = 0.0; + var[10].type = nsXPTType::T_DOUBLE; + var[10].flags = nsXPTCVariant::PTR_IS_DATA; + var[10].ptr = &var[10].val.d; + + if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 9, 11, var))) + printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %f\n", + var[10].val.d); + else + printf("\tFAILED"); + + var[0].val.f = 1.0f; + var[0].type = nsXPTType::T_FLOAT; + var[0].flags = 0; + + var[1].val.f = 2.0f; + var[1].type = nsXPTType::T_FLOAT; + var[1].flags = 0; + + var[2].val.f = 3.0f; + var[2].type = nsXPTType::T_FLOAT; + var[2].flags = 0; + + var[3].val.f = 4.0f; + var[3].type = nsXPTType::T_FLOAT; + var[3].flags = 0; + + var[4].val.f = 5.0f; + var[4].type = nsXPTType::T_FLOAT; + var[4].flags = 0; + + var[5].val.f = 6.0f; + var[5].type = nsXPTType::T_FLOAT; + var[5].flags = 0; + + var[6].val.f = 7.0f; + var[6].type = nsXPTType::T_FLOAT; + var[6].flags = 0; + + var[7].val.f = 8.0f; + var[7].type = nsXPTType::T_FLOAT; + var[7].flags = 0; + + var[8].val.f = 9.0f; + var[8].type = nsXPTType::T_FLOAT; + var[8].flags = 0; + + var[9].val.f = 10.0f; + var[9].type = nsXPTType::T_FLOAT; + var[9].flags = 0; + + var[10].val.f = 0.0f; + var[10].type = nsXPTType::T_FLOAT; + var[10].flags = nsXPTCVariant::PTR_IS_DATA; + var[10].ptr = &var[10].val.f; + + if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 10, 11, var))) + printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %ff\n", + (double) var[10].val.f); + else + printf("\tFAILED"); + + var[0].val.f = 1.0f; + var[0].type = nsXPTType::T_FLOAT; + var[0].flags = 0; + + var[1].val.f = 2.0f; + var[1].type = nsXPTType::T_FLOAT; + var[1].flags = 0; + + var[2].val.f = 3.0f; + var[2].type = nsXPTType::T_FLOAT; + var[2].flags = 0; + + var[3].val.f = 4.0f; + var[3].type = nsXPTType::T_FLOAT; + var[3].flags = 0; + + var[4].val.f = 5.0f; + var[4].type = nsXPTType::T_FLOAT; + var[4].flags = 0; + + var[5].val.f = 6.0f; + var[5].type = nsXPTType::T_FLOAT; + var[5].flags = 0; + + var[6].val.f = 7.0f; + var[6].type = nsXPTType::T_FLOAT; + var[6].flags = 0; + + var[7].val.f = 8.0f; + var[7].type = nsXPTType::T_FLOAT; + var[7].flags = 0; + + var[8].val.f = 9.0f; + var[8].type = nsXPTType::T_FLOAT; + var[8].flags = 0; + + var[9].val.f = 10.0f; + var[9].type = nsXPTType::T_FLOAT; + var[9].flags = 0; + + var[10].val.f = 11.0f; + var[10].type = nsXPTType::T_FLOAT; + var[10].flags = 0; + + var[11].val.f = 12.0f; + var[11].type = nsXPTType::T_FLOAT; + var[11].flags = 0; + + var[12].val.f = 13.0f; + var[12].type = nsXPTType::T_FLOAT; + var[12].flags = 0; + + var[13].val.f = 14.0f; + var[13].type = nsXPTType::T_FLOAT; + var[13].flags = 0; + + var[14].val.f = 15.0f; + var[14].type = nsXPTType::T_FLOAT; + var[14].flags = 0; + + var[15].val.f = 16.0f; + var[15].type = nsXPTType::T_FLOAT; + var[15].flags = 0; + + var[16].val.f = 17.0f; + var[16].type = nsXPTType::T_FLOAT; + var[16].flags = 0; + + var[17].val.f = 18.0f; + var[17].type = nsXPTType::T_FLOAT; + var[17].flags = 0; + + var[18].val.f = 19.0f; + var[18].type = nsXPTType::T_FLOAT; + var[18].flags = 0; + + var[19].val.f = 20.0f; + var[19].type = nsXPTType::T_FLOAT; + var[19].flags = 0; + + var[20].val.f = 0.0f; + var[20].type = nsXPTType::T_FLOAT; + var[20].flags = nsXPTCVariant::PTR_IS_DATA; + var[20].ptr = &var[20].val.f; + + if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 11, 21, var))) + printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 = %ff\n", + (double) var[20].val.f); + + var[0].val.i64 = 1; + var[0].type = nsXPTType::T_I64; + var[0].flags = 0; + + var[1].val.i32 = 2; + var[1].type = nsXPTType::T_I32; + var[1].flags = 0; + + var[2].val.i64 = 3; + var[2].type = nsXPTType::T_I64; + var[2].flags = 0; + + var[3].val.i32 = 4; + var[3].type = nsXPTType::T_I32; + var[3].flags = 0; + + var[4].val.i32 = 5; + var[4].type = nsXPTType::T_I32; + var[4].flags = 0; + + var[5].val.i64 = 6; + var[5].type = nsXPTType::T_I64; + var[5].flags = 0; + + var[6].val.i32 = 7; + var[6].type = nsXPTType::T_I32; + var[6].flags = 0; + + var[7].val.i32 = 8; + var[7].type = nsXPTType::T_I32; + var[7].flags = 0; + + var[8].val.i64 = 9; + var[8].type = nsXPTType::T_I64; + var[8].flags = 0; + + var[9].val.i32 = 10; + var[9].type = nsXPTType::T_I32; + var[9].flags = 0; + + var[10].val.i64 = 0; + var[10].type = nsXPTType::T_I64; + var[10].flags = nsXPTCVariant::PTR_IS_DATA; + var[10].ptr = &var[10].val.i64; + + if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 12, 11, var))) + printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %d\n", + (int)var[10].val.i64); + else + printf("\tFAILED"); + + var[0].val.i32 = 1; + var[0].type = nsXPTType::T_I32; + var[0].flags = 0; + + var[1].val.i64 = 2; + var[1].type = nsXPTType::T_I64; + var[1].flags = 0; + + var[2].val.i32 = 3; + var[2].type = nsXPTType::T_I32; + var[2].flags = 0; + + var[3].val.i64 = 4; + var[3].type = nsXPTType::T_I64; + var[3].flags = 0; + + var[4].val.i64 = 5; + var[4].type = nsXPTType::T_I64; + var[4].flags = 0; + + var[5].val.i32 = 6; + var[5].type = nsXPTType::T_I32; + var[5].flags = 0; + + var[6].val.i64 = 7; + var[6].type = nsXPTType::T_I64; + var[6].flags = 0; + + var[7].val.i64 = 8; + var[7].type = nsXPTType::T_I64; + var[7].flags = 0; + + var[8].val.i32 = 9; + var[8].type = nsXPTType::T_I32; + var[8].flags = 0; + + var[9].val.i64 = 10; + var[9].type = nsXPTType::T_I64; + var[9].flags = 0; + + var[10].val.i64 = 0; + var[10].type = nsXPTType::T_I64; + var[10].flags = nsXPTCVariant::PTR_IS_DATA; + var[10].ptr = &var[10].val.i64; + + if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 13, 11, var))) + printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %d\n", + (int)var[10].val.i64); + else + printf("\tFAILED"); + + var[0].val.f = 1.0f; + var[0].type = nsXPTType::T_FLOAT; + var[0].flags = 0; + + var[1].val.f = 2.0f; + var[1].type = nsXPTType::T_FLOAT; + var[1].flags = 0; + + var[2].val.d = 3.0; + var[2].type = nsXPTType::T_DOUBLE; + var[2].flags = 0; + + var[3].val.d = 4.0; + var[3].type = nsXPTType::T_DOUBLE; + var[3].flags = 0; + + var[4].val.f = 5.0f; + var[4].type = nsXPTType::T_FLOAT; + var[4].flags = 0; + + var[5].val.f = 6.0f; + var[5].type = nsXPTType::T_FLOAT; + var[5].flags = 0; + + var[6].val.d = 7.0; + var[6].type = nsXPTType::T_DOUBLE; + var[6].flags = 0; + + var[7].val.d = 8.0; + var[7].type = nsXPTType::T_DOUBLE; + var[7].flags = 0; + + var[8].val.f = 9.0f; + var[8].type = nsXPTType::T_FLOAT; + var[8].flags = 0; + + var[9].val.d = 10.0; + var[9].type = nsXPTType::T_DOUBLE; + var[9].flags = 0; + + var[10].val.f = 11.0f; + var[10].type = nsXPTType::T_FLOAT; + var[10].flags = 0; + + var[11].val.d = 0.0; + var[11].type = nsXPTType::T_DOUBLE; + var[11].flags = nsXPTCVariant::PTR_IS_DATA; + var[11].ptr = &var[11].val.d; + + if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 14, 12, var))) + printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 = %f\n", + var[11].val.d); + else + printf("\tFAILED"); + + var[0].val.p = (void*)"moo"; + var[0].type = nsXPTType::T_CHAR_STR; + var[0].flags = 0; + + var[1].val.p = (void*)"cow"; + var[1].type = nsXPTType::T_CHAR_STR; + var[1].flags = 0; + + var[2].val.p = 0; + var[2].type = nsXPTType::T_CHAR_STR; + var[2].flags = nsXPTCVariant::PTR_IS_DATA; + var[2].ptr = &var[2].val.p; + + if(NS_SUCCEEDED(XPTC_InvokeByIndex(test, 15, 3, var))) + printf(" = %s\n", var[2].val.p); + else + printf("\tFAILED"); + + DoMultipleInheritenceTest(); + DoMultipleInheritenceTest2(); + // Disabled by default - takes too much time on slow machines + //DoSpeedTest(); + + return 0; +} + +/***************************************************************************/ +/***************************************************************************/ +/***************************************************************************/ + +// {491C65A0-3317-11d3-9885-006008962422} +#define FOO_IID \ +{ 0x491c65a0, 0x3317, 0x11d3, \ + { 0x98, 0x85, 0x0, 0x60, 0x8, 0x96, 0x24, 0x22 } } + +// {491C65A1-3317-11d3-9885-006008962422} +#define BAR_IID \ +{ 0x491c65a1, 0x3317, 0x11d3, \ + { 0x98, 0x85, 0x0, 0x60, 0x8, 0x96, 0x24, 0x22 } } + +/***************************/ + +class nsIFoo : public nsISupports +{ +public: + NS_DEFINE_STATIC_IID_ACCESSOR(FOO_IID) + NS_IMETHOD FooMethod1(PRInt32 i) = 0; + NS_IMETHOD FooMethod2(PRInt32 i) = 0; +}; + +class nsIBar : public nsISupports +{ +public: + NS_DEFINE_STATIC_IID_ACCESSOR(BAR_IID) + NS_IMETHOD BarMethod1(PRInt32 i) = 0; + NS_IMETHOD BarMethod2(PRInt32 i) = 0; +}; + +/***************************/ + +class FooImpl : public nsIFoo +{ +public: + NS_IMETHOD FooMethod1(PRInt32 i); + NS_IMETHOD FooMethod2(PRInt32 i); + + FooImpl(); + +protected: + ~FooImpl() {} + +public: + virtual const char* ImplName() = 0; + + int SomeData1; + int SomeData2; + const char* Name; +}; + +class BarImpl : public nsIBar +{ +public: + NS_IMETHOD BarMethod1(PRInt32 i); + NS_IMETHOD BarMethod2(PRInt32 i); + + BarImpl(); + +protected: + ~BarImpl() {} + +public: + virtual const char * ImplName() = 0; + + int SomeData1; + int SomeData2; + const char* Name; +}; + +/***************************/ + +FooImpl::FooImpl() : Name("FooImpl") +{ +} + +NS_IMETHODIMP FooImpl::FooMethod1(PRInt32 i) +{ + printf("\tFooImpl::FooMethod1 called with i == %d, %s part of a %s\n", + i, Name, ImplName()); + return NS_OK; +} + +NS_IMETHODIMP FooImpl::FooMethod2(PRInt32 i) +{ + printf("\tFooImpl::FooMethod2 called with i == %d, %s part of a %s\n", + i, Name, ImplName()); + return NS_OK; +} + +/***************************/ + +BarImpl::BarImpl() : Name("BarImpl") +{ +} + +NS_IMETHODIMP BarImpl::BarMethod1(PRInt32 i) +{ + printf("\tBarImpl::BarMethod1 called with i == %d, %s part of a %s\n", + i, Name, ImplName()); + return NS_OK; +} + +NS_IMETHODIMP BarImpl::BarMethod2(PRInt32 i) +{ + printf("\tBarImpl::BarMethod2 called with i == %d, %s part of a %s\n", + i, Name, ImplName()); + return NS_OK; +} + +/***************************/ + +class FooBarImpl : public FooImpl, public BarImpl +{ +public: + NS_DECL_ISUPPORTS + + const char* ImplName(); + + FooBarImpl(); + +private: + ~FooBarImpl() {} + +public: + const char* MyName; +}; + +FooBarImpl::FooBarImpl() : MyName("FooBarImpl") +{ + NS_ADDREF_THIS(); +} + +const char* FooBarImpl::ImplName() +{ + return MyName; +} + +NS_IMETHODIMP +FooBarImpl::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + if (NULL == aInstancePtr) { + return NS_ERROR_NULL_POINTER; + } + + *aInstancePtr = NULL; + + + if (aIID.Equals(NS_GET_IID(nsIFoo))) { + *aInstancePtr = (void*) NS_STATIC_CAST(nsIFoo*,this); + NS_ADDREF_THIS(); + return NS_OK; + } + if (aIID.Equals(NS_GET_IID(nsIBar))) { + *aInstancePtr = (void*) NS_STATIC_CAST(nsIBar*,this); + NS_ADDREF_THIS(); + return NS_OK; + } + + if (aIID.Equals(NS_GET_IID(nsISupports))) { + *aInstancePtr = (void*) NS_STATIC_CAST(nsISupports*, + NS_STATIC_CAST(nsIFoo*,this)); + NS_ADDREF_THIS(); + return NS_OK; + } + return NS_NOINTERFACE; +} + +NS_IMPL_ADDREF(FooBarImpl) +NS_IMPL_RELEASE(FooBarImpl) + + +static void DoMultipleInheritenceTest() +{ + FooBarImpl* impl = new FooBarImpl(); + if(!impl) + return; + + nsIFoo* foo; + nsIBar* bar; + + nsXPTCVariant var[1]; + + printf("\n"); + if(NS_SUCCEEDED(impl->QueryInterface(NS_GET_IID(nsIFoo), (void**)&foo)) && + NS_SUCCEEDED(impl->QueryInterface(NS_GET_IID(nsIBar), (void**)&bar))) + { + printf("impl == %p\n", impl); + printf("foo == %p\n", foo); + printf("bar == %p\n", bar); + + printf("Calling Foo...\n"); + printf("direct calls:\n"); + foo->FooMethod1(1); + foo->FooMethod2(2); + + printf("invoke calls:\n"); + var[0].val.i32 = 1; + var[0].type = nsXPTType::T_I32; + var[0].flags = 0; + XPTC_InvokeByIndex(foo, 3, 1, var); + + var[0].val.i32 = 2; + var[0].type = nsXPTType::T_I32; + var[0].flags = 0; + XPTC_InvokeByIndex(foo, 4, 1, var); + + printf("\n"); + + printf("Calling Bar...\n"); + printf("direct calls:\n"); + bar->BarMethod1(1); + bar->BarMethod2(2); + + printf("invoke calls:\n"); + var[0].val.i32 = 1; + var[0].type = nsXPTType::T_I32; + var[0].flags = 0; + XPTC_InvokeByIndex(bar, 3, 1, var); + + var[0].val.i32 = 2; + var[0].type = nsXPTType::T_I32; + var[0].flags = 0; + XPTC_InvokeByIndex(bar, 4, 1, var); + + printf("\n"); + + NS_RELEASE(foo); + NS_RELEASE(bar); + } + NS_RELEASE(impl); +} +/***************************************************************************/ +/***************************************************************************/ +/***************************************************************************/ +/* This is a variation on the theme submitted by duncan@be.com (Duncan Wilcox). +* He was seeing the other test work and this test not work. They should both +* Work on any given platform +*/ + +class nsIFoo2 : public nsISupports +{ +public: + NS_IMETHOD FooMethod1(PRInt32 i) = 0; + NS_IMETHOD FooMethod2(PRInt32 i) = 0; +}; + +class nsIBar2 : public nsISupports +{ +public: + NS_IMETHOD BarMethod1(PRInt32 i) = 0; + NS_IMETHOD BarMethod2(PRInt32 i) = 0; +}; + +class FooBarImpl2 : public nsIFoo2, public nsIBar2 +{ +public: + // Foo interface + NS_IMETHOD FooMethod1(PRInt32 i); + NS_IMETHOD FooMethod2(PRInt32 i); + + // Bar interface + NS_IMETHOD BarMethod1(PRInt32 i); + NS_IMETHOD BarMethod2(PRInt32 i); + + NS_DECL_ISUPPORTS + + FooBarImpl2(); + +private: + ~FooBarImpl2() {} + +public: + PRInt32 value; +}; + +FooBarImpl2::FooBarImpl2() : value(0x12345678) +{ + NS_ADDREF_THIS(); +} + +NS_IMETHODIMP FooBarImpl2::FooMethod1(PRInt32 i) +{ + printf("\tFooBarImpl2::FooMethod1 called with i == %d, local value = %x\n", + i, value); + return NS_OK; +} + +NS_IMETHODIMP FooBarImpl2::FooMethod2(PRInt32 i) +{ + printf("\tFooBarImpl2::FooMethod2 called with i == %d, local value = %x\n", + i, value); + return NS_OK; +} + +NS_IMETHODIMP FooBarImpl2::BarMethod1(PRInt32 i) +{ + printf("\tFooBarImpl2::BarMethod1 called with i == %d, local value = %x\n", + i, value); + return NS_OK; +} + +NS_IMETHODIMP FooBarImpl2::BarMethod2(PRInt32 i) +{ + printf("\tFooBarImpl2::BarMethod2 called with i == %d, local value = %x\n", + i, value); + return NS_OK; +} + +NS_IMETHODIMP +FooBarImpl2::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + if (NULL == aInstancePtr) { + return NS_ERROR_NULL_POINTER; + } + + *aInstancePtr = NULL; + + + if (aIID.Equals(NS_GET_IID(nsIFoo))) { + *aInstancePtr = (void*) NS_STATIC_CAST(nsIFoo2*,this); + NS_ADDREF_THIS(); + return NS_OK; + } + if (aIID.Equals(NS_GET_IID(nsIBar))) { + *aInstancePtr = (void*) NS_STATIC_CAST(nsIBar2*,this); + NS_ADDREF_THIS(); + return NS_OK; + } + + if (aIID.Equals(NS_GET_IID(nsISupports))) { + *aInstancePtr = (void*) NS_STATIC_CAST(nsISupports*, + NS_STATIC_CAST(nsIFoo2*,this)); + NS_ADDREF_THIS(); + return NS_OK; + } + return NS_NOINTERFACE; +} + +NS_IMPL_ADDREF(FooBarImpl2) +NS_IMPL_RELEASE(FooBarImpl2) + +static void DoMultipleInheritenceTest2() +{ + FooBarImpl2* impl = new FooBarImpl2(); + if(!impl) + return; + + nsIFoo2* foo; + nsIBar2* bar; + + nsXPTCVariant var[1]; + + printf("\n"); + if(NS_SUCCEEDED(impl->QueryInterface(NS_GET_IID(nsIFoo), (void**)&foo)) && + NS_SUCCEEDED(impl->QueryInterface(NS_GET_IID(nsIBar), (void**)&bar))) + { + printf("impl == %p\n", impl); + printf("foo == %p\n", foo); + printf("bar == %p\n", bar); + + printf("Calling Foo...\n"); + printf("direct calls:\n"); + foo->FooMethod1(1); + foo->FooMethod2(2); + + printf("invoke calls:\n"); + var[0].val.i32 = 1; + var[0].type = nsXPTType::T_I32; + var[0].flags = 0; + XPTC_InvokeByIndex(foo, 3, 1, var); + + var[0].val.i32 = 2; + var[0].type = nsXPTType::T_I32; + var[0].flags = 0; + XPTC_InvokeByIndex(foo, 4, 1, var); + + printf("\n"); + + printf("Calling Bar...\n"); + printf("direct calls:\n"); + bar->BarMethod1(1); + bar->BarMethod2(2); + + printf("invoke calls:\n"); + var[0].val.i32 = 1; + var[0].type = nsXPTType::T_I32; + var[0].flags = 0; + XPTC_InvokeByIndex(bar, 3, 1, var); + + var[0].val.i32 = 2; + var[0].type = nsXPTType::T_I32; + var[0].flags = 0; + XPTC_InvokeByIndex(bar, 4, 1, var); + + printf("\n"); + + NS_RELEASE(foo); + NS_RELEASE(bar); + } + NS_RELEASE(impl); +} + +static void DoSpeedTest() +{ + InvokeTestTarget *test = new InvokeTestTarget(); + + nsXPTCVariant var[3]; + + var[0].val.i32 = 1; + var[0].type = nsXPTType::T_I32; + var[0].flags = 0; + + var[1].val.i32 = 1; + var[1].type = nsXPTType::T_I32; + var[1].flags = 0; + + var[2].val.i32 = 0; + var[2].type = nsXPTType::T_I32; + var[2].flags = nsXPTCVariant::PTR_IS_DATA; + var[2].ptr = &var[2].val.i32; + + PRInt32 in1 = 1; + PRInt32 in2 = 1; + PRInt32 out; + + // Crank this number down if your platform is slow :) + static const int count = 100000000; + int i; + PRIntervalTime start; + PRIntervalTime interval_direct; + PRIntervalTime interval_invoke; + + printf("Speed test...\n\n"); + printf("Doing %d direct call iterations...\n", count); + start = PR_IntervalNow(); + for(i = count; i; i--) + (void)test->AddTwoInts(in1, in2, &out); + interval_direct = PR_IntervalNow() - start; + + printf("Doing %d invoked call iterations...\n", count); + start = PR_IntervalNow(); + for(i = count; i; i--) + (void)XPTC_InvokeByIndex(test, 3, 3, var); + interval_invoke = PR_IntervalNow() - start; + + printf(" direct took %0.2f seconds\n", + (double)interval_direct/(double)PR_TicksPerSecond()); + printf(" invoke took %0.2f seconds\n", + (double)interval_invoke/(double)PR_TicksPerSecond()); + printf(" So, invoke overhead was ~ %0.2f seconds (~ %0.0f%%)\n", + (double)(interval_invoke-interval_direct)/(double)PR_TicksPerSecond(), + (double)(interval_invoke-interval_direct)/(double)interval_invoke*100); +} |