xpcom/reflect/xptcall/src/md/unix/xptcinvoke_mips.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: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
michael@0 2 * Version: MPL 1.1
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 /* This code is for MIPS using the O32 ABI. */
michael@0 9
michael@0 10 /* Platform specific code to invoke XPCOM methods on native objects */
michael@0 11
michael@0 12 #include "xptcprivate.h"
michael@0 13
michael@0 14 #include <stdint.h>
michael@0 15
michael@0 16 extern "C" uint32_t
michael@0 17 invoke_count_words(uint32_t paramCount, nsXPTCVariant* s)
michael@0 18 {
michael@0 19 // Count a word for a0 even though it's never stored or loaded
michael@0 20 // We do this only for alignment of register pairs.
michael@0 21 uint32_t result = 1;
michael@0 22 for (uint32_t i = 0; i < paramCount; i++, result++, s++)
michael@0 23 {
michael@0 24 if (s->IsPtrData())
michael@0 25 continue;
michael@0 26
michael@0 27 switch(s->type)
michael@0 28 {
michael@0 29 case nsXPTType::T_I64 :
michael@0 30 case nsXPTType::T_U64 :
michael@0 31 case nsXPTType::T_DOUBLE :
michael@0 32 if (result & 1)
michael@0 33 result++;
michael@0 34 result++;
michael@0 35 break;
michael@0 36
michael@0 37 default:
michael@0 38 break;
michael@0 39 }
michael@0 40 }
michael@0 41 return (result + 1) & ~(uint32_t)1;
michael@0 42 }
michael@0 43
michael@0 44 extern "C" void
michael@0 45 invoke_copy_to_stack(uint32_t* d, uint32_t paramCount,
michael@0 46 nsXPTCVariant* s)
michael@0 47 {
michael@0 48 // Skip the unused a0 slot, which we keep only for register pair alignment.
michael@0 49 d++;
michael@0 50
michael@0 51 for (uint32_t i = 0; i < paramCount; i++, d++, s++)
michael@0 52 {
michael@0 53 if (s->IsPtrData())
michael@0 54 {
michael@0 55 *((void**)d) = s->ptr;
michael@0 56 continue;
michael@0 57 }
michael@0 58
michael@0 59 switch(s->type)
michael@0 60 {
michael@0 61 case nsXPTType::T_I8 : *d = (uint32_t) s->val.i8; break;
michael@0 62 case nsXPTType::T_I16 : *d = (uint32_t) s->val.i16; break;
michael@0 63 case nsXPTType::T_I32 : *d = (uint32_t) s->val.i32; break;
michael@0 64 case nsXPTType::T_I64 :
michael@0 65 if ((intptr_t)d & 4) d++;
michael@0 66 *((int64_t*) d) = s->val.i64; d++;
michael@0 67 break;
michael@0 68 case nsXPTType::T_U8 : *d = (uint32_t) s->val.u8; break;
michael@0 69 case nsXPTType::T_U16 : *d = (uint32_t) s->val.u16; break;
michael@0 70 case nsXPTType::T_U32 : *d = (uint32_t) s->val.u32; break;
michael@0 71 case nsXPTType::T_U64 :
michael@0 72 if ((intptr_t)d & 4) d++;
michael@0 73 *((uint64_t*) d) = s->val.u64; d++;
michael@0 74 break;
michael@0 75 case nsXPTType::T_FLOAT : *((float*) d) = s->val.f; break;
michael@0 76 case nsXPTType::T_DOUBLE :
michael@0 77 if ((intptr_t)d & 4) d++;
michael@0 78 *((double*) d) = s->val.d; d++;
michael@0 79 break;
michael@0 80 case nsXPTType::T_BOOL : *d = (bool) s->val.b; break;
michael@0 81 case nsXPTType::T_CHAR : *d = (char) s->val.c; break;
michael@0 82 case nsXPTType::T_WCHAR : *d = (wchar_t) s->val.wc; break;
michael@0 83 default:
michael@0 84 *((void**)d) = s->val.p;
michael@0 85 break;
michael@0 86 }
michael@0 87 }
michael@0 88 }
michael@0 89
michael@0 90 extern "C" nsresult _NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
michael@0 91 uint32_t paramCount,
michael@0 92 nsXPTCVariant* params);
michael@0 93
michael@0 94 EXPORT_XPCOM_API(nsresult)
michael@0 95 NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
michael@0 96 uint32_t paramCount, nsXPTCVariant* params)
michael@0 97 {
michael@0 98 return _NS_InvokeByIndex(that, methodIndex, paramCount, params);
michael@0 99 }

mercurial