# US 2013/0212700 A1 · Exception handling in a data processing apparatus having a secure domain and a less secure domain

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2013/0212700 A1
- Document ID: US20130212700A1
- Status: Published application
- Kind: A1
- Application number: 13/741,709
- Filed: 2013-01-15
- Published: 2013-08-15
- Earliest claimed: 2012-02-08
- Assignees: Arm Limited
- Inventors: Thomas Christopher GROCUTT; Richard Roy Grisenthwaite
- Web page: https://patentgrep.com/patent/US20130212700A1

## CPC

- G06F 21/606: {by securing the transmission between two devices or processes}
- G06F 21/52: during program execution, e.g. stack integrity {; Preventing unwanted data erasure; Buffer overflow}
- G06F 9/3009: {Thread control instructions}
- G06F 9/30101: {Special purpose registers}
- G06F 21/74: operating in dual or compartmented mode, i.e. at least one secure mode
- G06F 2209/481: Exception handling
- G06F 2221/2105: Dual mode as a secondary aspect
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A data processing apparatus and method are provided for handling exceptions, including processing circuitry configured to perform data processing operations in response to program code, said circuitry including exception control circuitry. A plurality of registers are provided including a first and second subsets of registers, and a data store. The data store includes a secure region and a less secure region, wherein the secure region is for storing data accessible by the processing circuitry when operating in a secure domain and not accessible by the processing circuitry when operating in a less secure domain. The exception control circuitry performs state saving of data from the first subset of registers before triggering the processing circuitry to perform an exception handling routine corresponding to the exception. Where background processing was performed by the processing circuitry in the secure domain, the exception control circuitry performs additional state saving of the data.

## Claims

### Claim 1

A data processing apparatus comprising:
processing circuitry configured to perform data processing operations in response to program code, the processing circuitry comprising exception control circuitry for controlling exception processing;
a plurality of registers configured to store data, the registers including a first subset of registers and a second subset of registers; and
a data store configured to store data, the data store comprising a plurality of regions including a secure region and a less secure region, wherein the secure region is for storing data which is accessible by the processing circuitry when operating in a secure domain and not accessible by the processing circuitry when operating in a less secure domain; wherein:
in response to an initial exception from background processing performed by the processing circuitry, the exception control circuitry is configured to perform state saving of data from the first subset of registers before triggering the processing circuitry to perform an exception handling routine corresponding to the exception, wherein the exception handling routine has responsibility for performing state saving of data from the second subset of registers; and
in response to a first exception causing a transition from the secure domain to the less secure domain, where the background processing was performed by the processing circuitry in the secure domain, the exception control circuitry is configured to perform additional state saving of the data from the second subset of registers before triggering the processing circuitry to perform the exception handling routine in the less secure domain.

### Claim 2 (depends on 1)

The data processing apparatus according to claim 1, wherein in response to said first exception, the exception control circuitry is configured to clear the second subset of registers before triggering the processing circuitry to perform the exception handling routine.

### Claim 3 (depends on 2)

The data processing apparatus according to claim 2, wherein in response to said first exception, the data processing apparatus is configured to ensure that the first subset of registers do not contain secure data, before the exception control circuitry triggers the processing circuitry to perform the exception handling routine.

### Claim 4 (depends on 1)

The data processing apparatus according to claim 1, wherein if the exception control circuitry has performed the additional state saving before triggering the processing circuitry to perform the exception handling routine, then the exception handling routine does not perform the state saving of the second subset of registers.

### Claim 5 (depends on 1)

The data processing apparatus according to claim 1, wherein if the exception control circuitry has performed the additional state saving before triggering the processing circuitry to perform the exception handling routine, then the exception handling routine also performs state saving of the second subset of registers.

### Claim 6 (depends on 1)

The data processing apparatus according to claim 1, wherein said first exception comprises the initial exception occurring during the background processing.

### Claim 7 (depends on 1)

The data processing apparatus according to claim 1, wherein said first exception comprises a tail-chained exception processed after the initial exception has been processed and before returning to the background processing being performed before the initial exception.

