(19)
(11)EP 3 306 470 B1

(12)EUROPEAN PATENT SPECIFICATION

(45)Mention of the grant of the patent:
27.07.2022 Bulletin 2022/30

(21)Application number: 16854908.7

(22)Date of filing:  09.10.2016
(51)International Patent Classification (IPC): 
G06F 13/24(2006.01)
G06F 9/48(2006.01)
(52)Cooperative Patent Classification (CPC):
G06F 9/4812; G06F 13/24
(86)International application number:
PCT/CN2016/101592
(87)International publication number:
WO 2017/063529 (20.04.2017 Gazette  2017/16)

(54)

METHOD AND APPARATUS FOR EXECUTING NON-MASKABLE INTERRUPT

VERFAHREN UND VORRICHTUNG ZUR AUSFÜHRUNG EINER NICHT-MASKIERBAREN UNTERBRECHUNG

PROCÉDÉ ET APPAREIL POUR EXÉCUTER UNE INTERRUPTION NON MASQUABLE


(84)Designated Contracting States:
AL AT BE BG CH CY CZ DE DK EE ES FI FR GB GR HR HU IE IS IT LI LT LU LV MC MK MT NL NO PL PT RO RS SE SI SK SM TR

(30)Priority: 16.10.2015 CN 201510677146

(43)Date of publication of application:
11.04.2018 Bulletin 2018/15

(60)Divisional application:
22179800.2

(73)Proprietor: Huawei Technologies Co., Ltd.
Longgang District Shenzhen, Guangdong 518129 (CN)

(72)Inventors:
  • MA, Jun
    Shenzhen Guangdong 518129 (CN)
  • DING, Tianhong
    Shenzhen Guangdong 518129 (CN)
  • TONG, Zhaozhe
    Shenzhen Guangdong 518129 (CN)

(74)Representative: Thun, Clemens 
Mitscherlich PartmbB Patent- und Rechtsanwälte Sonnenstraße 33
80331 München
80331 München (DE)


(56)References cited: : 
CN-A- 1 070 496
CN-A- 102 591 719
CN-A- 105 279 021
US-A1- 2008 098 264
CN-A- 102 483 713
CN-A- 102 708 015
GB-A- 2 259 167
US-B2- 7 117 284
  
  • ANONYMOUS: "ARMv7-A and ARMv7-R edition ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition", ARM. ALL RIGHTS RESERVED. ARM DDI 0406C.C NON-CONFIDENTIAL ID051414 COPYRIGHT, 1 January 2014 (2014-01-01), pages 1211-1255, XP055489246,
  • Anonymous: "Interrupt vector table - Wikipedia", , 20 October 2014 (2014-10-20), pages 1-2, XP055489260, Retrieved from the Internet: URL:https://en.wikipedia.org/w/index.php?t itle=Interrupt_vector_table&direction=prev &oldid=690068087 [retrieved on 2018-06-29]
  
Note: Within nine months from the publication of the mention of the grant of the European patent, any person may give notice to the European Patent Office of opposition to the European patent granted. Notice of opposition shall be filed in a written reasoned statement. It shall not be deemed to have been filed until the opposition fee has been paid. (Art. 99(1) European Patent Convention).


Description

TECHNICAL FIELD



[0001] Embodiments of the present invention relate to the server field, and more specifically, to a method and an apparatus for executing a non-maskable interrupt.

BACKGROUND



[0002] Generally, a server imposes an extremely high requirement on system stability. A system status can be periodically saved when a system runs normally, and some key data also needs to be saved when the system is abnormal, so as to provide data support for locating a system error cause. When the system runs normally, there may be multiple methods and means to save system data. However, when the system is abnormal-crash for a most severe case, all routine methods and means are infeasible, and all interrupts cannot be responded to. In this case, a non-maskable interrupt (NMI) mechanism is required to save data.

[0003] The NMI is an interrupt that cannot be masked by a central processing unit (CPU). Regardless of a status of an interrupt flag (IF) bit, the CPU needs to make a response after receiving a valid NMI. The NMI is generally used to process faults, such as a coprocessor operation error, a memory verification error, and an input/output (I/O) port verification error, and is used to save an error status, exception information, and the like of an operating system (OS). Therefore, the NMI is an extremely important fault locating means in the current server field, and also is an extremely important feature in terms of a product itself.

[0004] Currently, architectures such as X86 and Million Instructions Per Second (MIPS) have corresponding NMI implementation mechanisms. Mainly, an interrupt is triggered periodically or triggered by a hardware fault, and the interrupt cannot be masked. The interrupt can be responded to even if a deadlock occurs in the system. The architectures such as X86 and MIPS make, by means of hardware, the system save data related to the NMI and execute user-defined processing such as writing a system log and resetting a watchdog timer in a non-secure mode. However, in an advanced reduced instruction set computing machine (ARM) architecture, no corresponding hardware can implement the NMI in the non-secure mode. Moreover, the existing arm-v8 specification and software solution do not support the NMI mechanism. Therefore, a method needs to be provided to implement the NMI mechanism without hardware support.

[0005] GB 2 259 167 A discloses to provide a dedicated memory area (SMRAM) on a microprocessor system for storing a customizable system interrupt service routine, and for storing at the time of interruption.

[0006] ANONYMOUS, "ARMv7-A and ARMv7-R edition ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition", ARM. ALL RIGHTS RESERVED. ARM DDI 0406C.C NON-CONFIDENTIAL ID051414 COPYRIGHT, (20140101), pages 1211 - 1255, XP055489246, indicates advanced SIMD and floating-point support, thumb execution environment and traps to the hypervisor.

[0007] Anonymous, "Interrupt vector table - Wikipedia", (20141020), pages 1 - 2, URL https://en.wikipedia.org/w/index.php?title=Interrupt_vector_table&direction=prev&ol did=690068087, (20180629), XP055489260, discloses the definition, background and handling method of interrupt handlers.

SUMMARY



[0008] Embodiments of the present invention provide a method and an apparatus for executing a non-maskable interrupt, and an NMI mechanism can be easily implemented in an ARM architecture without depending on hardware.

[0009] According to a first aspect, the present invention provides a method for executing a non-maskable interrupt, including: obtaining a secure interrupt request in a non-secure mode, and interrupting an operation of an operating system, OS, where the secure interrupt request cannot be masked; entering a secure mode by using the secure interrupt request, and saving, in the secure mode, an interrupt context of an OS status when the operation of the OS is interrupted; returning to the non-secure mode to execute user-defined processing; after the user-defined processing is completed, entering the secure mode again, and resuming the OS status in the secure mode according to the interrupt context; and returning to the non-secure mode again, and continuing to execute an operation of the OS.

[0010] Before the method is executed, a corresponding register and exception vector table may be preconfigured, so that a non-maskable interrupt procedure can be executed after the secure interrupt request is obtained.

[0011] For example, in an ARM architecture, an FIQ bit of a register SCR_EL3 is preconfigured to 1. Therefore, when obtaining a secure interrupt request FIQ, a system can learn that the non-maskable interrupt needs to be executed, so as to turn to the exception vector table to search for a mode that the system needs to be routed to. In preconfiguration for the exception vector table, an address may be initialized to VBAR EL3, so that the system enters the non-secure mode when executing the non-maskable interrupt.

[0012] Based on the foregoing technical solution, according to the method for executing a non-maskable interrupt in this embodiment of the present invention, a system enters, by using a secure interrupt request, a secure mode to save an interrupt context of an OS status during an interrupt; after returning to a non-secure mode to execute user-defined processing, enters the secure mode again to resume the OS status; and after resuming the OS status, returns to the non-secure mode again to continue to execute an operation of an OS. Therefore, an NMI procedure can be easily implemented without depending on hardware.

[0013] With reference to the first aspect, in an implementation manner of the first aspect, the returning to the non-secure mode to execute user-defined processing includes: after the interrupt context is saved in the secure mode, returning to the non-secure mode according to an exception return address of the secure mode, and executing a user-defined function to complete the user-defined processing.

