toolkit/crashreporter/google-breakpad/src/processor/stackwalker_selftest_sol.s

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* Copyright (c) 2007, Google Inc.
     2  * All rights reserved.
     3  *
     4  * Redistribution and use in source and binary forms, with or without
     5  * modification, are permitted provided that the following conditions are
     6  * met:
     7  *
     8  *     * Redistributions of source code must retain the above copyright
     9  * notice, this list of conditions and the following disclaimer.
    10  *     * Redistributions in binary form must reproduce the above
    11  * copyright notice, this list of conditions and the following disclaimer
    12  * in the documentation and/or other materials provided with the
    13  * distribution.
    14  *     * Neither the name of Google Inc. nor the names of its
    15  * contributors may be used to endorse or promote products derived from
    16  * this software without specific prior written permission.
    17  *
    18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    29  */
    31 /* stackwalker_selftest_sol.s
    32  * On Solaris, the recommeded compiler is CC, so we can not use gcc inline
    33  * asm, use this method instead.
    34  *
    35  * How to compile: as -P -L -D_ASM -D_STDC -K PIC -o \
    36  *                 src/processor/stackwalker_selftest_sol.o \
    37  *                 src/processor/stackwalker_selftest_sol.s
    38  *
    39  * Author: Michael Shang
    40  */
    42 #include <sys/asm_linkage.h>
    44 #if defined(__i386)
    47 ENTRY(GetEBP) 
    48       pushl    %ebp
    49       movl     %esp,%ebp
    50       subl     $0x00000004,%esp
    51       movl     0x00000000(%ebp),%eax
    52       movl     %eax,0xfffffffc(%ebp)
    53       movl     0xfffffffc(%ebp),%eax
    54       leave    
    55       ret      
    56 SET_SIZE(GetEBP)
    58 ENTRY(GetEIP) 
    59       pushl    %ebp
    60       movl     %esp,%ebp
    61       subl     $0x00000004,%esp
    62       movl     0x00000004(%ebp),%eax
    63       movl     %eax,0xfffffffc(%ebp)
    64       movl     0xfffffffc(%ebp),%eax
    65       leave    
    66       ret      
    67 SET_SIZE(GetEIP)
    69 ENTRY(GetESP) 
    70       pushl    %ebp
    71       movl     %esp,%ebp
    72       subl     $0x00000004,%esp
    73       movl     %ebp,%eax
    74       movl     %eax,0xfffffffc(%ebp)
    75       movl     0xfffffffc(%ebp),%eax
    76       addl     $0x00000008,%eax
    77       leave    
    78       ret      
    79 SET_SIZE(GetESP)
    82 #elif defined(__sparc)
    85 ENTRY(GetPC)
    86       save     %sp, -120, %sp
    87       mov      %i7, %i4
    88       inccc    8, %i4
    89       mov      %i4, %i0
    90       ret      
    91       restore  
    92 SET_SIZE(GetPC)
    94 ENTRY(GetSP)
    95       save     %sp, -120, %sp
    96       mov      %fp, %i4
    97       mov      %i4, %i0
    98       ret      
    99       restore  
   100 SET_SIZE(GetSP)
   102 ENTRY(GetFP)
   103       save     %sp, -120, %sp
   104       ld       [%fp + 56], %g1
   105       mov      %g1, %i0
   106       ret      
   107       restore  
   108 SET_SIZE(GetFP)
   111 #endif  // __i386 || __sparc

mercurial