mips: Make the assembly-code N32-compatible.
There are no $t4 or $t5 in N32 but there are $a4 and $a5.
This commit is contained in:
parent
6e21195890
commit
285540e448
4 changed files with 35 additions and 22 deletions
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
.set mips3
|
.set mips3
|
||||||
sync
|
sync
|
||||||
ld $t2, 0($t6)
|
ld $t2, 0($t1)
|
||||||
|
|
||||||
a:
|
a:
|
||||||
addiu $t7, $s0, (b - a)
|
addiu $t1, $s0, (b - a)
|
||||||
b: nop
|
b: nop
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <grub/machine/memory.h>
|
#include <grub/machine/memory.h>
|
||||||
#include <grub/machine/kernel.h>
|
#include <grub/machine/kernel.h>
|
||||||
#include <grub/offsets.h>
|
#include <grub/offsets.h>
|
||||||
|
#include <grub/mips/asm.h>
|
||||||
|
|
||||||
#define BASE_ADDR 8
|
#define BASE_ADDR 8
|
||||||
|
|
||||||
|
@ -118,32 +119,32 @@ parsestr:
|
||||||
move $v0, $zero
|
move $v0, $zero
|
||||||
move $t3, $t1
|
move $t3, $t1
|
||||||
3:
|
3:
|
||||||
lb $t4, 0($t2)
|
lb GRUB_ASM_T4, 0($t2)
|
||||||
lb $t5, 0($t3)
|
lb GRUB_ASM_T5, 0($t3)
|
||||||
addiu $t2, $t2, 1
|
addiu $t2, $t2, 1
|
||||||
addiu $t3, $t3, 1
|
addiu $t3, $t3, 1
|
||||||
beq $t5, $zero, 1f
|
beq GRUB_ASM_T5, $zero, 1f
|
||||||
nop
|
nop
|
||||||
beq $t5, $t4, 3b
|
beq GRUB_ASM_T5, GRUB_ASM_T4, 3b
|
||||||
nop
|
nop
|
||||||
bne $t4, $zero, 1f
|
bne GRUB_ASM_T4, $zero, 1f
|
||||||
nop
|
nop
|
||||||
|
|
||||||
addiu $t3, $t3, 0xffff
|
addiu $t3, $t3, 0xffff
|
||||||
digcont:
|
digcont:
|
||||||
lb $t5, 0($t3)
|
lb GRUB_ASM_T5, 0($t3)
|
||||||
/* Substract '0' from digit. */
|
/* Substract '0' from digit. */
|
||||||
addiu $t5, $t5, 0xffd0
|
addiu GRUB_ASM_T5, GRUB_ASM_T5, 0xffd0
|
||||||
bltz $t5, 1f
|
bltz GRUB_ASM_T5, 1f
|
||||||
nop
|
nop
|
||||||
addiu $t4, $t5, 0xfff7
|
addiu GRUB_ASM_T4, GRUB_ASM_T5, 0xfff7
|
||||||
bgtz $t4, 1f
|
bgtz GRUB_ASM_T4, 1f
|
||||||
nop
|
nop
|
||||||
/* Multiply $v0 by 10 with bitshifts. */
|
/* Multiply $v0 by 10 with bitshifts. */
|
||||||
sll $v0, $v0, 1
|
sll $v0, $v0, 1
|
||||||
sll $t4, $v0, 2
|
sll GRUB_ASM_T4, $v0, 2
|
||||||
addu $v0, $v0, $t4
|
addu $v0, $v0, GRUB_ASM_T4
|
||||||
addu $v0, $v0, $t5
|
addu $v0, $v0, GRUB_ASM_T5
|
||||||
addiu $t3, $t3, 1
|
addiu $t3, $t3, 1
|
||||||
b digcont
|
b digcont
|
||||||
nop
|
nop
|
||||||
|
@ -182,10 +183,10 @@ argdone:
|
||||||
b argdone
|
b argdone
|
||||||
addiu $a1, $a1, 4
|
addiu $a1, $a1, 4
|
||||||
do_check:
|
do_check:
|
||||||
lb $t4, 0($t7)
|
lb GRUB_ASM_T4, 0($t7)
|
||||||
beq $t4, $zero, 1f
|
beq GRUB_ASM_T4, $zero, 1f
|
||||||
lb $t3, 0($t6)
|
lb $t3, 0($t6)
|
||||||
bne $t3, $t4, 2f
|
bne $t3, GRUB_ASM_T4, 2f
|
||||||
addiu $t6, $t6, 1
|
addiu $t6, $t6, 1
|
||||||
b do_check
|
b do_check
|
||||||
addiu $t7, $t7, 1
|
addiu $t7, $t7, 1
|
||||||
|
@ -222,8 +223,8 @@ cmdlinedone:
|
||||||
|
|
||||||
1:
|
1:
|
||||||
beq $t1, $t3, 2f
|
beq $t1, $t3, 2f
|
||||||
lb $t4, 0($t2)
|
lb GRUB_ASM_T4, 0($t2)
|
||||||
sb $t4, 0($t1)
|
sb GRUB_ASM_T4, 0($t1)
|
||||||
addiu $t1, $t1, 1
|
addiu $t1, $t1, 1
|
||||||
b 1b
|
b 1b
|
||||||
addiu $t2, $t2, 1
|
addiu $t2, $t2, 1
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <grub/machine/memory.h>
|
#include <grub/machine/memory.h>
|
||||||
#include <grub/machine/kernel.h>
|
#include <grub/machine/kernel.h>
|
||||||
#include <grub/offsets.h>
|
#include <grub/offsets.h>
|
||||||
|
#include <grub/mips/asm.h>
|
||||||
|
|
||||||
#define BASE_ADDR 8
|
#define BASE_ADDR 8
|
||||||
|
|
||||||
|
@ -95,8 +96,8 @@ cont:
|
||||||
modulesmovcont:
|
modulesmovcont:
|
||||||
beq $t3, $0, modulesmovdone
|
beq $t3, $0, modulesmovdone
|
||||||
nop
|
nop
|
||||||
lb $t4, 0($t2)
|
lb GRUB_ASM_T4, 0($t2)
|
||||||
sb $t4, 0($t1)
|
sb GRUB_ASM_T4, 0($t1)
|
||||||
addiu $t2, $t2, -1
|
addiu $t2, $t2, -1
|
||||||
addiu $t1, $t1, -1
|
addiu $t1, $t1, -1
|
||||||
b modulesmovcont
|
b modulesmovcont
|
||||||
|
|
11
include/grub/mips/asm.h
Normal file
11
include/grub/mips/asm.h
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#ifndef GRUB_MIPS_ASM_HEADER
|
||||||
|
#define GRUB_MIPS_ASM_HEADER 1
|
||||||
|
|
||||||
|
#if defined(_MIPS_SIM) && defined(_ABIN32) && _MIPS_SIM == _ABIN32
|
||||||
|
#define GRUB_ASM_T4 $a4
|
||||||
|
#define GRUB_ASM_T5 $a5
|
||||||
|
#else
|
||||||
|
#define GRUB_ASM_T4 $t4
|
||||||
|
#define GRUB_ASM_T5 $t5
|
||||||
|
#endif
|
||||||
|
#endif
|
Loading…
Reference in a new issue