]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Fix bugs in asm code
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Tue, 21 Sep 2010 22:53:34 +0000 (00:53 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Tue, 21 Sep 2010 22:53:34 +0000 (00:53 +0200)
grub-core/boot/mips/startup_raw.S
grub-core/kern/mips/startup.S

index d810f2fb4ecf81f3eb14ff45829311e6206a9ea4..c41ce8257925e2cdbaa6f198c562dd928e095fe4 100644 (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
index 97145b81881fa9ef8ed0980b599ea680b7396ff2..ae0e0b187a3cb7f21cb3483c7a224d0314d34b26 100644 (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)