[0014] With reference to either the first aspect or the foregoing corresponding implementation manner, in another implementation manner of the first aspect, before the returning to the non-secure mode according to an exception return address of the secure mode, and executing a user-defined function to complete the user-defined processing, the method further includes: calling an interface function when a kernel of the non-secure mode is started, where the interface function records an address of the user-defined function into the exception return address in the secure mode by using a secure monitor call, SMC, instruction.

[0015] With reference to any one of the first aspect or the foregoing corresponding implementation manners, in another implementation manner of the first aspect, the method further includes: preconfiguring an address of a saving function in the exception vector table of the secure mode, where the saving function is used to save the interrupt context of the OS status when the operation of the OS is interrupted; and the entering a secure mode by using the secure interrupt request includes: when the secure interrupt request is generated, entering the secure mode according to the address of the saving function, to execute the saving function.

[0016] According to a second aspect, the present invention provides an apparatus for executing a non-maskable interrupt, including an interruption module, a saving module, a first execution module, a resumption module, and a second execution module, configured to execute the method for executing a non-maskable interrupt according to the first aspect and the implementation manners corresponding to the first aspect. The interruption module is configured to obtain a secure interrupt request in a non-secure mode, and interrupt an operation of an operating system OS. The saving module is configured to enter a secure mode by using the secure interrupt request, and save, in the secure mode, an interrupt context of an OS status when the operation of the OS is interrupted. The first execution module is configured to return to the non-secure mode to execute user-defined processing. The resumption module is configured to: after the user-defined processing is completed, enter the secure mode again, and resume the OS status according to the interrupt context. The second execution module is configured to return to the non-secure mode, and continue to execute an operation of the OS.

[0017] With reference to the second aspect, in an implementation manner of the second aspect, the first execution module is specifically configured to: after the interrupt context is saved in the secure mode, return to the non-secure mode according to an exception return address of the secure mode, and execute a user-defined function to complete the user-defined processing.

[0018] With reference to either the second aspect or the foregoing corresponding implementation manner, in another implementation manner of the second aspect, the apparatus further includes an interface calling module, configured to: before the first execution module returns to the non-secure mode according to the exception return address of the secure mode, and executes the user-defined function to complete the user-defined processing, call an interface function when a kernel of the non-secure mode is started, where the interface function records an address of the user-defined function into the exception return address of the secure mode in the secure mode by using a secure monitor call SMC instruction.

[0019] With reference to any one of the second aspect or the foregoing corresponding implementation manners, in another implementation manner of the second aspect, the saving module is specifically configured to capture, by using secure monitor Secure Monitor software running in the secure mode, the secure interrupt request to enter the secure mode, and save, in the secure mode by using the Secure Monitor software, the interrupt context of the OS status when the operation of the OS is interrupted.

[0020] With reference to any one of the second aspect or the foregoing corresponding implementation manners, in another implementation manner of the second aspect, the apparatus further includes a preconfiguration module, configured to preconfigure an address of a saving function in an exception vector table of the secure mode, where the saving function is used to save the interrupt context of the OS status when the operation of the OS is interrupted; and the saving module is specifically configured to: when the secure interrupt request is generated, and the secure interrupt request cannot be masked, directly enter the secure mode according to the address of the saving function that is preconfigured by the preconfiguration module, to execute the saving function.

[0021] According to a third aspect, the present invention provides a computer program product comprising computer program instructions that when executed by a processing apparatus cause the processing apparatus to perform the method according to the first aspect and the implementation manners corresponding to the first aspect.

[0022] In the first aspect to the third aspect and the corresponding implementation manners, the secure interrupt request is a fast interrupt request FIQ.

[0023] In the first aspect to the third aspect and the corresponding implementation manners, the user-defined processing may be an instruction that is defined by a user and can be executed in the non-secure mode of a non-maskable interrupt procedure. The user-defined processing may include at least one of saving a system log, reporting an OS status, or resetting a watchdog timer.

[0024] According to the method and the apparatus for executing a non-maskable interrupt in the embodiments of the present invention, corresponding preconfiguration is performed for a secure interrupt request, so that when the secure interrupt request is obtained, a secure mode is directly entered free from masking of hardware (such as MASK), to save an interrupt context of an interrupt procedure; then, switching is performed between the secure mode and a non-secure mode by using secure monitor software of the secure mode, to implement subsequent processing such as user-defined processing, OS status resumption, and continuing to execute an operation of an OS. Therefore, a non-maskable interrupt procedure can be easily implemented without depending on hardware.

BRIEF DESCRIPTION OF DRAWINGS



[0025] To describe the technical solutions in the embodiments of the present invention more clearly, the following briefly describes the accompanying drawings required for describing the embodiments. Apparently, the accompanying drawings in the following description show merely some embodiments of the present invention, and a person of ordinary skill in the art may still derive other drawings from these accompanying drawings without creative efforts.

FIG. 1 is a schematic flowchart of a method for executing a non-maskable interrupt according to an embodiment of the present invention;

FIG. 2 is a schematic flowchart of a method for executing a non-maskable interrupt according to another embodiment of the present invention;

FIG. 3 is a schematic flowchart of a method for executing a non-maskable interrupt according to another embodiment of the present invention;

FIG. 4 is a schematic flowchart of preconfiguration of an FIQ according to an embodiment of the present invention;

FIG. 5 is a schematic flowchart of preconfiguration of a user-defined function according to an embodiment of the present invention;

FIG. 6 is a schematic block diagram of an apparatus for executing a non-maskable interrupt according to an embodiment of the present invention; and

FIG. 7 is a schematic block diagram of an apparatus for executing a non-maskable interrupt according to another embodiment of the present invention.


DESCRIPTION OF EMBODIMENTS



[0026] The following clearly describes the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Apparently, the described embodiments are some but not all of the embodiments of the present invention. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0027] The following briefly describes several basic concepts related to embodiments of the present invention.

[0028] NMI: non-maskable interrupt, that is, interrupt that cannot be masked by a central processing unit (CPU). Regardless of a status of an interrupt flag (IF) bit, the CPU needs to make a response after receiving a valid NMI. The NMI is generally used to process faults, such as a coprocessor operation error, a memory verification error, and an input/output (I/O) port verification error, and is used to save an error status, exception information, and the like of an operating system (OS).

[0029] EL0: exception level (Exception Level) 0, referring to a running environment of application software in an ARM architecture, belonging to a non-secure mode, and also referred to as Normal World.

[0030] EL1: exception level (Exception Level) 1, referring to a running environment of a kernel in an ARM architecture, and belonging to a non-secure mode. The kernel is a kernel of an operating system, and refers to a core part of most operating systems (OS). The kernel includes parts that are in the OS and used to manage a memory, a file, a peripheral, and a system resource. The kernel is generally used to run a process and provide communication between processes.

[0031] EL3: Exception Level 3, generally used to run secure monitor software, such as open-source software Trust Firmware that can be obtained from the Internet, in an ARM architecture. EL3 belongs to a secure mode, and is also referred to as Secure World.

[0032] Secure interrupt request: interrupt that can be processed by code of a secure mode.

[0033] FIQ: fast interrupt request (Fast Interrupt Request, FIQ). During interruption, a system performs optimization to reach a purpose of processing the request rapidly and in real-time. The FIQ needs to be processed as soon as possible, and after processing is completed, system software leaves this mode. An interrupt request (Interrupt Request, IRQ) may be interrupted by the FIQ, but the IRQ cannot interrupt the FIQ.

[0034] A method in the embodiments of the present invention may be applied to an ARM architecture, for example, applied to an ARM64 architecture; or may be applied to a system with a non-ARM architecture. All systems that can run secure monitor software or can generate an interrupt similar to a secure interrupt can use an idea of the present invention to implement an NMI mechanism.

