summaryrefslogtreecommitdiff
path: root/src/context.h
blob: b4a8b65b77cfc9a4cb9e9bf4ad11bc1d095ce039 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright 2011 Google Inc. All Rights Reserved.

#ifndef ART_SRC_CONTEXT_H_
#define ART_SRC_CONTEXT_H_

#include <stdint.h>

namespace art {

class Frame;

// Representation of a thread's context on the executing machine
class Context {
 public:
  // Creates a context for the running architecture
  static Context* Create();

  virtual ~Context() {}

  // Read values from callee saves in the given frame. The frame also holds
  // the method that holds the layout.
  virtual void FillCalleeSaves(const Frame& fr) = 0;

  // Set the stack pointer value
  virtual void SetSP(uintptr_t new_sp) = 0;

  // Set the program counter value
  virtual void SetPC(uintptr_t new_pc) = 0;

  // Read the given GPR
  virtual uintptr_t GetGPR(uint32_t reg) = 0;

  // Switch execution of the executing context to this context
  virtual void DoLongJump() = 0;
};

}  // namespace art

#endif  // ART_SRC_CONTEXT_H_