Diff for /np2/i386c/ia32/ia32.c between versions 1.20 and 1.26

version 1.20, 2008/01/25 17:49:46 version 1.26, 2012/02/05 06:36:14
Line 1 Line 1
 /*      $Id$    */  
   
 /*  /*
  * Copyright (c) 2002-2003 NONAKA Kimihiro   * Copyright (c) 2002-2003 NONAKA Kimihiro
  * All rights reserved.   * All rights reserved.
Line 132  ia32_setemm(UINT frame, UINT32 addr) { Line 130  ia32_setemm(UINT frame, UINT32 addr) {
   
   
 /*  /*
  * ¡¦ä£¥·¡¦¥Î¥Á¥©¡¼¥ï   * åã¡Öå㥷åã²ë¢¹î©¥µ
  */   */
 void FASTCALL  void CPUCALL
 change_pm(BOOL onoff)  change_pm(BOOL onoff)
 {  {
         int i;  
   
         if (onoff) {          if (onoff) {
                 for (i = 0; i < CPU_SEGREG_NUM; i++) {                  VERBOSE(("change_pm: Entering to Protected-Mode..."));
                         CPU_STAT_SREG(i).valid = 1;  
                         CPU_STAT_SREG(i).dpl = 0;  
                 }  
                 VERBOSE(("Entering to Protected-Mode..."));  
         } else {          } else {
                 VERBOSE(("Leaveing from Protected-Mode..."));                  VERBOSE(("change_pm: Leaveing from Protected-Mode..."));
         }          }
   
         CPU_INST_OP32 = CPU_INST_AS32 =          CPU_INST_OP32 = CPU_INST_AS32 =
             CPU_STATSAVE.cpu_inst_default.op_32 =               CPU_STATSAVE.cpu_inst_default.op_32 = 
             CPU_STATSAVE.cpu_inst_default.as_32 = 0;              CPU_STATSAVE.cpu_inst_default.as_32 = 0;
         CPU_STAT_SS32 = 0;          CPU_STAT_SS32 = 0;
         CPU_SET_CPL(0);          set_cpl(0);
         CPU_STAT_PM = onoff;          CPU_STAT_PM = onoff;
 }  }
   
 void FASTCALL  void CPUCALL
 change_pg(BOOL onoff)  change_pg(BOOL onoff)
 {  {
   
         if (onoff) {          if (onoff) {
                 VERBOSE(("Entering to Paging-Mode..."));                  VERBOSE(("change_pg: Entering to Paging-Mode..."));
         } else {          } else {
                 VERBOSE(("Leaveing from Paging-Mode..."));                  VERBOSE(("change_pg: Leaveing from Paging-Mode..."));
         }          }
   
         CPU_STAT_PAGING = onoff;          CPU_STAT_PAGING = onoff;
 }  }
   
 void FASTCALL  void CPUCALL
 change_vm(BOOL onoff)  change_vm(BOOL onoff)
 {  {
         int i;          int i;
   
         CPU_STAT_VM86 = onoff;          CPU_STAT_VM86 = onoff;
         if (onoff) {          if (onoff) {
                   VERBOSE(("change_vm: Entering to Virtual-8086-Mode..."));
                 for (i = 0; i < CPU_SEGREG_NUM; i++) {                  for (i = 0; i < CPU_SEGREG_NUM; i++) {
                         CPU_STAT_SREGLIMIT(i) = 0xffff;                          LOAD_SEGREG(i, CPU_REGS_SREG(i));
                         CPU_SET_SEGREG(i, CPU_REGS_SREG(i));  
                 }                  }
                 CPU_INST_OP32 = CPU_INST_AS32 =                  CPU_INST_OP32 = CPU_INST_AS32 =
                     CPU_STATSAVE.cpu_inst_default.op_32 =                      CPU_STATSAVE.cpu_inst_default.op_32 =
                     CPU_STATSAVE.cpu_inst_default.as_32 = 0;                      CPU_STATSAVE.cpu_inst_default.as_32 = 0;
                 CPU_STAT_SS32 = 0;                  CPU_STAT_SS32 = 0;
                 CPU_SET_CPL(3);                  set_cpl(3);
                 VERBOSE(("Entering to Virtual-8086-Mode..."));  
         } else {          } else {
                 VERBOSE(("Leaveing from Virtual-8086-Mode..."));                  VERBOSE(("change_vm: Leaveing from Virtual-8086-Mode..."));
         }          }
 }  }
   
 /*  /*
  * flags   * flags
  */   */
 static void  static void CPUCALL
 modify_eflags(UINT32 new_flags, UINT32 mask)  modify_eflags(UINT32 new_flags, UINT32 mask)
 {  {
         UINT32 orig = CPU_EFLAG;          UINT32 orig = CPU_EFLAG;
Line 216  modify_eflags(UINT32 new_flags, UINT32 m Line 209  modify_eflags(UINT32 new_flags, UINT32 m
         }          }
 }  }
   
 void  void CPUCALL
 set_flags(UINT16 new_flags, UINT16 mask)  set_flags(UINT16 new_flags, UINT16 mask)
 {  {
   
Line 225  set_flags(UINT16 new_flags, UINT16 mask) Line 218  set_flags(UINT16 new_flags, UINT16 mask)
         modify_eflags(new_flags, mask);          modify_eflags(new_flags, mask);
 }  }
   
 void  void CPUCALL
 set_eflags(UINT32 new_flags, UINT32 mask)  set_eflags(UINT32 new_flags, UINT32 mask)
 {  {
   
Line 234  set_eflags(UINT32 new_flags, UINT32 mask Line 227  set_eflags(UINT32 new_flags, UINT32 mask
         mask |= AC_FLAG|ID_FLAG;          mask |= AC_FLAG|ID_FLAG;
         modify_eflags(new_flags, mask);          modify_eflags(new_flags, mask);
 }  }
   
   /*
    * CR3 (Page Directory Entry base physical address)
    */
   void CPUCALL
   set_cr3(UINT32 new_cr3)
   {
   
           VERBOSE(("set_CR3: old = %08x, new = 0x%08x", CPU_CR3, new_cr3));
   
           CPU_CR3 = new_cr3 & CPU_CR3_MASK;
           CPU_STAT_PDE_BASE = CPU_CR3 & CPU_CR3_PD_MASK;
           tlb_flush(0);
   }
   
   /*
    * CPL (Current Privilege Level)
    */
   void CPUCALL
   set_cpl(int new_cpl)
   {
           int cpl = new_cpl & 3;
   
           CPU_STAT_CPL = (UINT8)cpl;
           CPU_STAT_USER_MODE = (cpl == 3) ? CPU_MODE_USER : CPU_MODE_SUPERVISER;
   }

Removed from v.1.20  
changed lines
  Added in v.1.26


RetroPC.NET-CVS <cvs@retropc.net>