WO2009144892A1 - デバイスエミュレーション支援装置、デバイスエミュレーション支援方法、デバイスエミュレーション支援回路及び情報処理装置 - Google Patents

デバイスエミュレーション支援装置、デバイスエミュレーション支援方法、デバイスエミュレーション支援回路及び情報処理装置 Download PDF

Info

Publication number
WO2009144892A1
WO2009144892A1 PCT/JP2009/002221 JP2009002221W WO2009144892A1 WO 2009144892 A1 WO2009144892 A1 WO 2009144892A1 JP 2009002221 W JP2009002221 W JP 2009002221W WO 2009144892 A1 WO2009144892 A1 WO 2009144892A1
Authority
WO
WIPO (PCT)
Prior art keywords
access
cpu
exception
unit
monitoring
Prior art date
Application number
PCT/JP2009/002221
Other languages
English (en)
French (fr)
Inventor
天野克重
谷川忠雄
Original Assignee
パナソニック株式会社
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by パナソニック株式会社 filed Critical パナソニック株式会社
Priority to CN2009801190956A priority Critical patent/CN102047228A/zh
Priority to JP2010514349A priority patent/JP5307133B2/ja
Priority to US12/670,929 priority patent/US8374842B2/en
Publication of WO2009144892A1 publication Critical patent/WO2009144892A1/ja

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/26Functional testing
    • G06F11/261Functional testing by simulating additional hardware, e.g. fault simulation

