Back to index

lightning-sunbird  0.9+nobinonly
xptcinvoke_ipf64.cpp
Go to the documentation of this file.
00001 
00002 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
00003  *
00004  * ***** BEGIN LICENSE BLOCK *****
00005  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00006  *
00007  * The contents of this file are subject to the Mozilla Public License Version
00008  * 1.1 (the "License"); you may not use this file except in compliance with
00009  * the License. You may obtain a copy of the License at
00010  * http://www.mozilla.org/MPL/
00011  *
00012  * Software distributed under the License is distributed on an "AS IS" basis,
00013  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00014  * for the specific language governing rights and limitations under the
00015  * License.
00016  *
00017  * The Original Code is mozilla.org code.
00018  *
00019  * The Initial Developer of the Original Code is
00020  * Netscape Communications Corporation.
00021  * Portions created by the Initial Developer are Copyright (C) 1999
00022  * the Initial Developer. All Rights Reserved.
00023  *
00024  * Contributor(s):
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * either of the GNU General Public License Version 2 or later (the "GPL"),
00028  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00029  * in which case the provisions of the GPL or the LGPL are applicable instead
00030  * of those above. If you wish to allow use of your version of this file only
00031  * under the terms of either the GPL or the LGPL, and not to allow others to
00032  * use your version of this file under the terms of the MPL, indicate your
00033  * decision by deleting the provisions above and replace them with the notice
00034  * and other provisions required by the GPL or the LGPL. If you do not delete
00035  * the provisions above, a recipient may use your version of this file under
00036  * the terms of any one of the MPL, the GPL or the LGPL.
00037  *
00038  * ***** END LICENSE BLOCK ***** */
00039 
00040 #include "xptcprivate.h"
00041 
00042 #include <stdint.h>
00043 
00044 // "This code is for IA64 only"
00045 
00046 
00047 /* invoke_copy_to_stack() will copy from variant array 's' to
00048  * the stack argument area 'mloc', the integer register area 'iloc', and
00049  * the float register area 'floc'.
00050  *
00051  */
00052 extern "C" void
00053 invoke_copy_to_stack(uint64_t* mloc, uint64_t* iloc, uint64_t* floc,
00054   const PRUint32 paramCount, nsXPTCVariant* s)
00055 {
00056   uint64_t* dest = mloc;
00057   PRUint32 len = paramCount;
00058   nsXPTCVariant* source = s;
00059 
00060   PRUint32 indx;
00061   PRUint32 endlen;
00062   endlen = (len > 7) ? 7 : len;
00063   /* handle the memory arguments */
00064   for (indx = 7; indx < len; ++indx)
00065   {
00066     if (source[indx].IsPtrData())
00067     {
00068       /* 64 bit pointer mode */
00069       *((void**) dest) = source[indx].ptr;
00070     }
00071     else
00072     switch (source[indx].type)
00073     {
00074     case nsXPTType::T_I8    : *(dest) = source[indx].val.i8;  break;
00075     case nsXPTType::T_I16   : *(dest) = source[indx].val.i16; break;
00076     case nsXPTType::T_I32   : *(dest) = source[indx].val.i32; break;
00077     case nsXPTType::T_I64   : *(dest) = source[indx].val.i64; break;
00078     case nsXPTType::T_U8    : *(dest) = source[indx].val.u8;  break;
00079     case nsXPTType::T_U16   : *(dest) = source[indx].val.u16; break;
00080     case nsXPTType::T_U32   : *(dest) = source[indx].val.u32; break;
00081     case nsXPTType::T_U64   : *(dest) = source[indx].val.u64; break;
00082     case nsXPTType::T_FLOAT : *(dest) = source[indx].val.u32; break;
00083     case nsXPTType::T_DOUBLE: *(dest) = source[indx].val.u64; break;
00084     case nsXPTType::T_BOOL  : *(dest) = source[indx].val.b; break;
00085     case nsXPTType::T_CHAR  : *(dest) = source[indx].val.c; break;
00086     case nsXPTType::T_WCHAR : *(dest) = source[indx].val.wc; break;
00087     default:
00088     // all the others are plain pointer types
00089       /* 64 bit pointer mode */
00090       *((void**) dest) = source[indx].val.p;
00091     }
00092     ++dest;
00093   }
00094   /* process register arguments */
00095   dest = iloc;
00096   for (indx = 0; indx < endlen; ++indx)
00097   {
00098     if (source[indx].IsPtrData())
00099     {
00100       /* 64 bit pointer mode */
00101       *((void**) dest) = source[indx].ptr;
00102     }
00103     else
00104     switch (source[indx].type)
00105     {
00106     case nsXPTType::T_I8    : *(dest) = source[indx].val.i8; break;
00107     case nsXPTType::T_I16   : *(dest) = source[indx].val.i16; break;
00108     case nsXPTType::T_I32   : *(dest) = source[indx].val.i32; break;
00109     case nsXPTType::T_I64   : *(dest) = source[indx].val.i64; break;
00110     case nsXPTType::T_U8    : *(dest) = source[indx].val.u8; break;
00111     case nsXPTType::T_U16   : *(dest) = source[indx].val.u16; break;
00112     case nsXPTType::T_U32   : *(dest) = source[indx].val.u32; break;
00113     case nsXPTType::T_U64   : *(dest) = source[indx].val.u64; break;
00114     case nsXPTType::T_FLOAT :
00115       *((double*) (floc++)) = (double) source[indx].val.f;
00116       break;
00117     case nsXPTType::T_DOUBLE:
00118       *((double*) (floc++)) = source[indx].val.d;
00119       break;
00120     case nsXPTType::T_BOOL  : *(dest) = source[indx].val.b; break;
00121     case nsXPTType::T_CHAR  : *(dest) = source[indx].val.c; break;
00122     case nsXPTType::T_WCHAR : *(dest) = source[indx].val.wc; break;
00123     default:
00124     // all the others are plain pointer types
00125       /* 64 bit pointer mode */
00126       *((void**) dest) = source[indx].val.p;
00127     }
00128     ++dest;
00129   }
00130 
00131 }
00132