summaryrefslogtreecommitdiffstats
path: root/sys/amd64/ia32/ia32_sigtramp.S
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2011-04-01 11:16:29 +0000
committerkib <kib@FreeBSD.org>2011-04-01 11:16:29 +0000
commit7c2eaa21fe792c26e223a2f36a4f5c00fdaf52d8 (patch)
tree601aa0131bd58a0facc71b1b7c7b138597686fbe /sys/amd64/ia32/ia32_sigtramp.S
parent6d6007bc145d7665435f03f2ff2043e14240d09e (diff)
downloadFreeBSD-src-7c2eaa21fe792c26e223a2f36a4f5c00fdaf52d8.zip
FreeBSD-src-7c2eaa21fe792c26e223a2f36a4f5c00fdaf52d8.tar.gz
Add support for executing the FreeBSD 1/i386 a.out binaries on amd64.
In particular: - implement compat shims for old stat(2) variants and ogetdirentries(2); - implement delivery of signals with ancient stack frame layout and corresponding sigreturn(2); - implement old getpagesize(2); - provide a user-mode trampoline and LDT call gate for lcall $7,$0; - port a.out image activator and connect it to the build as a module on amd64. The changes are hidden under COMPAT_43. MFC after: 1 month
Diffstat (limited to 'sys/amd64/ia32/ia32_sigtramp.S')
-rw-r--r--sys/amd64/ia32/ia32_sigtramp.S37
1 files changed, 37 insertions, 0 deletions
diff --git a/sys/amd64/ia32/ia32_sigtramp.S b/sys/amd64/ia32/ia32_sigtramp.S
index 9455169..7d64470 100644
--- a/sys/amd64/ia32/ia32_sigtramp.S
+++ b/sys/amd64/ia32/ia32_sigtramp.S
@@ -66,6 +66,35 @@ freebsd4_ia32_sigcode:
jmp 1b
#endif
+#ifdef COMPAT_43
+ ALIGN_TEXT
+ia32_osigcode:
+ calll *IA32_SIGF_HANDLER(%esp)/* call signal handler */
+ leal IA32_SIGF_SC(%esp),%eax /* get sigcontext */
+ pushl %eax
+ movl $103,%eax /* 3.x SYS_sigreturn */
+ pushl %eax /* junk to fake return addr. */
+ int $0x80 /* enter kernel with args */
+1:
+ jmp 1b
+
+
+ ALIGN_TEXT
+lcall_tramp:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl 0x24(%ebp) /* arg 6 */
+ pushl 0x20(%ebp)
+ pushl 0x1c(%ebp)
+ pushl 0x18(%ebp)
+ pushl 0x14(%ebp)
+ pushl 0x10(%ebp) /* arg 1 */
+ pushl 0xc(%ebp) /* gap */
+ int $0x80
+ leave
+ lretl
+#endif
+
ALIGN_TEXT
esigcode:
@@ -78,3 +107,11 @@ sz_ia32_sigcode:
sz_freebsd4_ia32_sigcode:
.long esigcode-freebsd4_ia32_sigcode
#endif
+#ifdef COMPAT_43
+ .globl sz_ia32_osigcode
+sz_ia32_osigcode:
+ .long esigcode-ia32_osigcode
+ .globl sz_lcall_tramp
+sz_lcall_tramp:
+ .long esigcode-lcall_tramp
+#endif
OpenPOWER on IntegriCloud