Definitions

  • the present invention relates to a device emulation support apparatus, a device emulation support method, a device emulation support circuit, and an information processing apparatus including the device emulation support apparatus that facilitate the emulation of peripheral devices used during execution by software.
  • the program executed by the information processing apparatus operates while using one or more devices (peripheral devices) included in the information processing apparatus. Therefore, a program created on the assumption of a specific information processing device is normal if there is no device to be processed, or if the control method and specifications are different even if a device of the same type as the device to be processed exists. Does not work. In such a case, if the device to be processed can be emulated without changing the program, the program can be used by an information processing apparatus different from the specific information processing apparatus.
  • a device control register is arranged in the central processing unit (CPU) address space, and the target device operates when the CPU operates the control register. That is, the CPU writes (writes) or reads (reads) the address of the control register of the target device. Therefore, in order to perform device emulation with software, it is necessary to capture (trap) access from the CPU to a specific address, that is, the address of the control register of the emulation target device.
  • An emulation target device is a device that is a target of processing by software but does not actually exist.
  • a general method for trapping access to a specific address is to use a memory space protection function. That is, by prohibiting reading and writing to the trapped address, an exception occurs when accessing the address. Emulation is started in response to the exception handler, and the device can be emulated without changing the program by returning to the original program after the end of the emulation.
  • bus monitoring device that detects access from a CPU to a specific address space by monitoring a signal flowing through the bus (see, for example, Patent Document 1).
  • the bus monitoring device monitors various signals flowing through the bus, and generates an interrupt to the CPU when a signal that matches the set condition is detected. Thereby, access to a specific address from the CPU can be trapped.
  • Emulation of the device is performed by the software performing the processing performed by the device that is the target of the emulation instead of the device.
  • the software In order for the software to perform processing instead, after trapping an access to the control register of the target device, it is necessary to acquire what the access is, that is, the contents of the access.
  • the device to be emulated is DMA (Direct Memory Access) and the process performed by the device is a memory copy
  • the software that performs the emulation processes the address on the memory where the data to be copied is stored. Acquire information necessary for.
  • the control register of the device to be emulated is referred to as a “virtual register”.
  • the emulation software analyzes the contents of the trapped instruction (write instruction) and identifies the operation register holding the data to be written. Further, the emulation software performs processing for acquiring data from the specified arithmetic register and writing the acquired data to a target address.
  • the emulation software analyzes the contents of the trapped instruction (read instruction) and specifies the storage destination (calculation register, memory, etc.) of the read data. . Further, the software that performs emulation performs a process of storing the read data in a storage destination.
  • the present invention has been made to solve the above-described problems, and can reduce the amount of processing during emulation and can efficiently emulate peripheral devices, and device emulation support apparatus and device emulation support It is an object of the present invention to provide a method, a device emulation support circuit, and an information processing apparatus.
  • a device emulation support apparatus is a device emulation support apparatus communicably connected via a bus to a CPU that executes an emulation process by generating an exception, and is connected to a peripheral device to be emulated
  • a monitoring address storage unit for storing a corresponding address as a monitoring target; access to the peripheral device from the CPU; and access information including an address corresponding to the peripheral device to be accessed; and the CPU From the access signal output from the access signal to the peripheral device, an access monitoring unit that acquires access information including an address that matches the address stored in the monitoring address storage unit, and the access acquired by the access monitoring unit
  • An access storage unit for storing information; When the access is a read access indicating data read, a read data storage unit for temporarily storing data read from the peripheral device and the exception occurrence notification for causing the CPU to generate an exception are sent to the CPU.
  • the exception generation unit to be transmitted and the access information acquired by the access monitoring unit are received, the received access information is compared with the previous access information stored in the access storage unit, and the received access information is immediately before
  • the access information is stored in the access storage unit, the exception generation unit is requested to transmit the exception occurrence notification, and the received access information is the same as the previous access information.
  • the previous access information stored in the access storage unit is excluded from comparison.
  • the CPU When the access monitored by the access monitoring unit is the read access, the CPU outputs the data stored in the read data storage unit to the CPU to complete the read access. And an access completion unit that instructs the CPU to complete the write access when the access monitored by the access monitoring unit is a write access indicating data writing.
  • the address corresponding to the peripheral device to be emulated is stored as a monitoring target in the monitoring address storage unit.
  • Access to the peripheral device from the CPU is monitored, access information including an address corresponding to the peripheral device to be accessed is stored, and stored in the monitoring address storage unit from an access signal output from the CPU to the peripheral device Access information including an address that matches the registered address is acquired.
  • the access storage unit stores the acquired access information.
  • the read data storage unit temporarily stores data read from the peripheral device when the access is a read access indicating reading of data.
  • the acquired access information is received, and the received access information is compared with the previous access information stored in the access storage unit.
  • the acquired access information is stored in the access storage unit, and an exception occurrence notification for causing the CPU to generate an exception is transmitted to the CPU.
  • the previous access information stored in the access storage unit is excluded from the comparison target. If the monitored access is a read access, the data stored in the read data storage unit is output to the CPU to instruct the CPU to complete the read access. If the monitored access is a write access representing data writing, the CPU is instructed to complete the write access.
  • the CPU executes an emulation process by generating an exception.
  • the received access information is the same as the previous access information stored in the access storage unit, it is considered that the access is re-executed upon completion of the exception.
  • the access is a read access
  • the predetermined data is transferred to the CPU. Is output to the CPU, the CPU is instructed to complete the read access. If the access is a write access, the CPU is instructed to complete the write access as it is.
  • the processing of analyzing the trapped access contents and acquiring necessary data is not performed by the CPU that performs emulation, the processing amount at the time of emulation can be reduced and efficiently Peripheral device emulation can be performed.
  • FIG. 1 shows the structure of the information processing apparatus provided with the device emulation assistance apparatus in Embodiment 1 of this invention. It is a flowchart for demonstrating operation
  • FIG. 1 is a diagram showing a configuration of an information processing apparatus including a device emulation support apparatus according to Embodiment 1 of the present invention.
  • the information processing apparatus includes a CPU (central processing unit) 1, a memory 2, a peripheral device (peripheral device) 3, a bus 4, and a device emulation support device 5.
  • the CPU 1 controls the information processing apparatus by executing a program stored in the memory 2.
  • the address space of the CPU 1 includes a register (control register) necessary for controlling the peripheral device 3.
  • the program executed by the CPU 1 can control the target peripheral device 3 by reading or writing data to the address of the control register corresponding to the target peripheral device 3. it can.
  • the memory 2 is a storage device that stores various programs and data executed by the information processing apparatus.
  • the memory 2 can be any type of memory such as random access memory (RAM) or flash memory. Further, the memory 2 may be a combination of a plurality of memories of the same type or different types. Furthermore, the memory 2 may include a read-on memory (ROM).
  • RAM random access memory
  • ROM read-on memory
  • Peripheral device 3 is a device such as various input / output devices, and devices according to the purpose of use of the information processing device are used. Here, an example is shown in which three peripheral devices of peripheral device A, peripheral device B, and peripheral device C are provided.
  • the bus 4 is a transmission path that connects the CPU 1, the memory 2, the peripheral device 3, and the device emulation support apparatus 5 so that they can communicate with each other and exchange data. That is, access from the CPU 1 to the peripheral device 3 is performed via the bus 4.
  • the device emulation support apparatus 5 monitors the access to the address space of the CPU 1 that executes the guest program and generates an exception process for the CPU 1. As a result, the device emulation support apparatus 5 notifies the program to be emulated (hereinafter referred to as an emulation program) of access to a specific address and supports the execution of the emulation program.
  • an emulation program the program to be emulated
  • the guest program is a program for controlling a part or all of peripheral devices that are assumed to exist in the program but are not included in the information processing apparatus.
  • the guest program includes a program for controlling peripheral devices included in the information processing apparatus and a program for controlling peripheral devices not included in the information processing apparatus.
  • the guest program may be only a program for controlling peripheral devices that the information processing apparatus does not have.
  • the guest program and the emulation program are stored in the memory 2 and executed by the CPU 1.
  • the CPU 1 executes the guest program, the access to the control register of the peripheral device that does not exist is trapped and the target emulation program is executed.
  • a peripheral device that does not exist can be emulated in software.
  • the device emulation support apparatus 5 includes a monitoring address setting unit 10, an access monitoring unit 11, an access storage unit 12, an access determination unit 13, an exception generation unit 14, a read data setting unit 15, and an access completion unit 16.
  • the monitoring address setting unit 10 is a storage unit that holds an address range to be monitored by the device emulation support apparatus 5.
  • the device emulation support apparatus 5 traps access to the address range set in the monitoring address setting unit 10. That is, the monitoring address setting unit 10 holds an address range corresponding to the peripheral device to be emulated. More specifically, the monitoring address setting unit 10 is a control register that sets a range of addresses to be trapped, similarly to the control register of the normal peripheral device 3.
  • the address range set in the monitoring address setting unit 10 for example, values indicating the upper limit and the lower limit of the address are used. Further, as the address range set in the monitoring address setting unit 10, a value indicating the start address and the size of the range may be used.
  • the setting of the address range in the monitoring address setting unit 10 is performed, for example, when the emulation program is initialized. Furthermore, in order to specify the access to be trapped in more detail, the monitoring address setting unit 10 may further set conditions other than the address range. For example, the monitoring address setting unit 10 can perform setting such that a read command, a write command, or both are targeted for trapping.
  • the access monitoring unit 11 monitors a signal (access signal) flowing on the bus 4 and detects the occurrence of an access that matches a condition including the address range set in the monitoring address setting unit 10.
  • This signal includes information about access contents (access information) such as the address to be accessed, the type indicating whether the access is read or write, and the data size of the data to be read or data to be written. Yes. Therefore, the access monitoring unit 11 can detect the access content of the access to the address space by the CPU 1 by monitoring the signal flowing on the bus 4. In addition, the access monitoring unit 11 notifies the access determination unit 13 of the access content that matches the detected condition.
  • the access storage unit 12 holds the access content that is detected by the access monitoring unit 11 and that matches the conditions set in the monitoring address setting unit 10.
  • the access determination unit 13 determines the access content notified from the access monitoring unit 11 and performs storage processing in the access storage unit 12.
  • the access storage unit 12 always holds the access content immediately before the condition set in the monitoring address setting unit 10 is met.
  • the access content stored in the access storage unit 12 includes at least an access destination address, a type indicating whether the access is a read or a write, and a value (data) to be written if the access is a write. It is out.
  • the access content stored in the access storage unit 12 may include information indicating the size of data to be read or written, for example.
  • the address space of the CPU 1 has a register that can acquire the previous access content.
  • the CPU 1 that executes the emulation program refers to this access content and emulates the peripheral device.
  • the access determination unit 13 receives the access content that is detected by the access monitoring unit 11 and matches the condition set in the monitoring address setting unit 10 and immediately before the received access content is stored in the access storage unit 12. It is determined whether or not the same as the access content (access content trapped last time).
  • the device emulation support apparatus 5 causes the CPU 1 to execute an emulation program when an exception occurs in the CPU 1. After the exception processing is completed, the CPU 1 returns to the instruction that caused access to the emulation target peripheral device, and re-executes the instruction. That is, the access determination unit 13 determines to re-execute the instruction when the acquired access content is different from the previous access content.
  • the access determination unit 13 When it is determined that the instruction is to be re-executed, the access determination unit 13 stores the new access content in the access storage unit 12 and requests the exception generation unit 14 to generate an exception. On the other hand, if it is determined that the instruction is not re-executed, that is, the access content received this time is the same as the previous access content, the access determination unit 13 erases the previous access content stored in the access storage unit 12. Then, the access completion unit 16 is notified of the access contents. Thus, thereafter, even if the received access content is the same as the previous access content stored, the received access content is determined as a new access.
  • the access determination unit 13 receives the access content acquired by the access monitoring unit 11 and compares the received access content with the previous access content stored in the access storage unit 12. If the received access content is different from the previous access content, the access determination unit 13 stores the acquired access content in the access storage unit 12 and requests the exception generation unit 14 to transmit an exception occurrence notification. On the other hand, when the received access content is the same as the previous access content, the access determination unit 13 excludes the previous access content stored in the access storage unit 12 from the comparison target.
  • the previous access contents are erased, but it is not always necessary to erase the stored contents.
  • the erasure of the immediately preceding access content means that the access determination unit 13 excludes it from comparison.
  • the exception generation unit 14 receives an exception generation request from the access determination unit 13 and sends an exception notification for generating an exception to the CPU 1. Output to. Specifically, the exception generation unit 14 outputs a specific signal such as a data abort that can cause the CPU 1 to generate an exception to the bus 4. Further, a configuration in which the exception generation unit 14 is directly connected to a terminal related to the occurrence of an exception of the CPU 1 and an exception notification is output from the exception generation unit 14 to the CPU 1 may be used. In response to this exception, the CPU 1 operates the emulation program.
  • the read data setting unit 15 temporarily holds data read from the peripheral device 3 when the trapped access is a read command.
  • the emulation program (CPU 1) sets data in the read data setting unit 15.
  • the address space of the CPU 1 has a register for setting data.
  • the access completion unit 16 receives the access content notified from the access determination unit 13 when the access determination unit 13 determines that the current access content is the same as the previous access content, that is, the instruction is not re-executed. .
  • the type included in the access content notified from the access determination unit 13 is read, that is, when a read access occurs in which the guest program (CPU 1) reads data from the control register of a peripheral device that does not exist, the access completion unit 16 completes the CPU 1 read access.
  • the access completion unit 16 when the access monitored by the access monitoring unit 11 is a read access, the access completion unit 16 outputs the data stored in the read data setting unit 15 to the CPU 1 and instructs the CPU 1 to complete the read access. To do. In addition, when the access monitored by the access monitoring unit 11 is a write access indicating data writing, the access completion unit 16 instructs the CPU 1 to complete the write access.
  • the access completion unit 16 acquires data held in the read data setting unit 15 and outputs the data to the bus 4 as a signal. That is, the access completion unit 16 causes the guest program to receive the data set by the emulation program as a result of the read access to the control register of the peripheral device that does not exist.
  • the completion unit 16 completes the write access of the CPU 1. Specifically, the access completion unit 16 outputs a data reception completion signal to the bus 4.
  • the monitoring address setting unit 10 corresponds to an example of a monitoring address storage unit
  • the access monitoring unit 11 corresponds to an example of an access monitoring unit
  • the access storage unit 12 corresponds to an example of an access storage unit.
  • the read data setting unit 15 corresponds to an example of a read data storage unit
  • the exception generation unit 14 corresponds to an example of an exception generation unit
  • the access determination unit 13 corresponds to an example of an access determination unit
  • the access completion unit 16 corresponds to an example of an access completion unit.
  • FIG. 2 is a flowchart for explaining the operation of the device emulation support apparatus 5 when the guest program is operating.
  • the CPU 1 starts the operation of the guest program
  • the device emulation support apparatus 5 starts processing.
  • the information processing apparatus including the device emulation support apparatus 5 may start the process of the device emulation support apparatus 5 by performing an initialization process at the time of activation.
  • the access monitoring unit 11 monitors a signal flowing on the bus 4 and determines whether or not an access has occurred (step S1). If access has not occurred (NO in step S1), the access monitoring unit 11 continues monitoring until access occurs. When an access occurs (YES in step S1), the access monitoring unit 11 acquires the access content of the generated access (step S2).
  • the access monitoring unit 11 determines whether or not the generated access is a trap target access (step S3). That is, the access monitoring unit 11 determines whether or not the address included in the acquired access content matches the trap target address range set in the monitoring address setting unit 10, and accesses (traps) that match the address. Detect the occurrence of (access). When conditions other than the address range are also set in the monitoring address setting unit 10, the access monitoring unit 11 determines whether these conditions are also met. If the generated access is not a trap target access (NO in step S3), the process proceeds to step S1, and the process is repeated.
  • the access monitoring unit 11 notifies the access determination unit 13 of the access content of the generated access (step S4).
  • the access determination unit 13 compares the access content notified from the access monitoring unit 11 with the access content of the previous access stored in the access storage unit 12 (the previous trapped access). That is, the access determination unit 13 determines whether or not the access that has occurred this time is the same as the previous access stored in the access storage unit 12 (step S5).
  • the access determination unit 13 compares at least the addresses of the access destinations, but may compare other information that can be used to determine whether the access is based on the same instruction.
  • the data size may be used for determination.
  • the presence / absence of burst transfer and the transfer size may be used for determination.
  • the access determination unit 13 stores the access content of the new access in the access storage unit 12 as the access content of the previous access.
  • a request for generating an exception for generating is output to the exception generation unit 14 (step S6).
  • the exception generation unit 14 receives the exception generation request output by the access determination unit 13, and outputs an exception notification for generating an exception to the CPU 1 (step S7).
  • step S5 determines that the access that has occurred is the same as the previous access (YES in step S5), the access determination unit 13 determines that the instruction is to be re-executed and the previous access stored in the access storage unit 12 The access contents are deleted, and the access completion part 16 is notified of the access contents of the new access (step S8).
  • the access completion unit 16 determines whether the access content notified by the access determination unit 13 is a read access for reading data from the memory or a write access for writing data to the memory (step S9).
  • the access completion unit 16 acquires the read data held in the read data setting unit 15, and the acquired read data is transferred to the bus 4 (Step S10). Next, the access completion unit 16 completes the re-executed read access (step S11), and returns to the process of step S1. Thereby, the process after step S1 is repeatedly performed.
  • step S9 the access completion unit 16 completes the re-executed write access (step S12) and returns to the process of step S1. Thereby, the process after step S1 is repeatedly performed.
  • the device emulation support apparatus 5 ends the access monitoring and completes the processing shown in FIG. Further, the device emulation support apparatus 5 may continue to monitor access while the information processing apparatus including the device emulation support apparatus 5 is activated.
  • FIG. 3 is a diagram showing an example of a register configuration used in the device emulation support apparatus 5 according to the first embodiment of the present invention. As described above, a plurality of registers are arranged in the address space of the CPU 1 in order to enable processing (read processing or write processing) by the CPU 1.
  • the monitoring address setting unit 10 is a register that sets a trap target address range. As shown in FIG. 3, the monitoring address setting unit 10 holds the head address of the target monitoring address area and the size of the monitoring address area as a set. The monitoring address setting unit 10 can hold a plurality of sets.
  • the access storage unit 12 is a register that stores the access contents of the trapped access.
  • the access storage unit 12 holds the access contents of the access being processed from when the access occurs until it is completed.
  • the access storage unit 12 writes as the access contents, the access destination address, the access type indicating read access or write access, and the write when the access type is write access.
  • a value (write data) is stored.
  • the read data setting unit 15 is a register that sets data (read data) to be read by the CPU 1 when the trapped access is a read access.
  • write data of the access storage unit 12 and the read data of the read data setting unit 15 are provided with the number of registers up to the maximum size of burst transfer in order to support burst read processing and burst write processing by the CPU 1.
  • FIG. 4 is a diagram illustrating an example of a software configuration of the information processing apparatus including the device emulation support apparatus according to the first embodiment.
  • the information processing apparatus does not include a peripheral device corresponding to the device driver 20. That is, the device driver 20 is a guest program and accesses a peripheral device that does not exist.
  • the device emulation support apparatus 5 When the application 22 operating on the information processing apparatus generates an access to a peripheral device controlled by the device driver 20, the device emulation support apparatus 5 operates. The device emulation support apparatus 5 outputs an exception notification to the CPU 1 and causes the CPU 1 to generate an exception. In response to an exception from the CPU 1, the exception handler 23 in the OS 21 operates. The exception handler 23 determines whether or not the generated exception is generated by the device emulation support apparatus 5, and operates the emulation program 24 in the case of the exception generated by the device emulation support apparatus 5.
  • the emulation program 24 obtains access contents from the access storage unit 12 of the device emulation support apparatus 5, specifies a peripheral device to be emulated, and performs emulation corresponding to the specified peripheral device. Thereby, the information processing apparatus can use the device driver 20 which is a guest program as it is. Therefore, for example, even if the application 22 depends on the specification of the device driver 20, the information processing apparatus can be operated without changing the dependency relationship with the device driver 20.
  • FIG. 5 is a diagram illustrating a first modification of the software configuration of the information processing apparatus including the device emulation support apparatus according to the first embodiment.
  • the information processing apparatus does not include a peripheral device corresponding to the device driver 20.
  • the guest program 25 includes a device driver 20, an OS 21, and an application 22.
  • the entire software system created on the assumption that the peripheral devices provided are different from each other is the guest program.
  • the information processing apparatus includes a virtualization layer 26 that controls the emulation of peripheral devices, and the virtualization layer 26 includes an exception control unit 27.
  • the device emulation support apparatus 5 When the application 22 operating on the information processing apparatus generates an access to a peripheral device controlled by the device driver 20, the device emulation support apparatus 5 outputs an exception notification to the CPU 1 and causes the CPU 1 to generate an exception. . Upon receiving the exception notification, the CPU 1 instructs the exception control unit 27 of the virtualization layer 26 to execute exception processing. The virtualization layer 26 receives the exception processing execution instruction from the CPU 1 and operates the exception control unit 27 first.
  • the exception control unit 27 determines whether or not the generated exception is generated by the device emulation support apparatus 5. In the case of an exception generated by the device emulation support apparatus 5, the exception control unit 27 operates the emulation program 24. If it is not an exception generated by the device emulation support apparatus 5, the exception control unit 27 transfers control to the exception handler 23 in the OS 21. Thus, the emulation program 24 operates when the device driver 20 in the guest program 25 accesses the peripheral device.
  • FIG. 6 is a diagram illustrating a second modification of the software configuration of the information processing apparatus including the device emulation support apparatus according to the first embodiment.
  • the information processing apparatus does not include a peripheral device corresponding to the device driver 20.
  • the virtualization layer 26 controls a plurality of virtual machines.
  • the virtualization layer 26 is called a hypervisor, and executes and controls a plurality of virtual computers (virtual computers) on one physical computer.
  • the information processing apparatus includes a first virtual machine 28 and a second virtual machine 29.
  • the first virtual machine 28 operates as a guest program.
  • the second virtual machine 29 executes the emulation program 24.
  • the virtualization layer 26 has a function of operating the second virtual machine 29 that executes the emulation program 24 and the first virtual machine 28 that executes the guest program 25 in a time-sharing manner. Further, the virtualization layer 26 includes an exception control unit 27.
  • the device emulation support apparatus 5 When the application 22 operating on the information processing apparatus generates an access to a peripheral device controlled by the device driver 20, the device emulation support apparatus 5 outputs an exception notification to the CPU 1 and causes the CPU 1 to generate an exception. . Upon receiving the exception notification, the CPU 1 instructs the exception control unit 27 of the virtualization layer 26 to execute exception processing. The virtualization layer 26 receives the exception processing execution instruction from the CPU 1 and operates the exception control unit 27 first.
  • the exception control unit 27 determines whether or not the generated exception is generated by the device emulation support apparatus 5. In the case of an exception generated by the device emulation support apparatus 5, the exception control unit 27 operates the emulation program 24. If it is not an exception generated by the device emulation support apparatus 5, the exception control unit 27 transfers control to the exception handler 23 in the OS 21. Thus, the emulation program 24 operates when the device driver 20 in the guest program 25 accesses the peripheral device.
  • peripheral devices that operate in parallel with the CPU, such as DMA, decode engine, and encode engine.
  • DMA digital versatile access
  • decode engine decode engine
  • encode engine encode engine
  • FIG. 7 is a flowchart showing an example of emulation processing at the time of read access of the information processing apparatus including the device emulation support apparatus according to Embodiment 1 of the present invention.
  • FIG. 7 shows emulation of read access.
  • the CPU 1 executes the guest program and executes read access for reading data from the address area of the peripheral device to be emulated, that is, a virtual control register (step S21).
  • the device emulation support apparatus 5 traps the access content of the read access by detecting the occurrence of this read access, and stores the trapped access content in the access storage unit 12 (step S22).
  • the device emulation support apparatus 5 causes the CPU 1 to generate an exception (step S23).
  • the process in step S22 corresponds to the process in steps S1 to S5 in FIG. 2 described above, and the process in step S23 corresponds to the process in steps S6 to S7 in FIG.
  • the exception that occurs here must have the property of transferring control to the exception handler 23 and the exception control unit 27 at the timing when the read access in step S21 occurs, and invalidating the instruction that caused the access. There is. Data abort exceptions are often exceptions having the properties described above.
  • the device emulation support apparatus 5 generates an exception having the above-described property in the specification of the CPU 1.
  • the exception handler 23 or the exception control unit 27 receives an exception processing execution instruction from the CPU 1, determines that the generated exception is an exception generated by the device emulation support apparatus 5, and calls the emulation program 24 (step S24).
  • An example of a method for calling the emulation program 24 has already been shown in the software configuration examples of FIGS.
  • the CPU 1 executes the called emulation program 24 and acquires the trapped access contents (step S25). Specifically, the CPU 1 that has executed the emulation program 24 acquires access contents including an access destination address from the control register of the access storage unit 12.
  • the CPU 1 that has executed the emulation program 24 executes emulation processing of a peripheral device that does not exist using the acquired access contents (step S26). Since the CPU 1 that has executed the emulation program 24 has already acquired the access contents of the read access issued by executing the guest program, it emulates the processing performed by the peripheral device using the acquired information (access contents of the read access). Then, read data to be read when the virtual control register is accessed is prepared.
  • the CPU 1 that has executed the emulation program 24 sets the prepared read data to be read in the read data setting unit 15 (step S27). Then, the CPU 1 executing the emulation program 24 ends the peripheral device emulation processing. Next, the exception handler 23 or the exception control unit 27 restores the guest program (step S28). At this time, the CPU 1 returns to the instruction that caused the read access in step S21 by executing the guest program again.
  • the CPU 1 when the CPU 1 receives the exception occurrence notification output by the exception generation unit 14, the CPU 1 executes an emulation process by generating an exception, and then again receives the same access signal as the access signal output to the peripheral device 3. Output to peripheral device 3.
  • step S29 Since returning to the same instruction, the CPU 1 that executed the guest program again executes read access for reading data from the address area of the peripheral device to be emulated, that is, a virtual control register (step S29). That is, the read access in step S29 is the same process as the read access in step S21.
  • the device emulation support apparatus 5 traps the access content of the read access by detecting the occurrence of this read access, and erases the access content immediately before stored in step S22 from the access storage unit 12 (step S30). ). That is, since the trapped access content is the same as the access content of the previous access stored in step S22, no exception occurs.
  • the processing in step S30 corresponds to the processing in steps S1 to S5 and S8 in FIG.
  • step S31 the device emulation support apparatus 5 outputs the read data set in step S27 to the bus 4 (step S31).
  • the process in step S31 corresponds to the process in step S10 in FIG.
  • the CPU 1 that executed the guest program receives the read data output to the bus 4 as a result of the read access, and completes the read access for reading data from the address area of the peripheral device to be emulated (step S32).
  • the emulation software reduces processing related to access to virtual registers such as analysis of trapped instructions and acquisition of instruction contents. Can do.
  • a process for analyzing the instruction that caused the exception in step S25 in FIG. 7 by software is required.
  • this analysis processing at least processing for specifying the storage destination of the data to be read and processing for storing the data in the specified storage destination are performed.
  • peripheral device emulation is realized by writing data to the read data setting unit 15 in step S27 and the overhead of instruction re-execution in step S29.
  • the instruction is re-executed, and therefore, there is no need to specifically process increment or decrement of a read destination address in emulation.
  • FIG. 8 is a flowchart showing an example of emulation processing at the time of write access of the information processing apparatus including the device emulation support apparatus according to Embodiment 1 of the present invention.
  • FIG. 8 shows the emulation of write access.
  • the CPU 1 executes the guest program and executes a write access for writing data to the address area of the peripheral device to be emulated, that is, a virtual control register (step S41).
  • step S42 the device emulation support apparatus 5 traps the access content of the write access by detecting the occurrence of this write access and stores the trapped access content in the access storage unit 12 (step S42).
  • step S43 the device emulation support apparatus 5 causes the CPU 1 to generate an exception (step S43).
  • the process in step S42 corresponds to the process in steps S1 to S5 in FIG. 2 described above, and the process in step S43 corresponds to the process in steps S6 to S7 in FIG.
  • the exception handler 23 or the exception control unit 27 receives an exception processing execution instruction from the CPU 1, determines that the generated exception is an exception generated by the device emulation support apparatus 5, and calls the emulation program 24 (step S44). .
  • the CPU 1 executes the called emulation program 24 and acquires the access content of the trapped access (step S45). Specifically, the CPU 1 that has executed the emulation program 24 acquires the access contents including the access destination address and the written data from the control register of the access storage unit 12.
  • step S46 the CPU 1 that has executed the emulation program 24 executes emulation processing of a peripheral device that does not exist using the acquired access contents. Since the CPU 1 that has executed the emulation program 24 has already acquired the access contents of the write access issued by executing the guest program, it emulates the processing performed by the peripheral device using the acquired information (access contents of the write access). To do.
  • the processing in step S46 is processing for starting processing of the peripheral device when the peripheral device to be emulated operates in parallel with the CPU. That is, when emulating DMA, the process of step S46 is a process of starting data copy.
  • the CPU 1 that has executed the emulation program 24 ends the peripheral device emulation processing.
  • the exception handler 23 or the exception control unit 27 restores the guest program (step 47).
  • the CPU 1 returns to the instruction that caused the write access in step S41 by executing the guest program again.
  • step S48 Since returning to the same instruction, the CPU 1 executing the guest program again executes write access for writing data to the address area of the peripheral device to be emulated, that is, a virtual control register (step S48).
  • step S49 the device emulation support apparatus 5 traps the access content of the write access by detecting the occurrence of this write access, and erases the access content immediately before stored in step S42 from the access storage unit 12 (step S49). ). That is, since the trapped access content is the same as the access content of the previous access stored in step S42, no exception occurs.
  • the processing in step S49 corresponds to the processing in steps S1 to S5 and S8 in FIG.
  • step S50 the device emulation support apparatus 5 outputs an access completion signal indicating that the access is completed to the bus 4 and ignores this write access (step S50).
  • the process in step S50 corresponds to the process in step S12 in FIG.
  • the CPU 1 executing the guest program receives the access completion signal output to the bus 4 and completes the write access for writing data to the address area of the peripheral device to be emulated (step S51).
  • the emulation software reduces processing related to access to virtual registers such as analysis of trapped instructions and acquisition of instruction contents. Can do.
  • the emulation software it is necessary for the emulation software to perform a process of analyzing an instruction, a process of specifying a storage destination of data to be written, and a process of incrementing or decrementing a register. is there.
  • peripheral device emulation is realized by reading data from the access storage unit 12 and overhead of instruction re-execution.
  • the emulation software reduces processing related to access to virtual registers such as analysis of trapped instructions and acquisition of the contents of instructions, thereby enabling efficient peripheral devices. Can be emulated. Processing that can be reduced here is processing such as analysis of instructions by software for acquiring access contents, storage of results at the time of reading by software, and acquisition of data at the time of writing.
  • FIG. 9 is a diagram showing a configuration of an information processing apparatus including a device emulation support apparatus according to Embodiment 2 of the present invention.
  • the information processing apparatus includes a CPU 1, a memory 2, a peripheral device 3, a bus 4, a device emulation support apparatus 5 and an interrupt controller 6.
  • the CPU 1, the memory 2, and the bus 4 have the same functions as the components shown in FIG.
  • the peripheral device 3 includes a peripheral device controlled using an interrupt.
  • the peripheral device D and the peripheral device E are peripheral devices controlled using an interrupt.
  • the interrupt controller 6 is directly connected to peripheral devices D and E that are controlled using interrupts in the peripheral device 3 via another circuit different from the bus 4.
  • the interrupt controller 6 causes the CPU 1 to perform interrupt processing by generating an interrupt signal to the CPU 1.
  • the device emulation support apparatus 5 includes a monitoring address setting unit 10, an access monitoring unit 11, an access storage unit 12, an access determination unit 13, an exception generation unit 14, a read data setting unit 15, an access completion unit 16, and An interrupt suppression unit 17 is provided.
  • the monitoring address setting unit 10, the access monitoring unit 11, the access storage unit 12, the access determination unit 13, the exception generation unit 14, the read data setting unit 15, and the access completion unit 16 have the same functions as the components of the first embodiment.
  • the interrupt suppression unit 17 is a newly added component. Hereinafter, the interrupt suppression unit 17 that is a new component will be mainly described.
  • An interrupt may occur during the execution of the peripheral device emulation processing, that is, during the processing in steps S24 to S28 in FIG. 7 or the processing in steps S44 to S47 in FIG.
  • the CPU 1 is disabled or the interrupt controller 6 is operated to mask the interrupt. This reduces the control complexity. In this case, it is necessary to cancel the interrupt disable or interrupt mask state at the stage of step S28 in FIG. 7 or step S47 in FIG. 8 to return to the guest program, unless the guest program was originally in the interrupt disable or interrupt mask state. There is.
  • the CPU 1 detects the interrupt signal and executes the interrupt handler immediately after the interrupt is disabled or the interrupt mask is released, that is, immediately after the guest program returns. That is, before the instruction re-execution in the process of step S29 of FIG. 7 or the process of step S48 of FIG.
  • this access is caused by instruction re-execution. There is a risk of being judged.
  • the interrupt suppression unit 17 suppresses the interrupt signal until the re-execution of the instruction is completed, that is, until the process in step S32 in FIG. 7 or the process in step S51 in FIG. Thereby, the above-mentioned problem is solved.
  • the interrupt suppression unit 17 corresponds to an example of an interrupt suppression unit.
  • the interrupt suppression unit 17 is directly connected to the interrupt controller 6 via another circuit different from the bus 4 and has a function of suppressing an interrupt signal to the CPU 1. Even when the interrupt controller 6 does not have a function of suppressing the interrupt signal, the interrupt suppression unit 17 may be connected in the middle of the wiring for transmitting the interrupt signal as shown in FIG.
  • FIG. 10 is a diagram illustrating an example of connection between the interrupt suppression unit and the interrupt controller according to Embodiment 2 of the present invention.
  • the signals output from the interrupt suppression unit 17 and the interrupt controller 6 are level signals, for example, by providing a simple AND circuit 7 as shown in FIG. Is possible.
  • the interrupt signal to the CPU 1 is turned off regardless of whether or not the interrupt is held in the interrupt controller 6, so that no interrupt is generated.
  • the suppression of interrupt may be started by, for example, providing a control register in the interrupt suppression unit 17 and operating the control register. In this case, interrupt suppression is started by executing the emulation program.
  • the interrupt suppression unit 17 may receive notification from the access monitoring unit 11 at the timing when the access is trapped (step S21 in FIG. 7 or step S41 in FIG. 8) and start interrupt suppression.
  • the interrupt suppression unit 17 releases the interrupt suppression by receiving a notification from the CPU 1 when the access content stored in the access storage unit 12 is deleted.
  • interrupt suppression is released when instruction re-execution is completed. If the interrupt is pending, after completion of the instruction re-execution, the CPU 1 detects an interrupt signal and executes interrupt processing.
  • the interrupt handler with the same access as the access to the control register of the peripheral device that does not exist by the guest program.
  • the peripheral device controlled using the interrupt can be set as the peripheral device to be emulated.
  • FIG. 11 is a diagram showing a configuration of an information processing apparatus including a device emulation support apparatus according to Embodiment 3 of the present invention.
  • the information processing apparatus includes a CPU 1, a memory 2, a peripheral device 3, a bus 4, and a device emulation support apparatus 5.
  • the peripheral device 3 is directly connected to the device emulation support apparatus 5 and is connected to the CPU 1 via the device emulation support apparatus 5. That is, the device emulation support apparatus 5 is disposed between the CPU 1 and the peripheral device 3. Note that the CPU 1, the memory 2, and the bus 4 have the same functions as the components in FIG. The peripheral device 3 is connected to the bus 4 via the device emulation support apparatus 5.
  • the device emulation support apparatus 5 includes a monitoring address setting unit 10, an access monitoring unit 31, an access storage unit 12, an access determination unit 13, an exception generation unit 14, a read data setting unit 15, an access completion unit 16, and A bus signal control unit 18 is provided.
  • the monitoring address setting unit 10, the access storage unit 12, the access determination unit 13, the exception generation unit 14, the read data setting unit 15, and the access completion unit 16 have the same functions as the components of the first embodiment, and access The monitoring unit 31 and the bus signal control unit 18 are different from those in the first embodiment.
  • the access monitoring unit 31 and the bus signal control unit 18 will be mainly described.
  • the signal output from the CPU 1 to the bus 4 is first transmitted to the device emulation support apparatus 5 and is not transmitted to the peripheral device 3.
  • the access monitoring unit 31 monitors a signal flowing on the bus 4 and detects the occurrence of an access that matches a condition including the address range set in the monitoring address setting unit 10.
  • This signal includes information about access contents such as the address to be accessed, the type indicating whether the access is a read or write, and the data size of the data to be read or the data to be written. Therefore, the access monitoring unit 31 can detect access to the address space by the CPU 1 by monitoring a signal flowing on the bus 4.
  • the access monitoring unit 31 notifies the access determination unit 13 of the access content that matches the detected condition. Further, the access monitoring unit 31 notifies the bus signal control unit 18 of the access content that does not match the condition.
  • the access monitoring unit 31 monitors the access from the CPU 1 to the peripheral device 3, and an address that matches the address stored in the monitoring address setting unit 10 from the access signal output from the CPU 1 to the peripheral device 3. Is output to the access storage unit 12 and the access determination unit 13. Further, the access monitoring unit 31 notifies the bus signal control unit 18 of the access content including an address that does not match the address stored in the monitoring address setting unit 10.
  • the bus signal control unit 18 receives an access signal output from the CPU 1 toward the peripheral device 3, and determines whether or not to output the received access signal to the peripheral device 3. When the access content is notified from the access monitoring unit 31, the bus signal control unit 18 outputs an access signal having the access content to the peripheral device 3.
  • the bus signal control unit 18 operates in response to a notification of access contents from the access monitoring unit 31 and transmits a signal from the CPU 1 to the peripheral device 3 only when the access is not trapped. That is, when access is trapped by the device emulation support apparatus 5, the peripheral device 3 is not accessed from the CPU 1.
  • the bus signal control unit 18 does not notify the peripheral device 3 of a signal from the CPU 1. Therefore, the peripheral device 3 does not respond to the CPU 1.
  • the access monitoring unit 31 corresponds to an example of an access monitoring unit
  • the bus signal control unit 18 corresponds to an example of a bus signal control unit.
  • the peripheral device can be emulated.
  • the device emulation support apparatus 5 may further include the interrupt suppression unit 17 of the second embodiment.
  • FIG. 12 is a diagram showing a configuration of an information processing apparatus including a device emulation support apparatus according to Embodiment 4 of the present invention.
  • the information processing apparatus includes a first CPU 1A, a second CPU 1B, a memory 2, a peripheral device 3, a bus 4, and a device emulation support apparatus 5.
  • the memory 2, the peripheral device 3, and the bus 4 have the same functions as the components in FIG.
  • the information processing apparatus includes two CPUs, and the device emulation support apparatus 5 generates an exception only for a specific CPU, for example, the first CPU 1A.
  • the device emulation support apparatus 5 includes a monitoring address setting unit 10, an access monitoring unit 11, an access storage unit 12, an access determination unit 13, a read data setting unit 15, an access completion unit 16, and a specific CPU exception generation unit. 19 is provided.
  • the monitoring address setting unit 10, the access monitoring unit 11, the access storage unit 12, the access determination unit 13, the read data setting unit 15, and the access completion unit 16 have the same functions as the components of the first embodiment.
  • the device emulation support apparatus 5 according to the fourth embodiment includes a specific CPU exception generating unit 19 instead of the exception generating unit 14 according to the first embodiment.
  • the specific CPU exception generating unit 19 which is a new component will be mainly described.
  • the specific CPU exception generating unit 19 is directly connected to the first CPU 1A, which is a specific CPU, via another circuit different from the bus 4, and has a function of notifying an exception by generating a signal. ing.
  • the specific CPU exception generation unit 19 receives an exception generation request from the access determination unit 13 and generates an exception in the first CPU 1A when the access determination unit 13 determines that the current access content is different from the previous access content Let Specifically, the specific CPU exception generating unit 19 is directly connected to a terminal related to the exception of the first CPU 1A, and outputs an exception notification for generating the exception to the first CPU 1A.
  • the first CPU 1A can operate the emulation program with this exception as a trigger.
  • the specific CPU exception generating unit 19 transmits an exception notification only to a predetermined specific CPU among a plurality of CPUs.
  • the specific CPU exception generating unit 19 corresponds to an example of the exception generating unit.
  • FIG. 13 is a diagram illustrating an example of a software configuration of the information processing apparatus including the device emulation support apparatus according to the fourth embodiment.
  • the information processing apparatus does not include a peripheral device corresponding to the device driver 20, and the device driver 20, OS 21, and application 22 are the guest program 25. Further, the first CPU 1A in which an exception occurs executes the guest program 25 and the virtualization layer 26 including the exception control unit 27. On the other hand, the second CPU 1B executes the emulation program 24.
  • the device emulation support apparatus 5 When the application 22 operating on the information processing apparatus generates access to a peripheral device controlled by the device driver 20, the device emulation support apparatus 5 outputs an exception notification to the first CPU 1A, and the first An exception is generated in the CPU 1A. Upon receiving the exception notification, the first CPU 1A instructs the exception control unit 27 of the virtualization layer 26 to execute exception processing. The virtualization layer 26 receives the instruction to execute exception processing from the first CPU 1A and operates the exception control unit 27 first.
  • the exception control unit 27 determines whether or not the generated exception is generated by the device emulation support apparatus 5. In the case of an exception generated by the device emulation support apparatus 5, the first CPU 1A notifies the emulation program 24 on the second CPU 1B using a general communication function between CPUs. The second CPU 1B executes emulation processing of peripheral devices. If the exception is not generated by the device emulation support apparatus 5, control is transferred to the exception handler 23 in the OS 21. Thus, the emulation program 24 operates when the device driver 20 in the guest program 25 accesses the peripheral device.
  • the virtualization layer 26 receives the exception process execution instruction and executes the emulation program 24.
  • the OS 21 may receive the exception process execution instruction and execute the emulation program 24. .
  • the emulation program 24 may be divided into two, and the first CPU 1A may execute an emulation processing portion related to data reading and data writing to the control register.
  • the first CPU 1A has a configuration as shown in FIG.
  • the second CPU 1B executes data processing portions of peripheral devices that operate in parallel with the first CPU 1A, such as data transfer processing by DMA, encoding processing, and decoding processing.
  • FIG. 14 is a diagram showing a modification of the software configuration of the information processing apparatus including the device emulation support apparatus according to Embodiment 4 of the present invention.
  • the first CPU 1A executes the emulation program 24 and the virtualization layer 26 including the exception control unit 27.
  • the second CPU 1B executes a guest program 25 including a device driver 20, an OS 21, and an application 22.
  • the guest program 25 is executed by the second CPU 1B to which no exception notification from the device emulation support apparatus 5 is input.
  • the emulation program 24 is executed by the first CPU 1A.
  • the virtualization layer 26 receives an instruction to execute exception processing and executes the emulation program 24.
  • the first CPU 1A also includes an OS, and the OS of the first CPU 1A
  • the emulation program 24 may be executed by receiving a process execution instruction. Further, the emulation program 24 may be directly mounted on the exception handler of the OS of the first CPU 1A.
  • emulation software performs analysis of a trapped instruction and a virtual control register for maintaining consistency related to execution of an instruction such as incrementing or decrementing a register.
  • the peripheral device can be emulated without the need for processing related to access. As a result, the amount of processing in emulation can be reduced, and the efficiency of emulation of peripheral devices can be improved.
  • the case where the CPU 1 is single is shown, but the present invention is not limited to this.
  • the device emulation support apparatus according to the first, second, and third embodiments can be used for an information processing apparatus that performs processing using a plurality of CPUs under the control of an OS or the like.
  • each of the first CPU 1A or the second CPU 1B may be composed of a plurality of CPUs.
  • the device emulation support apparatus can be realized as an LSI which is an integrated circuit, but these may be individually integrated into one chip, or may be integrated into one chip so as to include a part or all of them. May be.
  • the name used here is LSI, but it may also be called IC, system LSI, super LSI, or ultra LSI depending on the degree of integration.
  • the method of circuit integration is not limited to LSI's, and implementation using dedicated circuitry or general purpose processors is also possible.
  • An FPGA Field Programmable Gate Array
  • a reconfigurable processor that can reconfigure the connection and setting of circuit cells inside the LSI may be used.
  • integrated circuit technology that replaces LSI appears as a result of progress in semiconductor technology or other derived technology functional blocks may be integrated using this technology. Biotechnology can be applied.
  • FIG. 15 is a diagram showing a configuration of an information processing apparatus including a device emulation support circuit according to Embodiment 5 of the present invention.
  • the information processing apparatus illustrated in FIG. 15 includes a CPU 1, a memory 2, a peripheral device 3, and a device emulation support circuit 51.
  • the device emulation support circuit 51 is an integrated circuit.
  • the device emulation support circuit 51 includes a monitoring address setting circuit 110, an access monitoring circuit 111, an access storage circuit 112, an access determination circuit 113, an exception generation circuit 114, a read data setting circuit 115, and an access completion circuit 116.
  • the same components as those in the first embodiment are denoted by the same reference numerals and description thereof is omitted.
  • the monitoring address setting circuit 110, the access monitoring circuit 111, the access storage circuit 112, the access determination circuit 113, the exception generation circuit 114, the read data setting circuit 115, and the access completion circuit 116 in the fifth embodiment are respectively the same as those in the first embodiment.
  • the monitoring address setting unit 10, the access monitoring unit 11, the access storage unit 12, the access determination unit 13, the exception generation unit 14, the read data setting unit 15, and the access completion unit 16 have the same functions.
  • the monitoring address setting circuit 110 corresponds to an example of a monitoring address storage circuit
  • the access monitoring circuit 111 corresponds to an example of an access monitoring circuit
  • the access storage circuit 112 corresponds to an example of an access storage circuit.
  • the read data setting circuit 115 corresponds to an example of a read data storage circuit
  • the exception generation circuit 114 corresponds to an example of an exception generation circuit
  • the access determination circuit 113 corresponds to an example of an access determination circuit
  • the access completion circuit 116 corresponds to an example of an access completion circuit.
  • the monitoring address setting circuit 110, the access monitoring circuit 111, the access storage circuit 112, the access determination circuit 113, the exception generation circuit 114, the read data setting circuit 115, and the access completion circuit 116 are mounted on one integrated circuit. Can do.
  • a device emulation support apparatus is a device emulation support apparatus communicably connected to a CPU via a bus, and stores an address corresponding to a peripheral device to be emulated as a monitoring target. Access that monitors the access from the CPU to the peripheral device and has access information including an address corresponding to the peripheral device to be accessed, and is output from the CPU to the peripheral device
  • An access monitoring unit that acquires access information including an address that matches an address stored in the monitoring address storage unit from a signal, an access storage unit that stores access information acquired by the access monitoring unit, and the access Is a read access that represents data read
  • a read data storage unit that temporarily stores data read from the peripheral device, an exception generation unit that transmits an exception generation notification for causing the CPU to generate an exception, and the access monitoring unit.
  • the received access information is compared with the previous access information stored in the access storage unit, and if the received access information is different from the previous access information, the acquired access information is Stores in the access storage unit and requests the exception generation unit to generate an exception. If the received access information is the same as the previous access information, the previous access information stored in the access storage unit is compared.
  • the access determination unit excluded from the target of the access and the access monitored by the access monitoring unit When the access is a read access, the data stored in the read data storage unit is output to the CPU to complete the access, and the access monitored by the access monitoring unit is a write access representing data writing And an access completion unit for completing the access.
  • a device emulation support method includes a monitoring address storage step of storing an address corresponding to a peripheral device to be emulated in a monitoring address storage unit as a monitoring target, and an access from the CPU to the peripheral device.
  • the access information including the address corresponding to the peripheral device to be monitored is accessed and output from the CPU to the peripheral device, and the address stored in the monitoring address storage unit
  • a read data storage step for temporarily storing the issued data in the read data storage unit; access information acquired in the access monitoring step; the access information received; and the immediately preceding stored access information in the access storage unit
  • An access determination step for comparing the access information, and if the received access information is different from the previous access information, the acquired access information is stored in the access storage unit and an exception is generated to cause the CPU to generate an exception
  • An exception generation step of sending a notification to the CPU, and an exclusion step of excluding the previous access information stored in the access storage unit from the comparison target when the received access information is the same as the previous access information;
  • Access monitored in the access monitoring step Is the read access, the data stored in the read data storage unit is output to the CPU to instruct the CPU to complete the read access, and the access monitored in the access monitoring step is data
  • An access completion step of instructing the CPU to complete the write access.
  • a device emulation support circuit is a device emulation support circuit communicably connected via a bus to a CPU that executes an emulation process by generating an exception, and is a peripheral device to be emulated
  • a monitoring address storage circuit for storing an address corresponding to the monitoring target, monitoring access from the CPU to the peripheral device, and access information including an address corresponding to the peripheral device to be accessed
  • An access monitoring circuit that acquires access information including an address that matches an address stored in the monitoring address storage circuit from an access signal output from the CPU to the peripheral device, and acquired by the access monitoring circuit Access memory times to store access information
  • a read data storage circuit for temporarily storing data read from the peripheral device, and an exception occurrence notification for causing the CPU to generate an exception when the access is a read access representing data reading.
  • the access information immediately before being stored in the access storage circuit If the access monitored by the access monitoring circuit and the access monitoring circuit is the read access, the data stored in the read data storage circuit is output to the CPU and the read access is performed. And an access completion circuit for instructing the CPU to complete the write access when the access monitored by the access monitoring circuit is a write access representing data writing.
  • An information processing apparatus includes a CPU, a peripheral device controlled by the CPU, a bus that transmits an access signal output from the CPU to the peripheral device, and any of the above Device emulation support apparatus.
  • the address corresponding to the peripheral device to be emulated is stored as a monitoring target in the monitoring address storage unit.
  • Access to the peripheral device from the CPU is monitored, access information including an address corresponding to the peripheral device to be accessed is stored, and stored in the monitoring address storage unit from an access signal output from the CPU to the peripheral device Access information including an address that matches the registered address is acquired.
  • the access storage unit stores the acquired access information.
  • the read data storage unit temporarily stores data read from the peripheral device when the access is a read access indicating reading of data.
  • the acquired access information is received, and the received access information is compared with the previous access information stored in the access storage unit.
  • the acquired access information is stored in the access storage unit, and an exception occurrence notification for causing the CPU to generate an exception is transmitted to the CPU.
  • the previous access information stored in the access storage unit is excluded from the comparison target. If the monitored access is a read access, the data stored in the read data storage unit is output to the CPU to instruct the CPU to complete the read access. If the monitored access is a write access representing data writing, the CPU is instructed to complete the write access.
  • the CPU executes an emulation process by generating an exception.
  • the received access information is the same as the previous access information stored in the access storage unit, it is considered that the access is re-executed upon completion of the exception.
  • the access is a read access
  • the predetermined data is transferred to the CPU. Is output to the CPU, the CPU is instructed to complete the read access. If the access is a write access, the CPU is instructed to complete the write access as it is.
  • the processing for analyzing the trapped access contents and acquiring the necessary data is not performed by the CPU that performs the emulation, the amount of processing at the time of emulation can be reduced, and the peripheral device emulation can be efficiently performed. It can be performed.
  • the device emulation support apparatus further includes an interrupt suppression unit that suppresses an interrupt to the CPU while the access storage unit stores the immediately preceding access information to be compared in the access determination unit. It is preferable to provide.
  • the peripheral device controlled by the interrupt can be the peripheral device to be emulated.
  • the bus signal control for receiving the access signal output from the CPU to the peripheral device and determining whether or not to output the received access signal to the peripheral device.
  • the access monitoring unit notifies the bus signal control unit of access information including an address that does not match the address stored in the monitoring address storage unit, and the bus signal control unit When the access information is notified from the monitoring unit, the access signal having the access information is preferably output to the peripheral device.
  • the bus signal control unit receives an access signal output from the CPU to the peripheral device. Then, access information including an address that does not match the address stored in the monitoring address storage unit is notified to the bus signal control unit. When the access information is notified, the bus signal control unit outputs an access signal having the access information to the peripheral device.
  • the CPU includes a plurality of CPUs, and the exception generation unit transmits the exception occurrence notification only to a predetermined specific CPU among the plurality of CPUs. Is preferred.
  • the specific CPU since the exception occurrence notification is transmitted only to a predetermined specific CPU among the plurality of CPUs, the specific CPU causes emulation by generating an exception, In the CPU, other programs can be executed.
  • the access information includes an address corresponding to the peripheral device to be accessed, an access type indicating whether the access is the read access or the write access, It is preferable that at least a value written in the peripheral device when the access type is the write access is included.
  • the access from the CPU to the peripheral device to be emulated can be specified using the address included in the access information, and the access can be read and accessed using the access type included in the access information. It can be specified whether the access is a write access. Further, when the access type is a write access, the value included in the access information can be written to the peripheral device.
  • the CPU when the CPU receives the exception generation notification output by the exception generation unit, the CPU executes an emulation process by generating an exception, and then outputs the exception processing to the peripheral device. It is preferable that the same access signal as the received access signal is output to the peripheral device again.
  • the emulation process can be performed without the CPU accessing the peripheral device.
  • the device emulation support apparatus, the device emulation support method, the device emulation support circuit, and the information processing apparatus according to the present invention are not only in the form of a large computer or a personal computer, but also in communication such as various home appliances and mobile phones. It can also be used for equipment, industrial equipment or passenger equipment.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Test And Diagnosis Of Digital Computers (AREA)
  • Debugging And Monitoring (AREA)

