144 (void (*)())get_hrtime, /* T_GETHRTIME */
145 (void (*)())gethrvtime, /* T_GETHRVTIME */
146 (void (*)())get_hrestime, /* T_GETHRESTIME */
147 (void (*)())getlgrp /* T_GETLGRP */
148 };
149
150 /*
151 * Structure containing pre-computed descriptors to allow us to temporarily
152 * interpose on a standard handler.
153 */
154 struct interposing_handler {
155 int ih_inum;
156 gate_desc_t ih_interp_desc;
157 gate_desc_t ih_default_desc;
158 };
159
160 /*
161 * The brand infrastructure interposes on two handlers, and we use one as a
162 * NULL signpost.
163 */
164 static struct interposing_handler brand_tbl[2];
165
166 /*
167 * software prototypes for default local descriptor table
168 */
169
170 /*
171 * Routines for loading segment descriptors in format the hardware
172 * can understand.
173 */
174
175 #if defined(__amd64)
176
177 /*
178 * In long mode we have the new L or long mode attribute bit
179 * for code segments. Only the conforming bit in type is used along
180 * with descriptor priority and present bits. Default operand size must
181 * be zero when in long mode. In 32-bit compatibility mode all fields
182 * are treated as in legacy mode. For data segments while in long mode
183 * only the present bit is loaded.
184 */
960
961 /*
962 * T_EXTOVRFLT coprocessor-segment-overrun not supported.
963 */
964
965 set_gatesegd(&idt[T_TSSFLT], &invtsstrap, KCS_SEL, SDT_SYSIGT, TRP_KPL,
966 0);
967 set_gatesegd(&idt[T_SEGFLT], &segnptrap, KCS_SEL, SDT_SYSIGT, TRP_KPL,
968 0);
969 set_gatesegd(&idt[T_STKFLT], &stktrap, KCS_SEL, SDT_SYSIGT, TRP_KPL, 0);
970 set_gatesegd(&idt[T_GPFLT], &gptrap, KCS_SEL, SDT_SYSIGT, TRP_KPL, 0);
971 set_gatesegd(&idt[T_PGFLT], &pftrap, KCS_SEL, SDT_SYSIGT, TRP_KPL, 0);
972 set_gatesegd(&idt[T_EXTERRFLT], &ndperr, KCS_SEL, SDT_SYSIGT, TRP_KPL,
973 0);
974 set_gatesegd(&idt[T_ALIGNMENT], &achktrap, KCS_SEL, SDT_SYSIGT,
975 TRP_KPL, 0);
976 set_gatesegd(&idt[T_MCE], &mcetrap, KCS_SEL, SDT_SYSIGT, TRP_KPL, 0);
977 set_gatesegd(&idt[T_SIMDFPE], &xmtrap, KCS_SEL, SDT_SYSIGT, TRP_KPL, 0);
978
979 /*
980 * install fast trap handler at 210.
981 */
982 set_gatesegd(&idt[T_FASTTRAP], &fasttrap, KCS_SEL, SDT_SYSIGT, TRP_UPL,
983 0);
984
985 /*
986 * System call handler.
987 */
988 #if defined(__amd64)
989 set_gatesegd(&idt[T_SYSCALLINT], &sys_syscall_int, KCS_SEL, SDT_SYSIGT,
990 TRP_UPL, 0);
991
992 #elif defined(__i386)
993 set_gatesegd(&idt[T_SYSCALLINT], &sys_call, KCS_SEL, SDT_SYSIGT,
994 TRP_UPL, 0);
995 #endif /* __i386 */
996
997 /*
998 * Install the DTrace interrupt handler for the pid provider.
999 */
1000 set_gatesegd(&idt[T_DTRACE_RET], &dtrace_ret, KCS_SEL,
1001 SDT_SYSIGT, TRP_UPL, 0);
1002
1003 /*
1004 * Prepare interposing descriptor for the syscall handler
1005 * and cache copy of the default descriptor.
1006 */
1007 brand_tbl[0].ih_inum = T_SYSCALLINT;
1008 brand_tbl[0].ih_default_desc = idt0[T_SYSCALLINT];
1009
1010 #if defined(__amd64)
1011 set_gatesegd(&(brand_tbl[0].ih_interp_desc), &brand_sys_syscall_int,
1012 KCS_SEL, SDT_SYSIGT, TRP_UPL, 0);
1013 #elif defined(__i386)
1014 set_gatesegd(&(brand_tbl[0].ih_interp_desc), &brand_sys_call,
1015 KCS_SEL, SDT_SYSIGT, TRP_UPL, 0);
1016 #endif /* __i386 */
1017
1018 brand_tbl[1].ih_inum = 0;
1019 }
1020
1021 #if defined(__xpv)
1022
1023 static void
1024 init_idt(gate_desc_t *idt)
1025 {
1026 init_idt_common(idt);
1027 }
1028
1029 #else /* __xpv */
1030
1031 static void
1032 init_idt(gate_desc_t *idt)
1033 {
1034 char ivctname[80];
1035 void (*ivctptr)(void);
1036 int i;
1037
1038 /*
|
144 (void (*)())get_hrtime, /* T_GETHRTIME */
145 (void (*)())gethrvtime, /* T_GETHRVTIME */
146 (void (*)())get_hrestime, /* T_GETHRESTIME */
147 (void (*)())getlgrp /* T_GETLGRP */
148 };
149
150 /*
151 * Structure containing pre-computed descriptors to allow us to temporarily
152 * interpose on a standard handler.
153 */
154 struct interposing_handler {
155 int ih_inum;
156 gate_desc_t ih_interp_desc;
157 gate_desc_t ih_default_desc;
158 };
159
160 /*
161 * The brand infrastructure interposes on two handlers, and we use one as a
162 * NULL signpost.
163 */
164 static struct interposing_handler brand_tbl[3];
165
166 /*
167 * software prototypes for default local descriptor table
168 */
169
170 /*
171 * Routines for loading segment descriptors in format the hardware
172 * can understand.
173 */
174
175 #if defined(__amd64)
176
177 /*
178 * In long mode we have the new L or long mode attribute bit
179 * for code segments. Only the conforming bit in type is used along
180 * with descriptor priority and present bits. Default operand size must
181 * be zero when in long mode. In 32-bit compatibility mode all fields
182 * are treated as in legacy mode. For data segments while in long mode
183 * only the present bit is loaded.
184 */
960
961 /*
962 * T_EXTOVRFLT coprocessor-segment-overrun not supported.
963 */
964
965 set_gatesegd(&idt[T_TSSFLT], &invtsstrap, KCS_SEL, SDT_SYSIGT, TRP_KPL,
966 0);
967 set_gatesegd(&idt[T_SEGFLT], &segnptrap, KCS_SEL, SDT_SYSIGT, TRP_KPL,
968 0);
969 set_gatesegd(&idt[T_STKFLT], &stktrap, KCS_SEL, SDT_SYSIGT, TRP_KPL, 0);
970 set_gatesegd(&idt[T_GPFLT], &gptrap, KCS_SEL, SDT_SYSIGT, TRP_KPL, 0);
971 set_gatesegd(&idt[T_PGFLT], &pftrap, KCS_SEL, SDT_SYSIGT, TRP_KPL, 0);
972 set_gatesegd(&idt[T_EXTERRFLT], &ndperr, KCS_SEL, SDT_SYSIGT, TRP_KPL,
973 0);
974 set_gatesegd(&idt[T_ALIGNMENT], &achktrap, KCS_SEL, SDT_SYSIGT,
975 TRP_KPL, 0);
976 set_gatesegd(&idt[T_MCE], &mcetrap, KCS_SEL, SDT_SYSIGT, TRP_KPL, 0);
977 set_gatesegd(&idt[T_SIMDFPE], &xmtrap, KCS_SEL, SDT_SYSIGT, TRP_KPL, 0);
978
979 /*
980 * install "int80" handler at, well, 0x80.
981 */
982 set_gatesegd(&idt0[T_INT80], &sys_int80, KCS_SEL, SDT_SYSIGT, TRP_UPL,
983 0);
984
985 /*
986 * install fast trap handler at 210.
987 */
988 set_gatesegd(&idt[T_FASTTRAP], &fasttrap, KCS_SEL, SDT_SYSIGT, TRP_UPL,
989 0);
990
991 /*
992 * System call handler.
993 */
994 #if defined(__amd64)
995 set_gatesegd(&idt[T_SYSCALLINT], &sys_syscall_int, KCS_SEL, SDT_SYSIGT,
996 TRP_UPL, 0);
997
998 #elif defined(__i386)
999 set_gatesegd(&idt[T_SYSCALLINT], &sys_call, KCS_SEL, SDT_SYSIGT,
1000 TRP_UPL, 0);
1001 #endif /* __i386 */
1002
1003 /*
1004 * Install the DTrace interrupt handler for the pid provider.
1005 */
1006 set_gatesegd(&idt[T_DTRACE_RET], &dtrace_ret, KCS_SEL,
1007 SDT_SYSIGT, TRP_UPL, 0);
1008
1009 /*
1010 - * Prepare interposing descriptors for the branded "int80"
1011 - * and syscall handlers and cache copies of the default
1012 - * descriptors.
1013 */
1014 brand_tbl[0].ih_inum = T_INT80;
1015 brand_tbl[0].ih_default_desc = idt0[T_INT80];
1016 set_gatesegd(&(brand_tbl[0].ih_interp_desc), &brand_sys_int80, KCS_SEL,
1017 SDT_SYSIGT, TRP_UPL, 0);
1018
1019 brand_tbl[1].ih_inum = T_SYSCALLINT;
1020 brand_tbl[1].ih_default_desc = idt0[T_SYSCALLINT];
1021
1022 #if defined(__amd64)
1023 set_gatesegd(&(brand_tbl[1].ih_interp_desc), &brand_sys_syscall_int,
1024 KCS_SEL, SDT_SYSIGT, TRP_UPL, 0);
1025 #elif defined(__i386)
1026 set_gatesegd(&(brand_tbl[1].ih_interp_desc), &brand_sys_call,
1027 KCS_SEL, SDT_SYSIGT, TRP_UPL, 0);
1028 #endif /* __i386 */
1029
1030 brand_tbl[2].ih_inum = 0;
1031 }
1032
1033 #if defined(__xpv)
1034
1035 static void
1036 init_idt(gate_desc_t *idt)
1037 {
1038 init_idt_common(idt);
1039 }
1040
1041 #else /* __xpv */
1042
1043 static void
1044 init_idt(gate_desc_t *idt)
1045 {
1046 char ivctname[80];
1047 void (*ivctptr)(void);
1048 int i;
1049
1050 /*
|