/[qemu]/qemu/helper-i386.c
ViewVC logotype

Diff of /qemu/helper-i386.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.14 by bellard, Wed Aug 20 21:34:35 2003 UTC revision 1.15 by bellard, Wed Aug 20 23:02:09 2003 UTC
# Line 189  static void do_interrupt_protected(int i Line 189  static void do_interrupt_protected(int i
189  {  {
190      SegmentCache *dt;      SegmentCache *dt;
191      uint8_t *ptr, *ssp;      uint8_t *ptr, *ssp;
192      int type, dpl, selector, ss_dpl;      int type, dpl, selector, ss_dpl, cpl;
193      int has_error_code, new_stack, shift;      int has_error_code, new_stack, shift;
194      uint32_t e1, e2, offset, ss, esp, ss_e1, ss_e2, push_size;      uint32_t e1, e2, offset, ss, esp, ss_e1, ss_e2, push_size;
195      uint32_t old_cs, old_ss, old_esp, old_eip;      uint32_t old_cs, old_ss, old_esp, old_eip;
# Line 216  static void do_interrupt_protected(int i Line 216  static void do_interrupt_protected(int i
216          break;          break;
217      }      }
218      dpl = (e2 >> DESC_DPL_SHIFT) & 3;      dpl = (e2 >> DESC_DPL_SHIFT) & 3;
219        cpl = env->hflags & HF_CPL_MASK;
220      /* check privledge if software int */      /* check privledge if software int */
221      if (is_int && dpl < env->cpl)      if (is_int && dpl < cpl)
222          raise_exception_err(EXCP0D_GPF, intno * 8 + 2);          raise_exception_err(EXCP0D_GPF, intno * 8 + 2);
223      /* check valid bit */      /* check valid bit */
224      if (!(e2 & DESC_P_MASK))      if (!(e2 & DESC_P_MASK))
# Line 232  static void do_interrupt_protected(int i Line 233  static void do_interrupt_protected(int i
233      if (!(e2 & DESC_S_MASK) || !(e2 & (DESC_CS_MASK)))      if (!(e2 & DESC_S_MASK) || !(e2 & (DESC_CS_MASK)))
234          raise_exception_err(EXCP0D_GPF, selector & 0xfffc);          raise_exception_err(EXCP0D_GPF, selector & 0xfffc);
235      dpl = (e2 >> DESC_DPL_SHIFT) & 3;      dpl = (e2 >> DESC_DPL_SHIFT) & 3;
236      if (dpl > env->cpl)      if (dpl > cpl)
237          raise_exception_err(EXCP0D_GPF, selector & 0xfffc);          raise_exception_err(EXCP0D_GPF, selector & 0xfffc);
238      if (!(e2 & DESC_P_MASK))      if (!(e2 & DESC_P_MASK))
239          raise_exception_err(EXCP0B_NOSEG, selector & 0xfffc);          raise_exception_err(EXCP0B_NOSEG, selector & 0xfffc);
240      if (!(e2 & DESC_C_MASK) && dpl < env->cpl) {      if (!(e2 & DESC_C_MASK) && dpl < cpl) {
241          /* to inner priviledge */          /* to inner priviledge */
242          get_ss_esp_from_tss(&ss, &esp, dpl);          get_ss_esp_from_tss(&ss, &esp, dpl);
243          if ((ss & 0xfffc) == 0)          if ((ss & 0xfffc) == 0)
# Line 255  static void do_interrupt_protected(int i Line 256  static void do_interrupt_protected(int i
256          if (!(ss_e2 & DESC_P_MASK))          if (!(ss_e2 & DESC_P_MASK))
257              raise_exception_err(EXCP0A_TSS, ss & 0xfffc);              raise_exception_err(EXCP0A_TSS, ss & 0xfffc);
258          new_stack = 1;          new_stack = 1;
259      } else if ((e2 & DESC_C_MASK) || dpl == env->cpl) {      } else if ((e2 & DESC_C_MASK) || dpl == cpl) {
260          /* to same priviledge */          /* to same priviledge */
261          new_stack = 0;          new_stack = 0;
262      } else {      } else {
# Line 402  void do_interrupt_user(int intno, int is Line 403  void do_interrupt_user(int intno, int is
403  {  {
404      SegmentCache *dt;      SegmentCache *dt;
405      uint8_t *ptr;      uint8_t *ptr;
406      int dpl;      int dpl, cpl;
407      uint32_t e2;      uint32_t e2;
408    
409      dt = &env->idt;      dt = &env->idt;
# Line 410  void do_interrupt_user(int intno, int is Line 411  void do_interrupt_user(int intno, int is
411      e2 = ldl(ptr + 4);      e2 = ldl(ptr + 4);
412            
413      dpl = (e2 >> DESC_DPL_SHIFT) & 3;      dpl = (e2 >> DESC_DPL_SHIFT) & 3;
414        cpl = env->hflags & HF_CPL_MASK;
415      /* check privledge if software int */      /* check privledge if software int */
416      if (is_int && dpl < env->cpl)      if (is_int && dpl < cpl)
417          raise_exception_err(EXCP0D_GPF, intno * 8 + 2);          raise_exception_err(EXCP0D_GPF, intno * 8 + 2);
418    
419      /* Since we emulate only user space, we cannot do more than      /* Since we emulate only user space, we cannot do more than
# Line 742  void helper_ljmp_protected_T0_T1(void) Line 744  void helper_ljmp_protected_T0_T1(void)
744          raise_exception_err(EXCP0D_GPF, 0);          raise_exception_err(EXCP0D_GPF, 0);
745      if (load_segment(&e1, &e2, new_cs) != 0)      if (load_segment(&e1, &e2, new_cs) != 0)
746          raise_exception_err(EXCP0D_GPF, new_cs & 0xfffc);          raise_exception_err(EXCP0D_GPF, new_cs & 0xfffc);
747      cpl = env->cpl;      cpl = env->hflags & HF_CPL_MASK;
748      if (e2 & DESC_S_MASK) {      if (e2 & DESC_S_MASK) {
749          if (!(e2 & DESC_CS_MASK))          if (!(e2 & DESC_CS_MASK))
750              raise_exception_err(EXCP0D_GPF, new_cs & 0xfffc);              raise_exception_err(EXCP0D_GPF, new_cs & 0xfffc);
# Line 826  void helper_lcall_protected_T0_T1(int sh Line 828  void helper_lcall_protected_T0_T1(int sh
828          raise_exception_err(EXCP0D_GPF, 0);          raise_exception_err(EXCP0D_GPF, 0);
829      if (load_segment(&e1, &e2, new_cs) != 0)      if (load_segment(&e1, &e2, new_cs) != 0)
830          raise_exception_err(EXCP0D_GPF, new_cs & 0xfffc);          raise_exception_err(EXCP0D_GPF, new_cs & 0xfffc);
831      cpl = env->cpl;      cpl = env->hflags & HF_CPL_MASK;
832      if (e2 & DESC_S_MASK) {      if (e2 & DESC_S_MASK) {
833          if (!(e2 & DESC_CS_MASK))          if (!(e2 & DESC_CS_MASK))
834              raise_exception_err(EXCP0D_GPF, new_cs & 0xfffc);              raise_exception_err(EXCP0D_GPF, new_cs & 0xfffc);
# Line 1079  static inline void helper_ret_protected( Line 1081  static inline void helper_ret_protected(
1081      if (!(e2 & DESC_S_MASK) ||      if (!(e2 & DESC_S_MASK) ||
1082          !(e2 & DESC_CS_MASK))          !(e2 & DESC_CS_MASK))
1083          raise_exception_err(EXCP0D_GPF, new_cs & 0xfffc);          raise_exception_err(EXCP0D_GPF, new_cs & 0xfffc);
1084      cpl = env->cpl;      cpl = env->hflags & HF_CPL_MASK;
1085      rpl = new_cs & 3;      rpl = new_cs & 3;
1086      if (rpl < cpl)      if (rpl < cpl)
1087          raise_exception_err(EXCP0D_GPF, new_cs & 0xfffc);          raise_exception_err(EXCP0D_GPF, new_cs & 0xfffc);

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26