summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1995-09-07 21:36:17 +0000
committerdg <dg@FreeBSD.org>1995-09-07 21:36:17 +0000
commiteed9438eb23b62f78af7685dc226228e2bf5c524 (patch)
tree062160c53d8c6a9a0bb1aa28274f45956a4e2aae
parentf97ffd6b4821bb83cba915b9b349a935f133d661 (diff)
downloadFreeBSD-src-eed9438eb23b62f78af7685dc226228e2bf5c524.zip
FreeBSD-src-eed9438eb23b62f78af7685dc226228e2bf5c524.tar.gz
Minor cleanup and (very) small micro optimization to Xsyscall (and the
linux one)..
-rw-r--r--sys/amd64/amd64/exception.S28
-rw-r--r--sys/amd64/amd64/exception.s28
-rw-r--r--sys/i386/i386/exception.s28
3 files changed, 39 insertions, 45 deletions
diff --git a/sys/amd64/amd64/exception.S b/sys/amd64/amd64/exception.S
index e0e7b3c..d6860a0 100644
--- a/sys/amd64/amd64/exception.S
+++ b/sys/amd64/amd64/exception.S
@@ -30,22 +30,16 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: exception.s,v 1.9 1995/06/11 19:31:13 rgrimes Exp $
+ * $Id: exception.s,v 1.10 1995/08/15 19:23:33 bde Exp $
*/
#include "npx.h" /* NNPX */
-
#include "assym.s" /* system defines */
-
#include <sys/errno.h> /* error return codes */
-
#include <machine/spl.h> /* SWI_AST_MASK ... */
-
#include <machine/psl.h> /* PSL_I */
-
#include <machine/trap.h> /* trap codes */
#include <sys/syscall.h> /* syscall numbers */
-
#include <machine/asmacros.h> /* miscellaneous macros */
#define KDSEL 0x10 /* kernel data selector */
@@ -230,19 +224,26 @@ _bpttraps:
#endif
/*
- * Call gate entry for syscall
+ * Call gate entry for syscall.
+ * The intersegment call has been set up to specify one dummy parameter.
+ * This leaves a place to put eflags so that the call frame can be
+ * converted to a trap frame. Note that the eflags is (semi-)bogusly
+ * pushed into (what will be) tf_err and then copied later into the
+ * final spot. It has to be done this way because esp can't be just
+ * temporarily altered for the pushfl - an interrupt might come in
+ * and clobber the saved cs/eip.
*/
SUPERALIGN_TEXT
IDTVEC(syscall)
- pushfl /* Room for tf_err */
- pushfl /* Room for tf_trapno */
+ pushfl /* save eflags in tf_err for now */
+ subl $4,%esp /* skip over tf_trapno */
pushal
pushl %ds
pushl %es
movl $KDSEL,%eax /* switch to kernel segments */
movl %ax,%ds
movl %ax,%es
- movl TF_ERR(%esp),%eax /* copy eflags from tf_err to fs_eflags */
+ movl TF_ERR(%esp),%eax /* copy saved eflags to final spot */
movl %eax,TF_EFLAGS(%esp)
FAKE_MCOUNT(12*4(%esp))
incl _cnt+V_SYSCALL
@@ -263,16 +264,13 @@ IDTVEC(syscall)
*/
SUPERALIGN_TEXT
IDTVEC(linux_syscall)
- pushfl /* Room for tf_err */
- pushfl /* Room for tf_trapno */
+ subl $8,%esp /* skip over tf_trapno and tf_err */
pushal
pushl %ds
pushl %es
movl $KDSEL,%eax /* switch to kernel segments */
movl %ax,%ds
movl %ax,%es
- movl TF_ERR(%esp),%eax /* copy eflags from tf_err to fs_eflags */
- movl %eax,TF_EFLAGS(%esp)
FAKE_MCOUNT(12*4(%esp))
incl _cnt+V_SYSCALL
movl $SWI_AST_MASK,_cpl
diff --git a/sys/amd64/amd64/exception.s b/sys/amd64/amd64/exception.s
index e0e7b3c..d6860a0 100644
--- a/sys/amd64/amd64/exception.s
+++ b/sys/amd64/amd64/exception.s
@@ -30,22 +30,16 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: exception.s,v 1.9 1995/06/11 19:31:13 rgrimes Exp $
+ * $Id: exception.s,v 1.10 1995/08/15 19:23:33 bde Exp $
*/
#include "npx.h" /* NNPX */
-
#include "assym.s" /* system defines */
-
#include <sys/errno.h> /* error return codes */
-
#include <machine/spl.h> /* SWI_AST_MASK ... */
-
#include <machine/psl.h> /* PSL_I */
-
#include <machine/trap.h> /* trap codes */
#include <sys/syscall.h> /* syscall numbers */
-
#include <machine/asmacros.h> /* miscellaneous macros */
#define KDSEL 0x10 /* kernel data selector */
@@ -230,19 +224,26 @@ _bpttraps:
#endif
/*
- * Call gate entry for syscall
+ * Call gate entry for syscall.
+ * The intersegment call has been set up to specify one dummy parameter.
+ * This leaves a place to put eflags so that the call frame can be
+ * converted to a trap frame. Note that the eflags is (semi-)bogusly
+ * pushed into (what will be) tf_err and then copied later into the
+ * final spot. It has to be done this way because esp can't be just
+ * temporarily altered for the pushfl - an interrupt might come in
+ * and clobber the saved cs/eip.
*/
SUPERALIGN_TEXT
IDTVEC(syscall)
- pushfl /* Room for tf_err */
- pushfl /* Room for tf_trapno */
+ pushfl /* save eflags in tf_err for now */
+ subl $4,%esp /* skip over tf_trapno */
pushal
pushl %ds
pushl %es
movl $KDSEL,%eax /* switch to kernel segments */
movl %ax,%ds
movl %ax,%es
- movl TF_ERR(%esp),%eax /* copy eflags from tf_err to fs_eflags */
+ movl TF_ERR(%esp),%eax /* copy saved eflags to final spot */
movl %eax,TF_EFLAGS(%esp)
FAKE_MCOUNT(12*4(%esp))
incl _cnt+V_SYSCALL
@@ -263,16 +264,13 @@ IDTVEC(syscall)
*/
SUPERALIGN_TEXT
IDTVEC(linux_syscall)
- pushfl /* Room for tf_err */
- pushfl /* Room for tf_trapno */
+ subl $8,%esp /* skip over tf_trapno and tf_err */
pushal
pushl %ds
pushl %es
movl $KDSEL,%eax /* switch to kernel segments */
movl %ax,%ds
movl %ax,%es
- movl TF_ERR(%esp),%eax /* copy eflags from tf_err to fs_eflags */
- movl %eax,TF_EFLAGS(%esp)
FAKE_MCOUNT(12*4(%esp))
incl _cnt+V_SYSCALL
movl $SWI_AST_MASK,_cpl
diff --git a/sys/i386/i386/exception.s b/sys/i386/i386/exception.s
index e0e7b3c..d6860a0 100644
--- a/sys/i386/i386/exception.s
+++ b/sys/i386/i386/exception.s
@@ -30,22 +30,16 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: exception.s,v 1.9 1995/06/11 19:31:13 rgrimes Exp $
+ * $Id: exception.s,v 1.10 1995/08/15 19:23:33 bde Exp $
*/
#include "npx.h" /* NNPX */
-
#include "assym.s" /* system defines */
-
#include <sys/errno.h> /* error return codes */
-
#include <machine/spl.h> /* SWI_AST_MASK ... */
-
#include <machine/psl.h> /* PSL_I */
-
#include <machine/trap.h> /* trap codes */
#include <sys/syscall.h> /* syscall numbers */
-
#include <machine/asmacros.h> /* miscellaneous macros */
#define KDSEL 0x10 /* kernel data selector */
@@ -230,19 +224,26 @@ _bpttraps:
#endif
/*
- * Call gate entry for syscall
+ * Call gate entry for syscall.
+ * The intersegment call has been set up to specify one dummy parameter.
+ * This leaves a place to put eflags so that the call frame can be
+ * converted to a trap frame. Note that the eflags is (semi-)bogusly
+ * pushed into (what will be) tf_err and then copied later into the
+ * final spot. It has to be done this way because esp can't be just
+ * temporarily altered for the pushfl - an interrupt might come in
+ * and clobber the saved cs/eip.
*/
SUPERALIGN_TEXT
IDTVEC(syscall)
- pushfl /* Room for tf_err */
- pushfl /* Room for tf_trapno */
+ pushfl /* save eflags in tf_err for now */
+ subl $4,%esp /* skip over tf_trapno */
pushal
pushl %ds
pushl %es
movl $KDSEL,%eax /* switch to kernel segments */
movl %ax,%ds
movl %ax,%es
- movl TF_ERR(%esp),%eax /* copy eflags from tf_err to fs_eflags */
+ movl TF_ERR(%esp),%eax /* copy saved eflags to final spot */
movl %eax,TF_EFLAGS(%esp)
FAKE_MCOUNT(12*4(%esp))
incl _cnt+V_SYSCALL
@@ -263,16 +264,13 @@ IDTVEC(syscall)
*/
SUPERALIGN_TEXT
IDTVEC(linux_syscall)
- pushfl /* Room for tf_err */
- pushfl /* Room for tf_trapno */
+ subl $8,%esp /* skip over tf_trapno and tf_err */
pushal
pushl %ds
pushl %es
movl $KDSEL,%eax /* switch to kernel segments */
movl %ax,%ds
movl %ax,%es
- movl TF_ERR(%esp),%eax /* copy eflags from tf_err to fs_eflags */
- movl %eax,TF_EFLAGS(%esp)
FAKE_MCOUNT(12*4(%esp))
incl _cnt+V_SYSCALL
movl $SWI_AST_MASK,_cpl
OpenPOWER on IntegriCloud