[0035] According to a method for executing a non-maskable interrupt in the embodiments of the present invention, corresponding preconfiguration is performed for a secure interrupt request, so that when the secure interrupt request is obtained, a secure mode is directly entered free from masking of hardware (such as MASK), to save an interrupt context of an interrupt procedure. Then, switching is performed between the secure mode and a non-secure mode by using secure monitor software of the secure mode, to implement subsequent processing such as user-defined processing, OS status resumption, and continuing to execute an operation of an OS. Therefore, a non-maskable interrupt procedure can be easily implemented without depending on hardware.

[0036] Specifically, FIG. 1 is a schematic flowchart of a method 100 for executing a non-maskable interrupt according to an embodiment of the present invention. The method 100 may include the following steps:

[0037] S110. Obtain a secure interrupt request in a non-secure mode, and interrupt an operation of an operating system OS, where the secure interrupt request cannot be masked.

[0038] S120. Enter a secure mode by using the secure interrupt request, and save, in the secure mode, an interrupt context of an OS status when the operation of the OS is interrupted.

[0039] S130. Return to the non-secure mode to execute user-defined processing.

[0040] S140. After the user-defined processing is completed, enter the secure mode again, and resume the OS status in the secure mode according to the interrupt context.

[0041] S150. Return to the non-secure mode again, and continue to execute an operation of the OS.

[0042] Before the method is executed, a corresponding register and exception vector table may be preconfigured, so that a non-maskable interrupt procedure can be executed after the secure interrupt request is obtained.

[0043] For example, in an ARM architecture, an FIQ bit of a register SCR_EL3 is preconfigured to 1. Therefore, when obtaining a secure interrupt request FIQ, a system can learn that a non-maskable interrupt needs to be executed, so as to turn to the exception vector table to search for a mode that the system needs to be routed to. In preconfiguration for the exception vector table, an address may be initialized to VBAR_EL3, so that the system enters the non-secure mode when executing the non-maskable interrupt.

[0044] It should be understood that the user-defined processing may be an instruction that is defined by a user and can be executed in the non-secure mode of a non-maskable interrupt procedure.

[0045] According to the method for executing a non-maskable interrupt in this embodiment of the present invention, a system enters, by using a secure interrupt request, a secure mode to save an interrupt context of an OS status during an interrupt; after returning to a non-secure mode to execute user-defined processing, enters the secure mode again to resume the OS status; and after resuming the OS status, returns to the non-secure mode again to continue to execute an operation of an OS. Therefore, an NMI can be easily implemented without depending on hardware.

[0046] The secure interrupt request in this embodiment of the present invention may be a fast interrupt request FIQ, or may be another type of secure interrupt request processed by code of the secure mode, and this is not limited in this embodiment of the present invention. This specification uses the FIQ as an example for description, and a case of another secure interrupt request is similar to this and is not repeatedly described.

[0047] This specification uses the ARM architecture as an example for description. In the ARM architecture, a non-secure mode may include at least one of EL0 or EL1, and a secure mode may include EL3.

[0048] Specifically, FIG. 2 and FIG. 3 show schematic flowcharts of executing a non-maskable interrupt according to an embodiment of the present invention. A process of executing the non-maskable interrupt may include the following steps.

[0049] S210. A watchdog (Watch Dog) generates a secure interrupt request, where the secure interrupt request may be an FIQ. An OS may periodically trigger the watchdog to generate the secure interrupt request or a hardware fault triggers the watchdog to generate the secure interrupt request, and this is not limited in this embodiment of the present invention.

[0050] To ensure running stability, the OS needs to periodically save an OS status, so as to periodically trigger the watchdog to generate the FIQ.

[0051] Hardware may be various types of hardware devices generating an interrupt, also referred to as an interrupt source (Interrupt Source), and may include a network card (that is, a network interface board, also referred to as a communications adapter, a network adapter (Network Adapter), or a network interface card (Network Interface Card, NIC)), a hard disk (SATA), a watchdog, and the like. When a fault occurs on the hardware, the watchdog may be triggered to generate the FIQ.

[0052] S220. After the watchdog generates the FIQ, a generic interrupt controller (Generic Interrupt Controller, GIC) captures this interrupt request, and sends the FIQ to an interface of a central processing unit (Central Processing Unit, CPU). In this case, regardless of a status of the CPU, the CPU stops making a work response, that is, interrupts an operation of the OS, and processes the FIQ.

[0053] The GIC is a hardware module for controlling and reporting an interrupt, and is a common module in an ARM architecture.

[0054] S230. The FIQ causes the CPU to enter an EL3 mode, and the FIQ cannot be masked and is captured by secure monitor software (such as trust firmware) running in the EL3 mode. After the secure monitor software captures the FIQ, the CPU determines an address of a saving function in the EL3 mode according to an exception vector table of the EL3 mode.

[0055] The FIQ cannot be masked, so that the CPU enters the EL3 mode by means of preconfiguration, and this is specifically described in a preconfiguration procedure 300 in the following.

[0056] S240. Execute the saving function, and save, in the EL3 mode, an interrupt context (Context, or referred to as a scenario) of an OS status when the operation of the OS is interrupted.

[0057] The interrupt context is related data generated when a system is interrupted. Generally, the interrupt context may include an X0-X30 status, ELR_EL3, an SPSR_EL3 status, and the like. X0-X30 is a general register, ELR_EL3 is an address in which the system exceptionally returns to another level from EL3, and SPSR_EL3 is a status of an exception return in EL3.

[0058] S250. After the interrupt context is saved, return to a user-defined function of a non-secure mode (in a kernel of an EL1 mode) according to an exception return address. Before the system returns to the non-secure mode, the saved interrupt context may be saved as a backup together with SP_EL0, SP_EL1, SP_EL2, and the like. SP_EL0 means data in a stack point (Stack Point, SP) of an EL0 level, SP_EL1 means data in an SP used by an EL1 level, and SP_EL2 means data in an SP used by an EL2 level.

[0059] The exception return address needs to be preconfigured by means of registration when the system is initialized, and this is specifically described in a preconfiguration procedure 400 in the following.

[0060] S260. In the kernel of the EL1 mode, execute the user-defined function to complete user-defined processing.

[0061] The user-defined processing may be an instruction that is defined by a user and can be executed in the non-secure mode of the non-maskable interrupt procedure. The user-defined processing may be customized by a user according to a system requirement, for example, may include at least one of saving a system log, reporting an OS status, or resetting a watchdog timer, so as to complete some usual subsequent processing of this interrupt, such as saving a system log, reporting an OS status of this interrupt, and emptying a Watch Dog timer.

[0062] The user-defined processing may further include some other processing defined by the user, and this is not limited in this embodiment of the present invention. The user-defined function may include an address of a function entered when the EL3 mode is entered again.

[0063] In the EL3 mode of the ARM architecture, the user-defined processing in this embodiment of the present invention cannot be implemented. Therefore, the system needs to return to the non-secure mode (the EL1 mode) for execution.

[0064] S250 and S260 may correspond to S130 of returning to the non-secure mode to execute user-defined processing, and include: after the interrupt context is saved in the secure mode, returning to the non-secure mode according to the exception return address of the secure mode, and executing the user-defined function to complete the user-defined processing.

[0065] S270. After the user-defined processing is completed, enter, by using a general secure monitor call (Secure Monitor Call, SMC) instruction in the ARM architecture, EL3 from EL1 again, that is, the secure mode, and enter a function in S260. The function may be a resumption function, used to resume the OS status according to the interrupt context, and this embodiment of the present invention is not limited thereto.

[0066] S280. After the interrupt context is resumed, return to the non-secure mode, and continue to execute the operation of the OS when the interrupt is generated.

[0067] It should be understood that when the method in this embodiment of the present invention runs in the EL3 mode, corresponding processing may be completed by using the Secure Monitor software. The Secure Monitor software may be a type of software running in the EL3 mode. The Secure Monitor software may be executed each time the CPU is switched between the secure mode and the non-secure mode. The Secure Monitor software is mainly responsible for secure and stable switching of a context (Context) when the CPU is switched between the two modes. Therefore, it may be considered that an NMI mechanism in this embodiment of the present invention is implemented on a basis of software.

