blob: b4a8b65b77cfc9a4cb9e9bf4ad11bc1d095ce039 [file] [log] [blame]
Ian Rogersbdb03912011-09-14 00:55:44 -07001// 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
8namespace art {
9
10class Frame;
11
12// Representation of a thread's context on the executing machine
13class 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 Rogersd6b1f612011-09-27 13:38:14 -070030 // Read the given GPR
31 virtual uintptr_t GetGPR(uint32_t reg) = 0;
32
Ian Rogersbdb03912011-09-14 00:55:44 -070033 // 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_