jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ART_SRC_OAT_RUNTIME_MIPS_CONTEXT_MIPS_H_ |
| 18 | #define ART_SRC_OAT_RUNTIME_MIPS_CONTEXT_MIPS_H_ |
| 19 | |
| 20 | #include "constants_mips.h" |
| 21 | #include "oat/runtime/context.h" |
| 22 | |
| 23 | namespace art { |
| 24 | namespace mips { |
| 25 | |
| 26 | class MipsContext : public Context { |
| 27 | public: |
| 28 | MipsContext(); |
| 29 | virtual ~MipsContext() {} |
| 30 | |
| 31 | // No callee saves on mips |
| 32 | virtual void FillCalleeSaves(const StackVisitor& fr); |
| 33 | |
| 34 | virtual void SetSP(uintptr_t new_sp) { |
| 35 | gprs_[SP] = new_sp; |
| 36 | } |
| 37 | |
| 38 | virtual void SetPC(uintptr_t new_pc) { |
jeffhao | 0703060 | 2012-09-26 14:33:14 -0700 | [diff] [blame] | 39 | gprs_[RA] = new_pc; |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | virtual uintptr_t GetGPR(uint32_t reg) { |
| 43 | CHECK_GE(reg, 0u); |
| 44 | CHECK_LT(reg, 32u); |
| 45 | return gprs_[reg]; |
| 46 | } |
| 47 | |
| 48 | virtual void SmashCallerSaves(); |
| 49 | virtual void DoLongJump(); |
| 50 | |
| 51 | private: |
| 52 | uintptr_t gprs_[32]; |
| 53 | uint32_t fprs_[32]; |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 54 | }; |
| 55 | } // namespace mips |
| 56 | } // namespace art |
| 57 | |
| 58 | #endif // ART_SRC_OAT_RUNTIME_MIPS_CONTEXT_MIPS_H_ |