Skip to content

Commit e790873

Browse files
author
Po Lu
committed
Address typos in MIPS executable loader
* exec/loader-mipsel.s (rest_of_exec): Delete redundant nop. (skip_environ): Correct stack space test. Don't jump into the label for the sp preserving case's delay slot.
1 parent b455133 commit e790873

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

exec/loader-mipsel.s

+5-6
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# You should have received a copy of the GNU General Public License
1616
# along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
1717

18-
include(`config-mips.m4')
18+
include(`config-mips.m4')
1919

2020
## Beware: $t0-$t4 alias the syscall (and function, but they are not
2121
## material in this context) argument registers on N32 systems, and
@@ -28,7 +28,7 @@ __start:
2828
## li $v0, SYSCALL_nanosleep # SYS_nanosleep
2929
## la $a0, timespec # rqtp
3030
## li $a1, 0 # rmtp
31-
## syscall # syscall
31+
## syscall # syscall
3232
lw $s6, ($sp) # original stack pointer
3333
addi $s0, $sp, 8 # start of load area
3434
addi $sp, -8 # primary fd, secondary fd
@@ -158,7 +158,6 @@ perror:
158158
rest_of_exec:
159159
move $s1, $s6 # s1 = original SP
160160
lw $t0, ($s1) # argc
161-
nop # delay slot
162161
sll $t0, $t0, 2 # argc *= 4
163162
addi $t0, $t0, 8 # argc += 8
164163
add $s1, $s1, $t0 # s1 = start of envp
@@ -195,11 +194,11 @@ skip_environ:
195194
$sp = copy of string. */
196195
move $t4, $sp # current sp
197196
sub $t5, $t3, $sp # new argc - current sp
198-
bleu $t5, -8, 1f # more than two slots apart
197+
blt $t5, 8, 1f # more than two slots apart
199198
addi $sp, $t3, -8 # $sp = two slots below new argc
200199
j 2f # skip copying fds
201-
1: move $sp, $t4 # retain current sp
202-
lw $t5, ($t4) # old primary fd
200+
move $sp, $t4 # retain current sp
201+
1: lw $t5, ($t4) # old primary fd
203202
sw $t5, ($sp) # save the same
204203
lw $t5, 4($t4) # old interpreter fd
205204
sw $t5, 4($sp) # save the same

0 commit comments

Comments
 (0)