Abstract

 アクセス監視部(11)は、CPU(1)から周辺デバイス(3)に向けて出力されるアクセス信号から、監視アドレス設定部(10)に記憶されているアドレスに合致するアドレスを含むアクセス情報を取得し、アクセス判断部(13)は、アクセス監視部(11)から受け取ったアクセス情報と、アクセス記憶部(12)に記憶されている直前のアクセス情報とを比較し、受け取ったアクセス情報が直前のアクセス情報と異なる場合、取得したアクセス情報をアクセス記憶部(12)に記憶するとともに、例外発生部(14)に例外発生通知の送信を要求し、受け取ったアクセス情報が直前のアクセス情報と同一の場合、アクセス記憶部(12)に記憶されている直前のアクセス情報を比較の対象から除外する。この構成により、エミュレーションする際の処理量を削減することができ、効率的に周辺装置のエミュレーションを行うことができる。

Description

デバイスエミュレーション支援装置、デバイスエミュレーション支援方法、デバイスエミュレーション支援回路及び情報処理装置
 本発明は、ソフトウェアが実行中に利用する周辺装置のエミュレーションを容易にするデバイスエミュレーション支援装置、デバイスエミュレーション支援方法及びデバイスエミュレーション支援回路、並びに当該デバイスエミュレーション支援装置を備える情報処理装置に関するものである。
 情報処理装置で実行されるプログラムは、情報処理装置が備える1つ以上のデバイス(周辺装置)を利用しながら動作する。そのため、特定の情報処理装置を前提に作成されたプログラムは、処理対象のデバイスが存在しない場合、あるいは、処理対象のデバイスと同種のデバイスが存在しても制御の方法や仕様が異なる場合、正常に動作しない。このような場合、処理対象のデバイスのエミュレーションをプログラムの変更なしに行うことができれば、特定の情報処理装置とは別の情報処理装置でそのプログラムを利用することが可能となる。
 一般に、中央演算装置(CPU)のアドレス空間にデバイスの制御レジスタが配置され、CPUが制御レジスタを操作することで、対象のデバイスは動作する。つまり、CPUは、対象デバイスの制御レジスタのアドレスに対し、書き込み(ライト)、または、読み出し(リード)を行う。従って、ソフトウェアでデバイスのエミュレーションを行うには、特定のアドレス、つまり、エミュレーション対象デバイスの制御レジスタのアドレスに対する、CPUからのアクセスを捕らえる(トラップする)必要がある。エミュレーション対象デバイスとは、ソフトウェアが処理対象としているが実際には存在していないデバイスである。
 特定アドレスへのアクセスをトラップする一般的な方法としては、メモリ空間の保護機能を用いるものがある。すなわち、トラップするアドレスへのリードとライトとを禁止することで、そのアドレスへのアクセス時に例外が発生する。例外ハンドラを契機にしてエミュレーションを開始し、エミュレーション終了後に元のプログラムに復帰することで、当該プログラムを変更することなしにデバイスのエミュレーションが可能となる。
 また、バスを流れる信号を監視することで、CPUから特定のアドレス空間へのアクセスを検知するバス監視装置がある(例えば、特許文献1参照)。バス監視装置は、バスを流れる各種信号を監視し、設定された条件に一致した信号が検知された場合、CPUに割り込みを発生させる。これにより、CPUからの特定のアドレスへのアクセスをトラップすることができる。
 エミューションの対象であるデバイスが行う処理を、ソフトウェアがデバイスの代わりに行うことにより、デバイスのエミュレーションが行われる。ソフトウェアが代わりに処理を行うために、対象デバイスの制御レジスタに対するアクセスをトラップした後、当該アクセスがどのようなアクセスであるか、すなわちアクセスの内容を取得する必要がある。例えば、エミュレーション対象であるデバイスがDMA(Direct Memory Access)であり、デバイスが行う処理がメモリコピーである場合、エミュレーションを行うソフトウェアは、コピー対象のデータが格納されているメモリ上のアドレスなど、処理に必要となる情報を取得する。以下、エミュレーションの対象であるデバイスの制御レジスタを“仮想的なレジスタ”と表す。
 仮想的なレジスタへのアクセスがデータのライトである場合、エミュレーションを行うソフトウェアは、トラップした命令(書き込み命令)の内容を解析し、書き込むデータを保持している演算レジスタを特定する。また、エミュレーションを行うソフトウェアは、特定した演算レジスタからデータを取得し、取得したデータを対象のアドレスに書き込む処理を行う。
 仮想的なレジスタへのアクセスがデータのリードである場合、エミュレーションを行うソフトウェアは、トラップした命令(読み出し命令)の内容を解析し、読み出したデータの保存先(演算レジスタ及びメモリなど)を特定する。また、エミュレーションを行うソフトウェアは、読み出したデータを保存先に格納する処理を行う。
 しかしながら、従来の技術では、制御レジスタに対するアクセスをトラップする毎に、エミュレーションを行うソフトウェアが、トラップしたアクセスの内容を解析して必要なデータを取得するため、複数の命令を実行することになり、処理量が増加するという課題を有していた。
