.ifill ldw r6, 0(r3);0xe7318000
.ifill cmpi r6,0;0xecb00000
;static calced
-.fill 1, 0xbb000103;breq- vm_next
+.fill 1, 0x1b000103;breq- vm_next
.fill 1, 0xeb000003;br+ CONST
prog_imm:
ldih r3, instrtable@hi
;set address to defer table
- ldil r9, instrtable@lo
- ldih r9, instrtable@hi
+ ldil r9, defertable@lo
+ ldih r9, defertable@hi
;call jit compiler
;generate branch
sub r11, r6, r8
+ lrs r11, r11, 2
;set the upper 16 bit 0
andx r11, 0xFFFF
;shift to the position of imm in br
stx r0, 12(r2)
;r8 has now the current base
- ldw r8, 0(r3)
+ ;ldw r8, 0-4(r3)
;we add the offset to this instruction
- addi r8, r8, 12
+ addi r8, r2, 16
;we know calculate the jump destination
;r6 is now the 'real' negativ number
or r6, r6, r7
;todo: testing showed (at least once) we are off by 2 instr.
- addi r6, r6, 2
+ ;addi r6, r6, 2
;multiply by to get the offset
lls r6, r6, 2
;generate address in table
add r6, r3, r6
;r0 now has the target address
+ ;todo: 0-4?
ldw r0, 0(r6)
;we calc the offset
- sub r8, r0, r2
+ sub r8, r0, r8
;we shift 2 bits out, because rel. br takes instr.
;count and not address amount ...
lrs r8, r8, 2
stw r8, 4(r9)
;todo: check if -1 is needed
- subi r6, r6, 1
+ ;subi r6, r6, 1
;multiply with 2 to get offset right
lls r6, r6, 2
;add to current base