xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ipf32.cpp

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1
michael@0 2 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
michael@0 3 *
michael@0 4 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 5 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 7
michael@0 8 #include "xptcprivate.h"
michael@0 9
michael@0 10 #include <iostream.h>
michael@0 11
michael@0 12 // "This code is for IA64 only"
michael@0 13
michael@0 14
michael@0 15 /* invoke_copy_to_stack() will copy from variant array 's' to
michael@0 16 * the stack argument area 'mloc', the integer register area 'iloc', and
michael@0 17 * the float register area 'floc'.
michael@0 18 *
michael@0 19 */
michael@0 20 extern "C" void
michael@0 21 invoke_copy_to_stack(uint64_t* mloc, uint64_t* iloc, uint64_t* floc,
michael@0 22 const uint32_t paramCount, nsXPTCVariant* s)
michael@0 23 {
michael@0 24 uint64_t* dest = mloc;
michael@0 25 uint32_t len = paramCount;
michael@0 26 nsXPTCVariant* source = s;
michael@0 27
michael@0 28 uint32_t indx;
michael@0 29 uint32_t endlen;
michael@0 30 endlen = (len > 7) ? 7 : len;
michael@0 31 /* handle the memory arguments */
michael@0 32 for (indx = 7; indx < len; ++indx)
michael@0 33 {
michael@0 34 if (source[indx].IsPtrData())
michael@0 35 {
michael@0 36 #ifdef __LP64__
michael@0 37 /* 64 bit pointer mode */
michael@0 38 *((void**) dest) = source[indx].ptr;
michael@0 39 #else
michael@0 40 /* 32 bit pointer mode */
michael@0 41 uint32_t* adr = (uint32_t*) dest;
michael@0 42 *(adr) = 0;
michael@0 43 *(adr+1) = (uint32_t) source[indx].ptr;
michael@0 44 #endif
michael@0 45 }
michael@0 46 else
michael@0 47 switch (source[indx].type)
michael@0 48 {
michael@0 49 case nsXPTType::T_I8 : *(dest) = source[indx].val.i8; break;
michael@0 50 case nsXPTType::T_I16 : *(dest) = source[indx].val.i16; break;
michael@0 51 case nsXPTType::T_I32 : *(dest) = source[indx].val.i32; break;
michael@0 52 case nsXPTType::T_I64 : *(dest) = source[indx].val.i64; break;
michael@0 53 case nsXPTType::T_U8 : *(dest) = source[indx].val.u8; break;
michael@0 54 case nsXPTType::T_U16 : *(dest) = source[indx].val.u16; break;
michael@0 55 case nsXPTType::T_U32 : *(dest) = source[indx].val.u32; break;
michael@0 56 case nsXPTType::T_U64 : *(dest) = source[indx].val.u64; break;
michael@0 57 case nsXPTType::T_FLOAT : *(dest) = source[indx].val.u32; break;
michael@0 58 case nsXPTType::T_DOUBLE: *(dest) = source[indx].val.u64; break;
michael@0 59 case nsXPTType::T_BOOL : *(dest) = source[indx].val.b; break;
michael@0 60 case nsXPTType::T_CHAR : *(dest) = source[indx].val.c; break;
michael@0 61 case nsXPTType::T_WCHAR : *(dest) = source[indx].val.wc; break;
michael@0 62 default:
michael@0 63 // all the others are plain pointer types
michael@0 64 #ifdef __LP64__
michael@0 65 /* 64 bit pointer mode */
michael@0 66 *((void**) dest) = source[indx].val.p;
michael@0 67 #else
michael@0 68 {
michael@0 69 /* 32 bit pointer mode */
michael@0 70 uint32_t* adr = (uint32_t*) dest;
michael@0 71 *(adr) = 0;
michael@0 72 *(adr+1) = (uint32_t) source[indx].val.p;
michael@0 73 }
michael@0 74 #endif
michael@0 75 }
michael@0 76 ++dest;
michael@0 77 }
michael@0 78 /* process register arguments */
michael@0 79 dest = iloc;
michael@0 80 for (indx = 0; indx < endlen; ++indx)
michael@0 81 {
michael@0 82 if (source[indx].IsPtrData())
michael@0 83 {
michael@0 84 #ifdef __LP64__
michael@0 85 /* 64 bit pointer mode */
michael@0 86 *((void**) dest) = source[indx].ptr;
michael@0 87 #else
michael@0 88 /* 32 bit pointer mode */
michael@0 89 uint32_t* adr = (uint32_t*) dest;
michael@0 90 *(adr) = 0;
michael@0 91 *(adr+1) = (uint32_t) source[indx].ptr;
michael@0 92 #endif
michael@0 93 }
michael@0 94 else
michael@0 95 switch (source[indx].type)
michael@0 96 {
michael@0 97 case nsXPTType::T_I8 : *(dest) = source[indx].val.i8; break;
michael@0 98 case nsXPTType::T_I16 : *(dest) = source[indx].val.i16; break;
michael@0 99 case nsXPTType::T_I32 : *(dest) = source[indx].val.i32; break;
michael@0 100 case nsXPTType::T_I64 : *(dest) = source[indx].val.i64; break;
michael@0 101 case nsXPTType::T_U8 : *(dest) = source[indx].val.u8; break;
michael@0 102 case nsXPTType::T_U16 : *(dest) = source[indx].val.u16; break;
michael@0 103 case nsXPTType::T_U32 : *(dest) = source[indx].val.u32; break;
michael@0 104 case nsXPTType::T_U64 : *(dest) = source[indx].val.u64; break;
michael@0 105 case nsXPTType::T_FLOAT :
michael@0 106 *((double*) (floc++)) = (double) source[indx].val.f;
michael@0 107 break;
michael@0 108 case nsXPTType::T_DOUBLE:
michael@0 109 *((double*) (floc++)) = source[indx].val.d;
michael@0 110 break;
michael@0 111 case nsXPTType::T_BOOL : *(dest) = source[indx].val.b; break;
michael@0 112 case nsXPTType::T_CHAR : *(dest) = source[indx].val.c; break;
michael@0 113 case nsXPTType::T_WCHAR : *(dest) = source[indx].val.wc; break;
michael@0 114 default:
michael@0 115 // all the others are plain pointer types
michael@0 116 #ifdef __LP64__
michael@0 117 /* 64 bit pointer mode */
michael@0 118 *((void**) dest) = source[indx].val.p;
michael@0 119 #else
michael@0 120 {
michael@0 121 /* 32 bit pointer mode */
michael@0 122 uint32_t* adr = (uint32_t*) dest;
michael@0 123 *(adr) = 0;
michael@0 124 *(adr+1) = (uint32_t) source[indx].val.p;
michael@0 125 }
michael@0 126 #endif
michael@0 127 }
michael@0 128 ++dest;
michael@0 129 }
michael@0 130
michael@0 131 }
michael@0 132

mercurial