Intermingling data with code
Posted: Wed Jan 16, 2013 9:42 pm
Is it safe to write a sequence like this?
.align 8
B label ; 32 bit version
.word arbitrary data
or even
.align8
JALR R42 ; go somewhere (but don't come back!) R14 handily points to arbitrary data after jump
.word arbitrary data
The pipeline decodes the instructions (stage 3) before executing them (stage 5). If the arbitrary data contained a bit pattern that was an invalid instruction would some kind of fault be generated? If it only generates the fault when instruction reaches stage 5 presumably all would be OK. If at stage 3, it wouldn't.
If a fault does get generated would this work?
.align8
JALR R42 ; go somewhere (but don't come back!) R14 handily points to word before arbitrary data after jump
NOP ; 16 bits each
NOP
.word arbitrary data
Thanks in advance,
Tim
.align 8
B label ; 32 bit version
.word arbitrary data
or even
.align8
JALR R42 ; go somewhere (but don't come back!) R14 handily points to arbitrary data after jump
.word arbitrary data
The pipeline decodes the instructions (stage 3) before executing them (stage 5). If the arbitrary data contained a bit pattern that was an invalid instruction would some kind of fault be generated? If it only generates the fault when instruction reaches stage 5 presumably all would be OK. If at stage 3, it wouldn't.
If a fault does get generated would this work?
.align8
JALR R42 ; go somewhere (but don't come back!) R14 handily points to word before arbitrary data after jump
NOP ; 16 bits each
NOP
.word arbitrary data
Thanks in advance,
Tim