特開2006-113906号公報
 本発明は、上記の課題を解決するためになされたもので、エミュレーションする際の処理量を削減することができ、効率的に周辺装置のエミュレーションを行うことができるデバイスエミュレーション支援装置、デバイスエミュレーション支援方法、デバイスエミュレーション支援回路及び情報処理装置を提供することを目的とするものである。
 本発明の一局面に係るデバイスエミュレーション支援装置は、例外を発生することによりエミュレーション処理を実行するCPUとバスを介して通信可能に接続されたデバイスエミュレーション支援装置であって、エミュレーション対象の周辺装置に対応するアドレスを監視の対象として記憶する監視アドレス記憶部と、前記CPUから前記周辺装置へのアクセスを監視し、アクセス対象である周辺装置に対応するアドレスを含むアクセス情報を有し、かつ前記CPUから前記周辺装置に向けて出力されるアクセス信号から、前記監視アドレス記憶部に記憶されているアドレスに合致するアドレスを含むアクセス情報を取得するアクセス監視部と、前記アクセス監視部によって取得されたアクセス情報を記憶するアクセス記憶部と、前記アクセスがデータの読み出しを表す読み出しアクセスである場合に、前記周辺装置から読み出されるデータを一時的に記憶するリードデータ記憶部と、前記CPUに例外を発生させるための前記例外発生通知を前記CPUへ送信する例外発生部と、前記アクセス監視部によって取得されたアクセス情報を受け取り、受け取ったアクセス情報と、前記アクセス記憶部に記憶されている直前のアクセス情報とを比較し、受け取ったアクセス情報が直前のアクセス情報と異なる場合、前記取得したアクセス情報を前記アクセス記憶部に記憶するとともに、前記例外発生部に前記例外発生通知の送信を要求し、受け取ったアクセス情報が直前のアクセス情報と同一の場合、前記アクセス記憶部に記憶されている直前のアクセス情報を比較の対象から除外するアクセス判断部と、前記アクセス監視部によって監視されるアクセスが前記読み出しアクセスである場合、前記リードデータ記憶部に記憶されているデータを前記CPUに出力して前記読み出しアクセスを完了するよう前記CPUに指示し、前記アクセス監視部によって監視されるアクセスがデータの書き込みを表す書き込みアクセスである場合、前記書き込みアクセスを完了するよう前記CPUに指示するアクセス完了部とを備える。
 この構成によれば、監視アドレス記憶部には、エミュレーション対象の周辺装置に対応するアドレスが監視の対象として記憶される。CPUから周辺装置へのアクセスが監視され、アクセス対象である周辺装置に対応するアドレスを含むアクセス情報を有し、かつCPUから周辺装置に向けて出力されるアクセス信号から、監視アドレス記憶部に記憶されているアドレスに合致するアドレスを含むアクセス情報が取得される。アクセス記憶部には、取得されたアクセス情報が記憶される。また、リードデータ記憶部には、アクセスがデータの読み出しを表す読み出しアクセスである場合に、周辺装置から読み出されるデータが一時的に記憶される。取得されたアクセス情報を受け取り、受け取ったアクセス情報と、アクセス記憶部に記憶されている直前のアクセス情報とが比較される。受け取ったアクセス情報が直前のアクセス情報と異なる場合、取得したアクセス情報がアクセス記憶部に記憶されるとともに、CPUに例外を発生させるための例外発生通知がCPUへ送信される。一方、受け取ったアクセス情報が直前のアクセス情報と同一の場合、アクセス記憶部に記憶されている直前のアクセス情報が比較の対象から除外される。監視されるアクセスが読み出しアクセスである場合、リードデータ記憶部に記憶されているデータがCPUに出力されて読み出しアクセスを完了するようCPUに指示される。また、監視されるアクセスがデータの書き込みを表す書き込みアクセスである場合、書き込みアクセスを完了するようCPUに指示される。
 すなわち、受け取ったアクセス情報が、アクセス記憶部に記憶されている直前のアクセス情報と異なる場合、CPUに例外を発生させることによりエミュレーション処理を実行させる。一方、受け取ったアクセス情報が、アクセス記憶部に記憶されている直前のアクセス情報と同一の場合、例外の終了に伴うアクセスの再実行と見なし、アクセスが読み出しアクセスである場合、所定のデータをCPUに出力した後、読み出しアクセスを完了するようCPUに指示し、アクセスが書き込みアクセスである場合、そのまま書き込みアクセスを完了するようCPUに指示する。
 本発明によれば、エミュレーションを行うCPUによって、トラップしたアクセスの内容を解析して必要なデータを取得する処理が行われないので、エミュレーションする際の処理量を削減することができ、効率的に周辺装置のエミュレーションを行うことができる。
 本発明の目的、特徴及び利点は、以下の詳細な説明と添付図面とによって、より明白となる。
