Lines Matching refs:e2
63 static inline unsigned int get_seg_limit(uint32_t e1, uint32_t e2) in get_seg_limit() argument
66 limit = (e1 & 0xffff) | (e2 & 0x000f0000); in get_seg_limit()
67 if (e2 & DESC_G_MASK) in get_seg_limit()
72 static inline uint32_t get_seg_base(uint32_t e1, uint32_t e2) in get_seg_base() argument
74 return ((e1 >> 16) | ((e2 & 0xff) << 16) | (e2 & 0xff000000)); in get_seg_base()
77 static inline void load_seg_cache_raw_dt(SegmentCache *sc, uint32_t e1, uint32_t e2) in load_seg_cache_raw_dt() argument
79 sc->base = get_seg_base(e1, e2); in load_seg_cache_raw_dt()
80 sc->limit = get_seg_limit(e1, e2); in load_seg_cache_raw_dt()
81 sc->flags = e2; in load_seg_cache_raw_dt()
131 uint32_t e1, e2; in tss_load_seg() local
135 if (load_segment(env, &e1, &e2, selector) != 0) in tss_load_seg()
137 if (!(e2 & DESC_S_MASK)) in tss_load_seg()
140 dpl = (e2 >> DESC_DPL_SHIFT) & 3; in tss_load_seg()
143 if (!(e2 & DESC_CS_MASK)) in tss_load_seg()
148 if ((e2 & DESC_C_MASK) && dpl > rpl) in tss_load_seg()
152 if ((e2 & DESC_CS_MASK) || !(e2 & DESC_W_MASK)) in tss_load_seg()
158 if ((e2 & DESC_CS_MASK) && !(e2 & DESC_R_MASK)) in tss_load_seg()
161 if (((e2 >> DESC_TYPE_SHIFT) & 0xf) < 12) { in tss_load_seg()
166 if (!(e2 & DESC_P_MASK)) in tss_load_seg()
169 get_seg_base(e1, e2), in tss_load_seg()
170 get_seg_limit(e1, e2), in tss_load_seg()
171 e2); in tss_load_seg()
185 uint32_t e1, uint32_t e2, int source, in switch_tss() argument
197 type = (e2 >> DESC_TYPE_SHIFT) & 0xf; in switch_tss()
202 if (!(e2 & DESC_P_MASK)) in switch_tss()
207 if (load_segment(env, &e1, &e2, tss_selector) != 0) in switch_tss()
209 if (e2 & DESC_S_MASK) in switch_tss()
211 type = (e2 >> DESC_TYPE_SHIFT) & 0xf; in switch_tss()
216 if (!(e2 & DESC_P_MASK)) in switch_tss()
223 tss_limit = get_seg_limit(e1, e2); in switch_tss()
224 tss_base = get_seg_base(e1, e2); in switch_tss()
273 uint32_t e2; in switch_tss() local
275 e2 = cpu_ldl_kernel(env, ptr + 4); in switch_tss()
276 e2 &= ~DESC_TSS_BUSY_MASK; in switch_tss()
277 cpu_stl_kernel(env, ptr + 4, e2); in switch_tss()
325 uint32_t e2; in switch_tss() local
327 e2 = cpu_ldl_kernel(env, ptr + 4); in switch_tss()
328 e2 |= DESC_TSS_BUSY_MASK; in switch_tss()
329 cpu_stl_kernel(env, ptr + 4, e2); in switch_tss()
339 env->tr.flags = e2 & ~DESC_TSS_BUSY_MASK; in switch_tss()
391 e2 = cpu_ldl_kernel(env, ptr + 4); in switch_tss()
392 if ((e2 & DESC_S_MASK) || ((e2 >> DESC_TYPE_SHIFT) & 0xf) != 2) in switch_tss()
394 if (!(e2 & DESC_P_MASK)) in switch_tss()
396 load_seg_cache_raw_dt(&env->ldt, e1, e2); in switch_tss()
427 static inline unsigned int get_sp_mask(unsigned int e2) in get_sp_mask() argument
429 if (e2 & DESC_B_MASK) in get_sp_mask()
502 uint32_t e1, e2, offset, ss = 0, esp, ss_e1 = 0, ss_e2 = 0; in do_interrupt_protected() local
518 e2 = cpu_ldl_kernel(env, ptr + 4); in do_interrupt_protected()
520 type = (e2 >> DESC_TYPE_SHIFT) & 0x1f; in do_interrupt_protected()
524 if (!(e2 & DESC_P_MASK)) in do_interrupt_protected()
526 switch_tss(env, intno * 8, e1, e2, SWITCH_TSS_CALL, old_eip); in do_interrupt_protected()
555 dpl = (e2 >> DESC_DPL_SHIFT) & 3; in do_interrupt_protected()
561 if (!(e2 & DESC_P_MASK)) in do_interrupt_protected()
564 offset = (e2 & 0xffff0000) | (e1 & 0x0000ffff); in do_interrupt_protected()
568 if (load_segment(env, &e1, &e2, selector) != 0) in do_interrupt_protected()
570 if (!(e2 & DESC_S_MASK) || !(e2 & (DESC_CS_MASK))) in do_interrupt_protected()
572 dpl = (e2 >> DESC_DPL_SHIFT) & 3; in do_interrupt_protected()
575 if (!(e2 & DESC_P_MASK)) in do_interrupt_protected()
577 if (!(e2 & DESC_C_MASK) && dpl < cpl) { in do_interrupt_protected()
598 } else if ((e2 & DESC_C_MASK) || dpl == cpl) { in do_interrupt_protected()
675 get_seg_base(e1, e2), in do_interrupt_protected()
676 get_seg_limit(e1, e2), in do_interrupt_protected()
677 e2); in do_interrupt_protected()
728 uint32_t e1, e2, e3, ss; in do_interrupt64() local
744 e2 = cpu_ldl_kernel(env, ptr + 4); in do_interrupt64()
747 type = (e2 >> DESC_TYPE_SHIFT) & 0x1f; in do_interrupt64()
756 dpl = (e2 >> DESC_DPL_SHIFT) & 3; in do_interrupt64()
762 if (!(e2 & DESC_P_MASK)) in do_interrupt64()
765 offset = ((target_ulong)e3 << 32) | (e2 & 0xffff0000) | (e1 & 0x0000ffff); in do_interrupt64()
766 ist = e2 & 7; in do_interrupt64()
770 if (load_segment(env, &e1, &e2, selector) != 0) in do_interrupt64()
772 if (!(e2 & DESC_S_MASK) || !(e2 & (DESC_CS_MASK))) in do_interrupt64()
774 dpl = (e2 >> DESC_DPL_SHIFT) & 3; in do_interrupt64()
777 if (!(e2 & DESC_P_MASK)) in do_interrupt64()
779 if (!(e2 & DESC_L_MASK) || (e2 & DESC_B_MASK)) in do_interrupt64()
781 if ((!(e2 & DESC_C_MASK) && dpl < cpl) || ist != 0) { in do_interrupt64()
790 } else if ((e2 & DESC_C_MASK) || dpl == cpl) { in do_interrupt64()
824 get_seg_base(e1, e2), in do_interrupt64()
825 get_seg_limit(e1, e2), in do_interrupt64()
826 e2); in do_interrupt64()
1004 uint32_t e2; in do_interrupt_user() local
1013 e2 = cpu_ldl_kernel(env, ptr + 4); in do_interrupt_user()
1015 dpl = (e2 >> DESC_DPL_SHIFT) & 3; in do_interrupt_user()
1225 uint32_t e1, e2; in helper_lldt() local
1249 e2 = cpu_ldl_kernel(env, ptr + 4); in helper_lldt()
1250 if ((e2 & DESC_S_MASK) || ((e2 >> DESC_TYPE_SHIFT) & 0xf) != 2) in helper_lldt()
1252 if (!(e2 & DESC_P_MASK)) in helper_lldt()
1258 load_seg_cache_raw_dt(&env->ldt, e1, e2); in helper_lldt()
1263 load_seg_cache_raw_dt(&env->ldt, e1, e2); in helper_lldt()
1272 uint32_t e1, e2; in helper_ltr() local
1297 e2 = cpu_ldl_kernel(env, ptr + 4); in helper_ltr()
1298 type = (e2 >> DESC_TYPE_SHIFT) & 0xf; in helper_ltr()
1299 if ((e2 & DESC_S_MASK) || in helper_ltr()
1302 if (!(e2 & DESC_P_MASK)) in helper_ltr()
1311 load_seg_cache_raw_dt(&env->tr, e1, e2); in helper_ltr()
1316 load_seg_cache_raw_dt(&env->tr, e1, e2); in helper_ltr()
1318 e2 |= DESC_TSS_BUSY_MASK; in helper_ltr()
1319 cpu_stl_kernel(env, ptr + 4, e2); in helper_ltr()
1327 uint32_t e1, e2; in helper_load_seg() local
1355 e2 = cpu_ldl_kernel(env, ptr + 4); in helper_load_seg()
1357 if (!(e2 & DESC_S_MASK)) in helper_load_seg()
1360 dpl = (e2 >> DESC_DPL_SHIFT) & 3; in helper_load_seg()
1363 if ((e2 & DESC_CS_MASK) || !(e2 & DESC_W_MASK)) in helper_load_seg()
1369 if ((e2 & (DESC_CS_MASK | DESC_R_MASK)) == DESC_CS_MASK) in helper_load_seg()
1372 if (!(e2 & DESC_CS_MASK) || !(e2 & DESC_C_MASK)) { in helper_load_seg()
1379 if (!(e2 & DESC_P_MASK)) { in helper_load_seg()
1387 if (!(e2 & DESC_A_MASK)) { in helper_load_seg()
1388 e2 |= DESC_A_MASK; in helper_load_seg()
1389 cpu_stl_kernel(env, ptr + 4, e2); in helper_load_seg()
1393 get_seg_base(e1, e2), in helper_load_seg()
1394 get_seg_limit(e1, e2), in helper_load_seg()
1395 e2); in helper_load_seg()
1409 uint32_t e1, e2, cpl, dpl, rpl, limit; in helper_ljmp_protected() local
1414 if (load_segment(env, &e1, &e2, new_cs) != 0) in helper_ljmp_protected()
1417 if (e2 & DESC_S_MASK) { in helper_ljmp_protected()
1418 if (!(e2 & DESC_CS_MASK)) in helper_ljmp_protected()
1420 dpl = (e2 >> DESC_DPL_SHIFT) & 3; in helper_ljmp_protected()
1421 if (e2 & DESC_C_MASK) { in helper_ljmp_protected()
1433 if (!(e2 & DESC_P_MASK)) in helper_ljmp_protected()
1435 limit = get_seg_limit(e1, e2); in helper_ljmp_protected()
1437 !(env->hflags & HF_LMA_MASK) && !(e2 & DESC_L_MASK)) in helper_ljmp_protected()
1440 get_seg_base(e1, e2), limit, e2); in helper_ljmp_protected()
1444 dpl = (e2 >> DESC_DPL_SHIFT) & 3; in helper_ljmp_protected()
1447 type = (e2 >> DESC_TYPE_SHIFT) & 0xf; in helper_ljmp_protected()
1455 switch_tss(env, new_cs, e1, e2, SWITCH_TSS_JMP, next_eip); in helper_ljmp_protected()
1462 if (!(e2 & DESC_P_MASK)) in helper_ljmp_protected()
1467 new_eip |= (e2 & 0xffff0000); in helper_ljmp_protected()
1468 if (load_segment(env, &e1, &e2, gate_cs) != 0) in helper_ljmp_protected()
1470 dpl = (e2 >> DESC_DPL_SHIFT) & 3; in helper_ljmp_protected()
1472 if (((e2 & (DESC_S_MASK | DESC_CS_MASK)) != in helper_ljmp_protected()
1475 if (((e2 & DESC_C_MASK) && (dpl > cpl)) || in helper_ljmp_protected()
1476 (!(e2 & DESC_C_MASK) && (dpl != cpl))) in helper_ljmp_protected()
1478 if (!(e2 & DESC_P_MASK)) in helper_ljmp_protected()
1480 limit = get_seg_limit(e1, e2); in helper_ljmp_protected()
1484 get_seg_base(e1, e2), limit, e2); in helper_ljmp_protected()
1527 uint32_t e1, e2, cpl, dpl, rpl, selector, offset, param_count; in helper_lcall_protected() local
1537 if (load_segment(env, &e1, &e2, new_cs) != 0) in helper_lcall_protected()
1540 LOG_PCALL("desc=%08x:%08x\n", e1, e2); in helper_lcall_protected()
1541 if (e2 & DESC_S_MASK) { in helper_lcall_protected()
1542 if (!(e2 & DESC_CS_MASK)) in helper_lcall_protected()
1544 dpl = (e2 >> DESC_DPL_SHIFT) & 3; in helper_lcall_protected()
1545 if (e2 & DESC_C_MASK) { in helper_lcall_protected()
1557 if (!(e2 & DESC_P_MASK)) in helper_lcall_protected()
1571 get_seg_base(e1, e2), in helper_lcall_protected()
1572 get_seg_limit(e1, e2), e2); in helper_lcall_protected()
1588 limit = get_seg_limit(e1, e2); in helper_lcall_protected()
1594 get_seg_base(e1, e2), limit, e2); in helper_lcall_protected()
1599 type = (e2 >> DESC_TYPE_SHIFT) & 0x1f; in helper_lcall_protected()
1600 dpl = (e2 >> DESC_DPL_SHIFT) & 3; in helper_lcall_protected()
1608 switch_tss(env, new_cs, e1, e2, SWITCH_TSS_CALL, next_eip); in helper_lcall_protected()
1623 if (!(e2 & DESC_P_MASK)) in helper_lcall_protected()
1626 offset = (e2 & 0xffff0000) | (e1 & 0x0000ffff); in helper_lcall_protected()
1627 param_count = e2 & 0x1f; in helper_lcall_protected()
1631 if (load_segment(env, &e1, &e2, selector) != 0) in helper_lcall_protected()
1633 if (!(e2 & DESC_S_MASK) || !(e2 & (DESC_CS_MASK))) in helper_lcall_protected()
1635 dpl = (e2 >> DESC_DPL_SHIFT) & 3; in helper_lcall_protected()
1638 if (!(e2 & DESC_P_MASK)) in helper_lcall_protected()
1641 if (!(e2 & DESC_C_MASK) && dpl < cpl) { in helper_lcall_protected()
1714 get_seg_base(e1, e2), in helper_lcall_protected()
1715 get_seg_limit(e1, e2), in helper_lcall_protected()
1716 e2); in helper_lcall_protected()
1762 uint32_t e2; in validate_seg() local
1771 e2 = env->segs[seg_reg].flags; in validate_seg()
1772 dpl = (e2 >> DESC_DPL_SHIFT) & 3; in validate_seg()
1773 if (!(e2 & DESC_CS_MASK) || !(e2 & DESC_C_MASK)) { in validate_seg()
1787 uint32_t e1, e2, ss_e1, ss_e2; in helper_ret_protected() local
1832 if (load_segment(env, &e1, &e2, new_cs) != 0) in helper_ret_protected()
1834 if (!(e2 & DESC_S_MASK) || in helper_ret_protected()
1835 !(e2 & DESC_CS_MASK)) in helper_ret_protected()
1841 dpl = (e2 >> DESC_DPL_SHIFT) & 3; in helper_ret_protected()
1842 if (e2 & DESC_C_MASK) { in helper_ret_protected()
1849 if (!(e2 & DESC_P_MASK)) in helper_ret_protected()
1857 get_seg_base(e1, e2), in helper_ret_protected()
1858 get_seg_limit(e1, e2), in helper_ret_protected()
1859 e2); in helper_ret_protected()
1918 get_seg_base(e1, e2), in helper_ret_protected()
1919 get_seg_limit(e1, e2), in helper_ret_protected()
1920 e2); in helper_ret_protected()
1980 uint32_t e1, e2; in helper_iret_protected() local
1991 if (load_segment(env, &e1, &e2, tss_selector) != 0) in helper_iret_protected()
1993 type = (e2 >> DESC_TYPE_SHIFT) & 0x17; in helper_iret_protected()
1997 switch_tss(env, tss_selector, e1, e2, SWITCH_TSS_IRET, next_eip); in helper_iret_protected()
2084 uint32_t e1, e2, eflags, selector; in helper_lsl() local
2091 if (load_segment(env, &e1, &e2, selector) != 0) in helper_lsl()
2094 dpl = (e2 >> DESC_DPL_SHIFT) & 3; in helper_lsl()
2096 if (e2 & DESC_S_MASK) { in helper_lsl()
2097 if ((e2 & DESC_CS_MASK) && (e2 & DESC_C_MASK)) { in helper_lsl()
2104 type = (e2 >> DESC_TYPE_SHIFT) & 0xf; in helper_lsl()
2121 limit = get_seg_limit(e1, e2); in helper_lsl()
2128 uint32_t e1, e2, eflags, selector; in helper_lar() local
2135 if (load_segment(env, &e1, &e2, selector) != 0) in helper_lar()
2138 dpl = (e2 >> DESC_DPL_SHIFT) & 3; in helper_lar()
2140 if (e2 & DESC_S_MASK) { in helper_lar()
2141 if ((e2 & DESC_CS_MASK) && (e2 & DESC_C_MASK)) { in helper_lar()
2148 type = (e2 >> DESC_TYPE_SHIFT) & 0xf; in helper_lar()
2169 return e2 & 0x00f0ff00; in helper_lar()
2174 uint32_t e1, e2, eflags, selector; in helper_verr() local
2181 if (load_segment(env, &e1, &e2, selector) != 0) in helper_verr()
2183 if (!(e2 & DESC_S_MASK)) in helper_verr()
2186 dpl = (e2 >> DESC_DPL_SHIFT) & 3; in helper_verr()
2188 if (e2 & DESC_CS_MASK) { in helper_verr()
2189 if (!(e2 & DESC_R_MASK)) in helper_verr()
2191 if (!(e2 & DESC_C_MASK)) { in helper_verr()
2207 uint32_t e1, e2, eflags, selector; in helper_verw() local
2214 if (load_segment(env, &e1, &e2, selector) != 0) in helper_verw()
2216 if (!(e2 & DESC_S_MASK)) in helper_verw()
2219 dpl = (e2 >> DESC_DPL_SHIFT) & 3; in helper_verw()
2221 if (e2 & DESC_CS_MASK) { in helper_verw()
2226 if (!(e2 & DESC_W_MASK)) { in helper_verw()