blob: aca994b0a2ab940165c4a64b2e135cf6648272ae [file] [log] [blame]
Ian Rogersbdb03912011-09-14 00:55:44 -07001// Copyright 2011 Google Inc. All Rights Reserved.
2
3#ifndef ART_SRC_CONTEXT_X86_H_
4#define ART_SRC_CONTEXT_X86_H_
5
6#include "context.h"
7
Ian Rogers67375ac2011-09-14 00:55:44 -07008#include "constants_x86.h"
9
Ian Rogersbdb03912011-09-14 00:55:44 -070010namespace art {
11namespace x86 {
12
13class X86Context : public Context {
14 public:
Ian Rogers67375ac2011-09-14 00:55:44 -070015 X86Context();
Ian Rogersbdb03912011-09-14 00:55:44 -070016 virtual ~X86Context() {}
17
18 // No callee saves on X86
Ian Rogers67375ac2011-09-14 00:55:44 -070019 virtual void FillCalleeSaves(const Frame& fr);
Ian Rogersbdb03912011-09-14 00:55:44 -070020
21 virtual void SetSP(uintptr_t new_sp) {
Ian Rogers67375ac2011-09-14 00:55:44 -070022 gprs_[ESP] = new_sp;
Ian Rogersbdb03912011-09-14 00:55:44 -070023 }
24
25 virtual void SetPC(uintptr_t new_pc) {
26 eip_ = new_pc;
27 }
28
Ian Rogersd6b1f612011-09-27 13:38:14 -070029 virtual uintptr_t GetGPR(uint32_t reg) {
30 CHECK_GE(reg, 0u);
31 CHECK_LT(reg, 8u);
32 return gprs_[reg];
33 }
34
Ian Rogersbdb03912011-09-14 00:55:44 -070035 virtual void DoLongJump();
36
37 private:
Ian Rogers67375ac2011-09-14 00:55:44 -070038 uintptr_t gprs_[8];
Ian Rogersbdb03912011-09-14 00:55:44 -070039 uintptr_t eip_;
40};
41} // namespace x86
42} // namespace art
43
44#endif // ART_SRC_CONTEXT_X86_H_