summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCamil Staps2016-11-07 11:58:49 +0000
committerCamil Staps2016-11-07 11:58:49 +0000
commit03cd3500b34064c232cc0bed0fa7b3088b08eb59 (patch)
tree6d1b4f6da03721f54178f7c9cadb60fb9b60d02e
parentRollback some previous changes because they were incorrect (diff)
Fix some incorrect offsets in thumb2divmod.s (dynamically computed offsets still incorrect)
-rw-r--r--thumb2divmod.s18
1 files changed, 8 insertions, 10 deletions
diff --git a/thumb2divmod.s b/thumb2divmod.s
index ec35a2b..2f19976 100644
--- a/thumb2divmod.s
+++ b/thumb2divmod.s
@@ -29,7 +29,8 @@ divide:
bhs divide_large_result
add r1,r1,r1,lsl #1
- mov r14,pc
+ .align
+ add r14,pc,#8
add r14,r14,r1,lsl #2
mov pc,r14
nop
@@ -49,7 +50,6 @@ divide:
it lt
neglt r4,r4
ldr lr,[sp],#4
- orr lr,lr,#1
mov pc,lr
.thumb_func
@@ -67,18 +67,17 @@ divide_large_result:
it lt
neglt r4,r4
ldr lr,[sp],#4
- orr lr,lr,#1
mov pc,lr
divide_result_0:
mov r4,#0
ldr lr,[sp],#4
- orr lr,lr,#1
mov pc,lr
.thumb_func
divide_by_small_number:
- mov r1,pc
+ .align
+ add r1,pc,#10
add r1,r1,r4,lsl #3
ldrb r4,[r1,#(div_mod_table+1)-(divide_by_small_number+8)]
ldr r2,[r1,#(div_mod_table+4)-(divide_by_small_number+8)]
@@ -91,7 +90,6 @@ divide_by_small_number:
it lt
neglt r4,r4
ldr lr,[sp],#4
- orr lr,lr,#1
mov pc,lr
.globl modulo
@@ -115,7 +113,8 @@ modulo:
cmp r1,#32-5-11
bhs modulo_large_divide_result
- mov r14,pc
+ .align
+ add r14,pc,#8
add r14,r14,r1,lsl #3
mov pc,r14
nop
@@ -147,12 +146,12 @@ modulo_divide_result_0:
it lt
neglt r4,r4
ldr lr,[sp],#4
- orr lr,lr,#1
mov pc,lr
.thumb_func
modulo_of_small_number:
- mov r1,pc
+ .align
+ add r1,pc,#10
add r1,r1,r4,lsl #3
ldrb r0,[r1,#(div_mod_table+1)-(modulo_of_small_number+8)]
ldr r2,[r1,#(div_mod_table+4)-(modulo_of_small_number+8)]
@@ -170,7 +169,6 @@ modulo_from_quotient:
it lt
neglt r4,r4
ldr lr,[sp],#4
- orr lr,lr,#1
mov pc,lr
.thumb_func