Patent ID: 8543371

Claim:
A non-transitory computer-readable storage medium storing thereon an emulation program for providing an execution environment of a target program, the emulation program causing a computer to perform: translating an instruction output from the target program to an instruction executable in an execution environment of the emulation program; generating, in a memory region for use by the target program, a first memory map which is write-protected in a first memory space based on the execution environment of the emulation program and a second memory map which is write-protected in a second memory space having a smaller memory length than the first memory space based on at least one of the execution environment of the target program and content of the instruction from the target program; and performing memory protection in the second memory space smaller than the first memory space in a memory protection mechanism provided by the execution environment of the emulation program by rewriting a first write instruction to the first memory map output at the translating to a second write instruction to the second memory map when the first write instruction causes a write protection violation to the first memory map, wherein the first memory space is a page of a predetermined range of memory addresses and the second memory space is a smaller range of memory addresses within the page, and since the first memory map is subjected to write protection in units of pages, a write protection mechanism works even in writing in data addresses on the same page that are not included in a sequence of target instructions, thereby causing a write protection violation, the performing includes, when a write destination on the second memory map is write-protected, rewriting the first write instruction to a write instruction proceeding to an exception handling at the time of a write violation, and the performing includes protecting the memory and suppressing occurrence of memory protection violation by rewriting an address of a store instruction causing a write violation to an address of the second memory map from an address of the first memory map.