changeset 13423:5959d9183ac3

1281 Expose all TSS definitions Reviewed by: Igor Kozhukhov <igor.kozhukhov@nexenta.com> Reviewed by: Gordon Ross <gwr@nexenta.com> Reviewed by: Garrett D'Amore <garrett@nexenta.com> Reviewed by: Eric Schrock <eric.schrock@delphix.com> Approved by: Garrett D'Amore <garrett@nexenta.com>
author Robert Mustacchi <rm@joyent.com>
date Wed, 10 Aug 2011 12:52:31 -0700
parents c9ad235c2ec1
children f2dd4a8a49cd
files usr/src/uts/i86pc/ml/mach_offsets.in usr/src/uts/i86pc/os/mp_pc.c usr/src/uts/i86pc/os/trap.c usr/src/uts/i86pc/sys/machcpuvar.h usr/src/uts/i86pc/sys/rm_platter.h usr/src/uts/intel/amd64/ml/mach_offsets.in usr/src/uts/intel/ia32/os/desctbls.c usr/src/uts/intel/sys/segments.h usr/src/uts/intel/sys/tss.h
diffstat 9 files changed, 83 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/i86pc/ml/mach_offsets.in	Sat Aug 06 00:34:00 2011 +0100
+++ b/usr/src/uts/i86pc/ml/mach_offsets.in	Wed Aug 10 12:52:31 2011 -0700
@@ -21,8 +21,8 @@
 \
 \ CDDL HEADER END
 \
-
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
+\ Copyright 2011 Joyent, Inc. All rights reserved.
+\
 
 \
 \ offsets.in: input file to produce assym.h using the ctfstabs program
@@ -92,7 +92,7 @@
 
 \#define	REGOFF_PC	REGOFF_EIP
 
-tss
+tss_t
 	tss_esp0		TSS_ESP0
 	tss_ss0		TSS_SS0
 	tss_ldt		TSS_LDT
--- a/usr/src/uts/i86pc/os/mp_pc.c	Sat Aug 06 00:34:00 2011 +0100
+++ b/usr/src/uts/i86pc/os/mp_pc.c	Wed Aug 10 12:52:31 2011 -0700
@@ -25,6 +25,9 @@
  * Copyright (c) 2010, Intel Corporation.
  * All rights reserved.
  */
+/*
+ * Copyright 2011 Joyent, Inc. All rights reserved.
+ */
 
 /*
  * Welcome to the world of the "real mode platter".
@@ -169,7 +172,7 @@
 static void *
 mach_cpucontext_alloc_tables(struct cpu *cp)
 {
-	struct tss *ntss;
+	tss_t *ntss;
 	struct cpu_tables *ct;
 
 	/*
--- a/usr/src/uts/i86pc/os/trap.c	Sat Aug 06 00:34:00 2011 +0100
+++ b/usr/src/uts/i86pc/os/trap.c	Wed Aug 10 12:52:31 2011 -0700
@@ -31,6 +31,10 @@
 /*		All Rights Reserved   				*/
 /*								*/
 
+/*
+ * Copyright 2011 Joyent, Inc. All rights reserved.
+ */
+
 #include <sys/types.h>
 #include <sys/sysmacros.h>
 #include <sys/param.h>
