Fix bugs in asm code

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-09-22 00:53:34 +02:00
parent 67c4bb722d
commit 9a0e5c815e
2 changed files with 25 additions and 16 deletions

View file

@ -67,10 +67,11 @@ argcont:
#define DO_PARSE(str, reg) \
addiu $t2, $s0, (str-base);\
bal parsestr;\
nop ;\
beq $v0, $zero, 1f;\
nop ;\
b 2f;\
move reg, $v0;
move reg, $v0; \
1:
DO_PARSE (busclockstr, $s2)
DO_PARSE (cpuclockstr, $s3)
@ -169,10 +170,10 @@ argdone:
*/
move $s6, $a3
lui $sp, %hi(_start)
lui $sp, %hi(_start - 256)
bal EXT_C(grub_decompress_core)
addiu $sp, $sp, %lo(_start)
addiu $sp, $sp, %lo(_start - 256)
move $a0, $s1
move $a1, $s6

View file

@ -35,6 +35,10 @@ start:
bal cont
nop
. = _start + GRUB_KERNEL_MIPS_YEELOONG_TOTAL_MODULE_SIZE
total_module_size:
.long 0
. = _start + GRUB_KERNEL_MACHINE_PREFIX
VARIABLE(grub_prefix)
@ -70,13 +74,13 @@ cont:
#endif
/* Move the modules out of BSS. */
lui $t2, %hi(_end)
addiu $t2, %lo(_end)
lui $t2, %hi(__bss_start)
addiu $t2, %lo(__bss_start)
lui $t1, %hi(_end)
addiu $t1, %lo(_end)
addiu $t1, (GRUB_KERNEL_MACHINE_MOD_ALIGN-1)
li $t3, (GRUB_KERNEL_MACHINE_MOD_ALIGN-1)
addiu $t1, (GRUB_KERNEL_MACHINE_MOD_ALIGN - 1)
li $t3, (GRUB_KERNEL_MACHINE_MOD_ALIGN - 1)
nor $t3, $t3, $0
and $t1, $t1, $t3
@ -85,29 +89,33 @@ cont:
/* Backward copy. */
add $t1, $t1, $t3
add $t2, $t2, $t3
addiu $t1, $t1, 0xffff
addiu $t2, $t2, 0xffff
addiu $t1, $t1, -1
addiu $t2, $t2, -1
/* $t2 is source. $t1 is destination. $t3 is size. */
modulesmovcont:
beq $t3, $0, modulesmovdone
nop
lb $t4, 0($t2)
sb $t4, 0($t1)
addiu $t2, $t2, -1
addiu $t1, $t1, -1
addiu $t3, $t3, -1
bne $t3, $0, modulesmovcont
addiu $t2, $t2, -1
b modulesmovcont
addiu $t3, $t3, -1
modulesmovdone:
/* Clean BSS. */
lui $t1, %hi(__bss_start)
addiu $t1, %lo(__bss_start)
addiu $t1, $t1, %lo(__bss_start)
lui $t2, %hi(_end)
addiu $t2, %lo(_end)
addiu $t2, $t2, %lo(_end)
bsscont:
sb $0,0($t1)
addiu $t1, $t1, 1
sltu $t3, $t1, $t2
bne $t3, $0, bsscont
addiu $t1, $t1, 1
nop
lui $t1, %hi(grub_main)
addiu $t1, %lo(grub_main)