Method and device for recombining runtime instruction
Abstract
A method for recombining runtime instruction comprising: an instruction running environment is buffered; the machine instruction segment to be scheduled is obtained; the second jump instruction which directs an entry address of an instruction recombining platform is inserted before the last instruction of the obtained machine instruction segment to generate the recombined instruction segment comprising the address A″; the value A of the address register of the buffered instruction running environment is modified to the address A″; the instruction running environment is recovered. A device for recombining the runtime instruction comprising: an instruction running environment buffering and recovering unit suitable for buffering and recovering the instruction running environment; an instruction obtaining unit suitable for obtaining the machine instruction segment to be scheduled; an instruction recombining unit suitable for generating the recombined instruction segment comprised the address A″; and an instruction replacing unit suitable for modifying the value of the address register of the buffered instruction running environment to the address of the recombined instruction segment. The monitoring and control of the runtime instruction of the computing device is completed.
Claims
exact text as granted — not AI-modifiedWhat is claimed is:
1 . A method for controlling running of instructions, comprising:
storing an instruction execution context; acquiring a machine instruction segment to be scheduled to an instruction recombination platform, where the machine instruction segment to be scheduled contains a first control transfer instruction at an end of the machine instruction segment to be scheduled, and a value of an address register in the instruction execution context represents an original address of the machine instruction segment to be scheduled; inserting a second control transfer instruction before the first control transfer instruction to form a current recombined instruction segment; modifying the value of the address register in the instruction execution context to a current address of the current recombined instruction segment; restoring the instruction execution context; and executing the current recombined instruction segment according to the current address of the current recombined instruction segment, where when the second control transfer instruction is executed, a next machine instruction segment to be scheduled starts to be acquired to the instruction recombination platform.
2 . The method of claim 1 , wherein acquiring a machine instruction segment to be scheduled comprises:
reading the original address of the machine instruction segment to be scheduled from the address register; and reading the machine instruction segment to be scheduled according to the original address of the machine instruction segment to be scheduled and the first control transfer instruction.
3 . The method of claim 2 , wherein reading the machine instruction segment to be scheduled according to the original address of the machine instruction segment to be scheduled and the first control transfer instruction comprises:
searching machine instructions corresponding to the original address of the machine instruction segment to be scheduled until the first control transfer instruction is found, the first control transfer instruction comprising JMP instruction and CALL instruction.
4 . The method of claim 1 , wherein after storing the instruction execution context and before acquiring the machine instruction segment to be scheduled, the method further comprises:
searching an address corresponding table according to the original address of the machine instruction segment to be scheduled, where the address corresponding table is used for storing corresponding relationships between original addresses of machine instruction segments to be scheduled and current addresses of corresponding recombined instruction segments; and if the original address of the machine instruction segment to be scheduled is found in the address corresponding table, modifying the value of the address register to a current address of corresponding recombined instruction segment and restoring the instruction execution context.
5 . The method of claim 4 , further comprising:
if the original address of the machine instruction segment to be scheduled is not found in the address corresponding table, creating a record in the address corresponding table with the original address of the machine instruction segment to be scheduled and the current address of the current recombined instruction segment.
6 . The method of claim 1 , wherein before inserting the second control transfer instruction, the method further comprises:
analyzing the machine instruction segment to be scheduled by using an instruction set to identify the machine instruction segment to be scheduled, in order to acquire a target machine instruction to be processed; and modifying the target machine instruction in a preset way.
7 . The method of claim 6 , wherein
the target machine instruction is a store or read instruction; and modifying the target machine instruction in a preset way comprises: modifying a store or read address of the store or read instruction to a corresponding address on a safety device.
8 . The method of claim 6 , wherein
the target machine instruction is an I/O instruction; and modifying the target machine instruction in a preset way comprises: blocking input instructions in the I/O instruction.
9 . The method of claim 6 , wherein
the target machine instruction is a network transmission instruction; and modifying the target machine instruction in a preset way comprises: determining if a destination address in the network transmission instruction which corresponds to a remote computing device is a permitted address; and if the destination address is not a permitted address, blocking the network transmission instruction.
10 . A non-transitory computer readable medium, having a computer executable program stored thereon which, when executed by a computer, causes the computer to perform the method of claim 1 .
11 . A device for controlling running of instructions, comprising:
an instruction execution context store and restore unit, being adapted to storing and restoring an instruction execution context; an instruction acquiring unit, being adapted to acquiring a machine instruction segment to be scheduled to an instruction recombination platform after the instruction execution context store and restore unit stores the instruction execution context, where the machine instruction segment to be scheduled contains a first control transfer instruction at an end of the machine instruction segment to be scheduled, and a value of an address register in the instruction execution context represents an original address of the machine instruction segment to be scheduled; an instruction recombination unit, being adapted to inserting a second control transfer instruction before the first control transfer instruction to form a current recombined instruction segment; an instruction replacing unit, being adapted to modifying the value of the address register in the instruction execution context to a current address of the current recombined instruction segment; and an instruction execution unit, being adapted to executing the current recombined instruction segment according to the current address of the current recombined instruction segment, where when the instruction execution unit executes the second control transfer instruction, the instruction acquiring unit starts to acquire a next machine instruction segment to be scheduled.
12 . The device of claim 11 , wherein the instruction acquiring unit is adapted to reading the original address of the machine instruction to be scheduled from the address register, and adapted to reading the machine instruction segment to be scheduled according to the original address of the machine instruction to be scheduled and the first control transfer instruction.
13 . The device of claim 12 , wherein the instruction acquiring unit is adapted to searching machine instructions corresponding to the original address of the machine instruction segment to be scheduled until the first control transfer instruction is found, the first control transfer instruction comprising JMP instruction and CALL instruction.
14 . The device of claim 11 , further comprising: an instruction searching unit, being adapted to search an address corresponding table according to the original address of the machine instruction segment to be scheduled, where the address corresponding table is used for storing corresponding relationships between original addresses of machine instruction segments to be scheduled and current addresses of corresponding recombined instruction segments;
where if the original address of the machine instruction segment to be scheduled is found in the address corresponding table, the instruction searching unit is adapted to calling the instruction replacing unit to modify the value of the address register to a current address of corresponding recombined instruction segment; and if the original address of the machine instruction segment to be scheduled is not found in the address corresponding table, the instruction searching unit is adapted to creating a record in the address corresponding table with the original address of the machine instruction segment to be scheduled and the current address of the current recombined instruction segment.
15 . The device of claim 11 , wherein the instruction recombination unit comprises:
an instruction analysis unit, being adapted to identifying the machine instruction segment to be scheduled by using an instruction set to acquire a target machine instruction to be processed; and an instruction modification unit, being adapted to modifying the target machine instruction in a preset way.
16 . The device of claim 15 , wherein if the target machine instruction is a store or read instruction, the instruction modification unit is adapted to modifying a store or read address of the store or read instruction to a corresponding address on a safety device.
17 . The device of claim 15 , wherein if the target machine instruction is an I/O instruction, the instruction modification unit is adapted to blocking input instructions in the I/O instruction.
18 . The device of claim 15 , wherein if the target machine instruction is a network transmission instruction, the instruction modification unit is adapted to determining if a destination address in the network transmission instruction which corresponds to a remote computing device is a permitted address; and if the destination address is not a permitted address, the instruction modification unit is adapted to blocking the network transmission instruction.Join the waitlist — get patent alerts
Track US2015012732A1 — get alerts on status changes and closely related new filings.
We store only your email — no account needed. See our privacy policy.