Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/i386/include Asm macros for interrupt/trap entry/ex...
details: https://anonhg.NetBSD.org/src/rev/f8dc1bbd168b
branches: trunk
changeset: 539586:f8dc1bbd168b
user: fvdl <fvdl%NetBSD.org@localhost>
date: Fri Nov 22 15:07:10 2002 +0000
description:
Asm macros for interrupt/trap entry/exit, used in multiple .S files.
diffstat:
sys/arch/i386/include/frameasm.h | 86 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 86 insertions(+), 0 deletions(-)
diffs (90 lines):
diff -r f2b3782b7b63 -r f8dc1bbd168b sys/arch/i386/include/frameasm.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/i386/include/frameasm.h Fri Nov 22 15:07:10 2002 +0000
@@ -0,0 +1,86 @@
+/* $NetBSD: frameasm.h,v 1.1 2002/11/22 15:07:10 fvdl Exp $ */
+
+#ifndef _I386_FRAMEASM_H_
+#define _I386_FRAMEASM_H_
+
+#ifdef _KERNEL_OPT
+#include "opt_multiprocessor.h"
+#endif
+
+#ifndef TRAPLOG
+#define TLOG /**/
+#else
+/*
+ * Fill in trap record
+ */
+#define TLOG \
+9: \
+ movl %fs:CPU_TLOG_OFFSET, %eax; \
+ movl %fs:CPU_TLOG_BASE, %ebx; \
+ addl $SIZEOF_TREC,%eax; \
+ andl $SIZEOF_TLOG-1,%eax; \
+ addl %eax,%ebx; \
+ movl %eax,%fs:CPU_TLOG_OFFSET; \
+ movl %esp,TREC_SP(%ebx); \
+ movl $9b,TREC_HPC(%ebx); \
+ movl TF_EIP(%esp),%eax; \
+ movl %eax,TREC_IPC(%ebx); \
+ rdtsc ; \
+ movl %eax,TREC_TSC(%ebx); \
+ movl $MSR_LASTBRANCHFROMIP,%ecx; \
+ rdmsr ; \
+ movl %eax,TREC_LBF(%ebx); \
+ incl %ecx ; \
+ rdmsr ; \
+ movl %eax,TREC_LBT(%ebx); \
+ incl %ecx ; \
+ rdmsr ; \
+ movl %eax,TREC_IBF(%ebx); \
+ incl %ecx ; \
+ rdmsr ; \
+ movl %eax,TREC_IBT(%ebx)
+#endif
+
+/*
+ * These are used on interrupt or trap entry or exit.
+ */
+#define INTRENTRY \
+ subl $TF_PUSHSIZE,%esp ; \
+ movl %gs,TF_GS(%esp) ; \
+ movl %fs,TF_FS(%esp) ; \
+ movl %es,TF_ES(%esp) ; \
+ movl %ds,TF_DS(%esp) ; \
+ movl %edi,TF_EDI(%esp) ; \
+ movl %esi,TF_ESI(%esp) ; \
+ movl %eax,TF_EAX(%esp) ; \
+ movl $GSEL(GDATA_SEL, SEL_KPL),%eax ; \
+ movl %eax,%ds ; \
+ movl %ebp,TF_EBP(%esp) ; \
+ movl %eax,%es ; \
+ movl %ebx,TF_EBX(%esp) ; \
+ movl %eax,%gs ; \
+ movl $GSEL(GCPU_SEL, SEL_KPL),%eax ; \
+ movl %edx,TF_EDX(%esp) ; \
+ movl %eax,%fs ; \
+ movl %ecx,TF_ECX(%esp) ; \
+ TLOG
+
+#define INTRFASTEXIT \
+ movl TF_GS(%esp),%gs ; \
+ movl TF_FS(%esp),%fs ; \
+ movl TF_ES(%esp),%es ; \
+ movl TF_DS(%esp),%ds ; \
+ movl TF_EDI(%esp),%edi ; \
+ movl TF_ESI(%esp),%esi ; \
+ movl TF_EBP(%esp),%ebp ; \
+ movl TF_EBX(%esp),%ebx ; \
+ movl TF_EDX(%esp),%edx ; \
+ movl TF_ECX(%esp),%ecx ; \
+ movl TF_EAX(%esp),%eax ; \
+ addl $(TF_PUSHSIZE+8),%esp ; \
+ iret
+
+#define CHECK_ASTPENDING() cmpl $0,CPUVAR(ASTPENDING)
+#define CLEAR_ASTPENDING() movl $0,CPUVAR(ASTPENDING)
+
+#endif /* _I386_FRAMEASM_H_ */
Home |
Main Index |
Thread Index |
Old Index