[0068] In this embodiment of the present invention, Trust Firmware software is used as an example of the Secure Monitor software for description. Certainly, other Secure Monitor software may also be used, and this is not limited in this embodiment of the present invention.

[0069] In this embodiment of the present invention, to enable the system to execute the non-maskable interrupt, the system needs to run the trust firmware software in the EL3 mode. In a system startup process, an FIQ needs to be preconfigured in a process of initializing the trust firmware, so that the FIQ can be used as a secure interrupt request.

[0070] Therefore, in this embodiment of the present invention, S120 of entering a secure mode by using the secure interrupt request, and saving, in the secure mode, an interrupt context of an OS status when the operation of the OS is interrupted may include: capturing, by using the secure monitor Secure Monitor software running in the secure mode, the secure interrupt request to enter the secure mode, and saving, in the secure mode by using the Secure Monitor software, the interrupt context of the OS status when the operation of the OS is interrupted.

[0071] Specifically, for example, a process of preconfiguring the FIQ may be the procedure 300 shown in FIG. 4, including the following steps:

[0072] S310. At a system startup stage, initialize an exception vector table, and initialize an address of the exception vector table (runtime_exceptions) to VBAR_EL3. Therefore, when the FIQ is captured, the CPU may enter the EL3 mode according to the exception vector table.

[0073] S320. Configure an FIQ bit of a register SCR_EL3 to 1. Therefore, when the FIQ is generated, the system may learn that the non-maskable interrupt needs to be executed, and then turns to the exception vector table to search for a mode that the system needs to be routed to.

[0074] S330. Configure hardware of the system, and define a feature of an interrupt generated by the FIQ. This step includes: configuring GICC FIQEn to 1, that is, an interrupt of Group0 is of an FIQ form, and configuring an FIQBypDisGrp0 bit of GICC to 0. Group0 and Group 1 of GICD are enabled to set that interrupt enabling of all secure interrupt requests is cleared before an interrupt, and set no priority differentiation. GICC PMR is set to skip masking any interrupt. An interrupt priority corresponding to a secure interrupt number is set to 0, that is, a highest priority. An interrupt grouping register is set, that is, a corresponding secure interrupt number is set to Group0.

[0075] Corresponding to the method 100, the method 100 may further include:
preconfiguring an address of a saving function in an exception vector table of the secure mode, where the saving function is used to save the interrupt context of the OS status when the operation of the OS is interrupted.

[0076] S120 of entering a secure mode by using the secure interrupt request, and saving, in the secure mode, an interrupt context of an OS status when the operation of the OS is interrupted may include:
when the secure interrupt request is generated, and the secure interrupt request cannot be masked, entering the secure mode according to the address, to execute the saving function.

[0077] It should be understood that the preconfiguration process may be executed in another process started by the system, other than executed when the trust firmware is initialized. Alternatively, the procedure may be divided and executed at different startup stages of the system, and a preconfiguration sequence may be not limited to the sequence provided in the procedure 300.

[0078] In this embodiment of the present invention, after the interrupt context is saved, the system returns to a user-defined function of a non-secure mode (in a kernel of the EL1 mode) according to the exception return address. The exception return address may be preconfigured according to the procedure 400 shown in FIG. 5, and is used to register, in the secure mode, an interrupt interface function of an NMI of an OS running in the non-secure mode.

[0079] S410. Start a kernel and load code of another module other than the kernel.

[0080] S420. Call an interrupt interface function (such as register_nmi_handler). An address of a user-defined function (such as nmi_handler) executed by the EL1 mode is transferred, by the function by using an SMC instruction, to trust firmware software in the EL3 mode, and is recorded.

[0081] Specifically, the interrupt interface function may send two parameters to the trust firmware by using the SMC instruction. A parameter 0 is an address of a user-defined function, and the user-defined function may be a function customized by the user according to a requirement. A parameter 1 is an SMC function identifier (ID), and may be set to 0x83000000 according to an SMC calling specification, for example. 0x83000000 may be an identifier ID defined by an original equipment manufacture (OEM) . 0x83000000 meets the SMC calling specification, and implements a function of saving the address of the user-defined function. Then, the system enters the trust firmware software of the EL3 mode, confirms the SMC function ID, and saves a user-defined function nmi_handler.

[0082] Correspondingly, before the returning to the non-secure mode according to an exception return address of the secure mode, and executing a user-defined function to complete the user-defined processing, the method further includes:
calling an interface function when the kernel of the non-secure mode is started, where the interface function records an address of the user-defined function into the exception return address in the secure mode by using a secure monitor call SMC instruction.

[0083] It should be understood that another manner, such as an interrupt manner, may also be used in this embodiment of the present invention to transmit the address of the user-defined function to the trust firmware software, and this is not limited in this embodiment of the present invention.

[0084] In addition, in the ARM architecture in this embodiment of the present invention, when another type of interrupt occurs in the system, that is, a maskable interrupt, an IRQ may be still generated in the existing manner. Corresponding hardware such as IRQ MASK masks the maskable interrupt, so that the non-secure mode such as EL0 run by application software or EL1 run by the kernel does not sense the interrupt. An implementation manner of the maskable interrupt is not limited in this embodiment of the present invention.

[0085] It should also be understood that sequence numbers of the foregoing processes do not mean execution sequences in various embodiments of the present invention. The execution sequences of the processes should be determined according to functions and internal logic of the processes, and should not be construed as any limitation on the implementation processes of the embodiments of the present invention.

[0086] The method for executing a non-maskable interrupt according to embodiments of the present invention is described above in detail with reference to FIG. 1 to FIG. 5, and an apparatus for executing a non-maskable interrupt according to the embodiments of the present invention is described in detail in the following with reference to FIG. 6 and FIG. 7.

[0087] As shown in FIG. 6, a apparatus 500 for executing a non-maskable interrupt includes:

an interruption module 510, configured to obtain a secure interrupt request in a non-secure mode, and interrupt an operation of an operating system OS, where the secure interrupt request cannot be masked;

a saving module 520, configured to enter a secure mode by using the secure interrupt request, and save, in the secure mode, an interrupt context of an OS status when the operation of the OS is interrupted;

a first execution module 530, configured to return to the non-secure mode to execute user-defined processing;

a resumption module 540, configured to: after the user-defined processing is completed, enter the secure mode again, and resume the OS status in the secure mode according to the interrupt context; and

a second execution module 550, configured to return to the non-secure mode again, and continue to execute an operation of the OS.



[0088] Therefore, the apparatus for executing a non-maskable interrupt in this embodiment of the present invention enters, by using a secure interrupt request, a secure mode to save an interrupt context of an OS status during an interrupt; after returning to a non-secure mode to execute user-defined processing, enters the secure mode again to resume the OS status; and after resuming the OS status, returns to the non-secure mode again to continue to execute an operation of an OS. Therefore, an NMI mechanism can be easily implemented without depending on hardware.

[0089] In this embodiment of the present invention, the secure interrupt request may be a fast interrupt request FIQ.

[0090] In this embodiment of the present invention, the user-defined processing may include at least one of saving a system log, reporting an OS status, or resetting a watchdog timer.

[0091] In this embodiment of the present invention, the non-secure mode may include at least one of exception level EL0 or EL1 of an advanced reduced instruction set computing machine ARM architecture, and the secure mode may include EL3 of the ARM architecture.

[0092] In this embodiment of the present invention, the OS may periodically trigger a watchdog to generate the secure interrupt request or a hardware fault may trigger a watchdog to generate the secure interrupt request.

[0093] Optionally, in an embodiment, the first execution module 530 may be specifically configured to:
after the interrupt context is saved in the secure mode, return to the non-secure mode according to an exception return address of the secure mode, and execute a user-defined function to complete the user-defined processing.

[0094] Optionally, in an embodiment, the apparatus 500 may further include:
an interface calling module, configured to: before the first execution module 530 returns to the non-secure mode according to the exception return address of the secure mode and executes the user-defined function to complete the user-defined processing, call an interface function when a kernel of the non-secure mode is started, where the interface function records an address of the user-defined function into the exception return address in the secure mode by using a secure monitor call SMC instruction.

[0095] Optionally, in an embodiment, the apparatus 500 further includes:

a preconfiguration module, configured to preconfigure an address of a saving function in an exception vector table of the secure mode, where the saving function is used to save the interrupt context of the OS status when the operation of the OS is interrupted; and

the saving module 520 is specifically configured to:
when the secure interrupt request is generated, and the secure interrupt request cannot be masked, enter the secure mode according to the address of the saving function that is preconfigured by the preconfiguration module, to execute the saving function.



[0096] Optionally, in an embodiment, the saving module 520 may be specifically configured to:
capture, by using secure monitor Secure Monitor software running in the secure mode, the secure interrupt request to enter the secure mode, and save, in the secure mode by using the Secure Monitor software, the interrupt context of the OS status when the operation of the OS is interrupted.

[0097] It should be understood that the apparatus 500 in this embodiment of the present invention may be a CPU.

[0098] It should also be understood that division of modules in the apparatus 500 is merely an example, is merely logical function division, and may be other division in actual implementation. The modules may exist independently, or may be combined. Preferably, the modules of the apparatus 500 may be integrated into one central module of the CPU, and configured to execute a non-maskable interrupt procedure.

[0099] It should also be understood that the apparatus 500 in this embodiment of the present invention may correspond to an execution body of executing a non-maskable interrupt in embodiments of the present invention, and the foregoing and other operations and/or functions of the modules in the apparatus 500 are respectively used to implement corresponding procedures in FIG. 1 to FIG 5. For brevity, details are not repeatedly described herein.

[0100] Therefore, the apparatus for executing a non-maskable interrupt in this embodiment of the present invention enters, by using a secure interrupt request, a secure mode to save an interrupt context of an OS status during an interrupt; after returning to a non-secure mode to execute user-defined processing, enters the secure mode again to resume the OS status; and after resuming the OS status, returns to the non-secure mode again to continue to execute an operation of an OS. Therefore, an NMI mechanism can be easily implemented without depending on hardware.

[0101] In an embodiment of the present invention, a transceiver may obtain the secure interrupt request in the non-secure mode, and a processor may implement functions that are implemented by the interruption module 510, the saving module 520, the first execution module 530, the resumption module 540, and the second execution module 550. As shown in FIG. 7, an apparatus 600 for executing a non-maskable interrupt may include a processor 610, a transceiver 620, and a memory 630. The memory 630 may be configured to store code executed by the processor 610, and the like. The transceiver 620 may be an interface, configured to receive a secure interrupt request sent by hardware, such as a watchdog, to a CPU.

[0102] All components of the apparatus 600 are coupled together by using a bus system 640. In addition to a data bus, the bus system 640 includes a power bus, a control bus, a status signal bus, and the like.

[0103] The apparatus 600 shown in FIG. 7 can implement all processes that are implemented in the foregoing embodiments in FIG. 1 to FIG. 5. The apparatus 600 includes the processor 610, the transceiver 620, and the memory 630. The memory 630 is configured to store an instruction. The processor 610 is configured to execute the instruction stored by the memory 630 to control the transceiver 620 to receive and send a signal. When the processor 610 executes the instruction stored by the memory 630, the apparatus 600 is configured to complete the method for executing a non-maskable interrupt in embodiments of the present invention.

[0104] The transceiver 620 may be configured to obtain a secure interrupt request in a non-secure mode, and the secure interrupt request cannot be masked.

[0105] The processor 610 may be configured to:

interrupt an operation of an operating system OS;

enter a secure mode by using the secure interrupt request, and save, in the secure mode, an interrupt context of an OS status when the operation of the OS is interrupted;

return to the non-secure mode to execute user-defined processing;

after the user-defined processing is completed, enter the secure mode again, and resume the OS status in the secure mode according to the interrupt context; and

return to the non-secure mode again, and continue to execute an operation of the OS.



[0106] Therefore, the apparatus for executing a non-maskable interrupt in this embodiment of the present invention enters, by using a secure interrupt request, a secure mode to save an interrupt context of an OS status during an interrupt; after returning to a non-secure mode to execute user-defined processing, enters the secure mode again to resume the OS status; and after resuming the OS status, returns to the non-secure mode again to continue to execute an operation of an OS. Therefore, an NMI mechanism can be easily implemented without depending on hardware.

[0107] In this embodiment of the present invention, the secure interrupt request may be a fast interrupt request FIQ.

[0108] In this embodiment of the present invention, the user-defined processing may include at least one of saving a system log, reporting an OS status, or resetting a watchdog timer.

[0109] In this embodiment of the present invention, the non-secure mode may include at least one of exception level EL0 or EL1 of an advanced reduced instruction set computing machine ARM architecture, and the secure mode may include EL3 of the ARM architecture.

[0110] In this embodiment of the present invention, the OS may periodically trigger a watchdog to generate the secure interrupt request or a hardware fault may trigger a watchdog to generate the secure interrupt request.

[0111] Optionally, in an embodiment, that the processor 610 returns to the non-secure mode to execute the user-defined processing may include:
after the interrupt context is saved in the secure mode, returning to the non-secure mode according to an exception return address of the secure mode, and executing a user-defined function to complete the user-defined processing.

[0112] Optionally, in an embodiment, before returning to the non-secure mode according to the exception return address of the secure mode, and executing the user-defined function to complete the user-defined processing, the processor 610 may be further configured to:
call an interface function when a kernel of the non-secure mode is started, where the interface function records an address of the user-defined function into the exception return address in the secure mode by using a secure monitor call SMC instruction.

[0113] Optionally, in an embodiment, the processor 610 may be further configured to preconfigure an address of a saving function in an exception vector table of the secure mode, where the saving function is used to save the interrupt context of the OS status when the operation of the OS is interrupted.

[0114] That the processor 610 enters the secure mode by using the secure interrupt request, and saves, in the secure mode, the interrupt context of the OS status when the operation of the OS is interrupted may include:
when the secure interrupt request is generated, and the secure interrupt request cannot be masked, entering the secure mode according to the address of the saving function, to execute the saving function.

[0115] Optionally, in an embodiment, that the processor 610 enters the secure mode by using the secure interrupt request, and saves, in the secure mode, the interrupt context of the OS status when the operation of the OS is interrupted may include:
capturing, by using secure monitor Secure Monitor software running in the secure mode, the secure interrupt request to enter the secure mode, and saving, in the secure mode by using the Secure Monitor software, the interrupt context of the OS status when the operation of the OS is interrupted.

[0116] It should be understood that the apparatus 600 in this embodiment of the present invention may be a CPU.

[0117] It should be noted that the foregoing method embodiments of the present invention may be applied to a processor, or implemented by a processor. The processor may be an integrated circuit chip and has a signal processing capability. In an implementation process, steps of the foregoing method embodiments may be completed by using an integrated logic circuit of hardware in the processor or an instruction in a form of software. The foregoing processor may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or another programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, which may implement or perform the methods, the steps, and logical block diagrams that are disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor, or the processor may further be any conventional processor, or the like. Steps of the methods disclosed with reference to the embodiments of the present invention may be directly executed and accomplished by means of a hardware decoding processor, or may be executed and accomplished by using a combination of hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, or the like. The storage medium is located in the memory, and a processor reads information in the memory and completes the steps in the foregoing methods in combination with hardware of the processor.

