11a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe/*
21a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * Copyright (C) 2014 The Android Open Source Project
31a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe *
41a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * Licensed under the Apache License, Version 2.0 (the "License");
51a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * you may not use this file except in compliance with the License.
61a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * You may obtain a copy of the License at
71a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe *
81a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe *      http://www.apache.org/licenses/LICENSE-2.0
91a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe *
101a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * Unless required by applicable law or agreed to in writing, software
111a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * distributed under the License is distributed on an "AS IS" BASIS,
121a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
131a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * See the License for the specific language governing permissions and
141a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * limitations under the License.
151a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe */
161a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe
171a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe#ifndef ART_RUNTIME_ARCH_MIPS64_ASM_SUPPORT_MIPS64_S_
181a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe#define ART_RUNTIME_ARCH_MIPS64_ASM_SUPPORT_MIPS64_S_
191a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe
201a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe#include "asm_support_mips64.h"
211a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe
221a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe// Define special registers.
231a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe
241a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe// Register holding suspend check count down.
251a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe#define rSUSPEND $s0
261a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe// Register holding Thread::Current().
271a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe#define rSELF $s1
281a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe
291a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe
3004568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic    // Declare a function called name, sets up $gp.
3104568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic    // This macro modifies t8.
321a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.macro ENTRY name
331a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe    .type \name, %function
341a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe    .global \name
351a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe    // Cache alignment for function entry.
361a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe    .balign 16
371a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe\name:
381a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe    .cfi_startproc
3904568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic    // Set up $gp and store the previous $gp value to $t8. It will be pushed to the
4004568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic    // stack after the frame has been constructed.
4104568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic    .cpsetup $t9, $t8, \name
421a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe    // Ensure we get a sane starting CFA.
431a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe    .cfi_def_cfa $sp,0
441a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe    // Declare a local convenience label to be branched to when $gp is already set up.
451a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.L\name\()_gp_set:
461a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.endm
471a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe
481a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe     // Declare a function called name, doesn't set up $gp.
491a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.macro ENTRY_NO_GP name
501a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe    .type \name, %function
511a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe    .global \name
521a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe    // Cache alignment for function entry.
531a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe    .balign 16
541a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe\name:
551a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe    .cfi_startproc
561a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe     // Ensure we get a sane starting CFA.
571a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe    .cfi_def_cfa $sp,0
581a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.endm
591a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe
601a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.macro END name
611a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe    .cfi_endproc
621a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe    .size \name, .-\name
631a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.endm
641a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe
651a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.macro UNIMPLEMENTED name
661a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe    ENTRY \name
671a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe    break
681a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe    break
691a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe    END \name
701a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.endm
711a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe
721a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe
731a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe#endif  // ART_RUNTIME_ARCH_MIPS64_ASM_SUPPORT_MIPS64_S_
74