xpcom/reflect/xptcall/src/md/win32/xptcinvoke_asm_x86_64.asm

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 ; This Source Code Form is subject to the terms of the Mozilla Public
     2 ; License, v. 2.0. If a copy of the MPL was not distributed with this
     3 ; file, You can obtain one at http://mozilla.org/MPL/2.0/.
     5 extrn invoke_copy_to_stack:PROC
     8 .CODE
    10 ;
    11 ;XPTC__InvokebyIndex(nsISupports* that, uint32_t methodIndex,
    12 ;                   uint32_t paramCount, nsXPTCVariant* params)
    13 ;
    15 XPTC__InvokebyIndex PROC FRAME
    17    ; store register parameters
    19     mov     qword ptr [rsp+32], r9        ; params
    20     mov     dword ptr [rsp+24], r8d       ; paramCount
    21     mov     dword ptr [rsp+16], edx       ; methodIndex
    22     mov     qword ptr [rsp+8], rcx        ; that
    24     push    rbp
    25     .PUSHREG rbp
    26     mov     rbp, rsp            ; store current RSP to RBP
    27     .SETFRAME rbp, 0
    28     .ENDPROLOG
    30     sub     rsp, 32
    32     ; maybe we don't have any parameters to copy
    34     test    r8d, r8d
    35     jz      noparams
    37     ;
    38     ; Build stack for stdcall
    39     ;
    41     ; 1st parameter is space for parameters
    43     mov     eax, r8d
    44     or      eax, 1
    45     shl     rax, 3              ; *= 8
    46     sub     rsp, rax
    47     mov     rcx, rsp
    49     ; 2nd parameter is parameter count
    51     mov     edx, r8d
    53     ; 3rd parameter is params
    55     mov     r8, r9
    57     sub     rsp, 40
    58     call    invoke_copy_to_stack ; rcx = d
    59                                  ; edx = paramCount
    60                                  ; r8  = s
    61     add     rsp, 32
    63     ; Current stack is the following.
    64     ;
    65     ;  0h: [space (for this)]
    66     ;  8h: [1st parameter]
    67     ; 10h: [2nd parameter]
    68     ; 18h: [3rd parameter]
    69     ; 20h: [4th parameter]
    70     ; ...
    71     ;
    72     ; On Win64 ABI, the first 4 parameters are passed using registers,
    73     ; and others are on stack. 
    75     ; 1st, 2nd and 3rd arguments are passed via registers
    77     mov     rdx, qword ptr [rsp+8] ; 1st parameter
    78     movsd   xmm1, qword ptr [rsp+8] ; for double
    80     mov     r8, qword ptr [rsp+16] ; 2nd parameter
    81     movsd   xmm2, qword ptr [rsp+16] ; for double
    83     mov     r9, qword ptr [rsp+24] ; 3rd parameter
    84     movsd   xmm3, qword ptr [rsp+24] ; for double
    86     ; rcx register is this
    88     mov     rcx, qword ptr [rbp+8+8] ; that
    90 noparams:
    92     ; calculate call address
    94     mov     r11, qword ptr [rcx]
    95     mov     eax, dword ptr [rbp+16+8] ; methodIndex
    97     call    qword ptr [r11+rax*8]      ; stdcall, i.e. callee cleans up stack.
    99     mov     rsp, rbp
   100     pop     rbp
   102     ret
   104 XPTC__InvokebyIndex ENDP
   107 END

mercurial