Prusa MINI Firmware overview
unwarm.h File Reference
#include "unwinder.h"

Go to the source code of this file.

Classes

struct  RegData
 
struct  MemData
 
struct  UnwState
 

Macros

#define UNW_MAX_INSTR_COUNT   500
 
#define MEM_HASH_SIZE   31
 
#define M_IsOriginValid(v)   !!((v) & 0x7F)
 
#define M_Origin2Str(v)   ((v) ? "VALID" : "INVALID")
 
#define UnwPrintd1(a)
 
#define UnwPrintd2(a, b)
 
#define UnwPrintd3(a, b, c)
 
#define UnwPrintd4(a, b, c, d)
 
#define UnwPrintd5(a, b, c, d, e)
 
#define UnwPrintd6(a, b, c, d, e, f)
 
#define UnwPrintd7(a, b, c, d, e, f, g)
 
#define UnwPrintd8(a, b, c, d, e, f, g, h)
 

Enumerations

enum  RegValOrigin {
  REG_VAL_INVALID = 0x00, REG_VAL_FROM_STACK = 0x01, REG_VAL_FROM_MEMORY = 0x02, REG_VAL_FROM_CONST = 0x04,
  REG_VAL_ARITHMETIC = 0x80
}
 

Functions

UnwResult UnwStartArm (UnwState *const state)
 
UnwResult UnwStartThumb (UnwState *const state)
 
void UnwInvalidateRegisterFile (RegData *regFile)
 
void UnwInitState (UnwState *const state, const UnwindCallbacks *cb, void *rptData, uint32_t pcValue, uint32_t spValue)
 
bool UnwReportRetAddr (UnwState *const state, uint32_t addr)
 
bool UnwMemWriteRegister (UnwState *const state, const uint32_t addr, const RegData *const reg)
 
bool UnwMemReadRegister (UnwState *const state, const uint32_t addr, RegData *const reg)
 
void UnwMemHashGC (UnwState *const state)
 

Macro Definition Documentation

◆ UNW_MAX_INSTR_COUNT

#define UNW_MAX_INSTR_COUNT   500

The maximum number of instructions to interpet in a function. Unwinding will be unconditionally stopped and UNWIND_EXHAUSTED returned if more than this number of instructions are interpreted in a single function without unwinding a stack frame. This prevents infinite loops or corrupted program memory from preventing unwinding from progressing.

◆ MEM_HASH_SIZE

#define MEM_HASH_SIZE   31

The size of the hash used to track reads and writes to memory. This should be a prime value for efficiency.

◆ M_IsOriginValid

#define M_IsOriginValid (   v)    !!((v) & 0x7F)

◆ M_Origin2Str

#define M_Origin2Str (   v)    ((v) ? "VALID" : "INVALID")

◆ UnwPrintd1

#define UnwPrintd1 (   a)

◆ UnwPrintd2

#define UnwPrintd2 (   a,
 
)

◆ UnwPrintd3

#define UnwPrintd3 (   a,
  b,
 
)

◆ UnwPrintd4

#define UnwPrintd4 (   a,
  b,
  c,
 
)

◆ UnwPrintd5

#define UnwPrintd5 (   a,
  b,
  c,
  d,
 
)

◆ UnwPrintd6

#define UnwPrintd6 (   a,
  b,
  c,
  d,
  e,
 
)

◆ UnwPrintd7

#define UnwPrintd7 (   a,
  b,
  c,
  d,
  e,
  f,
 
)

◆ UnwPrintd8

#define UnwPrintd8 (   a,
  b,
  c,
  d,
  e,
  f,
  g,
 
)

Enumeration Type Documentation

◆ RegValOrigin

Enumerator
REG_VAL_INVALID 

Invalid value.

REG_VAL_FROM_STACK 
REG_VAL_FROM_MEMORY 
REG_VAL_FROM_CONST 
REG_VAL_ARITHMETIC 
35  {
36  /** Invalid value. */
37  REG_VAL_INVALID = 0x00,
38  REG_VAL_FROM_STACK = 0x01,
39  REG_VAL_FROM_MEMORY = 0x02,
40  REG_VAL_FROM_CONST = 0x04,
41  REG_VAL_ARITHMETIC = 0x80

Function Documentation

◆ UnwStartArm()

UnwResult UnwStartArm ( UnwState *const  state)

◆ UnwStartThumb()

UnwResult UnwStartThumb ( UnwState *const  state)

◆ UnwInvalidateRegisterFile()

void UnwInvalidateRegisterFile ( RegData regFile)

◆ UnwInitState()

void UnwInitState ( UnwState *const  state,
const UnwindCallbacks cb,
void rptData,
uint32_t  pcValue,
uint32_t  spValue 
)

◆ UnwReportRetAddr()

bool UnwReportRetAddr ( UnwState *const  state,
uint32_t  addr 
)

◆ UnwMemWriteRegister()

bool UnwMemWriteRegister ( UnwState *const  state,
const uint32_t  addr,
const RegData *const  reg 
)

◆ UnwMemReadRegister()

bool UnwMemReadRegister ( UnwState *const  state,
const uint32_t  addr,
RegData *const  reg 
)

◆ UnwMemHashGC()

void UnwMemHashGC ( UnwState *const  state)
REG_VAL_FROM_STACK
Definition: unwarm.h:38
REG_VAL_FROM_CONST
Definition: unwarm.h:40
REG_VAL_INVALID
Definition: unwarm.h:37
REG_VAL_FROM_MEMORY
Definition: unwarm.h:39
REG_VAL_ARITHMETIC
Definition: unwarm.h:41