From 8c0b2f8aeeb3f4ca9bb09bed3ec2f163e6a214fe Mon Sep 17 00:00:00 2001 From: David Given Date: Fri, 14 Sep 2018 00:15:43 +0200 Subject: [PATCH] Fix csa and csb. --- mach/mips/libem/csa.s | 8 ++++---- mach/mips/libem/csb.s | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mach/mips/libem/csa.s b/mach/mips/libem/csa.s index 1bdd41b62..bbc386be0 100644 --- a/mach/mips/libem/csa.s +++ b/mach/mips/libem/csa.s @@ -13,18 +13,18 @@ .define .csa .csa: lw r4, 0(sp) /* r4 = table */ - lw r5, 0(sp) /* r5 = value */ + lw r5, 4(sp) /* r5 = value */ addiu sp, sp, 8 lw r6, 0(r4) /* r6 = default target */ lw r7, 4(r4) /* r7 = lower bound */ - subu r5, r5, r6 /* adjust value */ + subu r5, r5, r7 /* adjust value */ bltz r5, 1f /* jump to default if out of range */ nop lw r7, 8(r4) /* fetch range */ - subu r7, r5, r7 /* compute (adjusted value - range) */ - blez r7, 1f /* jump to default if out of range */ + subu r7, r7, r5 /* compute difference within range */ + bltz r7, 1f /* jump to default if out of range */ nop addiu r4, r4, 12 /* skip header */ diff --git a/mach/mips/libem/csb.s b/mach/mips/libem/csb.s index acc1f636e..c04382b79 100644 --- a/mach/mips/libem/csb.s +++ b/mach/mips/libem/csb.s @@ -13,7 +13,7 @@ .define .csb .csb: lw r4, 0(sp) ! r4 = address of table - lw r5, 0(sp) ! r5 = value + lw r5, 4(sp) ! r5 = value addiu sp, sp, 8 lw r6, 0(r4) ! r6 = default target