+ if (sel.ti == SEL_LDT)
+ return (TRUE);
+ else if (sel.index < GDTSZ) {
+ if ((gdt_desc_p(selector)->access & ACC_PL_U) == ACC_PL_U)
+ return (TRUE);
+ }
+
+ return (FALSE);
+}
+
+static inline boolean_t
+valid_user_code_selector(uint16_t selector)
+{
+ sel_t sel = selector_to_sel(selector);
+
+ if (selector == 0)
+ return (FALSE);
+
+ if (sel.ti == SEL_LDT) {
+ if (sel.rpl == USER_PRIV)
+ return (TRUE);
+ }
+ else if (sel.index < GDTSZ && sel.rpl == USER_PRIV) {
+ if ((gdt_desc_p(selector)->access & ACC_PL_U) == ACC_PL_U)
+ return (TRUE);
+ }
+
+ return (FALSE);
+}
+
+static inline boolean_t
+valid_user_stack_selector(uint16_t selector)
+{
+ sel_t sel = selector_to_sel(selector);
+
+ if (selector == 0)
+ return (FALSE);
+
+ if (sel.ti == SEL_LDT) {
+ if (sel.rpl == USER_PRIV)
+ return (TRUE);
+ }
+ else if (sel.index < GDTSZ && sel.rpl == USER_PRIV) {
+ if ((gdt_desc_p(selector)->access & ACC_PL_U) == ACC_PL_U)
+ return (TRUE);
+ }
+
+ return (FALSE);
+}
+
+extern boolean_t
+valid_user_segment_selectors(uint16_t cs,
+ uint16_t ss,
+ uint16_t ds,
+ uint16_t es,
+ uint16_t fs,
+ uint16_t gs);