diff options
| author | Po Lu | 2023-05-01 11:28:22 +0800 |
|---|---|---|
| committer | Po Lu | 2023-05-01 11:28:22 +0800 |
| commit | ddc16de86964d445309dd38175a85221c14f05ab (patch) | |
| tree | 42b7b7d86abd636e90dbc914f347b32b7099ef33 /exec | |
| parent | a8f9a4d2d9bc982217b4be783b236778f9d6dd32 (diff) | |
| download | emacs-ddc16de86964d445309dd38175a85221c14f05ab.tar.gz emacs-ddc16de86964d445309dd38175a85221c14f05ab.zip | |
Update Android port
* Makefile.in (extraclean): Clean in exec as well.
* configure.ac: Fix detection of absolute srcdir. Also, pass
CFLAGS.
* exec/Makefile.in: (.c.o): Add -I. so config.h can be
found.:(.s.o): Don't create m4 temporary in srcdir.
* exec/config-mips.m4.in (DADDI2, DADDI3): New macros. Define
to substitute if as cannot assemble daddi.
* exec/configure.ac (user_h): Look for user.h in asm/ as well.
Use new user.h. Also look in ptrace.h on arm systems. Check if
as supports daddi on mips64.
* exec/exec.c (check_interpreter): Fix char signedness bug.
* exec/loader-mips64el.s (__start): Use DADDI2 and DADDI3 for
two- and 3-operand daddi.
* exec/mipsel-user.h: Don't include sgidefs.h.
* java/INSTALL: Document that m4 is now required.
* src/android.c (android_rewrite_spawn_argv): Add missing NULL.
Diffstat (limited to 'exec')
| -rw-r--r-- | exec/Makefile.in | 6 | ||||
| -rw-r--r-- | exec/config-mips.m4.in | 6 | ||||
| -rw-r--r-- | exec/configure.ac | 70 | ||||
| -rw-r--r-- | exec/exec.c | 2 | ||||
| -rw-r--r-- | exec/loader-mips64el.s | 45 | ||||
| -rw-r--r-- | exec/mipsel-user.h | 1 |
6 files changed, 95 insertions, 35 deletions
diff --git a/exec/Makefile.in b/exec/Makefile.in index 5bd61b2e831..365dc42e0b7 100644 --- a/exec/Makefile.in +++ b/exec/Makefile.in | |||
| @@ -81,10 +81,10 @@ Makefile: config.status Makefile.in | |||
| 81 | 81 | ||
| 82 | .SUFFIXES: .c .s | 82 | .SUFFIXES: .c .s |
| 83 | .c.o: | 83 | .c.o: |
| 84 | $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEPFLAGS) -I$(srcdir) $< -o $@ | 84 | $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEPFLAGS) -I$(srcdir) -I. $< -o $@ |
| 85 | .s.o: | 85 | .s.o: |
| 86 | $(M4) $< > $<.s | 86 | $(M4) $< > $(notdir $<).s |
| 87 | $(AS) $(ASFLAGS) $<.s -o $@ | 87 | $(AS) $(ASFLAGS) $(notdir $<).s -o $@ |
| 88 | 88 | ||
| 89 | # Set up dependencies for config-mips.m4. | 89 | # Set up dependencies for config-mips.m4. |
| 90 | 90 | ||
diff --git a/exec/config-mips.m4.in b/exec/config-mips.m4.in index 886d19b8e8f..72632765bd0 100644 --- a/exec/config-mips.m4.in +++ b/exec/config-mips.m4.in | |||
| @@ -34,3 +34,9 @@ define(`SYSCALL', `ifelse(`@MIPS_N32@',`yes',` move $a4, $1 | |||
| 34 | sw $4, 28($sp)')') | 34 | sw $4, 28($sp)')') |
| 35 | 35 | ||
| 36 | define(`RESTORE', `ifelse(`@MIPS_N32@',`yes',` nop',` addi $sp, 32')') | 36 | define(`RESTORE', `ifelse(`@MIPS_N32@',`yes',` nop',` addi $sp, 32')') |
| 37 | |||
| 38 | dnl For mips64. Some assemblers don't want to assemble `daddi'. | ||
| 39 | define(`DADDI2', `ifelse(`@DADDI_BROKEN@',`yes',` li $at, $2 | ||
| 40 | dadd $1, $1, $at',` daddi $1, $2')') | ||
| 41 | define(`DADDI3', `ifelse(`@DADDI_BROKEN@',`yes',` li $at, $3 | ||
| 42 | dadd $1, $2, $at',` daddi $1, $2, $3')') | ||
diff --git a/exec/configure.ac b/exec/configure.ac index 0a334c6e4ff..9763edc99f3 100644 --- a/exec/configure.ac +++ b/exec/configure.ac | |||
| @@ -96,6 +96,13 @@ AH_TEMPLATE([CLONE3_SYSCALL], [Define to number of the `clone3' system call.]) | |||
| 96 | 96 | ||
| 97 | AC_CANONICAL_HOST | 97 | AC_CANONICAL_HOST |
| 98 | 98 | ||
| 99 | # Check whether or not sys/user exists. If it doesn't, try | ||
| 100 | # asm/user.h, and croak if that doesn't exist either. | ||
| 101 | AS_CASE([$host], [*mips*], [], [*], | ||
| 102 | [AC_CHECK_HEADER([sys/user.h], [user_h="<sys/user.h>"], | ||
| 103 | [AC_CHECK_HEADER([asm/user.h], [user_h="<asm/user.h>"], | ||
| 104 | [AC_MSG_ERROR([Can not find working user.h])])])]) | ||
| 105 | |||
| 99 | # Look for required tools. | 106 | # Look for required tools. |
| 100 | 107 | ||
| 101 | AC_ARG_VAR([M4], [`m4' preprocessor command.]) | 108 | AC_ARG_VAR([M4], [`m4' preprocessor command.]) |
| @@ -187,11 +194,12 @@ AS_IF([test "x$exec_cv_mips_nabi" != "xno"], | |||
| 187 | exec_loader= | 194 | exec_loader= |
| 188 | is_mips= | 195 | is_mips= |
| 189 | OBJS="exec.o trace.o" | 196 | OBJS="exec.o trace.o" |
| 197 | DADDI_BROKEN=no | ||
| 190 | 198 | ||
| 191 | AS_CASE([$host], [x86_64-*linux*], | 199 | AS_CASE([$host], [x86_64-*linux*], |
| 192 | [AC_CHECK_MEMBER([struct user_regs_struct.rdi], | 200 | [AC_CHECK_MEMBER([struct user_regs_struct.rdi], |
| 193 | [AC_DEFINE([SYSCALL_HEADER], [<asm/unistd.h>]) | 201 | [AC_DEFINE([SYSCALL_HEADER], [<asm/unistd.h>]) |
| 194 | AC_DEFINE([USER_HEADER], [<sys/user.h>]) | 202 | AC_DEFINE_UNQUOTED([USER_HEADER], [$user_h]) |
| 195 | AC_DEFINE([USER_REGS_STRUCT], [struct user_regs_struct]) | 203 | AC_DEFINE([USER_REGS_STRUCT], [struct user_regs_struct]) |
| 196 | AC_DEFINE([SYSCALL_NUM_REG], [orig_rax]) | 204 | AC_DEFINE([SYSCALL_NUM_REG], [orig_rax]) |
| 197 | AC_DEFINE([SYSCALL_RET_REG], [rax]) | 205 | AC_DEFINE([SYSCALL_RET_REG], [rax]) |
| @@ -213,11 +221,11 @@ AS_CASE([$host], [x86_64-*linux*], | |||
| 213 | exec_loader=loader-x86_64.s], | 221 | exec_loader=loader-x86_64.s], |
| 214 | [AC_MSG_ERROR([Missing `rdi' in user_regs_struct])], | 222 | [AC_MSG_ERROR([Missing `rdi' in user_regs_struct])], |
| 215 | [[ | 223 | [[ |
| 216 | #include <sys/user.h> | 224 | #include $user_h |
| 217 | ]])], [i[[34567]]86-*linux*], | 225 | ]])], [i[[34567]]86-*linux*], |
| 218 | [AC_CHECK_MEMBER([struct user_regs_struct.edi], | 226 | [AC_CHECK_MEMBER([struct user_regs_struct.edi], |
| 219 | [AC_DEFINE([SYSCALL_HEADER], [<asm/unistd.h>]) | 227 | [AC_DEFINE([SYSCALL_HEADER], [<asm/unistd.h>]) |
| 220 | AC_DEFINE([USER_HEADER], [<sys/user.h>]) | 228 | AC_DEFINE_UNQUOTED([USER_HEADER], [$user_h]) |
| 221 | AC_DEFINE([USER_REGS_STRUCT], [struct user_regs_struct]) | 229 | AC_DEFINE([USER_REGS_STRUCT], [struct user_regs_struct]) |
| 222 | AC_DEFINE([SYSCALL_NUM_REG], [orig_eax]) | 230 | AC_DEFINE([SYSCALL_NUM_REG], [orig_eax]) |
| 223 | AC_DEFINE([SYSCALL_RET_REG], [eax]) | 231 | AC_DEFINE([SYSCALL_RET_REG], [eax]) |
| @@ -237,11 +245,11 @@ AS_CASE([$host], [x86_64-*linux*], | |||
| 237 | exec_loader=loader-x86.s], | 245 | exec_loader=loader-x86.s], |
| 238 | [AC_MSG_ERROR([Missing `edi' in user_regs_struct])], | 246 | [AC_MSG_ERROR([Missing `edi' in user_regs_struct])], |
| 239 | [[ | 247 | [[ |
| 240 | #include <sys/user.h> | 248 | #include $user_h |
| 241 | ]])], [aarch64-*linux*], | 249 | ]])], [aarch64-*linux*], |
| 242 | [AC_CHECK_MEMBER([struct user_regs_struct.sp], | 250 | [AC_CHECK_MEMBER([struct user_regs_struct.sp], |
| 243 | [AC_DEFINE([SYSCALL_HEADER], [<asm/unistd.h>]) | 251 | [AC_DEFINE([SYSCALL_HEADER], [<asm/unistd.h>]) |
| 244 | AC_DEFINE([USER_HEADER], [<sys/user.h>]) | 252 | AC_DEFINE_UNQUOTED([USER_HEADER], [$user_h]) |
| 245 | AC_DEFINE([USER_REGS_STRUCT], [struct user_regs_struct]) | 253 | AC_DEFINE([USER_REGS_STRUCT], [struct user_regs_struct]) |
| 246 | AC_DEFINE([SYSCALL_NUM_REG], [[regs[8]]]) | 254 | AC_DEFINE([SYSCALL_NUM_REG], [[regs[8]]]) |
| 247 | AC_DEFINE([SYSCALL_RET_REG], [[regs[0]]]) | 255 | AC_DEFINE([SYSCALL_RET_REG], [[regs[0]]]) |
| @@ -263,11 +271,11 @@ AS_CASE([$host], [x86_64-*linux*], | |||
| 263 | exec_loader=loader-aarch64.s], | 271 | exec_loader=loader-aarch64.s], |
| 264 | [AC_MSG_ERROR([Missing `sp' in user_regs_struct])], | 272 | [AC_MSG_ERROR([Missing `sp' in user_regs_struct])], |
| 265 | [[ | 273 | [[ |
| 266 | #include <sys/user.h> | 274 | #include $user_h |
| 267 | ]])], [arm*linux*eabi* | armv7*linux*], | 275 | ]])], [arm*linux*eabi* | armv7*linux*], |
| 268 | [AC_CHECK_MEMBER([struct user_regs.uregs], | 276 | [AC_CHECK_MEMBER([struct user_regs.uregs], |
| 269 | [AC_DEFINE([SYSCALL_HEADER], [<asm/unistd.h>]) | 277 | [AC_DEFINE([SYSCALL_HEADER], [<asm/unistd.h>]) |
| 270 | AC_DEFINE([USER_HEADER], [<sys/user.h>]) | 278 | AC_DEFINE_UNQUOTED([USER_HEADER], [$user_h]) |
| 271 | AC_DEFINE([USER_REGS_STRUCT], [struct user_regs]) | 279 | AC_DEFINE([USER_REGS_STRUCT], [struct user_regs]) |
| 272 | AC_DEFINE([SYSCALL_NUM_REG], [[uregs[7]]]) | 280 | AC_DEFINE([SYSCALL_NUM_REG], [[uregs[7]]]) |
| 273 | AC_DEFINE([SYSCALL_RET_REG], [[uregs[0]]]) | 281 | AC_DEFINE([SYSCALL_RET_REG], [[uregs[0]]]) |
| @@ -283,9 +291,30 @@ AS_CASE([$host], [x86_64-*linux*], | |||
| 283 | exec_CHECK_LINUX_CLONE3 | 291 | exec_CHECK_LINUX_CLONE3 |
| 284 | LOADERFLAGS="$LOADERFLAGS $LDPREFIX-Ttext=0x20000000" | 292 | LOADERFLAGS="$LOADERFLAGS $LDPREFIX-Ttext=0x20000000" |
| 285 | exec_loader=loader-armeabi.s], | 293 | exec_loader=loader-armeabi.s], |
| 286 | [AC_MSG_ERROR([Missing `uregs' in user_regs_struct])], | 294 | [AC_CHECK_MEMBER([struct pt_regs.uregs], |
| 295 | [AC_DEFINE([SYSCALL_HEADER], [<asm/unistd.h>]) | ||
| 296 | AC_DEFINE_UNQUOTED([USER_HEADER], [<asm/ptrace.h>]) | ||
| 297 | AC_DEFINE([USER_REGS_STRUCT], [struct pt_regs]) | ||
| 298 | AC_DEFINE([SYSCALL_NUM_REG], [[uregs[7]]]) | ||
| 299 | AC_DEFINE([SYSCALL_RET_REG], [[uregs[0]]]) | ||
| 300 | AC_DEFINE([SYSCALL_ARG_REG], [[uregs[0]]]) | ||
| 301 | AC_DEFINE([SYSCALL_ARG1_REG], [[uregs[1]]]) | ||
| 302 | AC_DEFINE([STACK_POINTER], [[uregs[13]]]) | ||
| 303 | AC_DEFINE([EXEC_SYSCALL], [__NR_execve]) | ||
| 304 | AC_DEFINE([USER_WORD], [uintptr_t]) | ||
| 305 | AC_DEFINE([EXECUTABLE_BASE], [0x0f000000]) | ||
| 306 | AC_DEFINE([INTERPRETER_BASE], [0x1f000000]) | ||
| 307 | AC_DEFINE([STACK_GROWS_DOWNWARDS], [1]) | ||
| 308 | AC_DEFINE([CLONE_SYSCALL], [__NR_clone]) | ||
| 309 | exec_CHECK_LINUX_CLONE3 | ||
| 310 | LOADERFLAGS="$LOADERFLAGS $LDPREFIX-Ttext=0x20000000" | ||
| 311 | exec_loader=loader-armeabi.s], | ||
| 312 | [AC_MSG_ERROR([Missing `uregs' in user_regs_struct or pt_regs])], | ||
| 313 | [[ | ||
| 314 | #include <asm/ptrace.h> | ||
| 315 | ]])], | ||
| 287 | [[ | 316 | [[ |
| 288 | #include <sys/user.h> | 317 | #include $user_h |
| 289 | ]])], [mipsel*linux*], | 318 | ]])], [mipsel*linux*], |
| 290 | [AC_DEFINE([SYSCALL_HEADER], [<asm/unistd.h>]) | 319 | [AC_DEFINE([SYSCALL_HEADER], [<asm/unistd.h>]) |
| 291 | AC_DEFINE([USER_HEADER], ["mipsel-user.h"]) | 320 | AC_DEFINE([USER_HEADER], ["mipsel-user.h"]) |
| @@ -325,6 +354,27 @@ AS_CASE([$host], [x86_64-*linux*], | |||
| 325 | AC_DEFINE([INTERPRETER_BASE], [0x3f00000000]) | 354 | AC_DEFINE([INTERPRETER_BASE], [0x3f00000000]) |
| 326 | AC_DEFINE([STACK_GROWS_DOWNWARDS], [1]) | 355 | AC_DEFINE([STACK_GROWS_DOWNWARDS], [1]) |
| 327 | AC_DEFINE([CLONE_SYSCALL], [__NR_clone]) | 356 | AC_DEFINE([CLONE_SYSCALL], [__NR_clone]) |
| 357 | AC_CACHE_CHECK([whether as understands `daddi'], | ||
| 358 | [exec_cv_as_daddi], | ||
| 359 | [exec_cv_as_daddi=no | ||
| 360 | cat <<_ACEOF >conftest.s | ||
| 361 | .section text | ||
| 362 | .global __start | ||
| 363 | __start: | ||
| 364 | li $t0, 0 | ||
| 365 | li $t1, 0 | ||
| 366 | daddi $t0, $t1, 1 | ||
| 367 | daddi $t0, $t1, -1 | ||
| 368 | daddi $t0, -1 | ||
| 369 | daddi $t0, 1 | ||
| 370 | |||
| 371 | _ACEOF | ||
| 372 | $AS $ASFLAGS conftest.s -o conftest.$OBJEXT \ | ||
| 373 | >&AS_MESSAGE_LOG_FD 2>&1 \ | ||
| 374 | && exec_cv_as_daddi=yes | ||
| 375 | rm -f conftest.s conftest.$OBJEXT]) | ||
| 376 | AS_IF([test "x$exec_cv_as_daddi" != "xyes"], | ||
| 377 | [DADDI_BROKEN=yes]) | ||
| 328 | exec_CHECK_LINUX_CLONE3 | 378 | exec_CHECK_LINUX_CLONE3 |
| 329 | exec_CHECK_MIPS_NABI | 379 | exec_CHECK_MIPS_NABI |
| 330 | LOADERFLAGS="$LOADERFLAGS $LDPREFIX-Ttext=0x3e00000000" | 380 | LOADERFLAGS="$LOADERFLAGS $LDPREFIX-Ttext=0x3e00000000" |
| @@ -332,6 +382,8 @@ AS_CASE([$host], [x86_64-*linux*], | |||
| 332 | exec_loader=loader-mips64el.s], [*], | 382 | exec_loader=loader-mips64el.s], [*], |
| 333 | [AC_MSG_ERROR([Please port libexec to $host])]) | 383 | [AC_MSG_ERROR([Please port libexec to $host])]) |
| 334 | 384 | ||
| 385 | AC_SUBST([DADDI_BROKEN]) | ||
| 386 | |||
| 335 | MIPS_N32=$exec_cv_mips_nabi | 387 | MIPS_N32=$exec_cv_mips_nabi |
| 336 | 388 | ||
| 337 | AC_ARG_VAR([LOADERFLAGS], [Flags used to link the loader.]) | 389 | AC_ARG_VAR([LOADERFLAGS], [Flags used to link the loader.]) |
diff --git a/exec/exec.c b/exec/exec.c index e890179a9ab..662c8bf69d2 100644 --- a/exec/exec.c +++ b/exec/exec.c | |||
| @@ -95,7 +95,7 @@ check_interpreter (const char *name, int fd, const char **extra) | |||
| 95 | 95 | ||
| 96 | /* Strip leading whitespace. */ | 96 | /* Strip leading whitespace. */ |
| 97 | start = buffer; | 97 | start = buffer; |
| 98 | while (*start && *start < 128 && isspace (*start)) | 98 | while (*start && ((unsigned char) *start) < 128 && isspace (*start)) |
| 99 | ++start; | 99 | ++start; |
| 100 | 100 | ||
| 101 | /* Look for a newline character. */ | 101 | /* Look for a newline character. */ |
diff --git a/exec/loader-mips64el.s b/exec/loader-mips64el.s index ccebdfe72f6..73dc8c63fe8 100644 --- a/exec/loader-mips64el.s +++ b/exec/loader-mips64el.s | |||
| @@ -15,7 +15,10 @@ | |||
| 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') | ||
| 19 | |||
| 18 | .set noreorder # delay slots managed by hand | 20 | .set noreorder # delay slots managed by hand |
| 21 | .set noat # no assembler macros | ||
| 19 | .section .text | 22 | .section .text |
| 20 | .global __start | 23 | .global __start |
| 21 | __start: | 24 | __start: |
| @@ -24,8 +27,8 @@ dnl dla $a0, .timespec # rqtp | |||
| 24 | dnl li $a1, 0 # rmtp | 27 | dnl li $a1, 0 # rmtp |
| 25 | dnl syscall # syscall | 28 | dnl syscall # syscall |
| 26 | ld $s2, ($sp) # original stack pointer | 29 | ld $s2, ($sp) # original stack pointer |
| 27 | daddi $s0, $sp, 16 # start of load area | 30 | DADDI3( $s0, $sp, 16) # start of load area |
| 28 | daddi $sp, -16 # primary fd, secondary fd | 31 | DADDI2( $sp, -16) # primary fd, secondary fd |
| 29 | li $t0, -1 # secondary fd | 32 | li $t0, -1 # secondary fd |
| 30 | sd $t0, 8($sp) # initialize secondary fd | 33 | sd $t0, 8($sp) # initialize secondary fd |
| 31 | .next_action: | 34 | .next_action: |
| @@ -33,7 +36,7 @@ dnl syscall # syscall | |||
| 33 | andi $t0, $s1, 15 # t0 = action number & 15 | 36 | andi $t0, $s1, 15 # t0 = action number & 15 |
| 34 | beqz $t0, .open_file # open file? | 37 | beqz $t0, .open_file # open file? |
| 35 | nop # delay slot | 38 | nop # delay slot |
| 36 | daddi $t0, -3 # t0 -= 3 | 39 | DADDI2( $t0, -3) # t0 -= 3 |
| 37 | beqz $t0, .rest_of_exec # jump to code | 40 | beqz $t0, .rest_of_exec # jump to code |
| 38 | nop # delay slot | 41 | nop # delay slot |
| 39 | li $t1, 1 | 42 | li $t1, 1 |
| @@ -76,30 +79,30 @@ dnl syscall # syscall | |||
| 76 | bne $t2, $zero, .fillb # fill bytes | 79 | bne $t2, $zero, .fillb # fill bytes |
| 77 | nop # delay slot | 80 | nop # delay slot |
| 78 | sd $zero, ($t1) # zero doubleword | 81 | sd $zero, ($t1) # zero doubleword |
| 79 | daddi $t1, 8 # next doubleword | 82 | DADDI2( $t1, 8) # next doubleword |
| 80 | sd $zero, ($t1) # zero doubleword | 83 | sd $zero, ($t1) # zero doubleword |
| 81 | daddi $t1, 8 # next doubleword | 84 | DADDI2( $t1, 8) # next doubleword |
| 82 | sd $zero, ($t1) # zero doubleword | 85 | sd $zero, ($t1) # zero doubleword |
| 83 | daddi $t1, 8 # next doubleword | 86 | DADDI2( $t1, 8) # next doubleword |
| 84 | sd $zero, ($t1) # zero doubleword | 87 | sd $zero, ($t1) # zero doubleword |
| 85 | daddi $t1, 8 # next doubleword | 88 | DADDI2( $t1, 8) # next doubleword |
| 86 | sd $zero, ($t1) # zero doubleword | 89 | sd $zero, ($t1) # zero doubleword |
| 87 | daddi $t1, 8 # next doubleword | 90 | DADDI2( $t1, 8) # next doubleword |
| 88 | sd $zero, ($t1) # zero doubleword | 91 | sd $zero, ($t1) # zero doubleword |
| 89 | daddi $t1, 8 # next doubleword | 92 | DADDI2( $t1, 8) # next doubleword |
| 90 | sd $zero, ($t1) # zero doubleword | 93 | sd $zero, ($t1) # zero doubleword |
| 91 | daddi $t1, 8 # next doubleword | 94 | DADDI2( $t1, 8) # next doubleword |
| 92 | sd $zero, ($t1) # zero doubleword | 95 | sd $zero, ($t1) # zero doubleword |
| 93 | daddi $t1, 8 # next doubleword | 96 | DADDI2( $t1, 8) # next doubleword |
| 94 | j .filld # fill either doubleword or byte | 97 | j .filld # fill either doubleword or byte |
| 95 | nop # delay slot | 98 | nop # delay slot |
| 96 | .fillb: | 99 | .fillb: |
| 97 | beq $t0, $t1, .continue # already finished? | 100 | beq $t0, $t1, .continue # already finished? |
| 98 | nop # delay slot | 101 | nop # delay slot |
| 99 | sb $zero, ($t1) # clear byte | 102 | sb $zero, ($t1) # clear byte |
| 100 | daddi $t1, $t1, 1 # t1++ | 103 | DADDI2( $t1, 1) # t1++ |
| 101 | .continue: | 104 | .continue: |
| 102 | daddi $s0, $s0, 56 # s0 = next action | 105 | DADDI2( $s0, 56) # s0 = next action |
| 103 | j .next_action # next action | 106 | j .next_action # next action |
| 104 | nop # delay slot | 107 | nop # delay slot |
| 105 | .do_mmap_anon: | 108 | .do_mmap_anon: |
| @@ -113,26 +116,26 @@ dnl syscall # syscall | |||
| 113 | nop # branch delay slot | 116 | nop # branch delay slot |
| 114 | .open_file: | 117 | .open_file: |
| 115 | li $v0, 5002 # SYS_open | 118 | li $v0, 5002 # SYS_open |
| 116 | daddi $a0, $s0, 8 # start of name | 119 | DADDI3( $a0, $s0, 8) # start of name |
| 117 | move $a1, $zero # flags = O_RDONLY | 120 | move $a1, $zero # flags = O_RDONLY |
| 118 | move $a2, $zero # mode = 0 | 121 | move $a2, $zero # mode = 0 |
| 119 | syscall # syscall | 122 | syscall # syscall |
| 120 | bne $a3, $zero, .perror # perror | 123 | bne $a3, $zero, .perror # perror |
| 121 | nop # delay slot | 124 | nop # delay slot |
| 122 | daddi $s0, $s0, 8 # start of string | 125 | DADDI2( $s0, 8) # start of string |
| 123 | .nextc: | 126 | .nextc: |
| 124 | lb $t0, ($s0) # load byte | 127 | lb $t0, ($s0) # load byte |
| 125 | daddi $s0, $s0, 1 # s0++ | 128 | DADDI2( $s0, 1) # s0++ |
| 126 | bne $t0, $zero, .nextc # next character? | 129 | bne $t0, $zero, .nextc # next character? |
| 127 | nop # delay slot | 130 | nop # delay slot |
| 128 | daddi $s0, $s0, 7 # adjust for round | 131 | DADDI2( $s0, 7) # adjust for round |
| 129 | li $t2, -8 # t2 = -8 | 132 | li $t2, -8 # t2 = -8 |
| 130 | and $s0, $s0, $t2 # mask for round | 133 | and $s0, $s0, $t2 # mask for round |
| 131 | andi $t0, $s1, 16 # t1 = s1 & 16 | 134 | andi $t0, $s1, 16 # t1 = s1 & 16 |
| 132 | move $t1, $sp # address of primary fd | 135 | move $t1, $sp # address of primary fd |
| 133 | beqz $t0, .primary # primary fd? | 136 | beqz $t0, .primary # primary fd? |
| 134 | nop # delay slot | 137 | nop # delay slot |
| 135 | daddi $t1, $t1, 8 # address of secondary fd | 138 | DADDI2( $t1, 8) # address of secondary fd |
| 136 | .primary: | 139 | .primary: |
| 137 | sd $v0, ($t1) # store fd | 140 | sd $v0, ($t1) # store fd |
| 138 | j .next_action # next action | 141 | j .next_action # next action |
| @@ -145,11 +148,11 @@ dnl syscall # syscall | |||
| 145 | move $s1, $s2 # original SP | 148 | move $s1, $s2 # original SP |
| 146 | ld $t0, ($s1) # argc | 149 | ld $t0, ($s1) # argc |
| 147 | dsll $t0, $t0, 3 # argc *= 3 | 150 | dsll $t0, $t0, 3 # argc *= 3 |
| 148 | daddi $t0, $t0, 16 # argc += 16 | 151 | DADDI2( $t0, 16) # argc += 16 |
| 149 | dadd $s1, $s1, $t0 # s1 = start of envp | 152 | dadd $s1, $s1, $t0 # s1 = start of envp |
| 150 | .skipenv: | 153 | .skipenv: |
| 151 | ld $t0, ($s1) # t0 = *s1 | 154 | ld $t0, ($s1) # t0 = *s1 |
| 152 | daddi $s1, $s1, 8 # s1++ | 155 | DADDI2( $s1, 8) # s1++ |
| 153 | bne $t0, $zero, .skipenv # skip again | 156 | bne $t0, $zero, .skipenv # skip again |
| 154 | nop # delay slot | 157 | nop # delay slot |
| 155 | dla $t3, .auxvtab # address of auxv table | 158 | dla $t3, .auxvtab # address of auxv table |
| @@ -170,7 +173,7 @@ dnl syscall # syscall | |||
| 170 | ld $t2, ($t2) # t2 = *t2 | 173 | ld $t2, ($t2) # t2 = *t2 |
| 171 | sd $t2, 8($s1) # set auxv value | 174 | sd $t2, 8($s1) # set auxv value |
| 172 | .next: | 175 | .next: |
| 173 | daddi $s1, $s1, 16 # next auxv | 176 | DADDI2( $s1, 16) # next auxv |
| 174 | j .one_auxv # next auxv | 177 | j .one_auxv # next auxv |
| 175 | nop # delay slot | 178 | nop # delay slot |
| 176 | .finish: | 179 | .finish: |
diff --git a/exec/mipsel-user.h b/exec/mipsel-user.h index 2b77a970d8e..dc3f98eb4e7 100644 --- a/exec/mipsel-user.h +++ b/exec/mipsel-user.h | |||
| @@ -22,7 +22,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 22 | #ifndef _MIPSEL_USER_H_ | 22 | #ifndef _MIPSEL_USER_H_ |
| 23 | #define _MIPSEL_USER_H_ | 23 | #define _MIPSEL_USER_H_ |
| 24 | 24 | ||
| 25 | #include <sgidefs.h> | ||
| 26 | #include <sys/user.h> | 25 | #include <sys/user.h> |
| 27 | 26 | ||
| 28 | #ifndef ELF_NGREG | 27 | #ifndef ELF_NGREG |