Ian Rogers | bdb0391 | 2011-09-14 00:55:44 -0700 | [diff] [blame] | 1 | // Copyright 2011 Google Inc. All Rights Reserved. |
| 2 | |
| 3 | #ifndef ART_SRC_CONTEXT_H_ |
| 4 | #define ART_SRC_CONTEXT_H_ |
| 5 | |
| 6 | #include <stdint.h> |
| 7 | |
| 8 | namespace art { |
| 9 | |
| 10 | class Frame; |
| 11 | |
| 12 | // Representation of a thread's context on the executing machine |
| 13 | class Context { |
| 14 | public: |
| 15 | // Creates a context for the running architecture |
| 16 | static Context* Create(); |
| 17 | |
| 18 | virtual ~Context() {} |
| 19 | |
| 20 | // Read values from callee saves in the given frame. The frame also holds |
| 21 | // the method that holds the layout. |
| 22 | virtual void FillCalleeSaves(const Frame& fr) = 0; |
| 23 | |
| 24 | // Set the stack pointer value |
| 25 | virtual void SetSP(uintptr_t new_sp) = 0; |
| 26 | |
| 27 | // Set the program counter value |
| 28 | virtual void SetPC(uintptr_t new_pc) = 0; |
| 29 | |
Ian Rogers | d6b1f61 | 2011-09-27 13:38:14 -0700 | [diff] [blame] | 30 | // Read the given GPR |
| 31 | virtual uintptr_t GetGPR(uint32_t reg) = 0; |
| 32 | |
Ian Rogers | bdb0391 | 2011-09-14 00:55:44 -0700 | [diff] [blame] | 33 | // Switch execution of the executing context to this context |
| 34 | virtual void DoLongJump() = 0; |
| 35 | }; |
| 36 | |
| 37 | } // namespace art |
| 38 | |
| 39 | #endif // ART_SRC_CONTEXT_H_ |