@@ -1983,7 +1987,7 @@
 dump_tss(void)
 {
 	const char tss_fmt[] = "tss.%s:\t0x%p\n";  /* Format string */
-	struct tss *tss = CPU->cpu_tss;
+	tss_t *tss = CPU->cpu_tss;
 
 	printf(tss_fmt, "tss_rsp0", (void *)tss->tss_rsp0);
 	printf(tss_fmt, "tss_rsp1", (void *)tss->tss_rsp1);
@@ -2004,7 +2008,7 @@
 dump_tss(void)
 {
 	const char tss_fmt[] = "tss.%s:\t0x%p\n";  /* Format string */
-	struct tss *tss = CPU->cpu_tss;
+	tss_t *tss = CPU->cpu_tss;
 
 	printf(tss_fmt, "tss_link", (void *)(uintptr_t)tss->tss_link);
 	printf(tss_fmt, "tss_esp0", (void *)(uintptr_t)tss->tss_esp0);
--- a/usr/src/uts/i86pc/sys/machcpuvar.h	Sat Aug 06 00:34:00 2011 +0100
+++ b/usr/src/uts/i86pc/sys/machcpuvar.h	Wed Aug 10 12:52:31 2011 -0700
@@ -22,6 +22,9 @@
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
+/*
+ * Copyright 2011 Joyent, Inc. All rights reserved.
+ */
 
 #ifndef	_SYS_MACHCPUVAR_H
 #define	_SYS_MACHCPUVAR_H
@@ -103,7 +106,7 @@
 	user_desc_t	*mcpu_gdt;	/* GDT */
 	gate_desc_t	*mcpu_idt;	/* current IDT */
 
-	struct tss	*mcpu_tss;	/* TSS */
+	tss_t		*mcpu_tss;	/* TSS */
 
 	kmutex_t	mcpu_ppaddr_mutex;
 	caddr_t		mcpu_caddr1;	/* per cpu CADDR1 */
--- a/usr/src/uts/i86pc/sys/rm_platter.h	Sat Aug 06 00:34:00 2011 +0100
+++ b/usr/src/uts/i86pc/sys/rm_platter.h	Wed Aug 10 12:52:31 2011 -0700
@@ -25,6 +25,9 @@
  * Copyright (c) 2010, Intel Corporation.
  * All rights reserved.
  */
+/*
+ * Copyright 2011 Joyent, Inc. All rights reserved.
+ */
 
 #ifndef	_SYS_RM_PLATTER_H
 #define	_SYS_RM_PLATTER_H
@@ -111,7 +114,7 @@
  */
 struct cpu_tables {
 	char		ct_stack[DEFAULTSTKSZ];
-	struct tss	ct_tss;
+	tss_t		ct_tss;
 };
 
 /*
--- a/usr/src/uts/intel/amd64/ml/mach_offsets.in	Sat Aug 06 00:34:00 2011 +0100
+++ b/usr/src/uts/intel/amd64/ml/mach_offsets.in	Wed Aug 10 12:52:31 2011 -0700
@@ -21,8 +21,8 @@
 \
 \ CDDL HEADER END
 \
-
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
+\ Copyright 2011 Joyent, Inc. All rights reserved.
+\
 
 \
 \ offsets.in: input file to produce assym.h using the ctfstabs program
@@ -108,7 +108,7 @@
 boot_syscalls
 	bsvc_putchar	BOOTSVCS_PUTCHAR
 
-tss
+tss_t
 	tss_rsp0
 	tss_rsp1
 	tss_rsp2
--- a/usr/src/uts/intel/ia32/os/desctbls.c	Sat Aug 06 00:34:00 2011 +0100
+++ b/usr/src/uts/intel/ia32/os/desctbls.c	Wed Aug 10 12:52:31 2011 -0700
@@ -24,6 +24,10 @@
  */
 
 /*
+ * Copyright 2011 Joyent, Inc. All rights reserved.
+ */
+
+/*
  * Copyright (c) 1992 Terrence R. Lambert.
  * Copyright (c) 1990 The Regents of the University of California.
  * All rights reserved.
@@ -103,10 +107,10 @@
 desctbr_t	idt0_default_r;		/* describes idt0 in IDTR format */
 #endif
 
-struct tss	*ktss0;			/* kernel task state structure */
+tss_t		*ktss0;			/* kernel task state structure */
 
 #if defined(__i386)
-struct tss	*dftss0;		/* #DF double-fault exception */
+tss_t		*dftss0;		/* #DF double-fault exception */
 #endif	/* __i386 */
 
 user_desc_t	zero_udesc;		/* base zero user desc native procs */
@@ -1232,7 +1236,7 @@
 #if !defined(__lint)
 	ASSERT(sizeof (*ktss0) <= PAGESIZE);
 #endif
-	ktss0 = (struct tss *)BOP_ALLOC(bootops, (caddr_t)KTSS_VA,
+	ktss0 = (tss_t *)BOP_ALLOC(bootops, (caddr_t)KTSS_VA,
 	    PAGESIZE, PAGESIZE);
 	bzero(ktss0, PAGESIZE);
 
@@ -1240,7 +1244,7 @@
 #if !defined(__lint)
 	ASSERT(sizeof (*dftss0) <= PAGESIZE);
 #endif
-	dftss0 = (struct tss *)BOP_ALLOC(bootops, (caddr_t)DFTSS_VA,
+	dftss0 = (tss_t *)BOP_ALLOC(bootops, (caddr_t)DFTSS_VA,
 	    PAGESIZE, PAGESIZE);
 	bzero(dftss0, PAGESIZE);
 #endif
--- a/usr/src/uts/intel/sys/segments.h	Sat Aug 06 00:34:00 2011 +0100
+++ b/usr/src/uts/intel/sys/segments.h	Wed Aug 10 12:52:31 2011 -0700
@@ -1,6 +1,9 @@
 /*
  * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
  */
+/*
+ * Copyright 2011 Joyent, Inc. All rights reserved.
+ */
 
 #ifndef	_SYS_SEGMENTS_H
 #define	_SYS_SEGMENTS_H
@@ -662,10 +665,10 @@
 extern user_desc_t	ucs32_off;
 #endif  /* __amd64 */
 
-extern struct tss *ktss0;
+extern tss_t *ktss0;
 
 #if defined(__i386)
-extern struct tss *dftss0;
+extern tss_t *dftss0;
 #endif	/* __i386 */
 
 extern void div0trap(), dbgtrap(), nmiint(), brktrap(), ovflotrap();
--- a/usr/src/uts/intel/sys/tss.h	Sat Aug 06 00:34:00 2011 +0100
+++ b/usr/src/uts/intel/sys/tss.h	Wed Aug 10 12:52:31 2011 -0700
@@ -6,8 +6,6 @@
 #ifndef	_SYS_TSS_H
 #define	_SYS_TSS_H
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #ifdef	__cplusplus
 extern "C" {
 #endif
@@ -54,6 +52,9 @@
  *	from: @(#)tss.h	5.4 (Berkeley) 1/18/91
  * $FreeBSD: src/sys/i386/include/tss.h,v 1.13 2002/09/23 05:04:05 peter Exp $
  */
+/*
+ * Copyright 2011 Joyent, Inc. All rights reserved.
+ */
 
 /*
  * Maximum I/O address that will be in TSS bitmap
@@ -63,14 +64,18 @@
 #ifndef _ASM
 
 /*
- * Task state segment (tss). Holds the processor state assoicated with
- * a task.
+ * Task state segment (tss). Holds the processor state assoicated with a task.
+ *
+ * Historically, this header only exposed a struct tss that was relevant to the
+ * specific Intel architecture that we were deploying on. However, the tss
+ * structures are defined by the Intel Architecture and other consumers would
+ * like to use them. Rather than requiring them to duplicate all of this
+ * information, we instead expose each version under different names but in a
+ * backwards compatible manner.
  */
 
-#if defined(__amd64)
-
 #pragma	pack(4)
-struct tss {
+struct tss64 {
 	uint32_t	tss_rsvd0;	/* reserved, ignored */
 	uint64_t	tss_rsp0; 	/* stack pointer CPL = 0 */
 	uint64_t	tss_rsp1; 	/* stack pointer CPL = 1 */
@@ -89,9 +94,7 @@
 };
 #pragma	pack()
 
-#elif defined(__i386)
-
-struct tss {
+struct tss32 {
 	uint16_t	tss_link;	/* 16-bit prior TSS selector */
 	uint16_t	tss_rsvd0;	/* reserved, ignored */
 	uint32_t	tss_esp0;
@@ -132,6 +135,39 @@
 	uint16_t	tss_bitmapbase;	/* io permission bitmap base address */
 };
 
+struct tss16 {
+	uint16_t	tss_link;
+	uint16_t	tss_sp0;
+	uint16_t	tss_ss0;
+	uint16_t	tss_sp1;
+	uint16_t	tss_ss1;
+	uint16_t	tss_sp2;
+	uint16_t	tss_ss2;
+	uint16_t	tss_ip;
+	uint16_t	tss_flag;
+	uint16_t	tss_ax;
+	uint16_t	tss_cx;
+	uint16_t	tss_dx;
+	uint16_t	tss_bx;
+	uint16_t	tss_sp;
+	uint16_t	tss_bp;
+	uint16_t	tss_si;
+	uint16_t	tss_di;
+	uint16_t	tss_es;
+	uint16_t	tss_cs;
+	uint16_t	tss_ss;
+	uint16_t	tss_ds;
+	uint16_t	tss_ldt;
+};
+
+#if defined(__amd64)
+
+typedef	struct tss64	tss_t;
+
+#elif defined(__i386)
+
+typedef	struct tss32	tss_t;
+
 #endif	/* __i386 */
 
 #endif	/* !_ASM */