|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object avrora.sim.Segment avrora.sim.CodeSegment
The CodeSegment
class represents a segment of memory that stores executable
code. The program memory on the AVR chips, for example, is a flash segment.
Nested Class Summary | |
static interface |
CodeSegment.CodeSharer
The CodeSharer interface is used to allow sharing of the underlying array
representing the code. |
static class |
CodeSegment.DefaultFactory
The DefaultFactory class represents a factory capable of creating a simple code segment
that is not reprogrammable. |
static interface |
CodeSegment.Factory
The CodeSegment.Factory class is used to create a new code segment for a new interpreter. |
protected class |
CodeSegment.ProbedInstr
The ProbedInstr class represents a wrapper around an instruction in the program that executes the probes before executing the instruction and after the instruction. |
Nested classes inherited from class avrora.sim.Segment |
Segment.AddressOutOfBoundsException, Segment.ErrorReporter, Segment.Sharer |
Field Summary | |
protected CodeSegment.CodeSharer |
codeSharer
|
static byte |
DEFAULT_VALUE
The DEFAULT_VALUE field stores the default value that is used to
initialize the flash memory. |
protected avrora.sim.CodeSegment.MisalignedInstr |
MISALIGNED_INSTR
|
protected avrora.sim.CodeSegment.NoInstr |
NO_INSTR
|
protected Instr[] |
segment_instr
The segment_instr field stores a reference to an array that contains the
disassembled instructions that correspond to the machine code. |
Fields inherited from class avrora.sim.Segment |
errorReporter, interpreter, name, segment_data, segment_watches, sharer, size, value |
Constructor Summary | |
CodeSegment(java.lang.String name,
int size,
BaseInterpreter bi,
Segment.ErrorReporter er)
The constructor for the CodeSegment class creates a new code segment, complete
with binary and instruction representations. |
Method Summary | |
Instr |
getInstr(int address)
The getInstr() method reads an Instr from the specified address in
the flash. |
void |
insertProbe(int address,
Simulator.Probe p)
The insertProbe() method inserts a probe on an instruction at the
specified address. |
void |
load(Program p)
The load() method loads a program into the flash memory, writing the
binary machine code and the disassembled instructions. |
Instr |
readInstr(int address)
The readInstr() method reads an Instr from the specified address in
the flash. |
void |
removeProbe(int address,
Simulator.Probe p)
The removeProbe() method removes a probe from a particular instruction
in the program. |
protected void |
replaceInstr(int address,
Instr i)
The replaceInstr() method is used internally to update an instruction in the flash segment
without losing all of its attached instrumentation (i.e. probes and watches). |
Instr[] |
shareCode(CodeSegment.CodeSharer s)
|
void |
update()
The update() method is called when the program attempts an update
to the flash memory through the SPM instruction. |
protected void |
writeInstr(int address,
Instr i)
|
Methods inherited from class avrora.sim.Segment |
get, insertWatch, read, removeWatch, set, share, write |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final byte DEFAULT_VALUE
DEFAULT_VALUE
field stores the default value that is used to
initialize the flash memory.
protected Instr[] segment_instr
segment_instr
field stores a reference to an array that contains the
disassembled instructions that correspond to the machine code.
protected final avrora.sim.CodeSegment.NoInstr NO_INSTR
protected final avrora.sim.CodeSegment.MisalignedInstr MISALIGNED_INSTR
protected CodeSegment.CodeSharer codeSharer
Constructor Detail |
public CodeSegment(java.lang.String name, int size, BaseInterpreter bi, Segment.ErrorReporter er)
CodeSegment
class creates a new code segment, complete
with binary and instruction representations.
name
- the name of the segment as a stringsize
- the size of the segment in bytesbi
- the interpreter that will use this segmenter
- the error reporter consulted on accesses out of boundsMethod Detail |
protected void replaceInstr(int address, Instr i)
replaceInstr()
method is used internally to update an instruction in the flash segment
without losing all of its attached instrumentation (i.e. probes and watches).
address
- the address in the code segment of the instructioni
- the new instruction to place at this location in the flashpublic void update()
update()
method is called when the program attempts an update
to the flash memory through the SPM instruction. This is only supported on some
flash memory types.
public Instr[] shareCode(CodeSegment.CodeSharer s)
public void load(Program p)
load()
method loads a program into the flash memory, writing the
binary machine code and the disassembled instructions. This should only be done
once for a FlashMemory
object, before any instrumentation is added.
p
- the program to be loaded into the flash memorypublic Instr readInstr(int address)
readInstr()
method reads an Instr from the specified address in
the flash. For misaligned accesses and accesses to places in the flash where there
are no valid instructions, this method returns null
. This method does
not return ProbedInstr
or DisassembleInstr
objects which
are used internally to accomplish probing and dynamically updated code.
address
- the address in the flash from which to read the instruction
Instr
object at this address in the flash;
null
if there is no instruction at this address.public Instr getInstr(int address)
getInstr()
method reads an Instr from the specified address in
the flash. For misaligned accesses and accesses to places in the flash where there
are no valid instructions, this method may return instances of MisalignedInstr
or DisassembleInstr
objects which are used internally to check for errors
and support dynamically updated code. Additionally, this method may return instances of
ProbedInstr
that are used internally to support probing of instructions.
address
- the address in the flash from which to read the instruction
Instr
object at this address in the flash;
null
if there is no instruction at this address.public void insertProbe(int address, Simulator.Probe p)
insertProbe()
method inserts a probe on an instruction at the
specified address. No equality testing is done; i.e. inserting the same probe
on the same address more than once will result in it being triggered more than
once when the instruction executes.
address
- the address of the instruction on which to insert the probep
- the probe to insert on this instructionpublic void removeProbe(int address, Simulator.Probe p)
removeProbe()
method removes a probe from a particular instruction
in the program. The probe will no longer be triggered for subsequent executions of
this instruction. Reference equality is used for testing whether the probe should be
removed; i.e. the Object.equals()
method is not consulted.
address
- the address of the instructiobn on which to insert the probep
- the probe to isnert on this instructionprotected void writeInstr(int address, Instr i)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |