Login| Sign Up| Help| Contact|

Patent Searching and Data


Title:
A METHOD FOR EXECUTING A PROGRAM IN A COMPUTER
Document Type and Number:
WIPO Patent Application WO/2019/025395
Kind Code:
A1
Abstract:
The disclosed embodiments relate to a method for memory modification resulting in a test probe for examining a program under test substantially during run-time. The ability to inject faults or errors in order to test the program's reaction to a fault in a particular state and to individually replace access to a regular operand by accessing a shadow operand allow for non-intrusive tests while the program is substantially executed in real-time and whereby the program itself is not substantially altered for testing purposes.

Inventors:
FIEGE, Ludger (Goethering 14, Grafing, 85567, DE)
FRÖHLICH, Joachim (Fritz-Arnold-Str. 3, Kirchseeon, 85614, DE)
ROTHBAUER, Stefan (Dr.-Zamenhof-Str. 16, Augsburg, 86156, DE)
Application Number:
EP2018/070654
Publication Date:
February 07, 2019
Filing Date:
July 31, 2018
Export Citation:
Click for automatic bibliography generation   Help
Assignee:
SIEMENS AKTIENGESELLSCHAFT (Werner-von-Siemens-Straße 1, München, 80333, DE)
International Classes:
G06F11/36
Foreign References:
US20090249301A12009-10-01
Other References:
ZIADE H ET AL: "A Survey on Fault Injection Techniques", THE INTERNATIONAL ARAB JOURNAL OF INFORMATION TECHNOLOGY, ZARKA PRIVATE UNIVERSITY, COLLEGES OF COMPUTING AND INFORMATION TECHNOLOGY, JORDAN, vol. 1, no. 2, 1 July 2004 (2004-07-01), pages 171 - 186, XP002669128, ISSN: 1683-3198
None
Download PDF:
Claims:
Claims

1. A method for executing a program in a computer, said program comprising a multiplicity of instructions to be executed by a processing unit of the computer, the method comprising the steps of:

a) allocating a first memory structure for storing at least one operand of said program, each operand stored in a first memory cell by an associated first address in the first memory structure;

b) allocating a second memory structure for storing at least one shadow operand, each shadow operand stored in a second memory cell by an associated second address in the second memory structure;

c) loading one of said instructions for accessing a first memory cell by an associated first address;

d) querying of data instructive of reading or writing a shadow operand;

e) responsive to a positive querying of said data, using an associated second address for accessing a second memory cell of one of said second memory cells instead of the first memory cell.

2. The method according to claim 1, wherein the second memory structure is allocated in a register memory included in the processing unit or administered by the processing unit.

3. The method according to claim 1, wherein the second memory structure is allocated in a main memory administered by the processing unit.

4. The method according to claim 1, wherein the second memory structure includes at least one memory cell for storing a modification indicator, the modification indicator indicating a presence or absence of at least one of said first address in the second memory.

5. The method according to claim 1, wherein the second memory structure includes at least one memory cell for storing a first address of at least one of said operands, for each of which a respective shadow operand is present.

6. The method according to claim 1, wherein the second memory structure includes at least one memory cell for storing at least one of said shadow operands. 7. The method according to claim 1, wherein said querying of data instructive of reading or writing a shadow operand includes an instruction for replacing an access of the operand by an access of the shadow operand. 8. The method according to claim 1, wherein said querying of data instructive of reading or writing a shadow operand includes querying a presence of the first address in the second memory. 9. The method according to claim 4, wherein said querying of data instructive of reading or writing a shadow operand includes querying said modification indicator.

10. The method according to claim 4, wherein said

multiplicity of instructions include an instruction for reading and/or amending the modification indicator.

11. A method for operating a supervisable program, including the steps of:

- preparing said supervisable program by compiling and/or linking a first program code of a program to be tested with a second program code adapted for carrying out a method according to one of the aforementioned claims; and; - storing and executing said supervisable program by a

processing unit.

12. The method according to claim 1, wherein said processing unit comprises components for carrying out a method according to one of the aforementioned claims.

Description:
Description

A method for executing a program in a computer TECHNICAL FIELD

The disclosed embodiments relate to a method for executing a program in a computer and, specifically, to a method for manipulating a program during execution in order to allow for a testing of said program.

BACKGROUND

In order to ensure a proper operation of programs,

particularly programs executed on an embedded system with real time requirements, it is necessary to perform rigorous testing in the course of developing and engineering such programs . Currently employed tools for software testing include

external devices which depend upon stimuli for indicating the state of a program being executed on a processing unit of a computer. In the course of testing, faults or errors are injected in response to the stimuli to test the program's reaction to a fault in that particular state.

A particular problem with external test devices - i.e.

devices outside and/or in a vicinity of a processing unit - is due to an integration and miniaturization of components and signals in current processing systems which render difficulties in reaching information of interest, e.g. cache- memory, internal registers and buses, and other on-chip logic of a processing unit. Due to a limited pin count a tapping of internal signals of interest is rather intricate.

Such testing is particularly demanding in the case of realtime systems and/or embedded systems which comprise highly integrated components and where test results have to be obtained without compromising a functional and timing

behavior . Running a program under control of a debugger - i.e. a tool for finding causes of errors - and modifying the program by setting watch points or break points massively interferes functional and timing behavior which makes debuggers

impractical for automated testing.

In general, stimulations for testing purposes must not impair the program under test. That is, process-internal

stimulations must only have the intended effects on the control process under test, without any unintended side effects. In this sense, process-internal stimulations must be non-intrusive .

Accordingly there is a need in the art for executing a program in a computer allowing for non-intrusive tests while the program is substantially executed in real-time and whereby the program itself is not substantially altered for testing purposes.

Further on, there is a need in the art for facilitating tests in programs by injecting faults at precise locations in the execution path of a program.

SUMMARY AND DESCRIPTION The present invention relates to a method for executing a program in a computer, said program comprising a multiplicity of instructions to be executed by a processing unit of the computer, the method comprising the steps of: a) allocating a first memory structure for storing at least one operand of said program, each operand stored in a first memory cell by an associated first address in the first memory structure; b) allocating a second memory structure for storing at least one shadow operand, each shadow operand stored in a second memory cell by an associated second address in the second memory structure; c) loading one of said instructions for accessing a first memory cell by an associated first address; d) querying a presence of the first address in the second memory structure and, responsive to a positive presence, using an associated second address for accessing a second memory cell of one of said second memory cells instead of the first memory cell.

The invention provides a technique for coordinating execution of instructions in a processor allowing for individually replacing an access to a regular operand by accessing a shadow operand instead. The concept of a shadow operand allows for non-intrusively seeding data into the execution of the program, particularly for the purpose of injecting faults into the normal program operation and testing the reaction of the program.

On occurrence of a regular instruction for accessing a first memory cell - which is an addressed location for reading or storing the operand - by a first address, data instructive of reading or writing a shadow operand is queried.

In case that this query delivers a positive presence an associated second memory cell dedicated for the shadow operand is used for access instead of the first memory cell for the regular operand. As the instruction of accessing a first memory cell by an associated first address includes both, reading or writing an operand, the method allows for both,

- reading a shadow operand instead of a regular operand; or; - writing a variable into the second memory cell dedicated for a shadow operand instead writing said variable into the regular first memory cell.

The first alternative, reading a shadow operand instead of a regular operand, is particularly advantageous for injecting faults to the normal program execution, for instance in that a value which is expected to cause an error is intentionally injected by the shadow operand in order to examine the reaction of the program. The second alternative, writing a variable into a memory cell dedicated for a shadow operand, is advantageous for dumping variables of interest into the second memory structure, e.g. for the purpose of analyzing these variables in the aftermath of a fault injection. BRIEF DESCRIPTION OF THE DRAWING

The objects as well as further advantages of the present invention will become more apparent and readily appreciated from the following description of the preferred embodiments, taken in conjunction with the accompanying drawing

accompanying drawing of which:

FIG. 1 shows a block diagram of an exemplary architecture according to an embodiment;

FIG. 2 shows a block diagram of an exemplary architecture according to an alternative embodiment;

FIG. 3 shows a an exemplary memory structure according

an embodiment; shows a state transition diagram for illustrating possible state transitions according to an

embodiment ; shows details of a first state transition; shows amendments in a memory structure as a result of the aforementioned first state transition; shows details of a second state transition; shows amendments in a memory structure as a result of the aforementioned second instruction; shows details of a third state transition; shows amendments in a memory structure as a result of the aforementioned third state transition; shows details of a fourth state transition; shows amendments in a memory structure as a result of the aforementioned fourth state transition; shows details of a fifth state transition; shows amendments in a memory structure as a result of the aforementioned fifth state transition; shows details of a sixth state transition; shows amendments in a memory structure as a result of the aforementioned sixth state transition; shows details of a seventh state transition; FIG. 18 shows amendments in a memory structure as a result of the aforementioned seventh state transition;

FIG. 19 shows an exemplary memory structure according to a first variant of an alternative embodiment;

FIG. 20 shows an exemplary memory structure according to a second variant of an alternative embodiment; and;

FIG. 21 shows a state transition diagram for illustrating possible state transitions according to an alternative embodiment.

DETAILED DESCRIPTION

FIG. 1 shows a block diagram of an exemplary architecture including a central processing unit CPU such as a

microprocessor or a microcontroller.

The central processing unit CPU exchanges - i.e. loads or saves - data with a main memory MEM. The exchange of data may include storage addresses ADD, data values DAT and control data CTR.

Control data CTR may include machine code instructions of one or more computer programs stored in the main memory MEM. An instruction is a group of bits causing the central processing unit CPU to perform a specific operation. A leading portion of an instruction includes an operation code or opcode. The opcode is a group of bits that specify an operation to be performed by the central processing unit CPU. For example, operations such as adding, or subtracting, or branching program execution or storing a value to memory may be

specified in the opcode. The remainder of the instruction typically provides data sources, data destinations and/or direct datafor the operation, called operands. Operands may be specified within the instruction itself or in a memory location .

Data values DAT may include operands and symbolic names associated with an operand whose associated value may be subject to change.

Addresses ADD are used for executing instructions and for storing and retrieving data. While a concept of physical addresses may be applied by machine code operands for addressing memory locations, logical or virtual addresses are used under a control of a - not shown - memory management unit or other memory mapping facilities, said facilities included within or controlled by the central processing unit CPU.

Further units or devices - not illustrated in the drawing - may exchange input/output data 10 with the main memory MEM with or without the central processing unit CPU.

Although the exchange of data is illustrated by separate lanes or busses - depicted by double arrows in the drawing - such exchange may include alternative organizations of data exchange including solely one or more common data lanes.

Generally, the central processing unit CPU, which supervises and implements various data processing tasks, contains hardware components for processing instructions and data. Instructions together with data are typically stored in a memory structure. The memory structure may be physically separate from the central processing unit CPU, mainly including the main memory MEM, although copies of

instructions and data may be temporarily stored within the microprocessor during program execution.

To this end, the central processing unit CPU may include or administer at least one further - not shown - memory structure which is commonly referred to as a register or a processor register. A register is a quickly accessible location available to the central processing unit CPU.

Registers usually consist of a small amount of fast storage and are typically addressed by mechanisms other than the main memory MEM, but may in some cases be memory mapped.

A common property of computer programs is locality of

reference, which refers to accessing the same values

repeatedly and holding frequently used values in registers in order to improve performance. This makes fast registers or caches meaningful. Allocating frequently used variables to registers can be critical to a program's performance. This register allocation is, therefore, usually performed by a compiler in the code generation phase.

A register may hold an instruction, a storage address, or any kind of data such as a bit sequence or individual characters. Some instructions specify registers as part of the

instruction. For example, an instruction may specify that the contents of two defined registers be added together and then placed in a specified register. Depending on the processor design and language rules, registers may be numbered or have arbitrary names.

A - not shown - computer program is provided to be executed by the central processing unit CPU. The program is subject to be examined substantially during run-time with the ability to inject faults or errors in order to test the program's reaction to a fault in that particular state. Embodiments of the invention provide for coordinating execution of

instructions in the central processing unit allowing for individually replacing an access to a regular operand by accessing a shadow operand instead.

Embodiments of the invention provide for writing a computed variable into a memory cell dedicated for the shadow operand related to a respective operand, e.g. for the purpose of analyzing the computed variable in the aftermath of a fault inj ection . Fig. 1 further shows a Memory Modification Unit MEMOU whose functionality will be described in detail hereinafter. The Memory Modification Unit MEMOU may include or use one or more memory structures including registers of the central

processing unit CPU and/or memory structures within the main memory MEM. According to the embodiment of Fig. 1 the Memory Modification Unit MEMOU is either located within the central processing unit CPU or at least using registers of this central processing unit CPU. Two implementations of the Memory Modification Unit MEMOU are suitable :

The Memory Modification Unit MEMOU may comprise one or more processor-internal or -external hardware components allowing for a modification of memory cells of the computer program to be tested when instructed to do so. The hardware components may either include register components delimited from the registers administered by the central processing unit or may use register

components of the central processing unit CPU.

The Memory Modification Unit MEMOU may consist of

software which is compiled and linked together with the computer program to be tested. The software Memory

Modification Unit MEMOU includes routines for allocating a delimited memory structure, providing for registers or other memory cells under the control of the Memory

Modification Unit MEMOU. The software Memory Modification Unit MEMOU may further amend the microcode of the central processing unit CPU by particular instructions for accessing shadow operands and/or extend existing

instructions for accessing operands. A skilled artisan will readily choose an implementation based on the requirements of the task at hand.

An alternative embodiment of the Memory Modification Unit MEMOU depicted in Fig 2. - wherein like parts are designated by like reference signs throughout - differs ceteris paribus to the embodiment of Fig. 1 in that the Memory Modification Unit MEMOU is located within the main memory MEM instead of the central processing unit CPU. However, it will be apparent hereinafter that the Memory Modification Unit MEMOU is more than a delimited memory structure.

In the following, an embodiment according to Fig. 1 is described wherein the Memory Modification Unit MEMOU is included in hardware portions of the central processing unit CPU and/or included in the program executed on the central processing unit CPU. The behavior of instructions of the Memory Modification Unit MEMOU and their effects on registers administered by the Memory Modification Unit MEMOU are defined by means of state transition diagrams.

The Memory Modification Unit MEMOU provides for an allocation of a second memory structure - in the embodiment of Fig. 1 and 3 one or more registers included within or administered by the central processing unit CPU - which is operated in parallel with a first memory structure used by the program under test.

On the occurrence of a program's instruction for accessing an operand - i.e. reading an operand from the first memory structure or writing an operand into the first memory

structure - the shadow operand is accessed under definable conditions instead of the operand. FIG. 3 shows an exemplary second memory structure MS

according to an embodiment. Said second memory structure MS provides three registers DRG,ARG,IRG within a register space of the central processing unit CPU which are exclusively administered by the Memory Modification Unit MEMOU.

Further - not shown - registers rl and r2 denote registers allocated in the register space of the central processing unit CPU which are regularly used by the program under test. The contents saved within a register, or generally: a memory cell, are referred to by a preceding sign »$«. Accordingly, the contents or the value saved in register rl are expressed by $rl.

A data register DRG is provided for access to shadow

operands. Fig. 3 shows n data memory cells whose contents are denoted by a concatenation of a type identifier $dm and an index number, i.e. $dml , $dm2 , $dmn. In each of the n data memory cells in the data register DRG a respective shadow operand $dml , $dm2 , $dmn can be saved or be retrieved.

Hereinafter, the shadow operand is also referred to as modified data value in order to express its modified nature compared to the original operand.

An address register ARG is provided to store modified

addresses of modified data memory cells. Fig. 3 shows n data memory cells whose contents are denoted by a concatenation of a type identifier $am and an index number, i.e. $aml , $am2 , $amn. In each of the n address memory cells in the address register ARG a respective address of a modified data value $aml , $am2 , $amn can be saved or be retrieved. A modification indication register IRG is provided to store a modification indicator $im with the following values:

A value of 0 (zero) identifies an unmodified memory cell; or;

a value in the range of the indexes 1 , ... , n, or, synonymously, positions i identifies a memory cell $ami

(1 < i < n) modified at a given time. The following instructions are defined for accessing, querying or administering a shadow operand by the Memory Modification Unit MEMOU:

A first instruction entitled »store modified« as follows: stm $rl, $r2

is used to store a shadow operand or modified data value to a memory cell in the second memory structure. The instruction with an opcode »stm« includes two operands specifying the contents $rl and $r2 of a respective register rl and r2 in the first memory structure used for normal operations of the program under test. The »store modified« instruction stores a data value of the shadow operand currently cached in the first register rl to a memory cell of the second memory structure whose address is currently cached in the second register r2.

A second instruction entitled »load modified« as follows: 1dm $rl, $r2

is used to load a shadow operand or modified data value from a memory cell of the second memory structure into a memory cell of the first register $rl used for normal operations of the program under test. The shadow operand is loaded from a memory cell of the second register whose specific address is passed to the load instruction by a value currently cached in the second register $r2.

A third instruction entitled »is modified« as follows:

ism $rl

is used to determine whether a shadow operand is provided at a given specific address of a memory cell in the second memory structure. Said specific address is passed to the »is modified« instruction by a value currently cached in the first register $rl. A fourth instruction entitled »clear modification« as follows :

elm $rl

is used to clear an »is modified« state for a given specific address of a memory cell in the second memory structure, whose specific address is passed to the »clear modification« instruction by a value currently cached in the first register $rl . Hereinafter, these instructions along with their effects on register contents are defined by a state transition diagram shown in FIG. 4 for illustrating possible state transitions.

The state transition diagram defines two states STl, ST2 wherein a first state STl is characterized in that a memory cell at a given address addr is not modified - or in other words: there is no shadow operand for a given operand stored in a given address - and wherein a second state ST2 is characterized in that a memory cell at a given address addr is modified - or in other words: there is shadow operand for a given operand stored in a given address. In the first state STl a query by the »is modified« instruction ism addr would return a value of zero, which is the contents of the

modification indication register IRG. In the second state ST2 a query by the »is modified« instruction ism addr would return a value unequal to zero.

The above described instructions for accessing or

administering a shadow operand, namely »store modified« or stm, »load modified« or 1dm, »is modified« or ism and »clear modification« or elm and their interplay with usual memory instructions, namely »store« or st and »load« or Id are influencing a state transition a, b, c, d, e, f, g as explained below .

The latter »usual« memory instructions refer to general instructions of accessing memory by the program under test. All instructions refer to a given adress addr which is passed as an operand addr for the given opcode of the instructions explained below. a) A first state transition a remaining in the first state ST1 is effected by the instruction

ism addr

wherein ism is the instruction of querying whether a shadow operand is provided at a given specific address addr of a memory cell in the second memory structure. b) A second state transition b remaining in the second state ST2 is effected by the instruction

ism addr

wherein ism again is the instruction of querying whether a shadow operand is provided at a given specific address addr of a memory cell in the second memory structure. Unlike to the first state transition, the second state transition assumes a situation, i.e. the second state ST2, wherein a shadow operand is present. c) A third state transition c is changing into the second state ST2 - see the outer bow in the drawing - or remains in the second state ST2 - see the inner loop in the drawing. This third state transition c is effected by the instruction stm , addr

wherein stm is the instruction for storing a shadow operand or modified data value to a memory cell in the second memory structure. The instruction with an opcode »stm« includes two operands, wherein the first operand is characterized by a place holder which means that the first operand - a data value of the shadow operand - does not affect the outcome of the instruction. The second operand of the stm instruction specifies the address addr of a memory cell in the second memory structure in which the shadow operand has to be stored . d) A fourth state transition d remaining in the second state ST2 is effected by the instruction

ldm , addr

wherein ldm is the instruction for loading a shadow operand or modified data value from a memory cell of the second memory structure specified by the second argument addr into a memory cell of a register with an address specified by the first argument - here by a placeholder since the address of the memory cell in the first memory structure does not affect the outcome of the instruction - used for normal operations of the program under test. e) A fifth state transition e remaining in the first state ST1 is effected by the instruction

Id , addr

wherein Id is the »usual« instruction in normal operations of the program under test for loading an operand from a memory cell of the first memory structure. By using this load instruction Id no consideration of a potentially present shadow operand is taking place. The source address addr of the memory cell from which the operand has to be loaded is specified by the second argument addr. The first argument of the load instruction Id is specified by a placeholder

since the target address of the load instruction does not affect the outcome of the instruction. f) A sixth state transition f remaining in the first state ST1 is effected by the instruction

st , addr

wherein st is the »usual« instruction in normal operations of the program under test for storing an operand to its own register, in other words to a memory cell of the first memory structure. By using this store instruction st no

consideration of a potentially present shadow operand is taking place. The target address addr of the memory cell into which the operand has to be stored is specified by the second argument addr. The first argument of the store instruction st is specified by a placeholder since the source address of the store instruction does not affect the outcome of the instruction . g) A seventh state transition g is changing into the first state ST1 - see the outer bow in the drawing - or remains in the first state ST1 - see the inner loop in the drawing. This seventh state transition g is effected by the instruction elm addr

wherein elm is the instruction for clearing an »is modified« state for a memory cell in the second memory structure, whose specific address addr is passed to the »clear modification« instruction . Further state transitions x,y - in the drawing illustrated by a crossed-out loop - are disabled: x) A state transition x remaining in the first state ST1 would be effected by the instruction

1dm , addr

This - disabled - state transition x would load a modified value for a memory cell which has not been modified - note that the first state ST1 is defined by a memory cell at address addr which is not modified. Hence, this operation has no effect. y) A state transition y remaining in the second state ST2 would be effected by the instruction

Id , addr

This - disabled - state transition y would try to load an unmodified value for a memory cell which has been modified - - note that the second state ST2 is defined by a memory cell at address addr which is modified. If permitted, this

operation would foil the semantics of the Memory Modification Unit MEMOU (see also definitions of state transitions d and e) . In the following, details of state transition a, b, c, d, e, f, g are shown along with amendments in the first memory structure and the second memory structure as a result of the respective state transition.

FIG. 5 shows details of the first state transition a in the course of executing the »is modified« instruction. The first state transition a is starting in a first state ST1, in which a memory cell at a given address is not modified, or, in other words: there is no shadow operand for a given operand stored in a given address. Accordingly, an »is modified« instruction query will deliver a value of 0 (zero) meaning that no shadow operand is present. The »is modified«

instruction, consequently, does not lead to a state

transition. The state remains unaltered at the first state ST1.

FIG. 6 shows amendments in memory structures before - left section - and after - right section - the first state

transition a depicted in the subsequent FIG. 5.

In the upper part of both sections the contents of a memory structure for program execution are shown, here a register $rl allocated in the register space of the central processing unit CPU which is regularly used for normal operations by the program under test. As depicted, the contents of this register $rl provide an address al which is cached by this register rl for executing the »is modified« instruction as follows :

ism $rl

In a boxed section below, the structure and contents of the second memory structure are shown. The second memory

comprises three registers under control of the Memory

Modification Unit MEMOU, namely: a data register dm comprising n memory cells whose contents are generally referred to as $dm or individually by $dl,$d2,... $dn. This data register conforms to the data register DRG of FIG. 3. It is assumed that some arbitrary data d or 0 (zero) etc. are stored in the n memory cells

$dl,$d2,... $dn of this data register $dm which are

irrelevant for this exemplary embodiment. an address register am comprising n memory cells whose contents are generally referred to as $am or individually by $al,$a2,... $an. This address register conforms to the data address register ARG of FIG. 3. It is assumed that some arbitrary addresses a8,a3 or 0 (zero) are stored in the n memory cells $al,$a2,... $an of this address register $am which are irrelevant for this exemplary embodiment. a modification indication register im comprising one memory cell with a content of $im. This modification indication register conforms to the modification

indication register IRG of FIG. 3. It is assumed that a value of d is stored in the memory cell $im of the modification indication register im, whereby this

arbitrary value d has remained since the latest call of the »is modified« instruction.

The »is modified« instruction begins with reading the

contents of register $rl and passing the contents, i.e. the address al to a query for a presence of this address al in the address register $am. In the course of executing the »is modified« instruction ism $rl, the memory modification unit sets the modification indicator $im from a former arbitrary value of d - see contents of modification indication register $im on the left side - to a value of 0 (zero) - see contents of modification indication register $im on the right side - since the queried address al is not included in the set of addresses {a8, a3} of the address register $am. Since al is not within this set of the address register $am, the memory cell $im of the modification indication register $im is set to a value of 0 (zero) .

In a boxed section below, the structure and contents of the first memory structure used for accessing the usual operands administered by the program are shown. The first memory structure - either main memory or register space - is allocated by the program for storing at least one operand of said program, each operand stored in a first memory cell by an associated address al, a2, a3 in the first memory

structure .

The first memory structure includes in a commonly known manner a multiplicity of memory cells addressed by addresses al,a2,a3,... including logical or virtual addresses used under control of commonly known memory mapping facilities

controlled by the central processing unit CPU.

The respective contents of the depicted memory cells of the first memory structure are specified by an arbitrary data value d in the drawing, meaning that the arbitrary data values d are irrelevant for this exemplary embodiment.

FIG. 7 shows details of the second state transition b in the course of executing the »is modified« instruction. Contrary to the situation depicted by FIG. 5, the second state

transition b is starting in the second state ST2. In the second state ST2 a memory cell at a given address is

modified, or, in other words: there is a shadow operand for a given operand stored in a given address. Accordingly, an »is modified« instruction query will deliver a value unequal to zero meaning that a shadow operand is present. As the »is modified« query does not affect the presence of a shadow operand, the »is modified« instruction does not lead to a state transition. The state remains unaltered at the second state ST2. FIG. 8 shows amendments in memory structures before - left section - and after - right section - the second state transition b depicted in the subsequent FIG. 7. The contents $rl of register rl allocated in the register space of the central processing unit CPU provides an address al which is cached by this register rl for executing the »is modified« instruction as follows:

ism $rl

The second memory in the boxed section below comprising the three registers under control of the Memory Modification Unit MEMOU is depicted in accordance with the structure of FIG. 6: The three registers are assumed to store the following data:

The contents $dm of the data register dm are assumed to comprise the same arbitrary data d or 0 (zero) etc. in respective memory cells $dl,$d2,... $dn as shown in FIG. 6, which are again irrelevant for this exemplary embodiment.

The contents $am of the address register am are assumed to store addresses a8,al or 0 (zero) in respective memory cells $al,$a2,... $an. - The modification indication register im is assumed to

store a value of d in its memory cell $im, whereby this arbitrary value d has remained since the latest call of the »is modified« instruction. The »is modified« instruction begins with reading the

contents $rl of register $r and passing the contents, i.e. the address al to a query for a presence of this address al in the address register $am. In the course of executing the »is modified« instruction ism $rl, the memory modification unit sets the modification indicator $im from a former arbitrary value of d - see contents of modification

indication register $im on the left side - to a value of 2 - see contents of modification indication register $im on the right side - since the queried address al is included in memory cell $a2 of the address register $am. The boxed section below depicts the contents of the first memory structure which is again irrelevant for this exemplary embodiment .

FIG. 9 shows details of the third state transition c in the course of executing the »store modified« instruction.

According to an embodiment of the invention, processing a shadow operand is generally preceded by querying of data instructive of reading or writing a shadow operand. In order to store a shadow operand by a »store modified« instruction using a given address, it is to be checked before, whether a shadow operand already exists under this given address. This check is previously performed by the »is modified«

instruction .

This means that the third transition c is preceded by the first transition a starting in a first state ST1, in which a memory cell at a given address is not modified, or, in other words: there is no shadow operand for a given operand stored in a given address. Accordingly, an »is modified« instruction ism $r2 query will deliver a value of 0 (zero) meaning that no shadow operand is present. The »is modified« instruction, consequently, does not lead to a state transition. The state remains unaltered at the first state ST1. This is shown in the middle of FIG. 9.

The subsequent third state transition c is changing from the first state ST1 into the second state ST2. This third state transition c is effected by the instruction

[$im = 0] stm $rl, $r2

The preceding portion [$im = 0] of this instruction is a condition or a state transition guard, safeguarding that the remaining portion stm $rl, $r2 is only executed when the returned value of the »is modified« query is 0 (zero) . The following »store modified« instruction stm $rl, $r2 includes two operands which are held in the contents of the first register $rl and the second register $r2. The first operand in register rl is a data value of the shadow operand to be stored. The second operand of the »store modified«

instruction specifies the contents $r2 of register r2 as address of a memory cell in the second memory structure in which the shadow operand has to be stored.

FIG. 10 shows amendments in memory structures before the first state transition a - left section -, after the first state transition a - centric section - and after the third state transition c - right section - depicted in the

subsequent FIG. 9.

In the upper part of all three sections the contents of a memory structure for program execution are shown, here a first register $rl and a second register $r2 allocated in the register space of the central processing unit CPU both of which are regularly used for normal operations by the program under test. As depicted, the contents $rl of the first register rl provides a data value which has to be stored as a shadow operand - or modified value - and which is currently cached by the first register rl . The contents $r2 of the second register r2 provide an address al for a memory cell in the second memory structure which is currently cached by the second register r2.

After execution of the »is modified« instruction as follows: ism $r2

amendments in the memory structures are shown in the centric section, which are analogously corresponding with the

contents of the second memory structure shown in the right section of FIG 6 after an analogous execution of the »is modified« instruction.

After execution of the »store modified« instruction as follows:

stm $rl, $r2

amendments in the memory structures are shown in the right section .

The »store modified« instruction has amended the contents $a3 of memory cell a3 within the address register $am by a value of al which is the address of the shadow operand passed by the contents $r2 of the second register r2.

The »store modified« instruction has further amended the contents $d3 of memory cell d3 within the data register dm by a value of d4 which is the data value of the shadow operand passed by contents $rl the first register rl . Note that the index 3 of the memory cell $d3 within the data register $dm is equal to the index of the memory cell $a3 within the address register $am, which determines the position of the saved shadow operand d3 within the data register $dm.

The »store modified« instruction has amended the contents $im of memory cell im within the modification indication register im by a value of 3 which is the position of the memory cell $a3 recently modified.

In a boxed section below, wherein the structure and contents of the first memory structures used for accessing operands of the program is shown, a data value dl for the operand under the address al is stored. This data value dl is the data value of the operand for which a respective shadow operand with a value of d4 is stored in the second memory structure.

FIG. 11 shows details of the fourth state transition d in the course of executing the »load modified« instruction.

According to an embodiment of the invention, processing a shadow operand is generally preceded by querying of data instructive of reading or writing a shadow operand. In order to load a shadow operand by a »load modified« instruction using a given address, it is to be verified before whether an existing shadow operand is associated with said given

address. This check is previously performed by the »is modified« instruction.

This means that the fourth transition d is preceded by the second transition b starting in a second state ST2, in which a memory cell at a given address is modified, or, in other words: there is a shadow operand for a given operand stored in a given address. Accordingly, an »is modified« instruction ism $r2 query will deliver a value of unequal zero meaning that a shadow operand is present. The »is modified«

instruction, consequently, does not lead to a state

transition. The state remains unaltered at the second state ST2. This is shown in the middle of FIG. 11.

The subsequent fourth transition d is not changing the present second state ST2. This fourth transition d is effected by the instruction

[$im ≠ 0] 1dm $rl, $r2

The preceding portion [$im ≠ 0] of this instruction is a condition or a state transition guard safeguarding that the remaining portion 1dm $rl, $r2 is only executed when the returned value of the »is modified« query is unequal zero.

The following »load modified« instruction 1dm $rl, $r2 includes two operands which are held in contents $rl of the first register rl and the contents $r2 of the second register r2. The first operand in register $rl is an arbitrary data value d which will be overwritten by the shadow operand to be loaded. The second operand of the »store modified«

instruction specifies the contents $r2 of register r2 as address of a memory cell in the second memory structure from which the shadow operand has to be loaded. FIG. 12 shows amendments in memory structures before the first state transition a - left section -, after the first state transition a - centric section - and after the fourth state transition d - right section - depicted in the

subsequent FIG. 11.

In the upper part of all three sections the contents of a memory structure for program execution are shown, here a first register $rl and a second register $r2 allocated in the register space of the central processing unit CPU both of which are regularly used for normal operations by the program under test.

As depicted, the contents $rl of the first register rl provides an arbitrary data value d which will be overwritten by a shadow operand or modified value. The contents $r2 of the second register r2 provides an address al for a memory cell in the second memory structure which is currently cached by the second register $r2.

After execution of the »is modified« instruction as follows: ism $r2

amendments in the memory structures are shown in the centric section, which are analogously corresponding with the

contents of the second memory structure shown in the right section of FIG 6 after an analogous execution of the »is modified« instruction.

The »is modified« instruction begins with reading the

contents $rl of register rl and passing the contents, i.e. the address al to a query for a presence of this address al in the contents of the address register $am. In the course of executing the »is modified« instruction ism $rl, the memory modification unit sets the modification indicator $im from a former arbitrary value of d - see contents $im of

modification indication register im on the left section - to a value of 3 - see contents $im of modification indication register im in the centric section - since the queried address al is included in memory cell $a3 of the address register $am. After execution of the »load modified« instruction as

follows :

ldm $rl, $r2

amendments in the memory structures are shown in the right section .

There are no amendments in the second memory structure including the data register $dm, the address register $am and the modification indication register $im.

The »load modified« instruction uses the contents $im of modification indication register im with a value of 3 as index for accessing the contents $d3 of a data memory cell with index 3 in the data register dm, which contains the modified data or shadow operand to be loaded. The data value d4 of this shadow operand associated with the address al is loaded into the contents of the first register $rl.

In a boxed section below, wherein the structure and contents of the first memory structures used for accessing operands of the program is shown, a data value dl for the operand under the address al is stored. This data value dl is the data value of the operand for which a respective shadow operand with a value of d4 is stored in the second memory structure.

FIG. 13 shows details of the fifth state transition e in the course of executing the »load modified« instruction.

According to an embodiment of the invention, processing a shadow operand is generally preceded by querying of data instructive of reading or writing a shadow operand. In order to load an operand by a »load« instruction using a given address, it is to be falsified before, whether an existing shadow operand is associated with said given address. This check is previously performed by the »is modified« instruction .

This means that the fourth transition d is preceded by the first transition a starting in a first state ST1, in which a memory cell at a given address is not modified, or, in other words: there is no shadow operand for a given operand stored in a given address. Accordingly, an »is modified« instruction ism $r2 query will deliver a value of unequal zero meaning that a shadow operand is present. The »is modified«

instruction, consequently, does not lead to a state

transition. The state remains unaltered at the first state ST1. This is shown in the middle of FIG. 13. The subsequent fifth state transition e is not changing the present first state ST1. This fifth state transition e is effected by the instruction

[$im = 0] Id $rl, $r2

The preceding portion [$im = 0] of this instruction is a condition or a state transition guard, safeguarding that the remaining portion Id $rl, $r2 is only executed when the returned value of the »is modified« query is 0 (zero) .

The following »load« instruction Id $rl, $r2 includes two operands which are held in the contents $rl of the first register rl and the contents $r2 of the second register r2. The first operand in register $rl is an arbitrary data value d which will be overwritten by the operand to be loaded. The second operand of the »store modified« instruction specifies the contents $r2 of register r2 as address of a memory cell in the first memory structure from which the operand has to be loaded. Note that the general difference between the

»load« instruction and the »load modified« instruction described before is in that the »load« instruction does load an operand from the first memory while the »load modified« instruction loads a shadow operand from the second memory. FIG. 14 shows amendments in memory structures before the first state transition a - left section -, after the first state transition a - centric section - and after the fifth state transition e - right section - depicted in the

subsequent FIG. 11.

In the upper part of all three sections the contents of a memory structure for program execution are shown, here a first register $rl and a second register $r2 allocated in the register space of the central processing unit CPU both of which are regularly used for normal operations by the program under test.

As depicted, the contents $rl of the first register rl provides an arbitrary data value d which will be overwritten by a data value of the operand. The contents $r2 of the second register r2 provides an address al for a memory cell in the first memory structure which is currently cached by the second register $r2.

After execution of the »is modified« instruction as follows: ism $r2

amendments in the memory structures are shown in the centric section, which are analogously corresponding with the

contents of the second memory structure shown in the right section of FIG 6 after an analogous execution of the »is modified« instruction.

The »is modified« instruction begins with reading the

contents of register $rl and passing the contents, i.e. the address al to a query for a presence of this address al in the contents $am of address register am. In the course of executing the »is modified« instruction ism $rl, the memory modification unit sets the modification indicator $im from a former arbitrary value of d - see contents $im of

modification indication register im on the left section - to a value of 0 - see contents $im of modification indication register im in the centric section - since the queried address al is not included in any memory of the address register $am. After execution of the »load« instruction as follows:

Id $rl, $r2

amendments in the memory structures are shown in the right section. There are no amendments in the second memory

structure including the data register dm, the address

register am and the modification indication register im.

The »load modified« instruction uses the contents $r2 of register r2 with a value of al for accessing a memory cell a3 in the first memory structure - boxed section below, wherein the structure and contents of the first memory structures used for accessing operands of the program is shown - which contains the data operand to be loaded. The data value dl of this operand associated with the address al is loaded into the contents $rlof the first register rl .

FIG. 15 shows details of the sixth state transition f in the course of executing the »store« instruction.

The sixth state transition f is either effected in the first state ST1, wherein a shadow operand does not exist or in the second state ST2, wherein a shadow operand exists. Regardless of the initial state STi, a completion of the sixth state transition f remains in the initial state STi in the end state STi.

The sixth state transition f effected by the instruction st $rl, $r2

The »store« instruction st $rl includes two operands which are held in the contents $rl of the first register rl and the contents $r2 of the second register r2. The operand in the contents $rl of the first register rl is a data value of the operand to be stored. The operand in the contents $r2 of the second register r2 specifies a target address of a memory cell in the first memory structure to which the operand has to be stored. FIG. 16 shows amendments in memory structures before - left section - and after - right section - the sixth state

transition f depicted in the subsequent FIG. 15.

As depicted, the contents $rl of the first register rl provides a data value dl which has to be stored as an operand and which is currently cached by the contents $rl of the first register rl . The contents $r2 of the second register r2 provide an address al for a memory cell in the first memory structure which is currently cached by the second register $r2.

After execution of the »store« instruction as follows:

st $rl, $r2

amendments in the memory structures are shown in the right section. There are no amendments in the second memory

structure including the data register dm, the address

register am and the modification indication register im.

In a boxed section below, wherein the structure and contents of the first memory structures used for accessing operands of the program is shown, an arbitrary data value d for the operand under the address al is stored prior to execution of the »store« instruction as shown in the left section of the undermost boxed area. The »store« instruction has amended the contents of this memory cell - see right section of the undermost boxed area within the first memory structure - by a value of dl which is the data value of the operand passed by the first register $rl .

FIG. 17 shows details of the seventh state transition g in the course of executing the »clear modification« instruction. According to an embodiment of the invention, processing a shadow operand is generally preceded by querying of data instructive of reading or writing a shadow operand. In order to clear a modification - which means that a relationship between an operand with its respective shadow operand is released or deleted - by a »clear modification« instruction using a given address, it is to be verified before, whether an existing shadow operand is associated with said given address. This check is previously performed by the »is modified« instruction.

The seventh state transition g is accordingly preceded by a second transition b starting in a second state ST2, in which a memory cell at a given address is modified, or, in other words: there is a shadow operand for a given operand stored in a given address. Accordingly, an »is modified« instruction ism $rl query will deliver a value of unequal zero meaning that a shadow operand is present. The »is modified«

instruction, consequently, does not lead to a state

transition. The state remains unaltered at the second state ST2. This is shown in the middle of FIG. 17.

The subsequent seventh state transition g is not changing the present second state ST2. This seventh state transition g is effected by the instruction

[$im ≠ 0] elm $rl

The preceding portion [$im ≠ 0] of this instruction is a condition or a state transition guard safeguarding that the remaining portion elm $rl is only executed when the returned value of the »is modified« query is unequal zero.

The following »clear modified« instruction elm $rl includes one operand held in the first register $rl. Said operand in register $rl has a data value of al, which is an address of a memory cell in the second memory structure, for which an »is modified« state has to be cleared. FIG. 18 shows amendments in memory structures before the second state transition b - left section -, after the second state transition b - centric section - and after the seventh state transition g - right section - depicted in the

subsequent FIG. 17.

As depicted, the contents of the first register $rl provides an address al for an operand whose association with a shadow operand has to be released or deleted.

After execution of the »is modified« instruction as follows: ism $rl

amendments in the memory structures are shown in the centric section. The »is modified« instruction begins with reading the contents $rl of register rl and passing the contents, i.e. the address al to a query for a presence of this address al in the address register $am. In the course of executing the »is modified« instruction ism $rl, the memory

modification unit sets the modification indicator $im from a former arbitrary value of d - see contents $im of

modification indication register im on the left section - to a value of 3 - see contents $im of modification indication register im in the centric section - since the queried address al is included in memory cell $a3 of the address register $am.

After execution of the »clear modification« instruction as follows :

elm $rl, $r2

amendments in the memory structures are shown in the right section .

The »clear modified« instruction uses the contents $im of modification indication register im with a value of 3 as index for accessing an address memory cell $a3 with index 3 in the address register $am. The former data value al - i.e. the address of the modified data or shadow operand associated with the operand for the same address al - contained in this address memory cell $a3 is overwritten by a value of 0 (zero) in the course of executing the »clear modified« instruction. In parallel, the former data value 3 contained in the

modification indication register $im is overwritten by a data value of 0 ( zero) .

There are no changes in memory cells of the first memory structure, see a boxed section below.

Turning back to FIG. 2, several embodiments are described wherein the access of shadow operands is not operated within registers of the central processing unit CPU but in the main memory MEM.

A major advantage of embodiments according to FIG. 2

- compared with embodiments having a memory organization shown in FIG. 1 - is obviously due to a larger available memory space of the second memory structure which is not limited to a register space according to embodiments of FIG. 1.

Due to the larger memory space of the second memory

structure, each operand - accessible in the main memory MEM by the program - may be associated by a respective shadow operand which is equally accessible in the main memory MEM so that within the main memory space an equal number of memory cells for storing shadow operands - or modified data values - and memory cells for storing operands - or unmodified data values - is provided.

Although embodiments according to FIG. 2 extend the storage space of the modifiable memory area, they might likely slow down execution times of an otherwise identical program which is due to a lower access time of memory cells in the main memory MEM compared to the faster access time of memory cells a register. Depending on the job at hand, a balance between the storage space of the modifiable memory and the access time will either favor implementations according to FIG. 1 described below or implementations according to FIG. 2 described hereinafter.

Another important difference is that embodiments according to FIG. 2 enable data seeding and fault injection into programs which have not been amended my Memory Modification Unit MEMOU functionality in terms of compiling and/or linking the program with program code providing the Memory Modification Unit MEMOU functionality for allocating a delimited memory structure, providing for registers or other memory cells under the control of the Memory Modification Unit MEMOU and providing extended instructions for accessing or

administering a shadow variable instead of a variable.

Referring now to FIG. 21 showing a state transition diagram for illustrating possible state transitions according to embodiments of the Memory Modification Unit MEMOU, wherein the first memory structure and the second memory structure are located within the main memory MEM.

In conformance with the state transition diagram according to FIG. 4, the state transition diagram according to FIG. 21 defines two similar states ST1, ST2 wherein a first state ST1 is characterized in that a memory cell at a given address is not modified - or in other words: there is no shadow operand for a given operand stored in a given address - and wherein a second state ST2 is characterized in that a memory cell at a given address is modified - or in other words: there is a shadow operand for a given operand stored in a given address.

Within the first state ST1 a query of whether a shadow operand - or modified data - is present would return a negative result or a »zero mark« explained below. Within the second state ST2 a query of whether a shadow operand - or modified data - is present would return a positive result which is unequal to the zero mark.

A »zero mark« is hereinafter denoted by an asterisk »*«. The zero mark * which indicates a non-modification is a special value which is not in the range of any data value.

The zero mark * can be realized in different ways, for example, including:

- One bit per modifiable memory cell: 0 (zero) means that the memory cell is not modified, 1 means that the memory cell is modified.

using indirect addressing, that is, a memory cell

contains an address and this address refers either to a memory cell with unmodified data - i.e. to the »original« memory cell - or to a memory cell with the modified data.

Unlike the state transition diagram according to FIG. 4, the state transition diagram according to FIG. 21 adds only two particular memory access instructions which are necessary for operating shadow operands along with the operands regularly used by the program. The two particular memory access

instructions include a »store modified« instruction stm and a clear modification elm instruction.

These instructions and their interplay with usual memory instructions, namely »store« or st and »load« or Id are influencing a state transition a, b, c, d, e, f, g, h as explained below .

The latter »usual« memory instructions refer to general instructions of accessing memory by the program under test which are extended with respect to their semantics and functionality as shown below. All instructions described below refer to a given adress addr which is passed as an operand addr for the given opcode of the instructions explained below. a) A first state transition a is changing from the first state ST1 into the second state ST2. This first state

transition a is effected by the instruction

stm , addr

wherein stm is the instruction for storing a shadow operand or modified data value. The instruction with an opcode »stm« includes two operands, wherein the first operand is

characterized by a place holder which means that the first operand does not affect the outcome of the instruction. The second operand of the stm instruction specifies an address addr of a memory cell. b) A second state transition b is remaining in the second state ST2. This first state transition a is effected by the instruction

stm , addr

which is identical to the instruction effecting the first state transition a as described above. c) A third state transition c is changing from the second state ST2 into the first state ST1. This second state

transition a is effected by the instruction

elm addr

wherein elm is the instruction for clearing an »is modified« state for a memory cell with the specific address addr. d) A fourth state transition d remaining in the first state ST1 is effected by the instruction

elm addr

which is identical to the instruction effecting the third state transition c as described above. e) A fifth state transition e remaining in the first state ST1 is effected by the instruction

Id , addr wherein Id is the instruction for loading an operand from a memory cell with the specific address addr. The first argument of the load instruction Id is specified by a placeholder since the target address of the load

instruction does not affect the outcome of the instruction. f) A sixth state transition f remaining in the second state ST2 is effected by the instruction

Id , addr

which is identical to the instruction effecting the fifth state transition e as described above. g) A seventh state transition g remaining in the first state ST1 is effected by the instruction

st , addr

wherein st is the instruction for storing an operand. The target address addr of the memory cell into which the operand has to be stored is specified by the second argument addr. The first argument of the store instruction st is specified by a placeholder since it does not affect the outcome of the instruction. h) An eighth state transition h remaining in the second state ST2 is effected by the instruction

st , addr

which is identical to the instruction effecting the seventh state transition g as described above.

A specific description of these state transitions

a, b, c, d, e, f, g, h is continued for embodiments referred to in FIG. 19 and FIG. 20.

FIG. 19 shows an exemplary memory structure, wherein the first memory structure and the second memory structure are located within the main memory MEM according to a first variant . The memory structure according to this first variant includes a first memory structure in a boxed section on top of FIG. 19 and a second memory structure in a boxed section on top of FIG. 19, both located within the main memory MEM.

The memory cells for an access of shadow operands within the second memory structure in the boxed section on top of

FIG. 19 are addressed by an address addri$m of a modified memory cell, wherein i is an index for respectively addressed memory cell and wherein an appendix »m«, a short for

»modified«, is attached to addresses of modified memory cells and modified data values or shadow operands. In FIG. 19 addresses addrl$m, addr2$m of two memory cells are depicted. The first memory cell addrl$m contains a modified data value datal$m of a shadow operand whereas the second memory cell addr2$m contains a zero mark * which indicates that no shadow operand is present under the address addr2$m.

The memory cells for an access of operands within the first memory structure in the boxed section at the bottom of

FIG. 19 are addressed by an address addri$o of memory cell, wherein i is an index for respectively addressed memory cell and wherein an appendix »o«, a short for »original«, is attached to addresses of memory cells and data values or operands. Alternatively, the addresses of operands within the first memory structure are simply noted as addri, which is suffiently distinguishing these address by an address of a modified memory cell. In FIG. 19 addresses addrl, addr2 of two memory cells are depicted. The first memory cell addrl contains a data value datal of an operand the second memory cell memory cell addr2 contains a data value data2 of an operand. The data value datai is a further short form of the expression datai$o. In the following, a complete set of instructions according to the first variant of this embodiment is specified. As in the previous embodiments, $rl and $r2 identify microcontroller registers .

A first instruction uses the »store modified« semantics as follows:

[true] stm $rl, $r2 -> st $rl, $r2$m

The first portion of this instruction:

[true]

expresses a condition which is generally enclosed by square brackets [...] . The expression [true] denotes a condition which is always valid. An arrow »->« denotes a term replacement whereby the term on the left side of the arrow is replaced by the term on the right side of the arrow. $m is again a short for »modified«. The expression $r2$m refers to the modified memory cell (which is addr$m) . The outcome of this

instruction is, that a modified data value is always stored in the modified memory cell.

This instruction covers the first and the second state transition a,b depicted in Fig. 21. The first state

transition a is executed by storing a modified value for a previously unmodified value, or, in other words: by storing a shadow operand under a given address, for which a shadow operand did not exist previously. The second state transition b is executed by storing a modified value for a previously modified value, or, in other words: by storing or rewriting a shadow operand under a given address, for which a shadow operand already exists. A second instruction uses the »clear modification« semantics as follows:

[true] elm $rl -> st *, $rl$m

This instruction covers the third and the fourth state transition c,d depicted in Fig. 21.

The second instruction always stores the zero mark * in the modified memory cell $rl$m indicating that the modification has been taken back. A third instruction uses the »load« semantics as follows: [$r2$m = * ] Id $rl, $r2 -> Id $rl, $r2$o

$r2$o refers to the original (unmodified) memory cell, whose address addr or, identically, addr$o. This instruction covers the fifth state transition e depicted in Fig. 21.