本発明の実施の形態1におけるデバイスエミュレーション支援装置を備えた情報処理装置の構成を示す図である。 本発明の実施の形態1におけるデバイスエミュレーション支援装置の動作を説明するためのフローチャートである。 本発明の実施の形態1におけるデバイスエミュレーション装置で用いるレジスタの構成の一例を示す図である。 本発明の実施の形態1におけるデバイスエミュレーション支援装置を備えた情報処理装置のソフトウェアの構成の一例を示す図である。 本発明の実施の形態1におけるデバイスエミュレーション支援装置を備えた情報処理装置のソフトウェアの構成の第1の変形例を示す図である。 本発明の実施の形態1におけるデバイスエミュレーション支援装置を備えた情報処理装置のソフトウェアの構成の第2の変形例を示す図である。 本発明の実施の形態1におけるデバイスエミュレーション支援装置を備えた情報処理装置のリードアクセス時のエミュレーション処理の一例を示すフローチャートである。 本発明の実施の形態1におけるデバイスエミュレーション支援装置を備えた情報処理装置のライトアクセス時のエミュレーション処理の一例を示すフローチャートである。 本発明の実施の形態2におけるデバイスエミュレーション支援装置を備えた情報処理装置の構成を示す図である。 本発明の実施の形態2における、割り込み抑制部と割り込みコントローラとの接続例を示す図である。 本発明の実施の形態3におけるデバイスエミュレーション支援装置を備えた情報処理装置の構成を示す図である。 本発明の実施の形態4におけるデバイスエミュレーション支援装置を備えた情報処理装置の構成を示す図である。 本発明の実施の形態4におけるデバイスエミュレーション支援装置を備えた情報処理装置のソフトウェアの構成の一例を示す図である。 本発明の実施の形態4におけるデバイスエミュレーション支援装置を備えた情報処理装置のソフトウェアの構成の変形例を示す図である。 本発明の実施の形態5におけるデバイスエミュレーション支援回路を備えた情報処理装置の構成を示す図である。
 以下本発明の実施の形態について、図面を参照しながら説明する。尚、以下の実施の形態は、本発明を具体化した一例であって、本発明の技術的範囲を限定する性格のものではない。
 (実施の形態1)
 図1は、本発明の実施の形態1におけるデバイスエミュレーション支援装置を備えた情報処理装置の構成を示す図である。情報処理装置は、CPU(中央演算装置)1、メモリ2、周辺デバイス(周辺装置)3、バス4及びデバイスエミュレーション支援装置5を備えている。
 CPU1は、メモリ2に格納されているプログラムを実行することで、情報処理装置を制御する。また、CPU1のアドレス空間は、周辺デバイス3の制御に必要なレジスタ(制御レジスタ)を含む。周辺デバイス3を制御する際、CPU1で実行されるプログラムが、対象の周辺デバイス3に対応する制御レジスタのアドレスに対し、データをリード又はライトすることで、対象の周辺デバイス3を制御することができる。
 メモリ2は、情報処理装置の実行する各種のプログラム及びデータを格納する記憶装置である。メモリ2は、ランダムアクセスメモリ(RAM)またはフラッシュメモリなど任意の種類のメモリを使用することができる。また、メモリ2は、同種または異種のメモリを複数組み合わせたものであってもよい。さらに、メモリ2は、リードオンメモリ(ROM)を含んでもよい。
 周辺デバイス3は、各種の入出力装置などのデバイスであり、情報処理装置の使用目的に応じたものが利用される。ここでは、周辺デバイスAと周辺デバイスBと周辺デバイスCとの3つの周辺デバイスを備えている一例を示している。
 バス4は、CPU1とメモリ2と周辺デバイス3とデバイスエミュレーション支援装置5とを互いに通信可能に接続しており、データをやり取りする伝送路である。つまり、CPU1から周辺デバイス3へのアクセスは、バス4を介して行われる。
 デバイスエミュレーション支援装置5は、ゲストプログラムを実行するCPU1のアドレス空間へのアクセスを監視し、CPU1に対する例外処理を発生させる。これにより、デバイスエミュレーション支援装置5は、エミュレーションを行うプログラム(以下エミュレーションプログラムと呼ぶ)に特定のアドレスへのアクセスを通知し、エミュレーションプログラムの実行を支援する。
 なお、ゲストプログラムとは、プログラム上では存在を前提としているが、情報処理装置が備えていない周辺デバイスの一部または全てを制御するためのプログラムである。ゲストプログラムは、情報処理装置が備える周辺デバイスを制御するためのプログラムと、情報処理装置が備えていない周辺デバイスを制御するためのプログラムとを含む。なお、ゲストプログラムは、情報処理装置が備えていない周辺デバイスを制御するためのプログラムのみであってもよい。
 ゲストプログラムとエミュレーションプログラムとは、メモリ2に格納されており、CPU1で実行される。ゲストプログラムをCPU1で実行する場合、存在しない周辺デバイスの制御レジスタへのアクセスをトラップし、対象のエミュレーションプログラムを実行する。これにより、存在しない周辺デバイスをソフトウェア的にエミュレーションすることができる。
 デバイスエミュレーション支援装置5は、監視アドレス設定部10、アクセス監視部11、アクセス記憶部12、アクセス判断部13、例外発生部14、リードデータ設定部15及びアクセス完了部16を備えている。
 監視アドレス設定部10は、デバイスエミュレーション支援装置5が監視の対象とするアドレス範囲を保持する記憶部である。デバイスエミュレーション支援装置5は、監視アドレス設定部10に設定されたアドレス範囲へのアクセスをトラップする。つまり、監視アドレス設定部10は、エミュレーション対象の周辺デバイスに対応するアドレス範囲を保持している。より具体的には、監視アドレス設定部10は、通常の周辺デバイス3の制御レジスタと同様に、トラップ対象のアドレスの範囲を設定する制御レジスタである。
 監視アドレス設定部10に設定されるアドレス範囲としては、例えば、アドレスの上限と下限とを示す値が用いられる。また、監視アドレス設定部10に設定されるアドレス範囲として、開始アドレスと範囲の大きさとを示す値を用いてもよい。また、監視アドレス設定部10へのアドレス範囲の設定は、例えば、エミュレーションプログラムの初期化時に行われる。更に、トラップ対象のアクセスをより詳細に指定するために、監視アドレス設定部10は、アドレス範囲以外の条件をさらに設定してもよい。例えば、監視アドレス設定部10は、リード命令、ライト命令、またはその両方をトラップの対象にするなどの設定が可能である。
 アクセス監視部11は、バス4上に流れる信号(アクセス信号)を監視し、監視アドレス設定部10に設定されているアドレス範囲を含む条件に合致するアクセスの発生を検知する。この信号には、アクセス対象のアドレス、アクセスがリードであるかライトであるかを表す種別、及び、リードするデータまたはライトするデータのデータサイズなどのアクセス内容に関する情報(アクセス情報)が含まれている。そのため、アクセス監視部11は、バス4上に流れる信号を監視することで、CPU1による、アドレス空間へのアクセスのアクセス内容を検知することができる。また、アクセス監視部11は、検知した条件に合致するアクセス内容を、アクセス判断部13に通知する。
 アクセス記憶部12は、アクセス監視部11によって検知された、監視アドレス設定部10に設定されている条件に合致するアクセス内容を保持する。アクセス判断部13は、アクセス監視部11から通知されたアクセス内容を判断し、アクセス記憶部12への格納処理を行う。アクセス記憶部12には、常に監視アドレス設定部10に設定されている条件に合致する直前のアクセス内容が保持される。
 アクセス記憶部12に記憶されるアクセス内容は、少なくとも、アクセス先のアドレスと、アクセスがリードであるかライトであるかを表す種別と、アクセスがライトの場合はライトする値(データ)とを含んでいる。また、アクセス記憶部12に記憶されるアクセス内容は、例えば、リードまたはライトするデータのサイズを示す情報を含んでもよい。さらに、CPU1からアクセス記憶部12に保持されている直前のアクセス内容を参照可能にするために、CPU1のアドレス空間は、直前のアクセス内容を取得できるレジスタを有する。エミュレーションプログラムを実行するCPU1は、このアクセス内容を参照し、周辺デバイスのエミュレーションを行う。
 アクセス判断部13は、アクセス監視部11によって検知された、監視アドレス設定部10に設定されている条件に合致するアクセス内容を受け取り、受け取ったアクセス内容が、アクセス記憶部12に記憶している直前のアクセス内容(前回トラップされたアクセス内容)と同じか否かを判断する。デバイスエミュレーション支援装置5は、CPU1での例外の発生により、CPU1にエミュレーションプログラムを実行させる。そして、例外処理終了後に、CPU1は、エミュレーション対象周辺デバイスへのアクセスを発生させた命令に復帰し、その命令を再実行する。つまり、アクセス判断部13は、取得したアクセス内容が直前のアクセス内容と異なる場合に、命令を再実行させると判断する。
 命令を再実行させると判断した場合、アクセス判断部13は、アクセス記憶部12に新しいアクセス内容を格納し、例外発生部14に例外の発生を要求する。一方、命令を再実行させない、すなわち今回受け取ったアクセス内容が、直前のアクセス内容と同一であると判断した場合、アクセス判断部13は、アクセス記憶部12に記憶されている直前のアクセス内容を消去し、アクセス完了部16にアクセス内容を通知する。これにより、以後は、受け取ったアクセス内容が、記憶されている直前のアクセス内容と同じであっても、当該受け取ったアクセス内容は新たなアクセスと判断されるようになる。
 すなわち、アクセス判断部13は、アクセス監視部11によって取得されたアクセス内容を受け取り、受け取ったアクセス内容と、アクセス記憶部12に記憶されている直前のアクセス内容とを比較する。受け取ったアクセス内容が直前のアクセス内容と異なる場合、アクセス判断部13は、取得したアクセス内容をアクセス記憶部12に記憶するとともに、例外発生部14に例外発生通知の送信を要求する。一方、受け取ったアクセス内容が直前のアクセス内容と同一の場合、アクセス判断部13は、アクセス記憶部12に記憶されている直前のアクセス内容を比較の対象から除外する。
 なお、本実施の形態1では、直前のアクセス内容を消去しているが、必ずしも記憶内容そのものを消去する必要はない。直前のアクセス内容の消去とは、アクセス判断部13による比較の対象から外すことを意味する。
 例外発生部14は、アクセス判断部13によって今回のアクセス内容が前回のアクセス内容と異なると判断された場合に、アクセス判断部13から例外発生要求を受け取り、例外を発生させるための例外通知をCPU1に出力する。具体的には、例外発生部14は、データアボートなどのCPU1に例外を発生させることができる特定の信号をバス4に出力する。また、CPU1の例外発生に関係する端子に、例外発生部14を直接接続し、例外発生部14からCPU1に例外通知を出力する構成を用いてもよい。この例外を契機に、CPU1は、エミュレーションプログラムを動作させる。
 リードデータ設定部15は、トラップしたアクセスがリード命令であった場合に、周辺デバイス3から読み出されるデータを一時的に保持する。リードデータ設定部15へのデータの設定は、エミュレーションプログラム(CPU1)が行う。CPU1からデータの設定を可能とするために、CPU1のアドレス空間は、データを設定するレジスタを有する。
 アクセス完了部16は、アクセス判断部13によって今回のアクセス内容が直前のアクセス内容と同一である、つまり命令を再実行させないと判断された場合に、アクセス判断部13から通知されるアクセス内容を受け取る。アクセス判断部13から通知されたアクセス内容に含まれる種別がリードである時、つまりゲストプログラム(CPU1)が、存在しない周辺デバイスの制御レジスタからデータをリードするリードアクセスが発生した時、アクセス完了部16は、CPU1のリードアクセスを完了させる。
 すなわち、アクセス完了部16は、アクセス監視部11によって監視されるアクセスが読み出しアクセスである場合、リードデータ設定部15に記憶されているデータをCPU1に出力して読み出しアクセスを完了するようCPU1に指示する。また、アクセス完了部16は、アクセス監視部11によって監視されるアクセスがデータの書き込みを表す書き込みアクセスである場合、書き込みアクセスを完了するようCPU1に指示する。
 具体的には、アクセス完了部16は、リードデータ設定部15に保持されているデータを取得し、バス4に信号として出力する。つまり、アクセス完了部16は、エミュレーションプログラムが設定したデータを、存在しない周辺デバイスの制御レジスタに対するリードアクセスの結果として、ゲストプログラムに受け取らせる。
 一方、アクセス判断部13から通知されたアクセス内容に含まれる種別がライトである時、つまりゲストプログラム(CPU1)が、存在しない周辺デバイスの制御レジスタにデータをライトするライトアクセスが発生した時、アクセス完了部16は、CPU1のライトアクセスを完了させる。具体的には、アクセス完了部16は、バス4にデータ受け取り完了の信号を出力する。
 なお、本実施の形態1において、監視アドレス設定部10が監視アドレス記憶部の一例に相当し、アクセス監視部11がアクセス監視部の一例に相当し、アクセス記憶部12がアクセス記憶部の一例に相当し、リードデータ設定部15がリードデータ記憶部の一例に相当し、例外発生部14が例外発生部の一例に相当し、アクセス判断部13がアクセス判断部の一例に相当し、アクセス完了部16がアクセス完了部の一例に相当する。
 図2は、ゲストプログラムが動作している際の、デバイスエミュレーション支援装置5の動作を説明するためのフローチャートである。まず、CPU1がゲストプログラムの動作を開始し、デバイスエミュレーション支援装置5が処理を開始する。なお、デバイスエミュレーション支援装置5を備えた情報処理装置が、起動時に初期化処理を行うことで、デバイスエミュレーション支援装置5の処理を開始してもよい。
 まず、アクセス監視部11は、バス4上に流れる信号を監視し、アクセスが発生したか否かを判断する(ステップS1)。アクセスが発生していない場合(ステップS1でNO)、アクセス監視部11は、アクセスが発生するまで、監視を継続する。アクセスが発生した場合(ステップS1でYES)、アクセス監視部11は、発生したアクセスのアクセス内容を取得する(ステップS2)。
 次に、アクセス監視部11は、発生したアクセスがトラップ対象のアクセスであるか否かを判断する(ステップS3)。すなわち、アクセス監視部11は、取得したアクセス内容に含まれるアドレスが、監視アドレス設定部10に設定されているトラップ対象のアドレス範囲に合致するか否かを判断し、アドレスが合致するアクセス(トラップ対象のアクセス)の発生を検知する。なお、監視アドレス設定部10に、アドレス範囲以外の条件も設定されている場合、アクセス監視部11は、それらの条件についても、合致しているか否かを判断する。発生したアクセスがトラップ対象のアクセスでない場合(ステップS3でNO)、ステップS1の処理に遷移し、処理を繰り返す。
 一方、発生したアクセスがトラップ対象のアクセスである場合(ステップS3でYES)、アクセス監視部11は、発生したアクセスのアクセス内容を、アクセス判断部13に通知する(ステップS4)。
 次に、アクセス判断部13は、アクセス監視部11から通知されたアクセス内容と、アクセス記憶部12に記憶している直前のアクセス(前回トラップされたアクセス)のアクセス内容とを比較する。すなわち、アクセス判断部13は、今回発生したアクセスが、アクセス記憶部12に記憶している直前のアクセスと同じであるか否かを判断する(ステップS5)。
 なお、アクセス判断部13は、少なくともアクセス先のアドレスを比較しているが、アクセスが同一命令によるものかの判断に用いることができる他の情報を比較してもよい。リードするデータサイズ及びライトするデータサイズを指定できる命令セットを有するCPUの場合、データサイズを判断に用いてもよい。また、バースト転送の可能な情報処理装置ならば、バースト転送の有無及び転送サイズを判断に用いてもよい。
 発生したアクセスが直前のアクセスと異なっていると判断した場合(ステップS5でNO)、アクセス判断部13は、アクセス記憶部12に新しいアクセスのアクセス内容を直前のアクセスのアクセス内容として格納し、例外を発生させるための例外発生要求を例外発生部14に出力する(ステップS6)。例外発生部14は、アクセス判断部13によって出力された例外発生要求を受け取り、例外を発生させるための例外通知をCPU1に出力する(ステップS7)。
 一方、発生したアクセスが直前のアクセスと同じであると判定した場合(ステップS5でYES)、アクセス判断部13は、命令の再実行と判断し、アクセス記憶部12に記憶されている直前のアクセスのアクセス内容を消去し、アクセス完了部16に新しいアクセスのアクセス内容を通知する(ステップS8)。
 次に、アクセス完了部16は、アクセス判断部13によって通知されたアクセス内容が、データをメモリから読み出すリードアクセス及びデータをメモリに書き込むライトアクセスのいずれであるかを判断する(ステップS9)。
 アクセス内容がリードアクセスであると判断した場合(ステップS9で“リードアクセス”)、アクセス完了部16は、リードデータ設定部15に保持されているリードデータを取得し、取得したリードデータをバス4に出力する(ステップS10)。次に、アクセス完了部16は、再実行されたリードアクセスを完了し(ステップS11)、ステップS1の処理に戻す。これにより、ステップS1以降の処理が繰り返し実行される。
 一方、アクセス内容がライトアクセスであると判断した場合(ステップS9で“ライトアクセス”)、アクセス完了部16は、再実行されたライトアクセスを完了し(ステップS12)、ステップS1の処理に戻す。これにより、ステップS1以降の処理が繰り返し実行される。
 なお、ゲストプログラムが動作を終了した際に、デバイスエミュレーション支援装置5は、アクセスの監視を終了し、図2に示した処理を完了する。また、デバイスエミュレーション支援装置5を備えた情報処理装置の起動中は、デバイスエミュレーション支援装置5がアクセスの監視を継続する実装でもよい。
 図3は、本発明の実施の形態1におけるデバイスエミュレーション支援装置5で用いるレジスタの構成の一例を示す図である。前述したとおり、CPU1による処理(リード処理又はライト処理)を可能とするため、複数のレジスタがCPU1のアドレス空間に配置されている。
 監視アドレス設定部10は、トラップ対象のアドレス範囲を設定するレジスタである。図3に示すように、監視アドレス設定部10は、対象とする監視アドレス領域の先頭アドレスと、監視アドレス領域のサイズとを組みにして保持している。監視アドレス設定部10は、複数の組みを保持することが可能である。
 アクセス記憶部12は、トラップしたアクセスのアクセス内容を記憶するレジスタである。アクセス記憶部12は、アクセスが発生してから完了するまで、処理中のアクセスのアクセス内容を保持している。図3に示すように、アクセス記憶部12は、アクセス内容として、アクセス先のアドレスと、リードアクセスであるかライトアクセスであるかを表すアクセス種別と、アクセス種別がライトアクセスである場合のライトする値(ライトデータ)とを記憶している。
 リードデータ設定部15は、トラップしたアクセスがリードアクセスである場合に、CPU1にリードさせるデータ(リードデータ)を設定するレジスタである。
 なお、アクセス記憶部12のライトデータと、リードデータ設定部15のリードデータとは、CPU1によるバーストリード処理及びバーストライト処理に対応するため、バースト転送の最大サイズまでのレジスタ数を設けている。
 図4は、本実施の形態1におけるデバイスエミュレーション支援装置を備えた情報処理装置のソフトウェア構成の一例を示す図である。
 図4では、情報処理装置は、デバイスドライバ20に対応する周辺デバイスを備えていないものとする。つまり、デバイスドライバ20は、ゲストプログラムであり、存在していない周辺デバイスへアクセスする。
 情報処理装置上で動作するアプリケーション22が、デバイスドライバ20が制御する周辺デバイスへのアクセスを発生させた際、デバイスエミュレーション支援装置5が動作する。デバイスエミュレーション支援装置5は、CPU1に例外通知を出力して、CPU1に例外を発生させる。CPU1からの例外を受けてOS21内の例外ハンドラ23が動作する。例外ハンドラ23は、発生した例外がデバイスエミュレーション支援装置5により発生したか否かを判断し、デバイスエミュレーション支援装置5によって発生した例外の場合、エミュレーションプログラム24を動作させる。
 エミュレーションプログラム24は、デバイスエミュレーション支援装置5のアクセス記憶部12から、アクセス内容を取得し、エミュレーションを行う周辺デバイスを特定し、特定した周辺デバイスに対応するエミュレーションを行う。これにより、情報処理装置は、ゲストプログラムであるデバイスドライバ20をそのまま利用できる。したがって、例えばアプリケーション22がデバイスドライバ20の仕様に依存するものであっても、デバイスドライバ20との依存関係を改変することなく情報処理装置を動作させることができる。
 図5は、本実施の形態1におけるデバイスエミュレーション支援装置を備えた情報処理装置のソフトウェア構成の第1の変形例を示す図である。
 図5では、情報処理装置は、デバイスドライバ20に対応する周辺デバイスを備えていないものとする。ゲストプログラム25は、デバイスドライバ20と、OS21と、アプリケーション22とを含む。つまり、備えている周辺デバイスが互いに異なるハードウェアを前提に作られたソフトウェアのシステム全体がゲストプログラムとなる。図5では、情報処理装置は、周辺デバイスのエミュレーションを制御する仮想化層26を有しており、仮想化層26は、例外制御部27を備えている。
 情報処理装置上で動作するアプリケーション22が、デバイスドライバ20が制御する周辺デバイスへのアクセスを発生させた際、デバイスエミュレーション支援装置5は、CPU1に例外通知を出力して、CPU1に例外を発生させる。CPU1は、例外通知を受け取ると、仮想化層26の例外制御部27に対して例外処理の実行を指示する。仮想化層26は、CPU1からの例外処理の実行指示を受けて、例外制御部27を最初に動作させる。
 例外制御部27は、発生した例外がデバイスエミュレーション支援装置5により発生したか否かを判断する。デバイスエミュレーション支援装置5によって発生した例外の場合、例外制御部27は、エミュレーションプログラム24を動作させる。デバイスエミュレーション支援装置5によって発生した例外でない場合、例外制御部27は、OS21内の例外ハンドラ23へ制御を移す。これにより、ゲストプログラム25内のデバイスドライバ20が周辺デバイスにアクセスした時に、エミュレーションプログラム24が動作する。
 図6は、本実施の形態1におけるデバイスエミュレーション支援装置を備えた情報処理装置のソフトウェア構成の第2の変形例を示す図である。
 図6では、情報処理装置は、デバイスドライバ20に対応する周辺デバイスを備えていないものとする。また、仮想化層26は、複数の仮想計算機を制御する。この仮想化層26は、ハイパバイザーと呼ばれており、一つの物理的な計算機の上で複数の仮想的な計算機(仮想計算機)を実行制御する。図6では、情報処理装置は、第1の仮想計算機28及び第2の仮想計算機29を備える。第1の仮想計算機28がゲストプログラムとして動作する。第2の仮想計算機29は、エミュレーションプログラム24を実行する。
 仮想化層26は、エミュレーションプログラム24を実行する第2の仮想計算機29と、ゲストプログラム25を実行する第1の仮想計算機28とを時分割で動作させる機能を有する。更に、仮想化層26は、例外制御部27を備えている。
 情報処理装置上で動作するアプリケーション22が、デバイスドライバ20が制御する周辺デバイスへのアクセスを発生させた際、デバイスエミュレーション支援装置5は、CPU1に例外通知を出力して、CPU1に例外を発生させる。CPU1は、例外通知を受け取ると、仮想化層26の例外制御部27に対して例外処理の実行を指示する。仮想化層26は、CPU1からの例外処理の実行指示を受けて、例外制御部27を最初に動作させる。
 例外制御部27は、発生した例外がデバイスエミュレーション支援装置5により発生したか否かを判断する。デバイスエミュレーション支援装置5によって発生した例外の場合、例外制御部27は、エミュレーションプログラム24を動作させる。デバイスエミュレーション支援装置5によって発生した例外でない場合、例外制御部27は、OS21内の例外ハンドラ23へ制御を移す。これにより、ゲストプログラム25内のデバイスドライバ20が周辺デバイスにアクセスした時に、エミュレーションプログラム24が動作する。
 なお、周辺デバイスには、DMA、デコードエンジン及びエンコードエンジンのように、CPUと平行して動作するものがある。このような周辺デバイスをエミュレーションする場合、ゲストプログラムの実行と、周辺デバイスのエミュレーションによるデータの処理とを並行して行うのが望ましい。図6に示すソフトウェア構成を用いる場合、ゲストプログラム25とエミュレーションプログラム24とを時分割的に並行して動作させることが可能となる。
 図7は、本発明の実施の形態1におけるデバイスエミュレーション支援装置を備えた情報処理装置のリードアクセス時のエミュレーション処理の一例を示すフローチャートである。図7では、リードアクセスのエミュレーションについて示している。
 CPU1は、ゲストプログラムを実行し、エミュレーション対象である周辺デバイスのアドレス領域、つまり仮想的な制御レジスタからデータを読み出すリードアクセスを実行する(ステップS21)。
 次に、デバイスエミュレーション支援装置5は、このリードアクセスの発生を検知することでリードアクセスのアクセス内容をトラップし、トラップしたアクセス内容をアクセス記憶部12に記憶する(ステップS22)。次に、デバイスエミュレーション支援装置5は、CPU1に例外を発生させる(ステップS23)。なお、ステップS22の処理は、前述した図2のステップS1~S5の処理に相当し、ステップS23の処理は、前述した図2のステップS6~S7の処理に相当する。
 なお、ここで発生する例外は、ステップS21のリードアクセスが発生したタイミングで、例外ハンドラ23と例外制御部27とへ制御を移し、かつ、アクセスを発生させた命令を無効化する性質を有する必要がある。データアボート例外は、前述した性質を持つ例外であることが多い。デバイスエミュレーション支援装置5は、CPU1の仕様において、前述した性質を有する例外を発生させる。
 次に、例外ハンドラ23又は例外制御部27は、CPU1からの例外処理の実行指示を受け、発生した例外がデバイスエミュレーション支援装置5により発生した例外と判断し、エミュレーションプログラム24を呼び出す(ステップS24)。なお、エミュレーションプログラム24を呼び出す方法の例は、既に、図4~図6のソフトウェア構成の例で示している。
 次に、CPU1は、呼び出されたエミュレーションプログラム24を実行し、トラップしたアクセス内容を取得する(ステップS25)。具体的には、エミュレーションプログラム24を実行したCPU1は、アクセス記憶部12の制御レジスタから、アクセス先のアドレスを含むアクセス内容を取得する。
 次に、エミュレーションプログラム24を実行したCPU1は、取得したアクセス内容を用いて、存在しない周辺デバイスのエミュレーション処理を実行する(ステップS26)。エミュレーションプログラム24を実行したCPU1は、ゲストプログラムを実行することによって発行されたリードアクセスのアクセス内容を取得済みなので、取得した情報(リードアクセスのアクセス内容)を用いて周辺デバイスが行う処理をエミュレートし、仮想的な制御レジスタにアクセスする際にリードされるべきリードデータを用意する。
 次に、エミュレーションプログラム24を実行したCPU1は、用意したリードされるべきリードデータをリードデータ設定部15に設定する(ステップS27)。そして、エミュレーションプログラム24を実行したCPU1は、周辺デバイスのエミュレーション処理を終了させる。次に、例外ハンドラ23又は例外制御部27は、ゲストプログラムを復帰させる(ステップS28)。この時、CPU1は、ゲストプログラムを再度実行することにより、ステップS21のリードアクセスを発生させた命令に復帰することになる。
 すなわち、CPU1は、例外発生部14によって出力された例外発生通知を受信した場合、例外を発生することによりエミュレーション処理を実行し、その後、周辺デバイス3に出力されたアクセス信号と同じアクセス信号を再び周辺デバイス3へ出力する。
 同じ命令に復帰したので、ゲストプログラムを実行したCPU1は、再び、エミュレーション対象である周辺デバイスのアドレス領域、つまり仮想的な制御レジスタからデータを読み出すリードアクセスを実行する(ステップS29)。すなわち、ステップS29におけるリードアクセスは、ステップS21におけるリードアクセスと同じ処理である。
 次に、デバイスエミュレーション支援装置5は、このリードアクセスの発生を検知することでリードアクセスのアクセス内容をトラップし、ステップS22で記憶した直前のアクセス内容を、アクセス記憶部12から消去する(ステップS30)。つまり、トラップしたアクセス内容が、ステップS22で記憶した直前のアクセスのアクセス内容と同じなので、例外は発生しない。ステップS30の処理は、前述した図2のステップS1~S5及びS8の処理に相当する。
 次に、デバイスエミュレーション支援装置5は、ステップS27において設定されたリードデータをバス4に出力する(ステップS31)。ステップS31の処理は、前述した図2のステップS10の処理に相当する。
 最後に、ゲストプログラムを実行したCPU1は、バス4に出力されたリードデータをリードアクセスの結果として受け取り、エミュレーション対象である周辺デバイスのアドレス領域からデータを読み出すリードアクセスを完了する(ステップS32)。
 以上により、本実施の形態1のデバイスエミュレーション支援装置によれば、エミュレーションを行うソフトウェアが、トラップした命令の解析及び命令の内容の取得などの、仮想的なレジスタへのアクセスに関する処理を削減することができる。つまり、従来の技術では、仮想的なレジスタのエミュレーションをソフトウェアで行う場合、図7のステップS25で例外を発生させた命令をソフトウェアで解析する処理が必要となる。この解析処理として、少なくとも読み出すデータの格納先を特定する処理と、特定した格納先へデータを格納する処理とが行われる。
 一方、本実施の形態1では、周辺デバイスのエミュレーションを、ステップS27のリードデータ設定部15へのデータの書き込みと、ステップS29の命令再実行のオーバヘッドとで実現している。また、リード先アドレスのインクリメント及びデクリメントなどが自動で行われる命令の場合、命令が再実行されるので、エミュレーションにおいてリード先アドレスのインクリメント及びデクリメントなどを特に処理する必要はない。
 図8は、本発明の実施の形態1におけるデバイスエミュレーション支援装置を備えた情報処理装置のライトアクセス時のエミュレーション処理の一例を示すフローチャートである。図8は、ライトアクセスのエミュレーションについて示している。
 CPU1は、ゲストプログラムを実行し、エミュレーション対象である周辺デバイスのアドレス領域、つまり仮想的な制御レジスタにデータを書き込むライトアクセスを実行する(ステップS41)。
 次に、リードアクセス時と同様に、デバイスエミュレーション支援装置5は、このライトアクセスの発生を検知することでライトアクセスのアクセス内容をトラップし、アクセス記憶部12にトラップしたアクセス内容を記憶する(ステップS42)。次に、デバイスエミュレーション支援装置5は、CPU1に例外を発生させる(ステップS43)。なお、ステップS42の処理は、前述した図2のステップS1~S5の処理に相当し、ステップS43の処理は、前述した図2のステップS6~S7の処理に相当する。
 次に、例外ハンドラ23又は例外制御部27は、CPU1からの例外処理の実行指示を受け、発生した例外がデバイスエミュレーション支援装置5により発生した例外と判断し、エミュレーションプログラム24を呼び出す(ステップS44)。
 次に、CPU1は、呼び出されたエミュレーションプログラム24を実行し、トラップしたアクセスのアクセス内容を取得する(ステップS45)。具体的には、エミュレーションプログラム24を実行したCPU1は、アクセス記憶部12の制御レジスタから、アクセス先のアドレスと、ライトされたデータとを含むアクセス内容を取得する。
 次に、エミュレーションプログラム24を実行したCPU1は、取得したアクセス内容を用いて、存在しない周辺デバイスのエミュレーション処理を実行する(ステップS46)。エミュレーションプログラム24を実行したCPU1は、ゲストプログラムを実行することによって発行されたライトアクセスのアクセス内容を取得済みなので、取得した情報(ライトアクセスのアクセス内容)を用いて周辺デバイスが行う処理をエミュレートする。このステップS46の処理は、エミュレーション対象である周辺デバイスが、CPUと平行して動作する場合、周辺デバイスの処理を開始する処理となる。つまり、DMAをエミュレーションする場合、ステップS46の処理は、データコピーを開始する処理となる。
 次に、エミュレーションプログラム24を実行したCPU1は、周辺デバイスのエミュレーション処理を終了させる。次に、例外ハンドラ23又は例外制御部27は、ゲストプログラムを復帰させる(ステップ47)。この時、リードアクセス時と同様に、CPU1は、ゲストプログラムを再度実行することにより、ステップS41のライトアクセスを発生させた命令に復帰することになる。
 同じ命令に復帰したので、ゲストプログラムを実行したCPU1は、再び、エミュレーション対象である周辺デバイスのアドレス領域、つまり仮想的な制御レジスタにデータを書き込むライトアクセスを実行する(ステップS48)。
 次に、デバイスエミュレーション支援装置5は、このライトアクセスの発生を検知することでライトアクセスのアクセス内容をトラップし、ステップS42で記憶した直前のアクセス内容を、アクセス記憶部12から消去する(ステップS49)。つまり、トラップしたアクセス内容が、ステップS42で記憶した直前のアクセスのアクセス内容と同じなので、例外は発生しない。ステップS49の処理は、前述した図2のステップS1~S5及びS8の処理に相当する。
 次に、デバイスエミュレーション支援装置5は、アクセスが完了したことを表すアクセス完了信号をバス4に出力し、このライトアクセスを無視する(ステップS50)。ステップS50の処理は、前述した図2のステップS12の処理に相当する。
 最後に、ゲストプログラムを実行したCPU1は、バス4に出力されたアクセス完了信号を受け取り、エミュレーション対象である周辺デバイスのアドレス領域にデータを書き込むライトアクセスを完了する(ステップS51)。
 以上により、本実施の形態1のデバイスエミュレーション支援装置によれば、エミュレーションを行うソフトウェアが、トラップした命令の解析及び命令の内容の取得などの、仮想的なレジスタへのアクセスに関する処理を削減することができる。つまり、リードアクセス時と同様に、従来の技術では、エミュレーションを行うソフトウェアが、命令を解析する処理、ライトするデータの格納先を特定する処理、及び、レジスタをインクリメント又はデクリメントする処理を行う必要がある。
 一方、本実施の形態1では、周辺デバイスのエミュレーションを、アクセス記憶部12からのデータの読み出しと、命令再実行のオーバヘッドとで実現している。
 以上、本実施の形態1によれば、エミュレーションを行うソフトウェアが、トラップした命令の解析及び命令の内容の取得などの仮想的なレジスタへのアクセスに関する処理を削減することで、効率的な周辺デバイスのエミュレーションが可能になる。ここで削減できる処理は、アクセス内容を取得するためのソフトウェアによる命令の解析、ソフトウェアによるリード時の結果の格納、及びライト時のデータの取得といった処理である。
 (実施の形態2)
 図9は、本発明の実施の形態2におけるデバイスエミュレーション支援装置を備えた情報処理装置の構成を示す図である。情報処理装置は、CPU1、メモリ2、周辺デバイス3、バス4、デバイスエミュレーション支援装置5及び割り込みコントローラ6を備えている。
 CPU1とメモリ2とバス4とは、図1の構成要素と同じ機能を有している。また、周辺デバイス3には、割り込みを用いて制御される周辺デバイスを含んでいる。本実施の形態2では、周辺デバイスDと周辺デバイスEとが、割り込みを用いて制御される周辺デバイスである。
 割り込みコントローラ6は、バス4とは異なる別の回路を介して、周辺デバイス3の中で割り込みを用いて制御される周辺デバイスD,Eと直接接続されている。割り込みコントローラ6は、CPU1への割り込み信号を発生させることで、CPU1に割り込み処理を行わせる。
 本実施の形態2のデバイスエミュレーション支援装置5は、監視アドレス設定部10、アクセス監視部11、アクセス記憶部12、アクセス判断部13、例外発生部14、リードデータ設定部15、アクセス完了部16及び割り込み抑制部17を備えている。監視アドレス設定部10、アクセス監視部11、アクセス記憶部12、アクセス判断部13、例外発生部14、リードデータ設定部15及びアクセス完了部16は、実施の形態1の構成要素と同じ機能を有しており、割り込み抑制部17が新規追加の構成要素である。以下、新規の構成要素である割り込み抑制部17を中心に説明する。
 周辺デバイスのエミュレーション処理の実行中、つまり図7のステップS24~S28の処理又は図8のステップS44~S47の処理の間に割り込みが発生することがある。エミュレーションプログラム24又は例外ハンドラ23が実行される段階で、CPU1を割り込み禁止にする、または、割り込みコントローラ6を操作して割り込みをマスクする。これにより、制御の複雑さが低減される。この場合、ゲストプログラムが元々割り込み禁止又は割り込みマスク状態であった場合を除き、ゲストプログラムに復帰する図7のステップS28又は図8のステップS47の段階において、割り込み禁止又は割り込みマスク状態を解除する必要がある。
 割り込み禁止又は割り込みマスクが行われている期間に割り込みが発生した場合、当該割り込みは保留された状態になる。割り込み禁止又は割り込みマスクの解除後、つまりゲストプログラムの復帰後即座に、CPU1は、割り込み信号を感知し、割り込みハンドラを実行する。つまり、図7のステップS29の処理又は図8のステップS48の処理における命令再実行の前に、割り込みハンドラ実行処理に移る。ここで、もし実行される割り込みハンドラ内に、アクセス記憶部12に記憶されている直前のアクセスと同じアクセス内容のアクセスを発生させる命令があると、このアクセス(割り込み)が命令再実行によるものと判断される虞がある。
 そこで、本実施の形態2の割り込み抑制部17は、命令の再実行が完了するまで、つまり図7のステップS32の処理又は図8のステップS51の処理までの間、割り込み信号を抑制する。これにより、上記の課題を解決する。なお、本実施の形態2において、割り込み抑制部17が割り込み抑制部の一例に相当する。
 割り込み抑制部17は、バス4とは異なる別の回路を介して、割り込みコントローラ6と直接接続されており、CPU1への割り込み信号を抑制させる機能を有している。なお、割り込みコントローラ6が、割り込み信号を抑制する機能を持たない場合でも、例えば図10のように割り込み信号を伝達する配線の途中に割り込み抑制部17を接続すればよい。
 図10は、本発明の実施の形態2における、割り込み抑制部と割り込みコントローラとの接続例を示す図である。割り込み抑制部17及び割り込みコントローラ6から出力される信号がレベル信号である場合、例えば、図10に示すように単純な論理積回路7を設けることにより、割り込み信号を抑制する機能を実現することが可能である。このような構成により、割り込み禁止又は割り込みマスクが解除された時点では、割り込みコントローラ6での割り込みの保留の有無にかかわらず、CPU1への割り込み信号はオフになるので、割り込みは発生しない。
 また、割り込みの抑制は、例えば、割り込み抑制部17に制御レジスタを設け、当該制御レジスタの操作により開始すればよい。この場合、エミュレーションプログラムが実行されることにより割り込み抑制が開始される。あるいは、割り込み抑制部17は、アクセスをトラップしたタイミング(図7のステップS21又は図8のステップS41)で、アクセス監視部11から通知を受け、割り込み抑制を開始してもよい。
 さらに、割り込み抑制部17は、アクセス記憶部12に記憶されているアクセス内容が消去された時点でCPU1から通知を受け取ることで、割り込み抑制を解除する。これにより、命令再実行の完了時に、割り込み抑制が解除される。割り込みが保留されていた場合、命令再実行の完了後に、CPU1は、割り込み信号を検知し、割り込み処理を実行する。
 以上のように、本実施の形態2では、ゲストプログラムによる、存在していない周辺デバイスの制御レジスタへのアクセスと同じアクセスを割り込みハンドラに設けることが可能となる。これにより、割り込みを用いて制御される周辺デバイスをエミュレーション対象の周辺デバイスとすることができる。
 (実施の形態3)
 図11は、本発明の実施の形態3におけるデバイスエミュレーション支援装置を備えた情報処理装置の構成を示す図である。情報処理装置は、CPU1、メモリ2、周辺デバイス3、バス4及びデバイスエミュレーション支援装置5を備えている。
 本実施の形態3では、周辺デバイス3は、デバイスエミュレーション支援装置5に直接接続しており、デバイスエミュレーション支援装置5を介してCPU1と接続している。つまり、デバイスエミュレーション支援装置5は、CPU1と周辺デバイス3との間に配置される。なお、CPU1とメモリ2とバス4とは、図1の構成要素と同じ機能を有している。また、周辺デバイス3は、デバイスエミュレーション支援装置5を介してバス4と接続している。
 本実施の形態3のデバイスエミュレーション支援装置5は、監視アドレス設定部10、アクセス監視部31、アクセス記憶部12、アクセス判断部13、例外発生部14、リードデータ設定部15、アクセス完了部16及びバス信号制御部18を備えている。監視アドレス設定部10、アクセス記憶部12、アクセス判断部13、例外発生部14、リードデータ設定部15及びアクセス完了部16は、実施の形態1の構成要素と同じ機能を有しており、アクセス監視部31とバス信号制御部18とが実施の形態1と異なっている。以下、アクセス監視部31とバス信号制御部18とを中心に説明する。
 本実施の形態3では、CPU1からバス4に出力された信号は、まずデバイスエミュレーション支援装置5に伝達され、周辺デバイス3には伝達されない。
 アクセス監視部31は、バス4上に流れる信号を監視し、監視アドレス設定部10に設定されているアドレス範囲を含む条件に合致するアクセスの発生を検知する。この信号には、アクセス対象のアドレス、アクセスがリードであるかライトであるかを表す種別、及び、リードするデータまたはライトするデータのデータサイズなどのアクセス内容に関する情報が含まれている。そのため、アクセス監視部31は、バス4上に流れる信号を監視することで、CPU1による、アドレス空間へのアクセスを検知することができる。また、アクセス監視部31は、検知した条件に合致するアクセス内容を、アクセス判断部13に通知する。さらに、アクセス監視部31は、条件に合致しなかったアクセス内容を、バス信号制御部18に通知する。
 すなわち、アクセス監視部31は、CPU1から周辺デバイス3へのアクセスを監視し、CPU1から周辺デバイス3に向けて出力されるアクセス信号から、監視アドレス設定部10に記憶されているアドレスに合致するアドレスを含むアクセス内容を、アクセス記憶部12及びアクセス判断部13に出力する。また、アクセス監視部31は、監視アドレス設定部10に記憶されているアドレスに合致しないアドレスを含むアクセス内容を、バス信号制御部18に通知する。
 バス信号制御部18は、CPU1から周辺デバイス3に向けて出力されるアクセス信号を受信し、受信したアクセス信号を周辺デバイス3に出力するか否かを判断する。バス信号制御部18は、アクセス監視部31からアクセス内容が通知された場合、当該アクセス内容を有するアクセス信号を周辺デバイス3に出力する。バス信号制御部18は、アクセス監視部31からアクセス内容の通知を受けて動作し、アクセスがトラップされなかった場合にのみ、CPU1からの信号を周辺デバイス3に伝達する。つまり、デバイスエミュレーション支援装置5によりアクセスがトラップされた場合、周辺デバイス3には、CPU1からのアクセスは発生しない。従って、実在しない仮想的な周辺デバイスの制御レジスタのアドレスが、実際に存在する周辺デバイス3のアドレスと重なっていた場合、バス信号制御部18は、CPU1からの信号を周辺デバイス3へ通知しない。そのため、周辺デバイス3がCPU1に応答することはない。
 なお、本実施の形態3において、アクセス監視部31がアクセス監視部の一例に相当し、バス信号制御部18がバス信号制御部の一例に相当する。
 本実施の形態3では、上記の構成により、仮想的な周辺デバイスの制御レジスタと、実在する周辺デバイス3の制御レジスタとのアドレスが同一であっても、周辺デバイスのエミュレーションが可能である。
 なお、本実施の形態3において、デバイスエミュレーション支援装置5が、実施の形態2の割り込み抑制部17を更に備える構成であってもよい。
 (実施の形態4)
 図12は、本発明の実施の形態4におけるデバイスエミュレーション支援装置を備えた情報処理装置の構成を示す図である。情報処理装置は、第1のCPU1A、第2のCPU1B、メモリ2、周辺デバイス3、バス4及びデバイスエミュレーション支援装置5を備えている。なお、メモリ2と周辺デバイス3とバス4とは、図1の構成要素と同じ機能を有している。
 本実施の形態4の情報処理装置は、2つのCPUを備えており、デバイスエミュレーション支援装置5は、特定のCPU、例えば第1のCPU1Aにのみ例外を発生させる。
 本実施の形態4のデバイスエミュレーション支援装置5は、監視アドレス設定部10、アクセス監視部11、アクセス記憶部12、アクセス判断部13、リードデータ設定部15、アクセス完了部16及び特定CPU例外発生部19を備えている。監視アドレス設定部10、アクセス監視部11、アクセス記憶部12、アクセス判断部13、リードデータ設定部15及びアクセス完了部16は、実施の形態1の構成要素と同じ機能を有している。本実施の形態4のデバイスエミュレーション支援装置5は、実施の形態1の例外発生部14の代わりに特定CPU例外発生部19を備える。以下、新規の構成要素である特定CPU例外発生部19を中心に説明する。
 特定CPU例外発生部19は、バス4とは異なる別の回路を介して、特定のCPUである第1のCPU1Aと直接接続しており、信号を発生することで例外を通知する機能を有している。特定CPU例外発生部19は、アクセス判断部13によって今回のアクセス内容が前回のアクセス内容と異なると判断された場合に、アクセス判断部13から例外発生要求を受け取り、第1のCPU1Aに例外を発生させる。具体的には、特定CPU例外発生部19は、第1のCPU1Aの例外に関係する端子に直接接続し、例外を発生させるための例外通知を第1のCPU1Aに出力する。第1のCPU1Aは、この例外を契機に、エミュレーションプログラムを動作させることができる。特定CPU例外発生部19は、複数のCPUのうちの予め決められた特定のCPUにのみ例外通知を送信する。
 なお、本実施の形態4において、特定CPU例外発生部19が例外発生部の一例に相当する。
 図13は、本実施の形態4におけるデバイスエミュレーション支援装置を備えた情報処理装置のソフトウェアの構成の一例を示す図である。
 図13では、情報処理装置は、デバイスドライバ20に対応する周辺デバイスを備えていないものとし、デバイスドライバ20と、OS21と、アプリケーション22とが、ゲストプログラム25であるとする。また、例外の発生する第1のCPU1Aは、ゲストプログラム25と、例外制御部27を備えた仮想化層26とを実行する。一方、第2のCPU1Bは、エミュレーションプログラム24を実行する。
 情報処理装置上で動作するアプリケーション22が、デバイスドライバ20が制御する周辺デバイスへのアクセスを発生させた際、デバイスエミュレーション支援装置5は、第1のCPU1Aに例外通知を出力して、第1のCPU1Aに例外を発生させる。第1のCPU1Aは、例外通知を受け取ると、仮想化層26の例外制御部27に対して例外処理の実行を指示する。仮想化層26は、第1のCPU1Aからの例外処理の実行指示を受けて、例外制御部27を最初に動作させる。
 例外制御部27は、発生した例外がデバイスエミュレーション支援装置5により発生したか否かを判断する。デバイスエミュレーション支援装置5によって発生した例外の場合、第1のCPU1Aは、一般的なCPU間の通信機能などを用いて第2のCPU1B上のエミュレーションプログラム24に通知する。第2のCPU1Bは、周辺デバイスのエミュレーション処理を実行する。デバイスエミュレーション支援装置5によって発生した例外でない場合、OS21内の例外ハンドラ23へ制御を移す。これにより、ゲストプログラム25内のデバイスドライバ20が周辺デバイスにアクセスした時に、エミュレーションプログラム24が動作する。
 なお、図13では、仮想化層26が、例外処理の実行指示を受け取り、エミュレーションプログラム24を実行させているが、OS21が、例外処理の実行指示を受け取り、エミュレーションプログラム24を実行させてもよい。
 また、エミュレーションプログラム24を2つに分割し、第1のCPU1Aは、制御レジスタへのデータのリード及びデータのライトに関するエミュレーション処理部分を実行してもよい。この場合、第1のCPU1Aは、図4又は図5のような構成となる。第2のCPU1Bは、DMAによるデータ転送処理、エンコード処理及びデコード処理等の、第1のCPU1Aと並列に動作する周辺デバイスのデータ処理部分を実行する。
 図14は、本発明の実施の形態4におけるデバイスエミュレーション支援装置を備えた情報処理装置のソフトウェアの構成の変形例を示す図である。
 図14において、第1のCPU1Aは、エミュレーションプログラム24と、例外制御部27を備えた仮想化層26とを実行する。一方、第2のCPU1Bは、デバイスドライバ20、OS21及びアプリケーション22を備えたゲストプログラム25を実行する。
 図14では、ゲストプログラム25は、デバイスエミュレーション支援装置5からの例外通知が入力されない第2のCPU1Bで実行される。デバイスエミュレーション支援装置5からの例外発生時は、第1のCPU1Aでエミュレーションプログラム24が実行される。
 なお、図14では、仮想化層26が、例外処理の実行指示を受け取り、エミュレーションプログラム24を実行させているが、第1のCPU1AでもOSを備える構成とし、第1のCPU1AのOSが、例外処理の実行指示を受け取り、エミュレーションプログラム24を実行させてもよい。また、第1のCPU1AのOSの例外ハンドラに直接エミュレーションプログラム24を実装してもよい。
 以上、本実施の形態4によれば、エミュレーションを行うソフトウェアが、トラップした命令の解析、及びレジスタをインクリメント又はデクリメントするなどの命令の実行に関連する整合性の維持などの仮想的な制御レジスタへのアクセスに関する処理を行なう必要がなく、周辺デバイスのエミュレーションを行うことができる。これにより、エミュレーションにおける処理量を削減することが可能となり、周辺デバイスのエミュレーションの効率を向上することができる。
 なお、実施の形態1、実施の形態2及び実施の形態3では、CPU1が単独である場合を示したがこれに限るものではない。OS等の制御で複数のCPUを用いて処理を行なう情報処理装置にも、本実施の形態1、実施の形態2及び実施の形態3のデバイスエミュレーション支援装置を用いることができる。また、実施の形態4でも、第1のCPU1A又は第2のCPU1Bはそれぞれ複数のCPUで構成されてもよい。
 また、本実施の形態1~4のデバイスエミュレーション支援装置は、集積回路であるLSIとして実現できるが、これらは個別に1チップ化されてもよいし、一部又は全てを含むように1チップ化されてもよい。ここでは、LSIとしたが、集積度の違いにより、IC、システムLSI、スーパーLSI又はウルトラLSIと呼称されることもある。また、集積回路化の手法はLSIに限るものではなく、専用回路又は汎用プロセッサで実現してもよい。LSI製造後に、プログラムすることが可能なFPGA(Field ProgrammableGate Array)や、LSI内部の回路セルの接続や設定を再構成可能なリコンフィギュラブル・プロセッサーを利用してもよい。さらには、半導体技術の進歩又は派生する別技術によりLSIに置き換わる集積回路化の技術が登場すれば、その技術を用いて機能ブロックの集積化を行ってもよい。バイオ技術の適応等が可能性としてありえる。
 (実施の形態5)
 図15は、本発明の実施の形態5におけるデバイスエミュレーション支援回路を備えた情報処理装置の構成を示す図である。図15に示す情報処理装置は、CPU1、メモリ2、周辺デバイス3及びデバイスエミュレーション支援回路51を備えている。
 デバイスエミュレーション支援回路51は、集積回路である。デバイスエミュレーション支援回路51は、監視アドレス設定回路110、アクセス監視回路111、アクセス記憶回路112、アクセス判断回路113、例外発生回路114、リードデータ設定回路115及びアクセス完了回路116を備えている。なお、図15に示す実施の形態5の情報処理装置において、実施の形態1と同じ構成については、同じ符号を付し、説明を省略する。
 実施の形態5における監視アドレス設定回路110、アクセス監視回路111、アクセス記憶回路112、アクセス判断回路113、例外発生回路114、リードデータ設定回路115及びアクセス完了回路116は、それぞれ、実施の形態1における監視アドレス設定部10、アクセス監視部11、アクセス記憶部12、アクセス判断部13、例外発生部14、リードデータ設定部15及びアクセス完了部16と同じ機能を有している。
 なお、本実施の形態5において、監視アドレス設定回路110が監視アドレス記憶回路の一例に相当し、アクセス監視回路111がアクセス監視回路の一例に相当し、アクセス記憶回路112がアクセス記憶回路の一例に相当し、リードデータ設定回路115がリードデータ記憶回路の一例に相当し、例外発生回路114が例外発生回路の一例に相当し、アクセス判断回路113がアクセス判断回路の一例に相当し、アクセス完了回路116がアクセス完了回路の一例に相当する。
 このように、監視アドレス設定回路110、アクセス監視回路111、アクセス記憶回路112、アクセス判断回路113、例外発生回路114、リードデータ設定回路115及びアクセス完了回路116は、1つの集積回路に搭載することができる。
 なお、上述した具体的実施形態には以下の構成を有する発明が主に含まれている。
 本発明の一局面に係るデバイスエミュレーション支援装置は、バスを介してCPUと通信可能に接続されたデバイスエミュレーション支援装置であって、エミュレーション対象の周辺装置に対応するアドレスを監視の対象として記憶する監視アドレス記憶部と、前記CPUから前記周辺装置へのアクセスを監視し、アクセス対象である前記周辺装置に対応するアドレスを含むアクセス情報を有し、前記CPUから前記周辺装置に向けて出力されるアクセス信号から、前記監視アドレス記憶部に記憶されているアドレスに合致するアドレスを含むアクセス情報を取得するアクセス監視部と、前記アクセス監視部によって取得されたアクセス情報を記憶するアクセス記憶部と、前記アクセスがデータの読み出しを表す読み出しアクセスである場合に、前記周辺装置から読み出されるデータを一時的に記憶するリードデータ記憶部と、前記CPUに例外を発生させるための例外発生通知を前記CPUへ送信する例外発生部と、前記アクセス監視部によって取得されたアクセス情報を受け取り、受け取ったアクセス情報と、前記アクセス記憶部に記憶されている直前のアクセス情報とを比較し、受け取ったアクセス情報が直前のアクセス情報と異なる場合、前記取得したアクセス情報を前記アクセス記憶部に記憶するとともに、前記例外発生部に例外の発生を要求し、受け取ったアクセス情報が直前のアクセス情報と同一の場合、前記アクセス記憶部に記憶されている直前のアクセス情報を比較の対象から除外するアクセス判断部と、前記アクセス監視部によって監視されるアクセスが前記読み出しアクセスである場合、前記リードデータ記憶部に記憶されているデータを前記CPUに出力して前記アクセスを完了し、前記アクセス監視部によって監視されるアクセスがデータの書き込みを表す書き込みアクセスである場合、前記アクセスを完了するアクセス完了部とを備える。
 本発明の他の局面に係るデバイスエミュレーション支援方法は、エミュレーション対象の周辺装置に対応するアドレスを監視の対象として監視アドレス記憶部に記憶する監視アドレス記憶ステップと、CPUから前記周辺装置へのアクセスを監視し、アクセス対象である周辺装置に対応するアドレスを含むアクセス情報を有し、かつ前記CPUから前記周辺装置に向けて出力されるアクセス信号から、前記監視アドレス記憶部に記憶されているアドレスに合致するアドレスを含むアクセス情報を取得するアクセス監視ステップと、前記アクセス監視ステップにおいて取得されたアクセス情報をアクセス記憶部に記憶するアクセス記憶ステップと、前記アクセスがデータの読み出しを表す読み出しアクセスである場合に、前記周辺装置から読み出されるデータをリードデータ記憶部に一時的に記憶するリードデータ記憶ステップと、前記アクセス監視ステップにおいて取得されたアクセス情報を受け取り、受け取ったアクセス情報と、前記アクセス記憶部に記憶されている直前のアクセス情報とを比較するアクセス判断ステップと、受け取ったアクセス情報が直前のアクセス情報と異なる場合、前記取得したアクセス情報を前記アクセス記憶部に記憶するとともに、前記CPUに例外を発生させるための例外発生通知を前記CPUへ送信する例外発生ステップと、受け取ったアクセス情報が直前のアクセス情報と同一の場合、前記アクセス記憶部に記憶されている直前のアクセス情報を比較の対象から除外する除外ステップと、前記アクセス監視ステップにおいて監視されるアクセスが前記読み出しアクセスである場合、前記リードデータ記憶部に記憶されているデータを前記CPUに出力して前記読み出しアクセスを完了するよう前記CPUに指示し、前記アクセス監視ステップにおいて監視されるアクセスがデータの書き込みを表す書き込みアクセスである場合、前記書き込みアクセスを完了するよう前記CPUに指示するアクセス完了ステップとを含む。
 本発明の他の局面に係るデバイスエミュレーション支援回路は、例外を発生することによりエミュレーション処理を実行するCPUとバスを介して通信可能に接続されたデバイスエミュレーション支援回路であって、エミュレーション対象の周辺装置に対応するアドレスを監視の対象として記憶する監視アドレス記憶回路と、前記CPUから前記周辺装置へのアクセスを監視し、アクセス対象である周辺装置に対応するアドレスを含むアクセス情報を有し、かつ前記CPUから前記周辺装置に向けて出力されるアクセス信号から、前記監視アドレス記憶回路に記憶されているアドレスに合致するアドレスを含むアクセス情報を取得するアクセス監視回路と、前記アクセス監視回路によって取得されたアクセス情報を記憶するアクセス記憶回路と、前記アクセスがデータの読み出しを表す読み出しアクセスである場合に、前記周辺装置から読み出されるデータを一時的に記憶するリードデータ記憶回路と、前記CPUに例外を発生させるための例外発生通知を前記CPUへ送信する例外発生回路と、前記アクセス監視回路によって取得されたアクセス情報を受け取り、受け取ったアクセス情報と、前記アクセス記憶回路に記憶されている直前のアクセス情報とを比較し、受け取ったアクセス情報が直前のアクセス情報と異なる場合、前記取得したアクセス情報を前記アクセス記憶回路に記憶するとともに、前記例外発生回路に前記例外発生通知の送信を要求し、受け取ったアクセス情報が直前のアクセス情報と同一の場合、前記アクセス記憶回路に記憶されている直前のアクセス情報を比較の対象から除外するアクセス判断回路と、前記アクセス監視回路によって監視されるアクセスが前記読み出しアクセスである場合、前記リードデータ記憶回路に記憶されているデータを前記CPUに出力して前記読み出しアクセスを完了するよう前記CPUに指示し、前記アクセス監視回路によって監視されるアクセスがデータの書き込みを表す書き込みアクセスである場合、前記書き込みアクセスを完了するよう前記CPUに指示するアクセス完了回路とを備える。
 本発明の他の局面に係る情報処理装置は、CPUと、前記CPUによって制御される周辺装置と、前記CPUから出力されたアクセス信号を前記周辺装置に伝達するバスと、上記のいずれかに記載のデバイスエミュレーション支援装置とを備える。
 これらの構成によれば、監視アドレス記憶部には、エミュレーション対象の周辺装置に対応するアドレスが監視の対象として記憶される。CPUから周辺装置へのアクセスが監視され、アクセス対象である周辺装置に対応するアドレスを含むアクセス情報を有し、かつCPUから周辺装置に向けて出力されるアクセス信号から、監視アドレス記憶部に記憶されているアドレスに合致するアドレスを含むアクセス情報が取得される。アクセス記憶部には、取得されたアクセス情報が記憶される。また、リードデータ記憶部には、アクセスがデータの読み出しを表す読み出しアクセスである場合に、周辺装置から読み出されるデータが一時的に記憶される。取得されたアクセス情報を受け取り、受け取ったアクセス情報と、アクセス記憶部に記憶されている直前のアクセス情報とが比較される。受け取ったアクセス情報が直前のアクセス情報と異なる場合、取得したアクセス情報がアクセス記憶部に記憶されるとともに、CPUに例外を発生させるための例外発生通知がCPUへ送信される。一方、受け取ったアクセス情報が直前のアクセス情報と同一の場合、アクセス記憶部に記憶されている直前のアクセス情報が比較の対象から除外される。監視されるアクセスが読み出しアクセスである場合、リードデータ記憶部に記憶されているデータがCPUに出力されて読み出しアクセスを完了するようCPUに指示される。また、監視されるアクセスがデータの書き込みを表す書き込みアクセスである場合、書き込みアクセスを完了するようCPUに指示される。
 すなわち、受け取ったアクセス情報が、アクセス記憶部に記憶されている直前のアクセス情報と異なる場合、CPUに例外を発生させることによりエミュレーション処理を実行させる。一方、受け取ったアクセス情報が、アクセス記憶部に記憶されている直前のアクセス情報と同一の場合、例外の終了に伴うアクセスの再実行と見なし、アクセスが読み出しアクセスである場合、所定のデータをCPUに出力した後、読み出しアクセスを完了するようCPUに指示し、アクセスが書き込みアクセスである場合、そのまま書き込みアクセスを完了するようCPUに指示する。
 したがって、エミュレーションを行うCPUによって、トラップしたアクセスの内容を解析して必要なデータを取得する処理が行われないので、エミュレーションする際の処理量を削減することができ、効率的に周辺装置のエミュレーションを行うことができる。
 また、上記のデバイスエミュレーション支援装置において、前記アクセス記憶部が前記アクセス判断部において比較の対象となる前記直前のアクセス情報を記憶している間、前記CPUへの割り込みを抑制する割り込み抑制部をさらに備えることが好ましい。
 この構成によれば、比較の対象となる直前のアクセス情報がアクセス記憶部に記憶されている間、CPUへの割り込みが抑制される。
 すなわち、エミュレーションの途中で、アクセス記憶部に記憶されている直前のアクセス情報と同じアクセス情報を有するアクセスが割り込み処理として実行された場合、例外の終了に伴うアクセスの再実行と見なされてしまう。
 そこで、比較の対象となる直前のアクセス情報がアクセス記憶部に記憶されている間、CPUへの割り込みが抑制されるので、割り込みにより制御される周辺装置をエミュレーション対象の周辺装置とすることができる。
 また、上記のデバイスエミュレーション支援装置において、前記CPUから前記周辺装置に向けて出力される前記アクセス信号を受信し、受信した前記アクセス信号を前記周辺装置に出力するか否かを判断するバス信号制御部をさらに備え、前記アクセス監視部は、前記監視アドレス記憶部に記憶されているアドレスに合致しないアドレスを含むアクセス情報を、前記バス信号制御部に通知し、前記バス信号制御部は、前記アクセス監視部から前記アクセス情報が通知された場合、当該アクセス情報を有する前記アクセス信号を前記周辺装置に出力することが好ましい。
 この構成によれば、バス信号制御部は、CPUから周辺装置に向けて出力されるアクセス信号を受信する。そして、監視アドレス記憶部に記憶されているアドレスに合致しないアドレスを含むアクセス情報が、バス信号制御部に通知される。バス信号制御部は、アクセス情報が通知された場合、当該アクセス情報を有するアクセス信号を周辺装置に出力する。
 したがって、CPUからエミュレーション対象でない周辺装置へ送られるアクセス信号のみが周辺装置へ出力されるので、エミュレーション対象である周辺装置のアドレスと、実在する周辺装置のアドレスとが同じ場合であっても、確実にエミュレーションを行うとともに、実在する周辺装置を制御することができる。
 また、上記のデバイスエミュレーション支援装置において、前記CPUは、複数のCPUを含み、前記例外発生部は、前記複数のCPUのうちの予め決められた特定のCPUにのみ前記例外発生通知を送信することが好ましい。
 この構成によれば、複数のCPUのうちの予め決められた特定のCPUにのみ例外発生通知が送信されるので、特定のCPUにおいて、例外を発生させることによりエミュレーションを行わせると同時に、他のCPUにおいて、他のプログラムを実行させることができる。
 また、上記のデバイスエミュレーション支援装置において、前記アクセス情報は、アクセス対象である前記周辺装置に対応するアドレスと、前記アクセスが前記読み出しアクセス及び前記書き込みアクセスのいずれであるかを表すアクセス種別と、前記アクセス種別が前記書き込みアクセスである場合に前記周辺装置に書き込まれる値とを少なくとも含むことが好ましい。
 この構成によれば、アクセス情報に含まれるアドレスを用いて、CPUからエミュレーション対象である周辺装置へのアクセスを特定することができ、アクセス情報に含まれるアクセス種別を用いて、アクセスが読み出しアクセス及び書き込みアクセスのいずれであるかを特定することができる。また、アクセス情報に含まれる値を用いて、アクセス種別が書き込みアクセスである場合に周辺装置に当該値を書き込むことができる。
 また、上記のデバイスエミュレーション支援装置において、前記CPUは、前記例外発生部によって出力された前記例外発生通知を受信した場合、例外を発生することによりエミュレーション処理を実行し、その後、前記周辺装置に出力された前記アクセス信号と同じアクセス信号を再び前記周辺装置へ出力することが好ましい。
 この構成によれば、CPUによって、例外発生通知が受信された場合、例外を発生することによりエミュレーション処理が実行され、その後、周辺装置に出力されたアクセス信号と同じアクセス信号が再び周辺装置へ出力される。
 したがって、最初のアクセス信号が出力されることにより、エミュレーション処理が実行され、最初のアクセス信号と同じアクセス信号が再び出力されることにより、読み出しアクセスに対応するデータがCPUに送られ、アクセスが完了されるので、CPUが周辺装置にアクセスすることなく、エミュレーション処理を行うことができる。
 なお、発明を実施するための形態の項においてなされた具体的な実施態様または実施例は、あくまでも、本発明の技術内容を明らかにするものであって、そのような具体例にのみ限定して狭義に解釈されるべきものではなく、本発明の精神と次に記載する特許請求事項との範囲内で、種々変更して実施することができるものである。
 本発明に係るデバイスエミュレーション支援装置、デバイスエミュレーション支援方法、デバイスエミュレーション支援回路及び情報処理装置は、例えば、大型計算機又はパーソナルコンピュータのような形態のみならず、各種の家電機器、携帯電話のような通信機器、産業機器又は乗用機器などにも利用可能である。

