diff options
| author | Po Lu | 2025-04-15 11:14:14 +0800 |
|---|---|---|
| committer | Po Lu | 2025-04-15 11:14:14 +0800 |
| commit | e790873be10720c108b9d6833ce0232167f03bf2 (patch) | |
| tree | d9baf989ffead2fe27478c8190f073df3ea565aa /exec | |
| parent | b4551334508076b10a895e400beba5b3e9a5e14c (diff) | |
| download | emacs-e790873be10720c108b9d6833ce0232167f03bf2.tar.gz emacs-e790873be10720c108b9d6833ce0232167f03bf2.zip | |
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.
Diffstat (limited to 'exec')
| -rw-r--r-- | exec/loader-mipsel.s | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/exec/loader-mipsel.s b/exec/loader-mipsel.s index bf90493e726..92239614de3 100644 --- a/exec/loader-mipsel.s +++ b/exec/loader-mipsel.s | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | # You should have received a copy of the GNU General Public License | 15 | # You should have received a copy of the GNU General Public License |
| 16 | # along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. | 16 | # along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. |
| 17 | 17 | ||
| 18 | include(`config-mips.m4') | 18 | include(`config-mips.m4') |
| 19 | 19 | ||
| 20 | ## Beware: $t0-$t4 alias the syscall (and function, but they are not | 20 | ## Beware: $t0-$t4 alias the syscall (and function, but they are not |
| 21 | ## material in this context) argument registers on N32 systems, and | 21 | ## material in this context) argument registers on N32 systems, and |
| @@ -28,7 +28,7 @@ __start: | |||
| 28 | ## li $v0, SYSCALL_nanosleep # SYS_nanosleep | 28 | ## li $v0, SYSCALL_nanosleep # SYS_nanosleep |
| 29 | ## la $a0, timespec # rqtp | 29 | ## la $a0, timespec # rqtp |
| 30 | ## li $a1, 0 # rmtp | 30 | ## li $a1, 0 # rmtp |
| 31 | ## syscall # syscall | 31 | ## syscall # syscall |
| 32 | lw $s6, ($sp) # original stack pointer | 32 | lw $s6, ($sp) # original stack pointer |
| 33 | addi $s0, $sp, 8 # start of load area | 33 | addi $s0, $sp, 8 # start of load area |
| 34 | addi $sp, -8 # primary fd, secondary fd | 34 | addi $sp, -8 # primary fd, secondary fd |
| @@ -158,7 +158,6 @@ perror: | |||
| 158 | rest_of_exec: | 158 | rest_of_exec: |
| 159 | move $s1, $s6 # s1 = original SP | 159 | move $s1, $s6 # s1 = original SP |
| 160 | lw $t0, ($s1) # argc | 160 | lw $t0, ($s1) # argc |
| 161 | nop # delay slot | ||
| 162 | sll $t0, $t0, 2 # argc *= 4 | 161 | sll $t0, $t0, 2 # argc *= 4 |
| 163 | addi $t0, $t0, 8 # argc += 8 | 162 | addi $t0, $t0, 8 # argc += 8 |
| 164 | add $s1, $s1, $t0 # s1 = start of envp | 163 | add $s1, $s1, $t0 # s1 = start of envp |
| @@ -195,11 +194,11 @@ skip_environ: | |||
| 195 | $sp = copy of string. */ | 194 | $sp = copy of string. */ |
| 196 | move $t4, $sp # current sp | 195 | move $t4, $sp # current sp |
| 197 | sub $t5, $t3, $sp # new argc - current sp | 196 | 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 |
| 199 | addi $sp, $t3, -8 # $sp = two slots below new argc | 198 | addi $sp, $t3, -8 # $sp = two slots below new argc |
| 200 | j 2f # skip copying fds | 199 | j 2f # skip copying fds |
| 201 | 1: move $sp, $t4 # retain current sp | 200 | move $sp, $t4 # retain current sp |
| 202 | lw $t5, ($t4) # old primary fd | 201 | 1: lw $t5, ($t4) # old primary fd |
| 203 | sw $t5, ($sp) # save the same | 202 | sw $t5, ($sp) # save the same |
| 204 | lw $t5, 4($t4) # old interpreter fd | 203 | lw $t5, 4($t4) # old interpreter fd |
| 205 | sw $t5, 4($sp) # save the same | 204 | sw $t5, 4($sp) # save the same |