xpcom/reflect/xptcall/src/md/unix/xptcinvoke_mips64.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 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 /* Platform specific code to invoke XPCOM methods on native objects */
michael@0 7
michael@0 8 #include "xptcprivate.h"
michael@0 9
michael@0 10 #if (_MIPS_SIM != _ABIN32)
michael@0 11 #error "This code is for MIPS N32 only"
michael@0 12 #endif
michael@0 13
michael@0 14 extern "C" uint32_t
michael@0 15 invoke_count_words(uint32_t paramCount, nsXPTCVariant* s)
michael@0 16 {
michael@0 17 return paramCount;
michael@0 18 }
michael@0 19
michael@0 20 extern "C" void
michael@0 21 invoke_copy_to_stack(uint64_t* d, uint32_t paramCount,
michael@0 22 nsXPTCVariant* s, uint64_t *regs)
michael@0 23 {
michael@0 24 #define N_ARG_REGS 7 /* 8 regs minus 1 for "this" ptr */
michael@0 25
michael@0 26 for (uint32_t i = 0; i < paramCount; i++, s++)
michael@0 27 {
michael@0 28 if (s->IsPtrData()) {
michael@0 29 if (i < N_ARG_REGS)
michael@0 30 regs[i] = (uint64_t)s->ptr;
michael@0 31 else
michael@0 32 *d++ = (uint64_t)s->ptr;
michael@0 33 continue;
michael@0 34 }
michael@0 35 switch (s->type) {
michael@0 36 //
michael@0 37 // signed types first
michael@0 38 //
michael@0 39 case nsXPTType::T_I8:
michael@0 40 if (i < N_ARG_REGS)
michael@0 41 ((int64_t*)regs)[i] = s->val.i8;
michael@0 42 else
michael@0 43 *d++ = s->val.i8;
michael@0 44 break;
michael@0 45 case nsXPTType::T_I16:
michael@0 46 if (i < N_ARG_REGS)
michael@0 47 ((int64_t*)regs)[i] = s->val.i16;
michael@0 48 else
michael@0 49 *d++ = s->val.i16;
michael@0 50 break;
michael@0 51 case nsXPTType::T_I32:
michael@0 52 if (i < N_ARG_REGS)
michael@0 53 ((int64_t*)regs)[i] = s->val.i32;
michael@0 54 else
michael@0 55 *d++ = s->val.i32;
michael@0 56 break;
michael@0 57 case nsXPTType::T_I64:
michael@0 58 if (i < N_ARG_REGS)
michael@0 59 ((int64_t*)regs)[i] = s->val.i64;
michael@0 60 else
michael@0 61 *d++ = s->val.i64;
michael@0 62 break;
michael@0 63 //
michael@0 64 // unsigned types next
michael@0 65 //
michael@0 66 case nsXPTType::T_U8:
michael@0 67 if (i < N_ARG_REGS)
michael@0 68 regs[i] = s->val.u8;
michael@0 69 else
michael@0 70 *d++ = s->val.u8;
michael@0 71 break;
michael@0 72 case nsXPTType::T_U16:
michael@0 73 if (i < N_ARG_REGS)
michael@0 74 regs[i] = s->val.u16;
michael@0 75 else
michael@0 76 *d++ = s->val.u16;
michael@0 77 break;
michael@0 78 case nsXPTType::T_U32:
michael@0 79 if (i < N_ARG_REGS)
michael@0 80 regs[i] = s->val.u32;
michael@0 81 else
michael@0 82 *d++ = s->val.u32;
michael@0 83 break;
michael@0 84 case nsXPTType::T_U64:
michael@0 85 if (i < N_ARG_REGS)
michael@0 86 regs[i] = s->val.u64;
michael@0 87 else
michael@0 88 *d++ = s->val.u64;
michael@0 89 break;
michael@0 90 case nsXPTType::T_FLOAT:
michael@0 91 if (i < N_ARG_REGS)
michael@0 92 *(float*)&regs[i] = s->val.f;
michael@0 93 else
michael@0 94 *(float*)d++ = s->val.f;
michael@0 95 break;
michael@0 96 case nsXPTType::T_DOUBLE:
michael@0 97 if (i < N_ARG_REGS)
michael@0 98 *(double*)&regs[i] = s->val.d;
michael@0 99 else
michael@0 100 *(double*)d++ = s->val.d;
michael@0 101 break;
michael@0 102 case nsXPTType::T_BOOL:
michael@0 103 if (i < N_ARG_REGS)
michael@0 104 regs[i] = s->val.b;
michael@0 105 else
michael@0 106 *d++ = s->val.b;
michael@0 107 break;
michael@0 108 case nsXPTType::T_CHAR:
michael@0 109 if (i < N_ARG_REGS)
michael@0 110 regs[i] = s->val.c;
michael@0 111 else
michael@0 112 *d++ = s->val.c;
michael@0 113 break;
michael@0 114 case nsXPTType::T_WCHAR:
michael@0 115 if (i < N_ARG_REGS)
michael@0 116 regs[i] = s->val.wc;
michael@0 117 else
michael@0 118 *d++ = s->val.wc;
michael@0 119 break;
michael@0 120 default:
michael@0 121 // all the others are plain pointer types
michael@0 122 if (i < N_ARG_REGS)
michael@0 123 regs[i] = (uint64_t)s->val.p;
michael@0 124 else
michael@0 125 *d++ = (uint64_t)s->val.p;
michael@0 126 break;
michael@0 127 }
michael@0 128 }
michael@0 129 }
michael@0 130
michael@0 131 extern "C" nsresult _NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
michael@0 132 uint32_t paramCount,
michael@0 133 nsXPTCVariant* params);
michael@0 134
michael@0 135 EXPORT_XPCOM_API(nsresult)
michael@0 136 NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
michael@0 137 uint32_t paramCount, nsXPTCVariant* params)
michael@0 138 {
michael@0 139 return _NS_InvokeByIndex(that, methodIndex, paramCount, params);
michael@0 140 }

mercurial