Claims (9)

  1.  例外を発生することによりエミュレーション処理を実行するCPUとバスを介して通信可能に接続されたデバイスエミュレーション支援装置であって、
     エミュレーション対象の周辺装置に対応するアドレスを監視の対象として記憶する監視アドレス記憶部と、
     前記CPUから前記周辺装置へのアクセスを監視し、アクセス対象である周辺装置に対応するアドレスを含むアクセス情報を有し、かつ前記CPUから前記周辺装置に向けて出力されるアクセス信号から、前記監視アドレス記憶部に記憶されているアドレスに合致するアドレスを含むアクセス情報を取得するアクセス監視部と、
     前記アクセス監視部によって取得されたアクセス情報を記憶するアクセス記憶部と、
     前記アクセスがデータの読み出しを表す読み出しアクセスである場合に、前記周辺装置から読み出されるデータを一時的に記憶するリードデータ記憶部と、
     前記CPUに例外を発生させるための前記例外発生通知を前記CPUへ送信する例外発生部と、
     前記アクセス監視部によって取得されたアクセス情報を受け取り、受け取ったアクセス情報と、前記アクセス記憶部に記憶されている直前のアクセス情報とを比較し、受け取ったアクセス情報が直前のアクセス情報と異なる場合、前記取得したアクセス情報を前記アクセス記憶部に記憶するとともに、前記例外発生部に前記例外発生通知の送信を要求し、受け取ったアクセス情報が直前のアクセス情報と同一の場合、前記アクセス記憶部に記憶されている直前のアクセス情報を比較の対象から除外するアクセス判断部と、
     前記アクセス監視部によって監視されるアクセスが前記読み出しアクセスである場合、前記リードデータ記憶部に記憶されているデータを前記CPUに出力して前記読み出しアクセスを完了するよう前記CPUに指示し、前記アクセス監視部によって監視されるアクセスがデータの書き込みを表す書き込みアクセスである場合、前記書き込みアクセスを完了するよう前記CPUに指示するアクセス完了部とを備えることを特徴とするデバイスエミュレーション支援装置。
  2.  前記アクセス記憶部が前記アクセス判断部において比較の対象となる前記直前のアクセス情報を記憶している間、前記CPUへの割り込みを抑制する割り込み抑制部をさらに備えることを特徴とする請求項1記載のデバイスエミュレーション支援装置。
  3.  前記CPUから前記周辺装置に向けて出力される前記アクセス信号を受信し、受信した前記アクセス信号を前記周辺装置に出力するか否かを判断するバス信号制御部をさらに備え、
     前記アクセス監視部は、前記監視アドレス記憶部に記憶されているアドレスに合致しないアドレスを含むアクセス情報を、前記バス信号制御部に通知し、
     前記バス信号制御部は、前記アクセス監視部から前記アクセス情報が通知された場合、当該アクセス情報を有する前記アクセス信号を前記周辺装置に出力することを特徴とする請求項1又は2記載のデバイスエミュレーション支援装置。
  4.  前記CPUは、複数のCPUを含み、
     前記例外発生部は、前記複数のCPUのうちの予め決められた特定のCPUにのみ前記例外発生通知を送信することを特徴とする請求項1~3のいずれかに記載のデバイスエミュレーション支援装置。
  5.  前記アクセス情報は、アクセス対象である前記周辺装置に対応するアドレスと、前記アクセスが前記読み出しアクセス及び前記書き込みアクセスのいずれであるかを表すアクセス種別と、前記アクセス種別が前記書き込みアクセスである場合に前記周辺装置に書き込まれる値とを少なくとも含むことを特徴とする請求項1~4のいずれかに記載のデバイスエミュレーション支援装置。
  6.  前記CPUは、前記例外発生部によって出力された前記例外発生通知を受信した場合、例外を発生することによりエミュレーション処理を実行し、その後、前記周辺装置に出力された前記アクセス信号と同じアクセス信号を再び前記周辺装置へ出力することを特徴とする請求項1~5のいずれかに記載のデバイスエミュレーション支援装置。
  7.  エミュレーション対象の周辺装置に対応するアドレスを監視の対象として監視アドレス記憶部に記憶する監視アドレス記憶ステップと、
     CPUから前記周辺装置へのアクセスを監視し、アクセス対象である周辺装置に対応するアドレスを含むアクセス情報を有し、かつ前記CPUから前記周辺装置に向けて出力されるアクセス信号から、前記監視アドレス記憶部に記憶されているアドレスに合致するアドレスを含むアクセス情報を取得するアクセス監視ステップと、
     前記アクセス監視ステップにおいて取得されたアクセス情報をアクセス記憶部に記憶するアクセス記憶ステップと、
     前記アクセスがデータの読み出しを表す読み出しアクセスである場合に、前記周辺装置から読み出されるデータをリードデータ記憶部に一時的に記憶するリードデータ記憶ステップと、
     前記アクセス監視ステップにおいて取得されたアクセス情報を受け取り、受け取ったアクセス情報と、前記アクセス記憶部に記憶されている直前のアクセス情報とを比較するアクセス判断ステップと、
     受け取ったアクセス情報が直前のアクセス情報と異なる場合、前記取得したアクセス情報を前記アクセス記憶部に記憶するとともに、前記CPUに例外を発生させるための例外発生通知を前記CPUへ送信する例外発生ステップと、
     受け取ったアクセス情報が直前のアクセス情報と同一の場合、前記アクセス記憶部に記憶されている直前のアクセス情報を比較の対象から除外する除外ステップと、
     前記アクセス監視ステップにおいて監視されるアクセスが前記読み出しアクセスである場合、前記リードデータ記憶部に記憶されているデータを前記CPUに出力して前記読み出しアクセスを完了するよう前記CPUに指示し、前記アクセス監視ステップにおいて監視されるアクセスがデータの書き込みを表す書き込みアクセスである場合、前記書き込みアクセスを完了するよう前記CPUに指示するアクセス完了ステップとを含むことを特徴とするデバイスエミュレーション支援方法。
  8.  例外を発生することによりエミュレーション処理を実行するCPUとバスを介して通信可能に接続されたデバイスエミュレーション支援回路であって、
     エミュレーション対象の周辺装置に対応するアドレスを監視の対象として記憶する監視アドレス記憶回路と、
     前記CPUから前記周辺装置へのアクセスを監視し、アクセス対象である周辺装置に対応するアドレスを含むアクセス情報を有し、かつ前記CPUから前記周辺装置に向けて出力されるアクセス信号から、前記監視アドレス記憶回路に記憶されているアドレスに合致するアドレスを含むアクセス情報を取得するアクセス監視回路と、
     前記アクセス監視回路によって取得されたアクセス情報を記憶するアクセス記憶回路と、
     前記アクセスがデータの読み出しを表す読み出しアクセスである場合に、前記周辺装置から読み出されるデータを一時的に記憶するリードデータ記憶回路と、
     前記CPUに例外を発生させるための例外発生通知を前記CPUへ送信する例外発生回路と、
     前記アクセス監視回路によって取得されたアクセス情報を受け取り、受け取ったアクセス情報と、前記アクセス記憶回路に記憶されている直前のアクセス情報とを比較し、受け取ったアクセス情報が直前のアクセス情報と異なる場合、前記取得したアクセス情報を前記アクセス記憶回路に記憶するとともに、前記例外発生回路に前記例外発生通知の送信を要求し、受け取ったアクセス情報が直前のアクセス情報と同一の場合、前記アクセス記憶回路に記憶されている直前のアクセス情報を比較の対象から除外するアクセス判断回路と、
     前記アクセス監視回路によって監視されるアクセスが前記読み出しアクセスである場合、前記リードデータ記憶回路に記憶されているデータを前記CPUに出力して前記読み出しアクセスを完了するよう前記CPUに指示し、前記アクセス監視回路によって監視されるアクセスがデータの書き込みを表す書き込みアクセスである場合、前記書き込みアクセスを完了するよう前記CPUに指示するアクセス完了回路とを備えることを特徴とするデバイスエミュレーション支援回路。
  9.  CPUと、
     前記CPUによって制御される周辺装置と、
     前記CPUから出力された前記アクセス信号を前記周辺装置に伝達するバスと、
     請求項1~6のいずれかに記載のデバイスエミュレーション支援装置とを備えることを特徴とする情報処理装置。