The first portion of this instruction:

[$r2$m = *] expresses a condition in that the remaining portion of this instruction is only executed, when for the address addr in register $r2 no modified data value is present, i.e. when the contents in a memory cell for this address return a zero mark. If this condition is true, then the unmodified or original data value is loaded.

A fourth instruction uses the »load« semantics as follows: [$r2$m ≠ * ] Id $rl, $r2 -> Id $rl, $r2$m

This instruction covers the sixth state transition f depicted in Fig . 21.

[$r2$m ≠ *] expresses a condition in that the remaining portion of this instruction is only executed, when for the address addr in register $r2 a modified data value is

present, i.e. when the contents in a memory cell for this address does not return a zero mark. If this condition is true, then the modified data value is loaded.

A fifth instruction uses the »store« semantics as follows: [true] st $rl, $r2 -> st $rl, $r2$o

This instruction covers the seventh and the eighth state transition g,h depicted in Fig. 21. The fifth instruction always stores the unmodified data value in the original memory cell.

FIG. 20 shows an exemplary memory structure, wherein the first memory structure and the second memory structure are located within the main memory MEM according to a second variant. Unlike the memory structure of FIG. 19, the memory structure of FIG. 20 is not organized in delimited sections for the first memory structure and the second memory

structure. However, the basic principles are still valid: Memory cells belonging to a second memory structure hold modified data values and memory cells belonging to a first memory structure hold original data values.

The memory organization according to FIG. 20 basically provides a multiplicity of three adjacent memory cells, each comprising an addressable address memory cell for indirectly addressing two data memory cells. The indirect addressing is either referencing a first data memory cell for accessing

- i.e. storing, reading or overwriting - an unmodified data value or operand, or a second data memory cell for accessing

- i.e. storing, reading or overwriting - a modified data value or shadow operand.

FIG 20 shows only one part of the multiplicity of three adjacent memory cells: - A first address memory cell is addressed by an address addri, wherein the contents of the address memory cell either provide an address addri$m of a modified memory cell - which is to be regarded as a memory cell of the second memory structure according to the nomenclature used in this specification - or an address addri$o of a not modified cell - which is to be regarded as a memory cell of the first memory structure according to the nomenclature used in this specification. The either-or- reference is depicted as addri$o|m for the contents of this first address memory cell, using a common operator.

A modified data memory cell is addressed by the address addri$m, wherein the contents of the modified data memory cell provide the modified data value datai$m.

An unmodified data memory cell is addressed by the address addri$o, wherein the contents of the unmodified data memory cell provide the unmodified data value datai$o . In the following, a complete set of instructions according to the second variant is shown. A first instruction uses the »store modified« semantics as follows :

[true] stm $rl, $r2 -> st $rl, $r2$m; st $r2$m, $r2

This instruction covers the first and the second state transition a,b depicted in Fig. 21.

The first portion of this instruction [true] denotes a condition which is always valid. An arrow »->« denotes a term replacement whereby the term on the left side of the arrow is replaced by the term on the right side of the arrow. The semicolon »;« chains 2 instructions in sequence.

The first part st $rl, $r2$m of the first instruction always stores a modified data value in the modified memory cell. Afterwards, by the chained instruction st $rl, $r2$m, an access to the memory cell is redirected to the memory cell with the modified value.

A second instruction uses the »clear modification« semantics as follows:

[true] elm $rl -> st $r2$o, $r2

This instruction covers the third and the fourth state transition c,d depicted in Fig. 21.

The second instruction always redirects accesses to the memory cell (back) to the (original) memory cell containing the unmodified data value. A third instruction uses the »load« semantics as follows: [true] Id $rl, $r2 -> Id $r3, $r2; Id $rl, $r3

This instruction covers the fifth and the sixth state

transition e.f depicted in Fig. 21.

The third instruction always resolves address indirection when accessing a memory cell. Afterwards the data value from the »redirected« memory cell is loaded. A fourth instruction uses the »store« semantics as follows: [true] st $rl, $r2 -> st $rl, $r2$o

This instruction covers the seventh and the eighth state transition g,h depicted in Fig. 21.

The third instruction always stores an unmodified data value into the original memory cell.

The disclosed embodiments relate to a method for memory modification resulting in a test probe for examining a program under test substantially during run-time. The ability to inject faults or errors in order to test the program's reaction to a fault in a particular state and to individually replace access to a regular operand by accessing a shadow operand allow for non-intrusive tests while the program is substantially executed in real-time and whereby the program itself is not substantially altered for testing purposes.

The disclosed embodiments provide for reliable statements on program behavior from non-intrusive tests that seed data or inject faults into the processor memory. It is not necessary to change a program under test on source code level to use instructions for accessing shadow operands. The program code or source code of a program to be tested is just compiled and/or linked together with a program code or source code providing the Memory Modification Unit MEMOU functionality disclosed herein.

Still another advantage is in that existing programs not using the instructions for accessing shadow operands operate as usual. In other words, extending a program under test with instructions for accessing shadow operands - or,

alternatively, using a central processing unit whose hardware is adapted for accessing shadow operands - is downward compatible .

The Memory Modification Unit MEMOU has full access to the complete memory, including data sections and code sections granting for accessing memory cells independently of whether they contain data values or program instructions. Test tools and tools for finding fault reasons - which are also referred to as debuggers - can easily be integrated with program translators - including compiler, linker, loader - because all these tools are able to use common memory maps. Memory maps are files which map human-readable, symbolic names of memory cells to physical addresses of memory cells for accessing memory cells for the purpose of reading or loading and for writing or storing.

During manipulation, original data values and modified data values are advantageously both kept and accessible at the same time, in different places, in the first and in the second memory structure, respectively.

By applying the Memory Modification Unit MEMOU, a behavior of automation and control programs, e.g. SIMATIC, or CNC

programs, e.g. SINUMERIC, can be analyzed during development, in lab and in field operation with tests that seed data or inject faults into program units at system levels without the need to recompile and redeploy the program under test which advantageously saves development and test efforts resulting in a reduction of costs and feedback cycles of programs to be developed or reengineered .

Functional safety standards of the IEC 61508 family highly recommend fault-injection tests for systems which are

classified in the highest safety levels. The Memory

Modification Unit MEMOU makes fault-injection tests feasible, affordable, quick and reliable.

As the complete memory of a processor is open, access to a Memory Modification Unit MEMOU must be secured. Modern operating systems offer for this purpose, for example, hierarchical protection domains, also known as protection rings. In order to grant for secure operations, access to special memory regions via a Memory Modification Unit MEMOU may be restricted to program code that runs in the most privileged ring 0 (kernel mode) . It is to be understood that the elements and features recited in the appended claims may be combined in different ways to produce new claims that likewise fall within the scope of the present invention. Thus, whereas the dependent claims appended below depend from only a single independent or dependent claim, it is to be understood that these dependent claims can, alternatively, be made to depend in the

alternative from any preceding or following claim, whether independent or dependent, and that such new combinations are to be understood as forming a part of the present

specification.

While the present invention has been described above by reference to various embodiments, it should be understood that many changes and modifications can be made to the described embodiments. It is therefore intended that the foregoing description be regarded as illustrative rather than limiting, and that it be understood that all equivalents and/or combinations of embodiments are intended to be

included in this description.