### Claim 8 (depends on 1)

The data processing apparatus according to claim 1, wherein in response to a further exception that is pending when said initial exception has been processed and before the processing circuitry has returned to said background processing being performed before the initial exception, the exception control circuitry is configured to control processing of the further exception as a tail-chained exception before causing the processing circuitry to return to the background processing.

### Claim 9 (depends on 1)

A data processing apparatus according to claim 1, wherein:
said exception control circuitry is configured, in response to a new exception of lower priority than a current exception whose corresponding exception handling routine is still being performed, to control processing of the new exception as a tail-chained exception before causing the processing circuitry to return to the background processing;
the exception control circuitry being configured to perform no further state saving operations when controlling processing of the new exception except where said current exception is executed in said secure domain, said new exception indicates switching to said less secure domain, and said background processing was performed in said secure domain, whereupon said exception control circuitry is configured following completion of the exception handling routine for said current exception, to perform said additional state saving of the data from said second subset of registers and ensure said second subset of registers are cleared before triggering the processing circuitry to perform the exception handling routine corresponding to the new exception.

### Claim 10 (depends on 1)

A data processing apparatus according to claim 1, wherein:
said exception control circuitry is configured, in response to a new exception of lower priority than a current exception whose corresponding exception handling routine is still being performed, to control processing of the new exception as a tail-chained exception before causing the processing circuitry to return to the background processing;
the exception control circuitry being configured to perform no state restoring operation when controlling processing of the new exception except where said current exception is executed in said less secure domain, said new exception indicates switching to said secure domain, and said background processing was performed in said secure domain, whereupon said exception control circuitry is configured following completion of the exception handling routine for said current exception, to perform a state restoring operation of the data into said second subset of registers before triggering the processing circuitry to perform the exception handling routine corresponding to the new exception.

### Claim 11 (depends on 1)

The data processing apparatus according to claim 1, wherein if a pre-empting exception having a higher priority than said first exception occurs while performing the additional state saving of the second subset of registers, and the pre-empting exception does not require a transition from the secure domain to the less secure domain, the exception control circuitry is configured to reverse the additional state saving before triggering the processing circuitry to process the exception handling routine of the pre-empting exception.

### Claim 12 (depends on 1)

The data processing apparatus according to claim 1, wherein if a current exception does not cause a transition from the secure domain to the less secure domain, and if a pre-empting exception having a higher priority than the current exception and requiring a transition from the secure domain to the less secure domain occurs before processing of the exception handling routine associated with the current exception begins, the exception control circuitry is configured to additionally perform the additional state saving of the data from the second subset of registers before triggering the processing circuitry to process the exception handling routine of the pre-empting exception.

### Claim 13 (depends on 1)

The data processing apparatus according to claim 1, wherein if a pre-empting exception occurs after the exception control circuitry has triggered the processing circuitry to perform the exception handling routine corresponding to a current exception, but before that exception handling routine has completed, the exception control circuitry is configured to treat the current exception as said background processing when determining whether said state saving of said first subset of registers, or of said first and second subsets of registers is required before triggering the processing circuitry to perform the exception handling routine of the pre-empting exception.

### Claim 14 (depends on 1)

The data processing apparatus according to claim 1, wherein the data store comprises a plurality of stacks including a secure stack in the secure region and a less secure stack in the less secure region.

### Claim 15 (depends on 14)

The data processing apparatus according to claim 14, wherein in the state saving of data from the first subset of registers and the additional state saving of data from the second subset of registers, the exception control circuitry is configured to save the data to the one of the secure stack and the less secure stack corresponding to the security of the domain in which the processing circuitry was operating when performing said background processing.

### Claim 16 (depends on 1)

A data processing apparatus according to claim 1, further comprising a secure configuration storage location for storing a secure configuration value indicating which of said plurality of registers are available for use by currently executing code for storing secure data, wherein in response to an exception causing the transition from the secure domain to the less secure domain, the exception control circuitry is configured to include within said second subset of registers one or more of the registers indicated by said secure configuration value.

### Claim 17 (depends on 1)

A data processing apparatus according to claim 1, further comprising a storage location for storing an exception return value, said processing circuitry being configured to set a domain value within said exception return value to indicate the domain said data processing apparatus is operating in on taking an initial exception from said background processing, said exception control circuitry determining which of said registers should be subjected to state saving or state restoring operations in dependence upon said domain value.

### Claim 18

A data processing apparatus comprising:
data processing circuitry for performing data processing operations in response to program code;
a plurality of registers; and
a data store for storing data, said data store comprising a plurality of regions each region having a secure level, and comprising at least one secure region for storing sensitive data accessible by said data processing circuitry operating in said secure domain and not accessible by said data processing circuitry operating in a less secure domain and a less secure region for storing less secure data;
said data store comprising at least two stacks a secure stack in said secure region and a less secure stack in said less secure region; wherein
said data processing circuitry comprises exception handling circuitry, said exception handling circuitry being configured to respond to receipt of an exception when said data processing circuitry is executing in said secure domain and said exception indicates switching to executing program code in a less secure domain to clear a set of said registers, said registers within said set of said registers depending on a secure level of said domain of execution and said domain said exception is to be taken in.

### Claim 19 (depends on 18)

A data processing apparatus according to claim 18, wherein said data processing circuitry is further configured to save state stored in said set of said registers to said stack of said domain said data processing circuitry is executing in prior to clearing said set of said registers.

### Claim 20 (depends on 18)

A data processing apparatus according to claim 18, wherein said data processing apparatus comprises a secure configuration storage location for storing a value indicating which of said plurality of registers are available for use by currently executing code for storing secure state, said data processing circuitry being configured to determine which registers are within said set of registers in dependence upon said plurality of registers indicated by said secure configuration value and a secure level of said domain of execution and said domain said exception is to be taken in.

### Claim 21

A method of processing data on a data processing apparatus, said data processing apparatus comprising processing circuitry for performing data processing operations in response to program code, the processing circuitry comprising exception control circuitry for controlling exception processing, a plurality of registers for storing data, the registers including a first subset of registers and a second subset of registers, and a data store for storing data, the data store comprising a plurality of regions including a secure region and a less secure region, wherein the secure region is for storing data which is accessible by the processing circuitry when operating in a secure domain and not accessible by the processing circuitry when operating in a less secure domain, said method comprising:
in response to an initial exception from background processing performed by the processing circuitry, employing the exception control circuitry to perform state saving of data from the first subset of registers before triggering the processing circuitry to perform an exception handling routine corresponding to the exception, wherein the exception handling routine has responsibility for performing state saving of data from the second subset of registers; and
in response to a first exception causing a transition from the secure domain to the less secure domain, where the background processing was performed by the processing circuitry in the secure domain, employing the exception control circuitry to perform additional state saving of the data from the second subset of registers before triggering the processing circuitry to perform the exception handling routine in the less secure domain.

### Claim 22

A data processing apparatus comprising:
processing means for performing data processing operations in response to program code, the processing means comprising exception control means for controlling exception processing;
a plurality of register means for storing data, including a first subset of register means and a second subset of register means; and
data store means for storing data, the data store means comprising a plurality of regions including a secure region and a less secure region, wherein the secure region is for storing data which is accessible by the processing means when operating in a secure domain and not accessible by the processing means when operating in a less secure domain; wherein:
in response to an initial exception from background processing performed by the processing means, the exception control means performs state saving of data from the first subset of register means before triggering the processing means to perform an exception handling routine corresponding to the exception, wherein the exception handling routine has responsibility for performing state saving of data from the second subset of register means; and
in response to a first exception causing a transition from the secure domain to the less secure domain, where the background processing was performed by the processing means in the secure domain, the exception control means performs additional state saving of the data from the second subset of register means before triggering the processing means to perform the exception handling routine in the less secure domain.