PCT/JP2009/002221 2008-05-28 2009-05-20 デバイスエミュレーション支援装置、デバイスエミュレーション支援方法、デバイスエミュレーション支援回路及び情報処理装置 WO2009144892A1 (ja)

Priority Applications (3)

Application Number Priority Date Filing Date Title
CN2009801190956A CN102047228A (zh) 2008-05-28 2009-05-20 设备仿真支援装置、设备仿真支援方法、设备仿真支援电路及信息处理装置
JP2010514349A JP5307133B2 (ja) 2008-05-28 2009-05-20 デバイスエミュレーション支援装置、デバイスエミュレーション支援方法、デバイスエミュレーション支援回路及び情報処理装置
US12/670,929 US8374842B2 (en) 2008-05-28 2009-05-20 Device emulation support apparatus, device emulation support method, device emulation support circuit and information processor

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2008139188 2008-05-28
JP2008-139188 2008-05-28

Publications (1)

Publication Number Publication Date
WO2009144892A1 true WO2009144892A1 (ja) 2009-12-03

Family

ID=41376782

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2009/002221 WO2009144892A1 (ja) 2008-05-28 2009-05-20 デバイスエミュレーション支援装置、デバイスエミュレーション支援方法、デバイスエミュレーション支援回路及び情報処理装置

