blob: 829849e6762e4be117eb35a73e91b9f3a9881d68 [file] [log] [blame]
Elliott Hughes2faa5f12012-01-30 14:42:07 -08001/*
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 */
Ian Rogersbdb03912011-09-14 00:55:44 -070016
17#ifndef ART_SRC_CONTEXT_X86_H_
18#define ART_SRC_CONTEXT_X86_H_
19
20#include "context.h"
21
Ian Rogers67375ac2011-09-14 00:55:44 -070022#include "constants_x86.h"
23
Ian Rogersbdb03912011-09-14 00:55:44 -070024namespace art {
25namespace x86 {
26
27class X86Context : public Context {
28 public:
Ian Rogers67375ac2011-09-14 00:55:44 -070029 X86Context();
Ian Rogersbdb03912011-09-14 00:55:44 -070030 virtual ~X86Context() {}
31
32 // No callee saves on X86
Ian Rogers67375ac2011-09-14 00:55:44 -070033 virtual void FillCalleeSaves(const Frame& fr);
Ian Rogersbdb03912011-09-14 00:55:44 -070034
35 virtual void SetSP(uintptr_t new_sp) {
Ian Rogers67375ac2011-09-14 00:55:44 -070036 gprs_[ESP] = new_sp;
Ian Rogersbdb03912011-09-14 00:55:44 -070037 }
38
39 virtual void SetPC(uintptr_t new_pc) {
40 eip_ = new_pc;
41 }
42
Ian Rogersd6b1f612011-09-27 13:38:14 -070043 virtual uintptr_t GetGPR(uint32_t reg) {
44 CHECK_GE(reg, 0u);
45 CHECK_LT(reg, 8u);
46 return gprs_[reg];
47 }
48
Ian Rogersbdb03912011-09-14 00:55:44 -070049 virtual void DoLongJump();
50
51 private:
Ian Rogers67375ac2011-09-14 00:55:44 -070052 uintptr_t gprs_[8];
Ian Rogersbdb03912011-09-14 00:55:44 -070053 uintptr_t eip_;
54};
55} // namespace x86
56} // namespace art
57
58#endif // ART_SRC_CONTEXT_X86_H_