xpcom/reflect/xptcall/src/md/unix/xptcinvoke_sparc64_openbsd.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.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     2  *
     3  * This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     8 /* Platform specific code to invoke XPCOM methods on native objects */
    10 #include "xptcprivate.h"
    12 #if !defined(__sparc) && !defined(__sparc__)
    13 #error "This code is for Sparc only"
    14 #endif
    16 extern "C" uint64_t
    17 invoke_copy_to_stack(uint64_t* d, uint32_t paramCount, nsXPTCVariant* s)
    18 {
    19   /*
    20     We need to copy the parameters for this function to locals and use them
    21     from there since the parameters occupy the same stack space as the stack
    22     we're trying to populate.
    23   */
    24   uint64_t *l_d = d;
    25   nsXPTCVariant *l_s = s;
    26   uint64_t l_paramCount = paramCount;
    27   uint64_t regCount = 0;  // return the number of registers to load from the stack
    29   for(uint64_t i = 0; i < l_paramCount; i++, l_d++, l_s++)
    30   {
    31     if (regCount < 5) regCount++;
    33     if (l_s->IsPtrData())
    34     {
    35       *l_d = (uint64_t)l_s->ptr;
    36       continue;
    37     }
    38     switch (l_s->type)
    39     {
    40       case nsXPTType::T_I8    : *((int64_t*)l_d)     = l_s->val.i8;    break;
    41       case nsXPTType::T_I16   : *((int64_t*)l_d)     = l_s->val.i16;   break;
    42       case nsXPTType::T_I32   : *((int64_t*)l_d)     = l_s->val.i32;   break;
    43       case nsXPTType::T_I64   : *((int64_t*)l_d)     = l_s->val.i64;   break;
    45       case nsXPTType::T_U8    : *((uint64_t*)l_d)    = l_s->val.u8;    break;
    46       case nsXPTType::T_U16   : *((uint64_t*)l_d)    = l_s->val.u16;   break;
    47       case nsXPTType::T_U32   : *((uint64_t*)l_d)    = l_s->val.u32;   break;
    48       case nsXPTType::T_U64   : *((uint64_t*)l_d)    = l_s->val.u64;   break;
    50       /* in the case of floats, we want to put the bits in to the
    51          64bit space right justified... floats in the parameter array on
    52          sparcv9 use odd numbered registers.. %f1, %f3, so we have to skip
    53          the space that would be occupied by %f0, %f2, etc.
    54       */
    55       case nsXPTType::T_FLOAT : *(((float*)l_d) + 1) = l_s->val.f;     break;
    56       case nsXPTType::T_DOUBLE: *((double*)l_d)      = l_s->val.d;     break;
    57       case nsXPTType::T_BOOL  : *((int64_t*)l_d)     = l_s->val.b;     break;
    58       case nsXPTType::T_CHAR  : *((uint64_t*)l_d)    = l_s->val.c;     break;
    59       case nsXPTType::T_WCHAR : *((int64_t*)l_d)     = l_s->val.wc;    break;
    61       default:
    62         // all the others are plain pointer types
    63         *((void**)l_d) = l_s->val.p;
    64         break;
    65     }
    66   }
    68   return regCount;
    69 }

mercurial