Country Status (4)

Country Link
US (1) US8374842B2 (ja)
JP (1) JP5307133B2 (ja)
CN (1) CN102047228A (ja)
WO (1) WO2009144892A1 (ja)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI450118B (zh) * 2010-11-02 2014-08-21 Global Unichip Corp 混合的電子設計系統及其可重組連接矩陣
US9529615B2 (en) * 2010-11-24 2016-12-27 International Business Machines Corporation Virtual device emulation via hypervisor shared memory
JP5826834B2 (ja) * 2011-05-16 2015-12-02 パナソニック インテレクチュアル プロパティ コーポレーション オブアメリカPanasonic Intellectual Property Corporation of America 仮想計算機システム、仮想計算機システムの制御方法、仮想計算機システムの制御プログラム、及び集積回路
US9721121B2 (en) * 2014-06-16 2017-08-01 Green Hills Software, Inc. Out-of-band spy detection and prevention for portable wireless systems
JP6378066B2 (ja) * 2014-11-27 2018-08-22 クラリオン株式会社 情報処理装置および実行管理プログラム
US9946868B2 (en) * 2015-10-12 2018-04-17 Dresser, Inc. Device functionality control
CN110083086B (zh) * 2019-03-25 2021-03-19 中国船舶重工集团公司第七一九研究所 过程控制装置运行数据存储方法及装置
CN113806967B (zh) * 2021-10-18 2023-02-10 广东英达思迅智能制造有限公司 基于物联网的缺失设备数据仿真方法、系统及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0368037A (ja) * 1989-08-07 1991-03-25 Nec Corp プログラム開発装置
JPH06348543A (ja) * 1993-06-02 1994-12-22 Matsushita Electric Ind Co Ltd 入出力シミュレータとの接続方法
JP2001209555A (ja) * 2000-01-25 2001-08-03 Matsushita Electric Ind Co Ltd 入出力エミュレーション装置、入出力装置のエミュレーション方法および入出力装置エミュレーションプログラムを記録した記録媒体
JP2004252824A (ja) * 2003-02-21 2004-09-09 Hitachi Information Technology Co Ltd 回路検証方法、回路シミュレータ、回路検証プログラム

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH02137054A (ja) * 1988-11-18 1990-05-25 Nec Corp 情報処理装置
US5809560A (en) * 1995-10-13 1998-09-15 Compaq Computer Corporation Adaptive read-ahead disk cache
US5778430A (en) * 1996-04-19 1998-07-07 Eccs, Inc. Method and apparatus for computer disk cache management
JP2006113906A (ja) 2004-10-15 2006-04-27 Canon Inc バス監視装置及びバス監視装置付きコントローラ

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0368037A (ja) * 1989-08-07 1991-03-25 Nec Corp プログラム開発装置
JPH06348543A (ja) * 1993-06-02 1994-12-22 Matsushita Electric Ind Co Ltd 入出力シミュレータとの接続方法
JP2001209555A (ja) * 2000-01-25 2001-08-03 Matsushita Electric Ind Co Ltd 入出力エミュレーション装置、入出力装置のエミュレーション方法および入出力装置エミュレーションプログラムを記録した記録媒体
JP2004252824A (ja) * 2003-02-21 2004-09-09 Hitachi Information Technology Co Ltd 回路検証方法、回路シミュレータ、回路検証プログラム

Also Published As

Publication number Publication date
US20100204976A1 (en) 2010-08-12
CN102047228A (zh) 2011-05-04
US8374842B2 (en) 2013-02-12
JP5307133B2 (ja) 2013-10-02
JPWO2009144892A1 (ja) 2011-10-06

Similar Documents

Publication Publication Date Title
JP5307133B2 (ja) デバイスエミュレーション支援装置、デバイスエミュレーション支援方法、デバイスエミュレーション支援回路及び情報処理装置
JP6130612B1 (ja) ハイパーバイザーを有するシステム
US9858084B2 (en) Copying of power-on reset sequencer descriptor from nonvolatile memory to random access memory
KR100961349B1 (ko) Vex - 가상 확장물을 고립시키는 방법
US8495344B2 (en) Simultaneous execution resumption of multiple processor cores after core state information dump to facilitate debugging via multi-core processor simulator using the state information
JP2005322242A (ja) 仮想環境からのハードウェアへの直接アクセスの提供
US20080098264A1 (en) Program debug method and apparatus
KR20110130435A (ko) 메모리 세그먼테이션 및 acpi 기반 컨텍스트 전환을 사용하는 운영 시스템 로딩
CN114741233A (zh) 快速启动方法
US20020049897A1 (en) Method for adding processor
JP2007206933A (ja) 情報処理装置、情報処理装置におけるブートローダ生成方法およびプログラム転送方法
KR102088690B1 (ko) 집적 회로 무선
JP2010003151A (ja) データ処理装置
JP6495290B2 (ja) Ic無線装置
JP2003122594A (ja) 半導体装置および評価装置
US8732721B2 (en) Method for reducing trap overhead when executing a guest in a virtual machine
CN107273105B (zh) 固件启动方法和装置
JP2008140124A (ja) データ処理装置
JP2000339189A (ja) 不正なメモリアクセスを検出する方法、デバッグ装置および記録媒体
JP2004252508A (ja) 単一プロセッサ用ソフトウェアプログラムをマルチプロセッサ用ソフトウェアプログラムに変換する方法
JP3449812B2 (ja) 制御用電子装置
CN118036092A (zh) 一种基于硬件辅助虚拟化的软件完整性保护方法与系统
JP6138482B2 (ja) 組み込みシステム
JPH10187480A (ja) エミュレータ
JP2004110086A (ja) 半導体装置

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 200980119095.6

Country of ref document: CN

WWE Wipo information: entry into national phase

Ref document number: 2010514349

Country of ref document: JP

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 09754401

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 12670929

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 09754401

Country of ref document: EP

Kind code of ref document: A1