Diff for /np2/i386c/ia32/cpu_io.c between versions 1.1 and 1.10

version 1.1, 2003/12/08 00:55:31 version 1.10, 2011/01/15 17:17:23
Line 1 Line 1
 /*      $Id$    */  
   
 /*  /*
  * Copyright (c) 2003 NONAKA Kimihiro   * Copyright (c) 2003 NONAKA Kimihiro
  * All rights reserved.   * All rights reserved.
Line 12 Line 10
  * 2. Redistributions in binary form must reproduce the above copyright   * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the   *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.   *    documentation and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products  
  *    derived from this software without specific prior written permission.  
  *   *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR   * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES   * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
Line 28 Line 24
  */   */
   
 #include "compiler.h"  #include "compiler.h"
   
 #include "cpu.h"  #include "cpu.h"
 #include "pccore.h"  #include "pccore.h"
 #include "iocore.h"  #include "iocore.h"
   #include "memory.h"
   
   static void IOOUTCALL check_io(UINT port, UINT len);
   
 static void  static void IOOUTCALL
 check_io(WORD port, int len)  check_io(UINT port, UINT len) 
 {  {
         WORD off;          UINT off;
         BYTE bit;          UINT8 bit;
         BYTE map;          UINT8 map;
   
         /* そもそも I/O 許可マップが無い場合 */  
         if (CPU_STAT_IOLIMIT == 0) {          if (CPU_STAT_IOLIMIT == 0) {
                   VERBOSE(("check_io: CPU_STAT_IOLIMIT == 0 (port = %04x, len = %d)", port, len));
                 EXCEPTION(GP_EXCEPTION, 0);                  EXCEPTION(GP_EXCEPTION, 0);
         }          }
   
         off = port / 8;          off = port / 8;
         bit = 1 << (port % 8);          bit = 1 << (port % 8);
         for (; len > 0; ++off, bit = 0x01) {          for (; len > 0; ++off, bit = 0x01) {
                 /* I/O 許可マップはビット単位なので */                  if (off >= CPU_STAT_IOLIMIT) {
                 if (off * 8 >= CPU_STAT_IOLIMIT) {                          VERBOSE(("check_io: off(%08x) >= CPU_STAT_IOLIMIT(%08x) (port = %04x, len = %d)", off, CPU_STAT_IOLIMIT, port, len));
                         EXCEPTION(GP_EXCEPTION, 0);                          EXCEPTION(GP_EXCEPTION, 0);
                 }                  }
   
                 map = cpu_lmemoryread(CPU_STAT_IOADDR + off);                  map = cpu_kmemoryread(CPU_STAT_IOADDR + off);
                 for (; (len > 0) && (bit != 0x00); bit <<= 1, --len) {                  for (; (len > 0) && (bit != 0x00); bit <<= 1, --len) {
                         if (map & bit) {                          if (map & bit) {
                                   VERBOSE(("check_io: (bitmap(0x%02x) & bit(0x%02x)) != 0 (port = %04x, len = %d)", map, bit, port, len));
                                 EXCEPTION(GP_EXCEPTION, 0);                                  EXCEPTION(GP_EXCEPTION, 0);
                         }                          }
                 }                  }
         }          }
 }  }
   
 BYTE  UINT8
 cpu_in(WORD port)  cpu_in(UINT port)
 {  {
   
         if (CPU_STAT_PM && (CPU_STAT_VM86 || (CPU_STAT_CPL > CPU_STAT_IOPL))) {          if (CPU_STAT_PM && (CPU_STAT_VM86 || (CPU_STAT_CPL > CPU_STAT_IOPL))) {
Line 72  cpu_in(WORD port) Line 72  cpu_in(WORD port)
         return iocore_inp8(port);          return iocore_inp8(port);
 }  }
   
 WORD  UINT16
 cpu_in_w(WORD port)  cpu_in_w(UINT port)
 {  {
   
         if (CPU_STAT_PM && (CPU_STAT_VM86 || (CPU_STAT_CPL > CPU_STAT_IOPL))) {          if (CPU_STAT_PM && (CPU_STAT_VM86 || (CPU_STAT_CPL > CPU_STAT_IOPL))) {
Line 82  cpu_in_w(WORD port) Line 82  cpu_in_w(WORD port)
         return iocore_inp16(port);          return iocore_inp16(port);
 }  }
   
 DWORD  UINT32
 cpu_in_d(WORD port)  cpu_in_d(UINT port)
 {  {
   
         if (CPU_STAT_PM && (CPU_STAT_VM86 || (CPU_STAT_CPL > CPU_STAT_IOPL))) {          if (CPU_STAT_PM && (CPU_STAT_VM86 || (CPU_STAT_CPL > CPU_STAT_IOPL))) {
Line 93  cpu_in_d(WORD port) Line 93  cpu_in_d(WORD port)
 }  }
   
 void  void
 cpu_out(WORD port, BYTE data)  cpu_out(UINT port, UINT8 data)
 {  {
   
         if (CPU_STAT_PM && (CPU_STAT_VM86 || (CPU_STAT_CPL > CPU_STAT_IOPL))) {          if (CPU_STAT_PM && (CPU_STAT_VM86 || (CPU_STAT_CPL > CPU_STAT_IOPL))) {
Line 103  cpu_out(WORD port, BYTE data) Line 103  cpu_out(WORD port, BYTE data)
 }  }
   
 void  void
 cpu_out_w(WORD port, WORD data)  cpu_out_w(UINT port, UINT16 data)
 {  {
   
         if (CPU_STAT_PM && (CPU_STAT_VM86 || (CPU_STAT_CPL > CPU_STAT_IOPL))) {          if (CPU_STAT_PM && (CPU_STAT_VM86 || (CPU_STAT_CPL > CPU_STAT_IOPL))) {
Line 113  cpu_out_w(WORD port, WORD data) Line 113  cpu_out_w(WORD port, WORD data)
 }  }
   
 void  void
 cpu_out_d(WORD port, DWORD data)  cpu_out_d(UINT port, UINT32 data)
 {  {
   
         if (CPU_STAT_PM && (CPU_STAT_VM86 || (CPU_STAT_CPL > CPU_STAT_IOPL))) {          if (CPU_STAT_PM && (CPU_STAT_VM86 || (CPU_STAT_CPL > CPU_STAT_IOPL))) {

Removed from v.1.1  
changed lines
  Added in v.1.10


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