simulavr
1.1.0
|
Implements a stack register with stack logic. More...
#include <hwstack.h>
Public Member Functions | |
HWStack (AvrDevice *core) | |
Creates a stack instance. More... | |
virtual | ~HWStack () |
virtual void | Push (unsigned char val)=0 |
Pushs one byte to stack. More... | |
virtual unsigned char | Pop ()=0 |
Pops one byte from stack. More... | |
virtual void | PushAddr (unsigned long addr)=0 |
Pushs a address to stack. More... | |
virtual unsigned long | PopAddr ()=0 |
Pops a address from stack. More... | |
virtual void | Reset () |
Resets stack pointer and listener table. More... | |
unsigned long | GetStackPointer () const |
Returns current stack pointer value. More... | |
void | SetStackPointer (unsigned long val) |
Sets current stack pointer value (used by GDB interface) More... | |
void | SetReturnPoint (unsigned long stackPointer, Funktor *listener) |
Subscribes a Listener for a return address. More... | |
void | ResetLowestStackpointer (void) |
Sets lowest stack marker back to current stackpointer. More... | |
unsigned long | GetLowestStackpointer (void) |
Gets back the lowest stack pointer (for measuring stack usage) More... | |
Public Attributes | |
ThreadList | m_ThreadList |
Protected Member Functions | |
void | CheckReturnPoints () |
Run functions registered for current stack address and delete them. More... | |
Protected Attributes | |
AvrDevice * | core |
Link to device. More... | |
uint32_t | stackPointer |
current value of stack pointer More... | |
uint32_t | lowestStackPointer |
marker: lowest stackpointer used by program More... | |
std::multimap< unsigned long, Funktor * > | returnPointList |
Maps adresses to listeners for return addresses. More... | |
Implements a stack register with stack logic.
This is the base class for all 2 different stack types. It holds the interface for pushing and poping bytes and addresses from stack by core and for interrupt
HWStack::HWStack | ( | AvrDevice * | core | ) |
|
virtual |
Definition at line 42 of file hwstack.cpp.
References returnPointList.
|
protected |
Run functions registered for current stack address and delete them.
Definition at line 55 of file hwstack.cpp.
References returnPointList, and stackPointer.
Referenced by HWStackSram::Pop(), HWStackSram::Push(), HWStackSram::SetSph(), and HWStackSram::SetSpl().
|
inline |
|
inline |
Returns current stack pointer value.
Definition at line 116 of file hwstack.h.
Referenced by ThreadList::OnCall(), and AvrDevice::Step().
|
pure virtual |
Pops one byte from stack.
Implemented in ThreeLevelStack, and HWStackSram.
Referenced by avr_op_POP::operator()().
|
pure virtual |
Pops a address from stack.
Implemented in ThreeLevelStack, and HWStackSram.
Referenced by avr_op_RET::operator()(), and avr_op_RETI::operator()().
|
pure virtual |
Pushs one byte to stack.
Implemented in ThreeLevelStack, and HWStackSram.
Referenced by avr_op_PUSH::operator()().
|
pure virtual |
Pushs a address to stack.
Implemented in ThreeLevelStack, and HWStackSram.
Referenced by avr_op_CALL::operator()(), avr_op_EICALL::operator()(), avr_op_ICALL::operator()(), avr_op_RCALL::operator()(), and AvrDevice::Step().
|
virtual |
Resets stack pointer and listener table.
Reimplemented in ThreeLevelStack, and HWStackSram.
Definition at line 49 of file hwstack.cpp.
References lowestStackPointer, returnPointList, and stackPointer.
Referenced by HWStack().
|
inline |
void HWStack::SetReturnPoint | ( | unsigned long | stackPointer, |
Funktor * | listener | ||
) |
Subscribes a Listener for a return address.
Attention! SetReturnPoint must get a COPY of a Funktor because it self destroy this functor after usage!
Definition at line 66 of file hwstack.cpp.
References returnPointList.
Referenced by AvrDevice::Step().
|
inline |
|
protected |
Link to device.
Definition at line 94 of file hwstack.h.
Referenced by HWStackSram::Pop(), HWStackSram::PopAddr(), HWStackSram::Push(), HWStackSram::PushAddr(), HWStackSram::Reset(), HWStackSram::SetSph(), and HWStackSram::SetSpl().
|
protected |
marker: lowest stackpointer used by program
Definition at line 96 of file hwstack.h.
Referenced by HWStackSram::Push(), ThreeLevelStack::PushAddr(), Reset(), HWStackSram::Reset(), and ThreeLevelStack::Reset().
ThreadList HWStack::m_ThreadList |
List of known threads created within target.
Definition at line 103 of file hwstack.h.
Referenced by HWStackSram::OnSPReadByTarget(), avr_op_CALL::operator()(), avr_op_EICALL::operator()(), avr_op_ICALL::operator()(), avr_op_RCALL::operator()(), HWStackSram::Pop(), HWStackSram::Push(), HWStackSram::SetSph(), and HWStackSram::SetSpl().
|
protected |
Maps adresses to listeners for return addresses.
Definition at line 97 of file hwstack.h.
Referenced by CheckReturnPoints(), Reset(), HWStackSram::Reset(), ThreeLevelStack::Reset(), SetReturnPoint(), and ~HWStack().
|
protected |
current value of stack pointer
Definition at line 95 of file hwstack.h.
Referenced by CheckReturnPoints(), HWStackSram::GetSph(), HWStackSram::GetSpl(), HWStackSram::OnSPReadByTarget(), HWStackSram::Pop(), ThreeLevelStack::PopAddr(), HWStackSram::Push(), ThreeLevelStack::PushAddr(), Reset(), HWStackSram::Reset(), ThreeLevelStack::Reset(), HWStackSram::SetSph(), HWStackSram::SetSpl(), and ThreeLevelStack::ThreeLevelStack().