Home | History | Annotate | Download | only in asm
      1 // Copyright 2014 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 /*
      6  * typedef void (*PushAllRegistersCallback)(SafePointBarrier*, ThreadState*, intptr_t*);
      7  * extern "C" void pushAllRegisters(SafePointBarrier*, ThreadState*, PushAllRegistersCallback)
      8  */
      9 
     10 .type pushAllRegisters, %function
     11 .global pushAllRegisters
     12 .hidden pushAllRegisters
     13 pushAllRegisters:
     14         // Push all callee-saves registers to get them
     15         // on the stack for conservative stack scanning.
     16         // Reserve space for callee-saved registers and return address.
     17         daddiu $sp,$sp,-80
     18         // Save the callee-saved registers and the return address.
     19         sd $s0,0($sp)
     20         sd $s1,8($sp)
     21         sd $s2,16($sp)
     22         sd $s3,24($sp)
     23         sd $s4,32($sp)
     24         sd $s5,40($sp)
     25         sd $s6,48($sp)
     26         sd $s7,56($sp)
     27         sd $ra,64($sp)
     28         // Note: the callee-saved floating point registers do not need to be
     29         // copied to the stack, because fp registers never hold heap pointers
     30         // and so do not need to be kept visible to the garbage collector.
     31         // Pass the two first arguments untouched in a0 and a1 and the
     32         // stack pointer to the callback.
     33         move $t9,$a2
     34         move $a2,$sp
     35         jal $t9
     36         // Restore return address, adjust stack and return.
     37         // Note: the copied registers do not need to be reloaded here,
     38         // because they were preserved by the called routine.
     39         ld $ra,64($sp)
     40         daddiu $sp,$sp,80
     41         jr $ra
     42