[0118] It may be understood that the memory in the embodiments of the present invention may be a volatile memory or a nonvolatile memory, or may include a volatile memory and a nonvolatile memory. The nonvolatile memory may be a read-only memory (Read-Only Memory, ROM), a programmable read-only memory (Programmable ROM, PROM), an erasable programmable read-only memory (Erasable PROM, EPROM), an electrically erasable programmable read-only memory (Electrically EPROM, EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), used as an external cache. Through example but not restrictive description, many forms of RAMs may be used, for example, a static random access memory (Static RAM, SRAM), a dynamic random access memory (Dynamic RAM, DRAM), a synchronous dynamic random access memory (Synchronous DRAM, SDRAM), a double data rate synchronous dynamic random access memory (Double Data Rate SDRAM, DDR SDRAM), an enhanced synchronous dynamic random access memory (Enhanced SDRAM, ESDRAM), a synchronous link dynamic random access memory (Synchlink DRAM, SLDRAM), and a direct rambus dynamic random access memory (Direct Rambus RAM, DR RAM). It should be noted that the memory of the system and method described in this specification includes but is not limited to these and any memory of another proper type.

[0119] A person of ordinary skill in the art may be aware that, in combination with the examples described in the embodiments disclosed in this specification, units and algorithm steps may be implemented by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are performed by hardware or software depends on particular applications and design constraint conditions of the technical solutions. A person skilled in the art may use different methods to implement the described functions for each particular application, but it should not be considered that the implementation goes beyond the scope of the present invention.

[0120] It may be clearly understood by a person skilled in the art that, for the purpose of convenient and brief description, for a detailed working process of the foregoing system, apparatus, and unit, reference may be made to a corresponding process in the foregoing method embodiments, and details are not described herein again.

[0121] In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus, and method may be implemented in other manners. For example, the described apparatus embodiment is merely an example. For example, the unit division is merely logical function division and may be other division in actual implementation. For example, a plurality of units or components may be combined or integrated into another system, or some features may be ignored or not performed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections may be implemented by using some interfaces. The indirect couplings or communication connections between the apparatuses or units may be implemented in electronic, mechanical, or other forms.

[0122] The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.

[0123] In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each of the units may exist alone physically, or two or more units are integrated into one unit.

[0124] When the functions are implemented in the form of a software functional unit and sold or used as an independent product, the functions may be stored in a computer-readable storage medium. Based on such an understanding, the technical solutions of the present invention essentially, or the part contributing to the prior art, or some of the technical solutions may be implemented in a form of a software product. The software product is stored in a storage medium, and includes several instructions for instructing a computer device (which may be a personal computer, a server, or a network device) to perform all or some of the steps of the methods described in the embodiments of the present invention. The foregoing storage medium includes: any medium that can store program code, such as a USB flash drive, a removable hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc.

[0125] The foregoing descriptions are merely specific implementation manners of the present invention, but are not intended to limit the protection scope of the present invention. Any variation or replacement readily figured out by a person skilled in the art within the technical scope disclosed in the present invention shall fall within the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.


Claims

1. A method (100) for executing a non-maskable interrupt, comprising:

obtaining (S110) a secure interrupt request in a non-secure mode, and interrupting an operation of an operating system, OS, wherein the secure interrupt request cannot be masked;

entering (S120) a secure mode by using the secure interrupt request, and saving, in the secure mode, an interrupt context of an OS status when the operation of the OS is interrupted;

returning (S130) to the non-secure mode to execute user-defined processing; after the user-defined processing is completed, entering (S140) the secure mode again,

and resuming the OS status in the secure mode according to the interrupt context; and

returning (S150) to the non-secure mode again, and continuing to execute an operation of the OS.


 
2. The method according to claim 1, the returning to the non-secure mode to execute user-defined processing comprises:
after the interrupt context is saved in the secure mode, returning to the non-secure mode according to an exception return address of the secure mode, and executing a user-defined function to complete the user-defined processing.
 
3. The method according to claim 2, wherein before the returning to the non-secure mode according to an exception return address of the secure mode, and executing a user-defined function to complete the user-defined processing, the method further comprises:
calling an interface function when a kernel of the non-secure mode is started, wherein the interface function records an address of the user-defined function into the exception return address in the secure mode by using a secure monitor call, SMC, instruction.
 
4. The method according to any one of claims 1 to 3, wherein the secure interrupt request is a fast interrupt request FIQ.
 
5. The method according to any one of claims 1 to 4, wherein the user-defined processing comprises at least one of saving a system log, reporting an OS status, or resetting a watchdog timer.
 
6. The method according to any one of claims 1 to 5, wherein the method further comprises:

preconfiguring an address of a saving function in an exception vector table of the secure mode, wherein the saving function is used to save the interrupt context of the OS status when the operation of the OS is interrupted; and

the entering a secure mode by using the secure interrupt request, comprises:
when the secure interrupt request is generated, entering the secure mode according to the address of the saving function, to execute the saving function.


 
7. An apparatus (500) configured to execute a non-maskable interrupt, comprising:

an interruption module (510), configured to obtain a secure interrupt request in a non-secure mode, and interrupt an operation of an operating system OS, wherein the secure interrupt request cannot be masked;

a saving module (520), configured to enter a secure mode by using the secure interrupt request, and save, in the secure mode, an interrupt context of an OS status when the operation of the OS is interrupted;

a first execution module (530), configured to return to the non-secure mode to execute user-defined processing;

a resumption 2. module (540), configured to: after the user-defined processing is completed, enter the secure mode again, and resume the OS status in the secure mode according to the interrupt context; and

a second execution module (550), configured to return to the non-secure mode again, and continue to execute an operation of the OS.


 
8. The apparatus according to claim 7, wherein the first execution module is specifically configured to:
after the interrupt context is saved in the secure mode, return to the non-secure mode according to an exception return address of the secure mode, and execute a user-defined function to complete the user-defined processing.
 
9. The apparatus according to claim 8, J wherein the apparatus further comprises:
an interface calling module, configured to: before the first execution module returns to the non-secure mode according to the exception return address of the secure mode and executes the user-defined function to complete the user-defined processing, call an interface function when a kernel of the non-secure mode is started, wherein the interface function records an address of the user-defined function into the exception return address in the secure mode by using a secure monitor call SMC instruction.
 
10. The apparatus according to any one of claims 7 to 9, wherein the secure interrupt request is a fast interrupt request FIQ.
 
11. The apparatus according to any one of claims 7 to 10, wherein the user-defined processing comprises at least one of saving a system log, reporting an OS status, or resetting a watchdog timer.
 
12. The apparatus according to any one of claims 7 to 11, wherein the apparatus further comprises:

a preconfiguration module, configured to preconfigure an address of a saving function in an exception vector table of the secure mode, wherein the saving function is used to save the interrupt context of the OS status when the operation of the OS is interrupted; and

the saving module is specifically configured to:
when the secure interrupt request is generated, and the secure interrupt request cannot be masked, enter the secure mode according to the address of the saving function that is preconfigured by the preconfiguration module, to execute the saving function.


 
13. The apparatus according to any one of claims 7 to 12, wherein the saving module is specifically configured to:
capture, by using secure monitor Secure Monitor software running in the secure mode, the secure interrupt request to enter the secure mode, and save, in the secure mode by using the Secure Monitor software, the interrupt context of the OS status when the operation of the OS is interrupted.
 
14. A computer-readable storage medium comprising instructions which, when executed by a computer, cause the computer to carry out the method according to any one of claims 1 to 6.
 
15. A computer program product comprising computer program instructions that when executed by a processing apparatus cause the processing apparatus to perform the method according to any one of claims 1 to 6.
 


Ansprüche

1. Verfahren (100) zum Ausführen einer nichtmaskierbaren Unterbrechung, umfassend Erhalten (S110) einer sicheren Unterbrechungsanforderung in einem nichtsicheren Modus und Unterbrechen eines Vorgangs eines Betriebssystems, OS, wobei die sichere Unterbrechungsanforderung nicht maskiert werden kann;

Wechseln (S120) in einen sicheren Modus durch Verwenden der sicheren Unterbrechungsanforderung und Speichern, im sicheren Modus, eines Unterbrechungskontexts eines OS-Status, wenn der Vorgang des OS unterbrochen ist; Zurückkehren (S130) in den nichtsicheren Modus zur Ausführung einer benutzerdefinierten Verarbeitung;

nachdem die benutzerdefinierte Verarbeitung abgeschlossen ist, erneutes Wechseln (S140) in den sicheren Modus und Fortsetzen des OS-Status im sicheren Modus gemäß dem Unterbrechungskontext und

erneutes Zurückkehren (S150) in den nichtsicheren Modus und Fortfahren mit der Ausführung eines Vorgangs des OS.


 
2. Verfahren nach Anspruch 1, wobei das Zurückkehren in den nichtsicheren Modus zur Ausführung einer benutzerdefinierten Verarbeitung umfasst:
nachdem der Unterbrechungskontext im sicheren Modus gespeichert ist, Zurückkehren in den nichtsicheren Modus gemäß einer Ausnahmerücksprungadresse des sicheren Modus und Ausführen einer benutzerdefinierten Funktion zum Abschluss der benutzerdefinierten Verarbeitung.
 
3. Verfahren nach Anspruch 2, wobei, vor dem Zurückkehren in den nichtsicheren Modus gemäß einer Ausnahmerücksprungadresse des sicheren Modus und dem Ausführen einer benutzerdefinierten Funktion zum Abschluss der benutzerdefinierten Verarbeitung, das Verfahren ferner umfasst:
Aufrufen einer Schnittstellenfunktion, wenn ein Kernel des nichtsicheren Modus gestartet wird, wobei die Schnittstellenfunktion eine Adresse der benutzerdefinierten Funktion in die Ausnahmerücksprungadresse im sicheren Modus durch Verwenden einer Anweisung zur sicheren Überwachung, SMC-Anweisung, erfasst.
 
4. Verfahren nach einem der Ansprüche 1 bis 3, wobei die sichere Unterbrechungsanforderung eine schnelle Unterbrechungsanforderung, FIQ, ist.
 
5. Verfahren nach einem der Ansprüche 1 bis 4, wobei die benutzerdefinierte Verarbeitung zumindest eines von Speichern eines Systemprotokolls, Berichten eines OS-Status oder Zurücksetzen eines Überwachungszeitgebers umfasst.
 
6. Verfahren nach einem der Ansprüche 1 bis 5, wobei das Verfahren ferner umfasst:

Vorkonfigurieren einer Adresse einer Speicherfunktion in einer Ausnahmevektortabelle des sicheren Modus, wobei die Speicherfunktion zur Speicherung des Unterbrechungskontexts des OS-Status, wenn der Vorgang des OS unterbrochen ist, verwendet wird; und

wobei das Wechseln in einen sicheren Modus durch Verwenden der sicheren Unterbrechungsanforderung umfasst:
wenn die sichere Unterbrechungsanforderung erzeugt wird, Wechseln in den sicheren Modus gemäß der Adresse der Speicherfunktion zur Ausführung der Speicherfunktion.


 
7. Vorrichtung (500), die zur Ausführung einer nichtmaskierbaren Unterbrechung ausgelegt ist, umfassend:

ein Unterbrechungsmodul (510), das zum Erhalten einer sicheren Unterbrechungsanforderung in einem nichtsicheren Modus und Unterbrechen eines Vorgangs eines Betriebssystems, OS, wobei die sichere Unterbrechungsanforderung nicht maskiert werden kann, ausgelegt ist;

ein Speichermodul (520), das zum Wechseln in einen sicheren Modus durch Verwenden der sicheren Unterbrechungsanforderung und Speichern, im sicheren Modus, eines Unterbrechungskontexts eines OS-Status, wenn der Vorgang des OS unterbrochen ist, ausgelegt ist;

ein erstes Ausführungsmodul (530), das zum Zurückkehren in den nichtsicheren Modus zur Ausführung einer benutzerdefinierten Verarbeitung ausgelegt ist;

ein Fortsetzungsmodul (540), das ausgelegt ist zum: nachdem die benutzerdefinierte Verarbeitung abgeschlossen ist, erneuten Wechseln in den sicheren Modus und Fortsetzen des OS-Status im sicheren Modus gemäß dem Unterbrechungskontext; und ein zweites Ausführungsmodul (550), das zum erneuten Zurückkehren in den nichtsicheren Modus und Fortfahren mit der Ausführung eines Vorgangs des OS ausgelegt ist.


 
8. Vorrichtung nach Anspruch 7, wobei das erste Ausführungsmodul insbesondere ausgelegt ist zum:
nachdem der Unterbrechungskontext im sicheren Modus gespeichert ist, Zurückkehren in den nichtsicheren Modus gemäß einer Ausnahmerücksprungadresse des sicheren Modus und Ausführen einer benutzerdefinierten Funktion zum Abschluss der benutzerdefinierten Verarbeitung.
 
9. Vorrichtung nach Anspruch 8, wobei die Vorrichtung ferner umfasst:
ein Schnittstellenaufrufmodul, das ausgelegt ist zum: bevor das erste Ausführungsmodul in den nichtsicheren Modus gemäß der Ausnahmerücksprungadresse des sicheren Modus zurückkehrt und die benutzerdefinierte Funktion zum Abschluss der benutzerdefinierten Verarbeitung ausführt, Aufrufen einer Schnittstellenfunktion, wenn ein Kernel des nichtsicheren Modus gestartet wird, wobei die Schnittstellenfunktion eine Adresse der benutzerdefinierten Funktion in die Ausnahmerücksprungadresse im sicheren Modus durch Verwenden einer Anweisung zur sicheren Überwachung, SMC-Anweisung, erfasst.
 
10. Vorrichtung nach einem der Ansprüche 7 bis 9, wobei die sichere Unterbrechungsanforderung eine schnelle Unterbrechungsanforderung, FIQ, ist.
 
11. Vorrichtung nach einem der Ansprüche 7 bis 10, wobei die benutzerdefinierte Verarbeitung zumindest eines von Speichern eines Systemprotokolls, Berichten eines OS-Status oder Zurücksetzen eines Überwachungszeitgebers umfasst.
 
12. Vorrichtung nach einem der Ansprüche 7 bis 11, wobei die Vorrichtung ferner umfasst:

ein Vorkonfigurationsmodul, das zum Vorkonfigurieren einer Adresse einer Speicherfunktion in einer Ausnahmevektortabelle des sicheren Modus, wobei die Speicherfunktion zur Speicherung des Unterbrechungskontexts des OS-Status, wenn der Vorgang des OS unterbrochen ist, verwendet wird, ausgelegt ist; und

wobei das Speichermodul insbesondere ausgelegt ist zum:
wenn die sichere Unterbrechungsanforderung erzeugt wird und die sichere Unterbrechungsanforderung nicht maskiert werden kann, Wechseln in den sicheren Modus gemäß der Adresse der Speicherfunktion, die durch das Vorkonfigurationsmodul vorkonfiguriert ist, zur Ausführung der Speicherfunktion.


 
13. Vorrichtung nach einem der Ansprüche 7 bis 12, wobei das Speichermodul insbesondere ausgelegt ist zum:
Erfassen, durch Verwenden von "Secure Monitor"-Software zur sicheren Überwachung, die im sicheren Modus ausgeführt wird, der sicheren Unterbrechungsanforderung zum Wechseln in den sicheren Modus und Speichern, im sicheren Modus durch Verwenden der "Secure Monitor"-Software, des Unterbrechungskontexts des OS-Status, wenn der Vorgang des OS unterbrochen ist.
 
14. Computerlesbares Speicherungsmedium, umfassend Anweisungen, die bei Ausführung durch einen Computer den Computer zur Ausführung des Verfahrens nach einem der Ansprüche 1 bis 6 veranlassen.
 
15. Computerprogrammprodukt, umfassend Computerprogrammanweisungen, die bei Ausführung durch eine Verarbeitungsvorrichtung die Verarbeitungsvorrichtung zur Durchführung des Verfahrens nach einem der Ansprüche 1 bis 6 veranlassen.
 


Revendications

1. Procédé (100) pour exécuter une interruption non masquable, comprenant les étapes consistant à :

obtenir (S110) une demande d'interruption sécurisée dans un mode non sécurisé, et interrompre un fonctionnement d'un système d'exploitation, OS, la demande d'interruption sécurisée ne pouvant pas être masquée ;

entrer (S120) dans un mode sécurisé en utilisant la demande d'interruption sécurisée, et sauvegarder, dans le mode sécurisé, un contexte d'interruption d'un état d'OS lorsque le fonctionnement de l'OS est interrompu ;

revenir (S130) au mode non sécurisé pour exécuter un traitement défini par l'utilisateur ;

une fois le traitement défini par l'utilisateur terminé, entrer (S140) à nouveau dans le mode sécurisé, et reprendre l'état d'OS dans le mode sécurisé selon le contexte d'interruption ;

revenir (S150) à nouveau au mode non sécurisé, puis continuer d'exécuter un fonctionnement de l'OS.


 
2. Procédé selon la revendication 1, le retour au mode non sécurisé pour exécuter un traitement défini par l'utilisateur comprend l'étape consistant à :

une fois le contexte d'interruption sauvegardé dans le mode sécurisé, revenir au mode non sécurisé selon une adresse de retour d'exception du mode sécurisé et

exécuter une fonction définie par l'utilisateur pour terminer le traitement défini par l'utilisateur.


 
3. Procédé selon la revendication 2, le procédé, avant le retour au mode non sécurisé selon une adresse de retour d'exception du mode sécurisé et l'exécution d'une fonction définie par l'utilisateur pour terminer le traitement défini par l'utilisateur, comprenant également l'étape consistant à :
appeler une fonction d'interface lorsqu'un noyau du mode non sécurisé est lancé, la fonction d'interface enregistrant une adresse de la fonction définie par l'utilisateur dans l'adresse de retour d'exception du mode sécurisé en utilisant une instruction d'appel de surveillance sécurisé, SMC.
 
4. Procédé selon l'une quelconque des revendications 1 à 3, dans lequel la demande d'interruption sécurisée est une demande d'interruption rapide FIQ.
 
5. Procédé selon l'une quelconque des revendications 1 à 4, dans lequel le traitement défini par l'utilisateur comprend au moins un traitement parmi la sauvegarde d'un journal système, la signalisation d'un état d'OS et la réinitialisation d'un temporisateur de chien de garde.
 
6. Procédé selon l'une quelconque des revendications 1 à 5, le procédé comprenant également l'étape consistant à :

préconfigurer une adresse d'une fonction de sauvegarde dans une table de vecteurs d'exception du mode sécurisé, la fonction de sauvegarde étant utilisée pour sauvegarder le contexte d'interruption de l'état d'OS lorsque le fonctionnement de l'OS est interrompu ; et

l'entrée dans un mode sécurisé au moyen de la demande d'interruption sécurisée comprenant l'étape consistant à :
lorsque la demande d'interruption sécurisée est générée, entrer dans le mode sécurisé selon l'adresse de la fonction de sauvegarde, pour exécuter la fonction de sauvegarde.


 
7. Appareil (500) configuré pour exécuter une interruption non masquable, comprenant :

un module d'interruption (510), configuré pour obtenir une demande d'interruption sécurisée dans un mode non sécurisé, et interrompre un fonctionnement d'un système d'exploitation, OS, la demande d'interruption sécurisée ne pouvant pas être masquée ;

un module de sauvegarde (520), configuré pour entrer dans un mode sécurisé en utilisant la demande d'interruption sécurisée, et sauvegarder, dans le mode sécurisé,

un contexte d'interruption d'un état d'OS lorsque le fonctionnement de l'OS est interrompu ;

un premier module d'exécution (530), configuré pour revenir au mode non sécurisé pour exécuter un traitement défini par l'utilisateur ;

un module de reprise (540), configuré pour : une fois le traitement défini par l'utilisateur terminé, entrer à nouveau dans le mode sécurisé, et reprendre l'état d'OS dans le mode sécurisé selon le contexte d'interruption ; et

un deuxième module d'exécution (550), configuré pour revenir à nouveau au mode non sécurisé, puis continuer d'exécuter un fonctionnement de l'OS.


 
8. Appareil selon la revendication 7, dans lequel le premier module d'exécution est spécifiquement configuré pour :

une fois le contexte d'interruption sauvegardé dans le mode sécurisé, revenir au mode non sécurisé selon une adresse de retour d'exception du mode sécurisé et

exécuter une fonction définie par l'utilisateur pour terminer le traitement défini par l'utilisateur.


 
9. Appareil selon la revendication 8, l'appareil comprenant également :
un module d'appel d'interface, configuré pour : avant que le premier module d'exécution ne retourne au mode non sécurisé selon l'adresse de retour d'exception du mode sécurisé et n'exécute la fonction définie par l'utilisateur pour terminer le traitement défini par l'utilisateur, appeler une fonction d'interface lorsqu'un noyau du mode non sécurisé est lancé, la fonction d'interface enregistrant une adresse de la fonction définie par l'utilisateur dans l'adresse de retour d'exception du mode sécurisé en utilisant une instruction d'appel de surveillance sécurisé SMC.
 
10. Appareil selon l'une quelconque des revendications 7 à 9, dans lequel la demande d'interruption sécurisée est une demande d'interruption rapide FIQ.
 
11. Appareil selon l'une quelconque des revendications 7 à 10, dans lequel le traitement défini par l'utilisateur comprend au moins un traitement parmi la sauvegarde d'un journal système, la signalisation d'un état d'OS et la réinitialisation d'un temporisateur de chien de garde.
 
12. Appareil selon l'une quelconque des revendications 7 à 11, l'appareil comprenant également :

un module de préconfiguration, configuré pour préconfigurer une adresse d'une fonction de sauvegarde dans une table de vecteurs d'exception du mode sécurisé, la fonction de sauvegarde étant utilisée pour sauvegarder le contexte d'interruption de l'état d'OS lorsque le fonctionnement de l'OS est interrompu ; et

le module de sauvegarde étant spécifiquement configuré pour :
lorsque la demande d'interruption sécurisée est générée, et que la demande d'interruption sécurisée ne peut pas être masquée, entrer dans le mode sécurisé selon l'adresse de la fonction de sauvegarde qui est préconfigurée par le module de préconfiguration, pour exécuter la fonction de sauvegarde.


 
13. Appareil selon l'une quelconque des revendications 7 à 12, dans lequel le module de sauvegarde est spécifiquement configuré pour :
capturer, au moyen du logiciel de surveillance sécurisé Secure Monitor s'exécutant dans le mode sécurisé, la demande d'interruption sécurisée pour entrer dans le mode sécurisé, et sauvegarder, dans le mode sécurisé en utilisant le logiciel Secure Monitor, le contexte d'interruption de l'état d'OS lorsque le fonctionnement de l'OS est interrompu.
 
14. Support de stockage lisible par ordinateur comprenant des instructions qui, lorsqu'elles sont exécutées par un ordinateur, amènent l'ordinateur à mettre en Ĺ“uvre le procédé selon l'une quelconque des revendications 1 à 6.
 
15. Produit-programme d'ordinateur comprenant des instructions de programme d'ordinateur qui, lorsqu'elles sont exécutées par un appareil de traitement, amènent l'appareil de traitement à effectuer le procédé selon l'une quelconque des revendications 1 à 6.
 




Drawing

















Cited references

REFERENCES CITED IN THE DESCRIPTION



This list of references cited by the applicant is for the reader's convenience only. It does not form part of the European patent document. Even though great care has been taken in compiling the references, errors or omissions cannot be excluded and the EPO disclaims all liability in this regard.

Patent documents cited in the description




Non-patent literature cited in the description