Systems and methods for managing interrupt priority levels
By managing interrupt priority levels through the DISICTL instruction, the issues of interrupt control flexibility and compatibility when the processor executes critical code are resolved, enabling stable execution and predictable timing of high-priority code.
Patent Information
- Application Number
- CN202280048433.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2022-12-01
- Filing Date
- 2022-12-06
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2042-12-06
AI Technical Summary
In the existing technology, there are limited and inflexible methods for processors to disable interrupts when executing important code, which cannot effectively manage interrupt requests of different priorities, resulting in uncertain execution time and compatibility issues.
Interrupt priority levels (IPLs) are managed through the DISICTL instruction, which disables exceptions equal to or lower than the current DISICTL IPL while allowing exceptions equal to the current DISICTL IPL to be handled. It utilizes the processor and memory to update and compare the highest priority between the current processor IPL and the DISICTL IPL, thus achieving flexible interrupt control.
This technology prevents low-priority interrupts while executing high-priority code, improving the predictability and compatibility of processor execution time and enhancing the processor's ability to manage code segments of different priorities.
Smart Images

Figure CN117677933B_ABST
Abstract
Description
[0001] Related patent applications
[0002] This application claims priority to jointly owned U.S. Provisional Patent Application No. 62 / 286,634, filed on December 7, 2021, the entire contents of which are incorporated herein by reference for all purposes. Technical Field
[0003] This disclosure relates to computer processing, and more specifically, to systems and methods for managing interrupt priority levels. Background Technology
[0004] Computer processors (such as microprocessors, central processing units (CPUs), digital signal processors (DSPs), digital signal controllers (DSCs), etc.) typically implement "interrupts" to interrupt some currently executing code to handle events of interest. To initiate an interrupt, the processor receives an interrupt request and determines whether to accept it. If the request is accepted, the processor suspends its current activity and executes an interrupt handler to handle the event of interest. After the event is handled, the processor resumes its previous activity. In some systems, interrupt handlers process interrupt events according to an Interrupt Priority Level (IPL) assigned to each event.
[0005] In some computer systems or situations, the processor needs to execute certain critical code without interruption, for example, to complete code execution within defined execution time constraints. Therefore, some systems include instructions for disabling interrupts to allow critical code to execute without interruption. For example, some microcontrollers available from Microchip Technology, Inc., Chandler, Arizona, include the "Disable Interrupts" or "DISI" instruction, which disables all interrupts of IPL6 or lower for a finite amount of time (defined by a specified loop count). However, in devices with less deterministic execution times, a fixed period of time for disabling interrupts may have limited practicality. Furthermore, the DISI instruction disables interrupts below IPL6 but allows interrupts with higher priority than IPL6, such as IPL7, which may be unnecessary in some cases. Additionally, the DISI instruction has limited compatibility with reentrant code. Summary of the Invention
[0006] This disclosure provides systems and methods for managing exception handling (e.g., interrupts and / or traps) based on Interrupt Priority Level (IPL). In some examples, a Disable Interrupt Control (DISICTL) instruction is used to establish and / or update the current DISICTL IPL, which disables exceptions with an associated IPL equal to or lower than the current DISICTL IPL. For example, a DISICTL instruction can be used to allow the processor to execute high-priority code without being interrupted by low-priority exceptions, such as those with an associated IPL equal to or lower than the current DISICTL IPL. In other examples, the current DISICTL IPL disables exceptions with IPLs lower than the current DISICTL IPL, but allows handling of exceptions with IPLs equal to the current DISICTL IPL (instead of disabling exceptions with IPLs equal to or lower than the current DISICTL IPL).
[0007] In some examples, the current DISICTL IPL can be set to any value between IPL=0 (no exceptions are disabled) and IPL 7 (all exceptions are disabled), and can be updated (and / or deactivated) over time by the corresponding DISICTL directive. In some examples, the current DISICTL IPL remains persistent (unchanged) until a subsequent DISICTL directive specifying a different DISICTL IPL is executed.
[0008] In some examples, the current DISICTL IPL is repeatedly compared with the processor's current operating IPL (referred to herein as the current processor IPL) to determine the highest IPL among the current DISICTL IPL and the current processor IPL, which is applied to new and pending exceptions. In this way, the current DISICTL IPL prevents the handling (i.e., disables) of exceptions whose IPL is equal to or lower than the current DISICTL IPL. As discussed above, in other examples, the current DISICTL IPL disables exceptions whose IPL is lower than the current DISICTL IPL, but allows the handling of exceptions whose IPL is equal to the current DISICTL IPL, which differs from the current processor IPL disabling (queuing) exceptions whose IPL is equal to or lower than the current processor IPL. In such examples, the system can implement any suitable operation, technique, or scheme to resolve the difference between the current processor IPL (disabling IPLs equal to or lower than the current processor IPL 106) and the current DISICTL IPL 108 (disabling IPLs lower than (but not equal to) the current DISICTL IPL 108), for example, as referenced below. Figure 1 To be discussed in more detail.
[0009] In some examples, the corresponding DISICTL instruction may indicate (a) a new DISICTL IPL to be set as the current DISICTL IPL, and optionally (b) a memory destination. To indicate the new DISICTL IPL to be set as the current DISICTL IPL, the instruction may specify (a) the value of the new DISICTL IPL, or (b) the memory address of the previous DISICTL IPL to be set (restored) as the current DISICTL IPL (e.g., a DISICTL IPL previously replaced by a previous DISICTL instruction). The DISICTL IPL specified in the corresponding DISICTL instruction may be user-defined, for example, selected by the code developer or another user who created the corresponding DISICTL instruction.
[0010] The (optional) memory target specified in the corresponding DISICTL instruction indicates the memory location used to store the current DISICTL IPL that is replaced by the new DISICTL IPL, where the (replaced) current DISICTL IPL is stored as the "previous DISICTL IPL". The stored previous DISICTL IPL can be accessed by subsequent DISICTL instructions and restored as the current DISICTL IPL. In some examples, nested DISICTL instructions can be used to store and restore DISICTL IPLs, for example, for code executing subroutines, function calls, or interrupt service routines with different priority levels.
[0011] One aspect provides a system including a non-transitory computer-readable storage device and a processor. The non-transitory computer-readable storage device stores a current processor IPL and a current DISICTL IPL. The processor updates the current processor IPL based on a corresponding IPL associated with a corresponding exception; updates the current DISICTL IPL based on a corresponding DISICTL instruction, wherein the corresponding DISICTL instruction specifies a corresponding user-definable DISICTL IPL; determines the highest IPL between the current processor IPL and the current DISICTL IPL; and applies the highest IPL during the execution of the corresponding code.
[0012] In some examples, the processor applying the highest IPL during the execution of the corresponding code includes the processor ignoring exceptions with a corresponding IPL equal to or lower than the highest IPL.
[0013] In some examples, the non-transitory computer-readable storage includes at least one first register in the processor that stores the current processor IPL, and at least one second register in the processor that stores the current DISICTL IPL.
[0014] In some examples, the corresponding DISICTL directive specifies a corresponding user-definable DISICTLIPL value from 0 to 7.
[0015] In some examples, the corresponding DISICTL directive uses the corresponding 3-bit literal to specify the corresponding user-definable DISICTL IPL.
[0016] In some examples, the corresponding DISICTL instruction uses the least significant 3 bits of the defined register contents to specify the corresponding user-definable DISICTL IPL.
[0017] In some examples, the corresponding DISICTL directive specifies that the corresponding user-defined DISICTL IPL includes the value of the user-defined DISICTL IPL specified by the corresponding DISICTL directive.
[0018] In some examples, the corresponding DISICTL instruction specifies that the corresponding user-defined DISICTL IPL includes the memory location of the previous DISICTL IPL specified by the corresponding DISICTL instruction.
[0019] In some examples, the corresponding DISICTL instruction specifies (a) a corresponding user-defined DISICTL IPL and (b) a storage target; and the processor executes the corresponding DISICTL instruction, including (i) updating the current DISICTL IPL from the previous DISICTL IPL to the corresponding user-defined DISICTL IPL specified in the corresponding DISICTL instruction, and (ii) storing the previous DISICTL IPL in the storage target specified in the corresponding DISICTL instruction.
[0020] In some examples, the processor executes the corresponding DISICTL instruction that specifies a first user-definable DISICTL IPL, wherein the execution of the corresponding DISICTL instruction includes updating the current DISICTL IPL from the previous DISICTL IPL to the first user-definable DISICTL IPL specified in the corresponding DISICTL instruction.
[0021] In some examples, the execution of the corresponding DISICTL instruction includes storing the previous DISICTL IPL, and the processor restoring the stored previous DISICTL IPL to the current DISICTL IPL after executing the first segment of the code.
[0022] In some examples, in response to receiving the corresponding DISICTL instruction, the processor stores the previous DISICTL interrupt priority and, after executing the first segment of the code associated with the corresponding DISICTL instruction, restores the stored previous DISICTL interrupt priority to the current DISICTL interrupt priority.
[0023] In some examples, the non-transitory computer-readable storage includes a first memory location storing the current processor IPL, a second memory location storing the current DISICTL IPL, and a third memory location storing the previous DISICTL IPL.
[0024] In some examples, after executing a portion of the first segment of the code, the processor executes a second user-defined DISICTL instruction to update the current DISICTL IPL to a second user-defined DISICTL interrupt priority level that is higher than the corresponding user-defined DISICTLIPL. The processor applies the second user-defined DISICTL IPL during the execution of the second segment of the code; after executing the second segment, it restores the current DISICTLIPL to the first user-defined DISICTL IPL; and then continues execution of the first segment of the code.
[0025] One aspect provides a system including a non-transitory computer-readable memory and a processor. The non-transitory computer-readable memory includes a first memory location for storing a current DISICTL IPL and a second memory location for storing a previous DISICTL IPL. The processor stores a first DISICTL IPL associated with a first DISICTL instruction as the current DISICTL IPL in the first memory location and applies the first DISICTL IPL during a first segment of code execution. The processor also executes a second DISICTL instruction specifying a DISICTL IPL, including storing the second DISICTL IPL specified by the second DISICTL instruction as the current DISICTL IPL in the first memory location and storing the first DISICTL IPL as the previous DISICTL IPL in the second memory location. The processor also applies the second DISICTL IPL during a second segment of code execution.
[0026] In some examples, the second DISICTL instruction specifying the second DISICTL IPL includes the second DISICTL instruction specifying the second memory location, and the processor storing the second DISICTL IPL specified by the second DISICTL instruction as the current DISICTL IPL in the first memory location includes the processor (a) accessing the previous DISICTL IPL stored in the second memory location, and (b) storing the accessed previous DISICTL IPL as the current DISICTL IPL in the first memory location.
[0027] In some examples, the processor executes a third DISICTL instruction that specifies a third DISICTL IPL, including storing the third DISICTL IPL specified by the third DISICTL instruction as the current DISICTL IPL in the first memory location, and storing the second DISICTL IPL as the previous DISICTL IPL in the second memory location. The processor also applies the third DISICTL IPL during the execution of a third segment of the code.
[0028] One aspect provides a method comprising storing a current processor IPL in non-transitory computer-readable memory and a currently disabled interrupt control (DISICTL) IPL in non-transitory computer-readable memory. The method further comprises updating the current processor IPL by the processor based on a corresponding IPL associated with a corresponding exception, and updating the current DISICTL IPL by the processor based on a corresponding DISICTL instruction, wherein the corresponding DISICTL instruction specifies a corresponding user-defined DISICTL IPL. The method further comprises determining a higher IPL between the current processor IPL and the current DISICTL IPL by the processor, and applying the higher IPL by the processor during execution of the corresponding code.
[0029] In some examples, applying the highest IPL during the execution of the corresponding code includes ignoring exceptions that have a corresponding IPL equal to or lower than the highest IPL.
[0030] In some examples, the corresponding DISICTL instruction specifying the corresponding DISICTL IPL includes the corresponding DISICTL instruction specifying the DISICTL IPL value, and updating the current DISICTL interrupt priority level based on the corresponding DISICTL instruction includes setting the current DISICTL interrupt priority level to the value of the corresponding DISICTL interrupt priority level specified in the corresponding DISICTL instruction.
[0031] In some examples, the corresponding DISICTL instruction specifying the corresponding DISICTL IPL includes the corresponding DISICTL instruction specifying the memory location of the previous DISICTL IPL, and updating the current DISICTL IPL based on the corresponding DISICTL instruction includes accessing the previous DISICTL IPL in the memory location specified in the corresponding DISICTL instruction, and setting the accessed previous DISICTL IPL as the current DISICTL IPL.
[0032] In some examples, the method includes the processor executing a first DISICTL instruction to set the current DISICTL IPL to a first user-definable DISICTL IPL specified in the first DISICTL instruction, wherein determining the highest interrupt priority between the current processor interrupt priority and the current DISICTL interrupt priority includes determining that the current DISICTL interrupt priority set to the first user-definable DISICTL interrupt priority is the highest interrupt priority, and the processor applying the first user-definable DISICTL IPL during the execution of a first segment of code.
[0033] In some examples, executing the first DISICTL instruction further includes storing the previous DISICTL IPL in a non-transitory computer-readable storage medium, and the method further includes, after executing the first segment of the code, accessing the stored previous DISICTL IPL and setting the accessed previous DISICTL IPL as the current DISICTL IPL.
[0034] In some examples, the method includes executing a second user-defined DISICTL instruction after a portion of the execution of the first segment of the code, wherein executing the second DISICTL instruction includes setting the current DISICTL IPL to a specified second user-defined DISICTL IPL that is higher than the first user-defined DISICTL IPL. The method also includes applying the second user-defined DISICTL IPL during the execution of the second segment of the code, restoring the first user-defined DISICTL IPL to the current DISICTL IPL after the execution of the second segment of the code, continuing execution of the first segment of the code, and applying the first user-defined DISICTL IPL during the continued execution of the first segment of the code. Attached Figure Description
[0035] Exemplary aspects of this disclosure are described below with reference to the accompanying drawings, in which: Figure 1An exemplary system (e.g., a computer system) for managing exceptions is shown, based on some examples. Figure 2 Aspects of an exemplary system (e.g., a computer system) 100 for managing exceptions, according to one example, are shown; Figure 3 The example shown is based on the following. Figure 1 Exemplary memory locations for various information related to the exemplary system shown; Figure 4 It shows, for example, by Figures 1 to 3 The exemplary process performed by the exemplary system shown is for determining and applying the highest IPL; Figure 5 This is shown according to an example, such as by Figures 1 to 3 The exemplary process for managing and handling exceptions is executed by the exemplary system shown. Figure 6 It shows, for example, by Figures 1 to 3 The exemplary process executed by the exemplary system shown is for executing exemplary DISICTL instructions to update the current DISICTL IPL (and optionally storing the replaced current DISICTL IPL as the previous DISICTL IPL); and Figure 7 It shows, for example, by Figures 1 to 3 The exemplary process executed by the exemplary system shown is for executing nested DISICTL instructions, for example for executing a subroutine with a different (e.g., higher) priority than the subroutine calling code.
[0036] It should be understood that reference numerals for any illustrated element appearing in multiple different figures have the same meaning in all figures, and any illustrated element mentioned or discussed herein in the context of any particular figure also applies to every other figure (if any) in which the same illustrated element is shown. Detailed Implementation
[0037] Figure 1An exemplary system (e.g., a computer system) 100 for managing exceptions is illustrated according to some examples. System 100 includes a processor 102 and a nontransitory computer-readable storage 104. Processor 102 may include a central processing unit (CPU), a microprocessor, a microcontroller, a processor core, or any other type of computer processor. Nontransitory computer-readable storage 104 may include one or more types and / or instances of computer memory devices, such as one or more volatile memory devices and / or non-volatile memory devices. For example, at least a portion of nontransitory computer-readable storage 104 may include one or more of the following: read-only memory (ROM) (e.g., erasable programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM)), flash memory, random access memory (RAM), cache memory, processor registers, and storage disks. For convenience, nontransitory computer-readable storage 104 is also referred to herein as memory 104.
[0038] In some examples, memory 104 stores (a) the current processor interrupt priority level (IPL) 106, (b) the current DISICTL IPL 108, (c) at least one previous processor IPL 109, and optionally (d) at least one previous DISICTL IPL 110. Memory 104 also stores various executable code 112 (referred to herein as code 112) that can be executed by processor 102. Code 112 may be embodied in software or firmware. A corresponding set or group of code 112, such as a block of code, line of code, routine, program, or other instruction set, is referred to herein as a “code segment.” The current processor IPL 106, the current DISICTL IPL 108, the previous processor IPL 109, (optionally) the previous DISICTL IPL 110, and code 112 may be stored in a corresponding memory location within memory 104 of the same or different instances and / or types. For example, see the following references. Figure 3 In one example, the current processor IPL 106 is stored in the first register 122a in processor 102, the current DISICTL IPL 108 is stored in the second register 122b in processor 102, the previous processor IPL 109 is stored in the processor stack (e.g., in RAM or DRAM), and code 112 and (optionally) the previous DISICTL IPL 110 are stored in external memory 124 (outside of processor 102).
[0039] Processor 102 can handle exceptions 114 (e.g., interrupts and / or traps, commonly referred to as CPU exceptions or processor exceptions) and DISICTL instructions 116. The corresponding exception 114 and corresponding DISICTL instructions 116 may be defined in corresponding code 112 stored in system 100, or may be received at processor 102 from an external source. In some examples, the current DISICTL IPL 108 managed and applied by system 100, as disclosed herein, applies to both interrupts and traps. In other examples, the current DISICTL IPL 108 managed and applied by system 100, as disclosed herein, applies to interrupts but not traps.
[0040] The corresponding exception 114 has an associated IPL. For example, such as Figure 1 As shown, exception A has an associated IPL. a Exception B has an associated IPL b And exception N has an associated IPL n IPL a IPL b IPLn can be a corresponding value between 0 and 7. Processor 102 can update the current processor IPL 106 based on the IPL of the corresponding exception 114. Processor 102 can process exception 114 (including new and queued exceptions 114) in order of IPL priority, specifically in order from highest to lowest IPL, wherein processor 102 updates the current processor IPL 106 based on the exception 114 currently being processed (i.e., processor 102 updates the current processor IPL 106 to the IPL of the currently processed exception 114). In some examples, processor 102 may include or utilize an interrupt controller (e.g., a programmable interrupt controller (PIC) for processing exception 114).
[0041] The corresponding DISICTL instruction 116 may specify (a) the corresponding DISICTL IPL (used by processor 102 to update the current DISICTL IPL 108) and optionally (b) a memory target (used by processor 102 to store the previous value of the current DISICTL IPL 108 that existed at the time the corresponding DISICTL instruction 116 was received). The DISICTL IPL specified in the corresponding DISICTL instruction 116 may indicate (a) the IPL value (e.g., between 0 and 7) or (b) the memory location of the previous DISICTL IPL 110, which may be used by processor 102 to update the current DISICTL IPL 108. For example, the corresponding DISICTL instruction 116 may include a 3-bit literal (lit3) specifying the IPL value (e.g., between 0 and 7), or alternatively, may specify the least significant (LS) 3 bits of the contents of a specified working register storing the previous DISICTL IPL 110 to be restored.
[0042] In some examples, unlike the current processor IPL 106 which is updated based on the currently being processed exception 114, the current DISICTL IPL 108 established by the corresponding DISICTL instruction 116n remains persistent (unchanged) until the processor 102 executes a subsequent DISICTL instruction 116, instead of the corresponding DISICTL instruction 116. n It expires after a defined (e.g., user-selectable) number of cycles.
[0043] Therefore, the DISICTL instruction 116 can be used to disable exceptions 114 whose IPL is equal to or lower than the specified DISICTL IPL, for example, to execute high-priority code segments without interruption (except for exceptions 114 with an IPL higher than the DISICTL IPL).
[0044] As used herein, "previous DISICTL IPL" refers to a DISICTL IPL that was previously set to the current DISICTL IPL 108 (when the corresponding DISICTL instruction 116 was executed) but was replaced by a subsequent DISICTL IPL 108 (when the subsequent DISICTL instruction 116 was executed). When the current DISICTL IPL 108 is updated when the corresponding DISICTL instruction 116 is executed, for example from DISICTL IPL... a =6 (set by the previous DISICTL instruction 116) to DISICTL IPL a =7 (set by the corresponding DISICTL instruction 116), the replaced DISICTL IPL (in this case, DISICTL IPL) a=6) can be stored as the previous DISICTL IPL 110.
[0045] The optional storage target used to store the (replaced) current DISICTL IPL 108 as the previous DISICTL IPL 110 can specify a corresponding memory location. For example, such as Figure 1 As shown, the DISICTL instruction A specifies (a) DISICTL PL a And optionally (b) a storage target for storing the (replaced) current DISICTL IPL 108 as the previous DISICTL IPL 110. Storing the (replaced) current DISICTL IPL 108 as the previous DISICTL IPL 110, as discussed below, allows the replaced DISICTL IPL to be subsequently restored to the current DISICTL IPL 108, for example, after a program subroutine completes. See, for example, referenced below. Figure 7 In order to execute code 112, which includes a first segment of code with IPL=6 and a subroutine (a second segment of code) with IPL=7, the processor may (i) execute a first DISICTL instruction 116 before executing the first segment of code to set the current DISICTL IPL 108 to IPL=6, (ii) execute a second DISICTL instruction 116 when the subroutine (the second segment of code) is called to set the current DISICTL IPL 108 to IPL=7 and store the replaced current DISICTL IPL 108 (IPL=6) as the previous DISICTL IPL 110, and (iii) execute a third DISICTL instruction 116 when the subroutine is completed and execution of the first segment of code is resumed to restore the previous DISICTL IPL 110 (IPL=6) to the current DISICTL IPL 108.
[0046] Processor 102 can determine the highest IPL 109 between the current processor IPL 106 and the current DISICTL IPL 108 (e.g., the higher of the current processor IPL 106 and the current DISICTL IPL 108), and apply the highest IPL to the corresponding segment of code, for example, by ignoring exceptions with a corresponding IPL equal to or lower than the highest IPL 109 (e.g., including new and queued exceptions). Therefore, the current DISICTL IPL 108 can "override" the current processor IPL 106, for example, allowing the execution of high-priority code without being interrupted by exceptions 114 with an IPL equal to or lower than the current DISICTL IPL 108.
[0047] In some examples, processor 102 may determine the highest IPL 109 by performing or initiating a comparison between the current processor IPL 106 and the current DISICTL IPL 108 (e.g., via a comparator provided in processor 102) to determine the highest value between the two. In other examples, processor 102 may determine the highest IPL 109 by receiving the highest IPL 109 from an external comparator or other components of system 100. In some examples, processor 102 repeatedly determines the highest IPL 109, for example, using a digital comparator that compares the current processor IPL 106 and the current DISICTL IPL 108 every ____ (or at a frequency of ____). In some examples, system 100 stores (and updates) the highest IPL 109 as discrete elements in memory 104, for example, in a memory location different from the current processor IPL 106, the current DISICTL IPL 108, (optionally) the previous DISICTL IPL 110, and code 112. In other examples, the highest IPL 109 is not stored as a discrete element.
[0048] In other examples, the current DISICTL IPL 108 disables exception 114 with an associated IPL lower than the current DISICTL IPL 108, but allows handling exception 114 with an associated IPL equal to the current DISICTL IPL 108. This differs from the current processor IPL 106, which prevents exception 114 with an associated IPL equal to or lower than the current processor IPL 106. In such examples, system 100 can consider this difference between the current processor IPL 106 (disabling IPLs equal to or lower than the current processor IPL 106) and the current DISICTL IPL 108 (disabling IPLs lower than (but not equal to) the current DISICTL IPL 108) in any suitable manner to accurately achieve the intended priority-based exception management. For example, system 100 may (a) apply an offset of 1 to the current DISICTL IPL 108, i.e., by reducing the DISICTL IPL value specified in the corresponding DISICTL instruction 116 by 1, and (b) apply the highest IPL 109 as discussed above, i.e., by disabling (queuing) exceptions whose IPL is equal to or lower than the highest IPL 109. Therefore, in the case where the current processor IPL = 5 and the DISICTL instruction 116 specifies DISICTL IPL = 6, processor 102 may set the current DISICTL IPL = 5 to effectively allow (not disable) the handling of exceptions with IPL = 6. As an alternative example, system 100 may (a) select the current DISICTL IPL 108 as the highest IPL 109 only if the current DISICTL IPL 108 is higher (at least 1 higher) than the current processor IPL 106, and (b) when the current DISICTL IPL 108 is currently the highest IPL 109 (i.e., when the current DISICTL IPL 108 is higher than the current processor IPL 106), processor 102 may disable exception 114 where the IPL is lower than the current DISICTL IPL 108, but allow exception 114 where the IPL is equal to the current DISICTL IPL 108.
[0049] In some examples, processor 102 may handle a new exception 114 as follows: the new exception 114 refers to the exception 114 currently received at processor 102, as opposed to a queued or executed exception 114. When a new exception 114 with an IPL is received at processor 102... n When a new exception 114n occurs, processor 102(a) will IPL n Compare with the highest IPL of 109. If the IPL... n If the value is greater than the highest IPL of 109, then processor 102 will update the current processor IPL of 106 to the highest IPL of 109. nThis interrupts its current operation (e.g., code execution) and handles exception 114n (e.g., by executing the corresponding code 112 associated with exception 114n). Alternatively, if the IPL of exception 114... n If the current processor IPL 106 is less than or equal to the current processor IPL 106, then processor 102 keeps the current processor IPL 106 unchanged and queues exception 114n for subsequent processing according to the corresponding priority (IPL value) of other queued exceptions and the new exception 114.
[0050] In some examples, processor 102 may process the DISICTL instruction 116 as follows: When a specified DISICTL IPL is received at processor 102... n When the corresponding DISICTL instruction 116n is invoked, the processor 102 bases its instruction on the DISICTL IPL specified by the corresponding DISICTL instruction 116n. n Update the current DISICTL IPL 108, regardless of the DISICTL IPL. n Is it greater than or less than the previous DISICTL IPL, that is, the current DISICTL IPL 108 when the DISICTL instruction 116n is received. As mentioned above, the corresponding DISICTL IPL n You can specify (a) an IPL value (e.g., between 0 and 7) or (b) the memory location of the previous DISICTL IPL 110. If the DISICTL IPL n If an IPL value is specified, processor 102 will update the current DISICTL IPL 108 to the specified IPL value. If DISICTL IPL n If the memory location of the previous DISICTL IPL 110 is specified, the processor 102 restores the previous DISICTL IPL 110 to the current DISICTL IPL 108. Alternatively, the processor 102 may store the (replaced) current DISICTL IPL 108 as the previous DISICTL IPL 110.
[0051] Figure 2 Aspects of an exemplary system (e.g., a computer system) 100 for managing exceptions, according to one example, are illustrated. As discussed above, the current processor IPL 106, the current DISICTL IPL 108, the previous processor IPL 109, and (optionally) the previous DISICTL IPL 110 may be stored in memory 104. There is no limitation on the number of previous processor IPL 109 and previous DISICTL IPL 110 that may be stored in memory 104. Figure 2As shown, the current processor IPL 106 may be stored in a first memory location 120a, the current DISICTL IPL 108 may be stored in a second memory location 120b, the previous processor IPL 109 may be stored in a third memory location 120c, (optionally) the previous DISICTL IPL 110 may be stored in at least one (optional) fourth memory location 120d, and code 112 may be stored in a fifth memory location 120e. The corresponding memory locations in the first memory location 120a, second memory location 120b, third memory location 120c, optional fourth memory location 120d, and fifth memory location 120e may be located inside or outside the processor 102, for example, in a memory device connected to or communicating with the processor 102 via a bus or other communication link.
[0052] In some examples, memory 104 may include multiple third memory locations 120c for storing multiple previous DISICTL IPLs 110, for example, for storing and restoring multiple DISICTL IPL values associated with nested DISICTL IPL instructions, for example, for executing nested instructions within function calls or interrupt service routines with different priority levels (e.g., as referenced below). Figure 7 The exemplary method 700 shown is discussed.
[0053] Figure 3The illustration shows various aspects of the storage of information according to an exemplary system (e.g., a computer system) 100, as illustrated in the figure. As shown, the memory 104 of system 100 may include internal memory 120 of processor 102 and external memory 124 outside of processor 102. In this example, the internal memory 120 of processor 102 includes one or more first registers (e.g., working registers) 122a storing the current processor IPL 106 and one or more second registers (e.g., working registers) 122b storing the current DISICTL IPL 108. Processor 102 may store the previous processor IPL 109 as a component of machine state information (e.g., including the previous processor IPL 109, program counter, processor state (SR), and other state information) in the processor stack, such as in RAM, DRAM, or other suitable memory devices. External memory 124 may store (optionally) the previous DISICTL IPL 110 and code 112. For example, the previous DISICTL IPL 110 may be stored in RAM memory, and code 112 may be stored in a hard disk drive, RAM, or flash memory. In some examples, the current DISICTL IPL 108 and (optionally) the previous DISICTL IPL 110 are stored as 3-bit values in the corresponding registers or other memory locations.
[0054] Figures 4 to 7 This is an exemplary flowchart illustrating an exemplary process implemented by the exemplary system 100 discussed above. Figure 4 It shows, for example, by Figures 1 to 3 The exemplary system 100 shown executes an exemplary process 400 for determining and applying the highest IPL 109. The various operations of the process 400 discussed below can be performed in any order, in a sequential or parallel manner, and according to any suitable timing or frequency.
[0055] At 402, system 100 stores the current processor IPL 106 in memory, for example, in a first designated working register in processor 102. At 402, system 100 stores the current DISICTL IPL 108 in memory, for example, in a second designated working register in processor 102.
[0056] At 406, processor 102 updates the current processor IPL 106 based on the IPL associated with the corresponding exception 114 (e.g., an interrupt and / or trap). In some examples, processor 102 updates the current processor IPL 106 to the IPL of the corresponding exception 114 currently being processed (e.g., via the interrupt controller of processor 102) and stores the previous processor IPL 109 associated with the interrupt operation on the processor stack (as machine state information).
[0057] At 408, processor 102 updates the current DISICTL IPL 108 based on the received DISICTL instruction 116, where the corresponding DISICTL instruction 116 specifies the corresponding DISICTL IPL (e.g., by specifying a DISICTL IPL value or specifying the memory location of the previous DISICTL IPL 110 to be restored to the current DISICTL IPL 108). The corresponding DISICTL IPL of the corresponding DISICTL instruction 116 can be user-definable (e.g., a value from 0 to 7) by the code developer or other user who created the DISICTL instruction 116. In some examples, processor 102 keeps the current processor IPL 106 unchanged until the next DISICTL instruction 116 specifying the new DISICTL IPL is executed by processor 102.
[0058] At 410, processor 102 compares the current processor IPL 106 and the current DISICTL IPL 108 to determine the highest IPL 109 (i.e., the higher of the current processor IPL 106 and the current DISICTL IPL 108). In some examples, processor 102 may repeatedly perform this comparison over time (to determine the current value of the highest IPL 109) as the current processor IPL 106 and the current DISICTL IPL 108 are updated over time with the processing of the corresponding exception 114 and DISICTL instruction 116. In some examples, a comparator provided in processor 102 may repeatedly compare the current processor IPL 106 and the current DISICTL IPL 108 to determine the highest IPL 109 (e.g., at a frequency of 1 / 2). In some examples, system 100 stores (and updates) the highest IPL 109 in memory 104. In other examples, the highest IPL 109 is not stored.
[0059] At 412, processor 102 applies the highest IPL 109 during the execution of the corresponding segment of code 112 (which varies over time based on corresponding updates to the current processor IPL 106 and the current DISICTL IPL 108 at 406 and 408, respectively, and the highest IPL 109 at 410). In some examples, processor 102 applies the highest IPL 109 by ignoring exception 114 where the IPL is equal to or lower than the highest IPL 109.
[0060] Figure 5 This is shown according to an example, such as by Figures 1 to 3 The exemplary system 100 shown executes an exemplary process 500 for managing and handling exception 114. At 502, for example during the execution of a corresponding segment of code 112, a process with IPL is received at processor 102. n Anomaly 114 n (For example, an interrupt or a trap). Exception 114 n It can be newly received at processor 102, or previously queued by processor 102 and now ready for processing.
[0061] In response, at positions 504 to 508, processor 102 determines whether to interrupt its current operation and currently handle exception 114. n Or alternatively, abnormality 114 n Queued for processing at a later time. At 504, the processor determines the highest IPL 109, for example, by comparing the current processor IPL 106 with the current DISICTL IPL 108 (e.g., as discussed above at 410), or alternatively by accessing the highest IPL 109 from memory (in the example where the highest IPL 109 is stored in memory).
[0062] At position 506, processor 102 will encounter exception 114. n IPL n Compare with the highest IPL of 109. If the IPL... n If the value is equal to or lower than the highest IPL 109, then at 508, processor 102 will experience an exception at 510. n (For example, in memory 104) they are queued for later processing, for example, when (a) there are no other queued exceptions 114 with a higher IPL. n High IPL, and (b) IPL n Higher than the highest IPL 109 (e.g., when IPL n A value higher than the current DISICTL IPL 108 ensures that the current DISICTL IPL 108 will not prevent exception 114. n (The processing).
[0063] Alternatively, if IPL n If the maximum IPL is higher than 109, then at 510, processor 102 will reduce the IPL. n Set the current processor IPL to 106, interrupt its current operation, store the current processor IPL 106 as the previous processor IPL 109, and for example, by executing exception 114. n The related code snippet 112 handles exception 114. n When handling exception 114 n At that time, processor 102 ignores IPL that is lower than or equal to IPL. n The new and queued exception 114, and the processor 102 can, upon receiving exception 114 with a higher IPL or upon receiving an exception specified as higher than IPL, [further information is needed]. n DISICTL IPL interrupt exception 114 when DISICTL instruction 116 is called. n The processing.
[0064] Figure 6 It shows, for example, by Figures 1 to 3 The exemplary process 600 executed by the exemplary system 100 shown is for the processor 102 to execute the exemplary DISICTL instruction 116. n To update the current DISICTL IPL 108 (and optionally store the current DISICTL IPL 108 as the previous DISICTL IPL 110). At 602, processor 102 fetches and decodes DISICTL instruction 116. n At 604, if the DISICTL instruction 116 n If a storage target is specified (for storing the current DISICTL IPL 108 as the previous DISICTL IPL 110), then the processor 102 captures the current DISICTL IPL 108 (e.g., IPL=5).
[0065] At 606, processor 102 is based on DISICTL instruction 116. n Update the current DISICTL IPL 108, which depends on DISICTL instruction 116 within it. n Specify DISITCTL IPL n In the form of. For example, if as indicated at 608, DISICTL instruction 116 n DISITCTL IPL nIf specified as a value (e.g., IPL=7), then at 610, processor 102 updates the current DISICTLIPL 108 to the specified value (e.g., 7). Alternatively, if indicated at 612, DISICTL instruction 116 n DISITCTL IPL n If a memory location is specified (e.g., the memory location of the previous DISICTL IPL 110 or another memory location), then at 614 the processor 102 copies the DISICTL IPL (e.g., IPL=7) from the specified memory location (e.g., the memory location of the previous DISICTL IPL 110) to the current DISICTL IPL 108 in order to update the current DISICTL IPL 108 to the recognized IPL (e.g., IPL=7).
[0066] At 616, if the processor captures the current DISICTL IPL 108 at 604 (e.g., DISICTL instruction 116 based on a specified memory target), n At 616, processor 102 stores the captured current DISICTL IPL 108 (e.g., IPL=5) to the specified memory target as the previous DISICTL IPL 110. At 618, processor 102 retires DISICTL instruction 116. n .
[0067] Figure 7 An exemplary procedure 700 according to one example is shown for executing nested DISICTL instructions 116, for example, for executing a subroutine with a different (e.g., higher) priority than the subroutine calling code. At 702, processor 102 executes the corresponding code 112 while the current DISICTL IPL 108 is set to IPL. n =0, for example, where DISICTL is inactive and exception handling is controlled by the current processor IPL 106.
[0068] At 704, processor 102 executes the first DISICTL instruction "DISICTL Instruction A" associated with the first segment ("Code A") of code 112. DISICTL Instruction A itself may be considered part of Code A, part of the interrupt code executed at 112, or something different, depending on the relevant code structure. In this example, DISICTL Instruction A specifies (a) DISICTL IPL a =6 and (b) the first storage target. Therefore, processor 102 updates the current DISICTL IPL 108 to 6 (IPL) a=6), and will replace the current DISICTL IPL 108 (IPL) n =0) is stored in the specified first storage target as the first preceding DISICTL IPL 110. At 706, processor 102 executes code A, such as the first segment of code 112, under the current DISICTL IPL 108 set to 6.
[0069] At 708, processor 102 arrives at a procedure call in code A, for example, for executing a subroutine that includes a second segment (code B) with code 112 having a higher priority than code A. At 710, processor 102 executes a second DISICTL instruction "DISICTL instruction B" associated with code B. DISICTL instruction B itself may be considered part of code A, part of code B, or different from both code A and code B, depending on the relevant code structure. In this example, DISICTL instruction B specifies (a) DISICTL IPL b =7 and (b) second storage target. Therefore, processor 102 updates the current DISICTL IPL 108 to 7 (IPL) b =7), and will replace the current DISICTL IPL 108 (IPL) a =6) Stored in the specified second storage target as the second preceding DISICTL IPL 110. At 712, processor 102 executes code B (e.g., a subroutine) under the current DISICTL IPL 108 set to 7, such as the second segment of code 112.
[0070] At 714, upon completion of code B (subroutine), processor 102 executes a third DISICTL instruction "DISICTL instruction C" (e.g., included in code B) to restore the current DISICTL IPL from a second memory target, e.g., to 6, before returning to code A. DISICTL instruction C itself may be considered part of code B, part of code A, or distinct from both code B and code A, depending on the relevant code structure. In this example, DISICTL instruction C specifies the DISICTL IPL. c =6, for example, by specifying the previously stored DISICTL IPL a The memory location = 6 is the second memory destination in this example. Alternatively, the DISICTL instruction C can specify the DISICTL IPL value by specifying the DISICTL IPL value. c Therefore, processor 102 restores the current DISICTL IPL 108 to 6 (IPL). c =IPL a=6). At 716, processor 102 returns to the execution process and resumes execution of code A at 718 under the current DISICTL IPL 108 set to 6.
[0071] Upon completion of code A, at position 720, processor 102 executes the fourth DISICTL instruction "DISICTL instruction D" (e.g., included in code A) to restore DISICTL IPL to 0, for example, deactivating DISICTL IPL. DISICTL instruction D may be considered part of code A or separate from code A, depending on the relevant code structure. In this example, DISICTL instruction D specifies DISICTL IPL. d =0, for example, by specifying the previously stored DISICTL IPL n The memory location = 6 is the first memory target in this example. Alternatively, the DISICTL instruction D can specify the DISICTL IPL, for example, a value of 0. Therefore, processor 102 restores the current DISICTL IPL 108 to 0 (IPL). d =IPL n =0), in other words, DISICTLIPL is returned to an inactive state. At 722, processor 102 executes additional code 112, while the current DISICTL IPL 108 is set to IPL. n =0, for example, where exception handling is controlled by the current processor IPL 106.
Claims
1. A system for managing interrupt priority levels, the system comprising: A non-transitory computer-readable storage device, wherein the non-transitory computer-readable storage device stores: Current processor interrupt priority; Interrupt control, specifically DISICTL interrupt priority level, is currently disabled. as well as Processor, the processor being used for: The current processor interrupt priority level is updated based on the corresponding interrupt priority level associated with the corresponding exception; The current DISICTL interrupt priority level is updated based on the corresponding DISICTL instruction, wherein the corresponding DISICTL instruction specifies the corresponding user-definable DISICTL interrupt priority level. as well as Exceptions are disabled during the execution of the corresponding code, where the exception has a corresponding associated interrupt priority that is equal to or lower than the highest interrupt priority between the current processor interrupt priority and the current DISICTL interrupt priority.
2. The system of claim 1, wherein the processor includes a stack storing at least one previous processor.
3. The system according to any one of claims 1 to 2, wherein the non-transitory computer-readable storage memory comprises: At least one first register in the processor, the first register storing the current processor interrupt priority level; as well as At least one second register in the processor stores the current DISICTL interrupt priority level.
4. The system according to any one of claims 1 to 2, wherein the corresponding DISICTL instruction specifying the corresponding user-defined DISICTL interrupt priority level includes the value of the corresponding DISICTL instruction specifying the user-defined DISICTL interrupt priority level.
5. The system according to any one of claims 1 to 2, wherein the corresponding DISICTL instruction specifying the corresponding user-defined DISICTL interrupt priority level includes the memory location of the previous DISICTL interrupt priority level specified by the corresponding DISICTL instruction.
6. The system according to any one of claims 1 to 2, wherein: The corresponding DISICTL instruction specifies (a) the corresponding user-definable DISICTL interrupt priority and (b) the storage target; and The processor executes the corresponding DISICTL instruction, including: Update the current DISICTL interrupt priority level from the previous DISICTL interrupt priority level to the corresponding user-definable DISICTL interrupt priority level specified in the corresponding DISICTL instruction; and The previous DISICTL interrupt priority level is stored in the storage target specified in the corresponding DISICTL instruction.
7. The system according to any one of claims 1 to 2, wherein the processor: Execute the corresponding DISICTL instruction that specifies the corresponding user-defined DISICTL interrupt priority level, wherein the execution of the corresponding DISICTL instruction includes updating the current DISICTL interrupt priority level from the previous DISICTL interrupt priority level to the corresponding user-defined DISICTL interrupt priority level specified in the corresponding DISICTL instruction.
8. The system according to claim 7, wherein: The execution of the corresponding DISICTL instruction includes storing the previous DISICTL interrupt priority level; and After executing the first segment of the corresponding code associated with the corresponding DISICTL instruction, the processor restores the stored previous DISICTL interrupt priority level to the current DISICTL interrupt priority level.
9. The system of claim 8, wherein the non-transitory computer-readable storage medium comprises: A first memory location stores the current processor interrupt priority level; The second memory location stores the current DISICTL interrupt priority level; and The third memory location stores the previous DISICTL interrupt priority level.
10. The system of claim 7, wherein the processor: After executing a portion of the first segment of the corresponding code, a second DISICTL instruction specifying a second user-defined DISICTL interrupt priority level is executed to update the current DISICTL interrupt priority level to a second user-defined DISICTL interrupt priority level that is higher than the corresponding user-defined DISICTL interrupt priority level. During the second segment of the execution of the corresponding code, exceptions are disabled, the exceptions having a corresponding associated interrupt priority level equal to or lower than the second user-defined DISICTL interrupt priority level; After executing the second segment of the corresponding code, the current DISICTL interrupt priority level is restored to the corresponding user-defined DISICTL interrupt priority level; and Continue executing the first segment of the corresponding code.
11. A system for managing interrupt priority levels, the system comprising: A non-transitory computer-readable storage device, the non-transitory computer-readable storage device comprising: A first memory location, used to store the currently disabled interrupt control DISICTL interrupt priority level; and The second memory location is used to store the previous DISICTL interrupt priority level, and Processor, the processor being used for: The first DISICTL interrupt priority level associated with the first DISICTL instruction is stored as the current DISICTL interrupt priority level in the first memory location. Exceptions are disabled during the execution of the first code segment, where the exception has a corresponding associated interrupt priority equal to or lower than the first DISICTL interrupt priority level; and Execute a second DISICTL instruction specifying a second DISICTL interrupt priority level, wherein the execution of the second DISICTL instruction includes: The second DISICTL interrupt priority level specified by the second DISICTL instruction is stored as the current DISICTL interrupt priority level in the first memory location; The first DISICTL interrupt priority level is stored as the previous DISICTL interrupt priority level in the second memory location; and Exceptions are disabled during the execution of the second code segment, the exception having a corresponding associated interrupt priority level equal to or lower than the second DISICTL interrupt priority level.
12. The system according to claim 11, wherein: The second DISICTL instruction specifying the second DISICTL interrupt priority level includes the second DISICTL instruction specifying the second memory location; and The processor storing the second DISICTL interrupt priority level specified by the second DISICTL instruction as the current DISICTL interrupt priority level in the first memory location includes: the processor (a) accessing the previous DISICTL interrupt priority level stored in the second memory location; and (b) storing the accessed previous DISICTL interrupt priority level as the current DISICTL interrupt priority level in the first memory location.
13. The system according to any one of claims 11 to 12, wherein the processor: Execute a third DISICTL instruction specifying a third DISICTL interrupt priority level, wherein the execution of the third DISICTL instruction includes: The third DISICTL interrupt priority level specified by the third DISICTL instruction is stored as the current DISICTL interrupt priority level in the first memory location; as well as The second DISICTL interrupt priority level is stored in the second memory location as the previous DISICTL interrupt priority level. as well as Exceptions are disabled during the execution of the third code segment, the exception having a corresponding associated interrupt priority level equal to or lower than the third DISICTL interrupt priority level.
14. A method for managing interrupt priority levels, the method comprising: Store the current processor interrupt priority in non-transitory computer-readable storage; The current disabled interrupt control DISICTL interrupt priority level is stored in the non-transitory computer-readable storage memory; The processor updates the current processor interrupt priority level based on the corresponding interrupt priority level associated with the corresponding exception; The processor updates the current DISICTL interrupt priority level based on the corresponding DISICTL instruction, wherein the corresponding DISICTL instruction specifies the corresponding user-definable DISICTL interrupt priority level. The processor disables exceptions during the execution of the corresponding code, the exception having a corresponding associated interrupt priority level equal to or lower than the highest interrupt priority level between the current processor interrupt priority level and the current DISICTL interrupt priority level.
15. The method of claim 14, wherein the processor includes a stack storing at least one previous processor.
16. The method according to any one of claims 14 to 15, wherein: The corresponding DISICTL instruction specifies the corresponding DISICTL interrupt priority level, including the value of the corresponding DISICTL interrupt priority level specified by the corresponding DISICTL instruction; and Updating the current DISICTL interrupt priority level by the processor based on the corresponding DISICTL instruction includes setting the current DISICTL interrupt priority level to the value of the corresponding DISICTL interrupt priority level specified in the corresponding DISICTL instruction.
17. The method according to any one of claims 14 to 15, wherein: The corresponding DISICTL instruction specifies the corresponding DISICTL interrupt priority level, including the memory location of the previous DISICTL interrupt priority level specified by the corresponding DISICTL instruction. and The processor updating the current DISICTL interrupt priority level based on the corresponding DISICTL instruction includes: Access the previous DISICTL interrupt priority level in the memory location specified in the corresponding DISICTL instruction; as well as Set the previous DISICTL interrupt priority level to the current DISICTL interrupt priority level.
18. The method according to any one of claims 14 to 15, the method comprising: The processor executes the corresponding DISICTL instruction that specifies the corresponding user-defined DISICTL interrupt priority level, wherein executing the corresponding DISICTL instruction includes setting the current DISICTL interrupt priority level to the corresponding user-defined DISICTL interrupt priority level; as well as The processor disables exceptions during the first segment of executing the corresponding code, the exception having a corresponding associated interrupt priority level equal to or lower than the corresponding user-defined DISICTL interrupt priority level.
19. The method of claim 18, wherein: Executing the corresponding DISICTL instruction includes storing the previous DISICTL interrupt priority level in a non-transitory computer-readable storage device; and The method includes executing the first segment of the corresponding code after: Access the previously stored DISICTL interrupt priority level; and Set the previous DISICTL interrupt priority level to the current DISICTL interrupt priority level.
20. The method of claim 18, wherein the method comprises: After executing a portion of the first segment of the corresponding code, the processor executes a second user-defined DISICTL instruction that specifies a second DISICTL interrupt priority that is higher than the corresponding user-defined DISICTL interrupt priority. Executing the second DISICTL instruction includes setting the current DISICTL interrupt priority level to the second user-definable DISICTL interrupt priority level. The processor disables exceptions during the second segment of executing the corresponding code, the exceptions having a corresponding associated interrupt priority level equal to or lower than the second user-defined DISICTL interrupt priority level; After executing the second segment of the corresponding code, the processor restores the corresponding user-defined DISICTL interrupt priority level to the current DISICTL interrupt priority level. Continue executing the first segment of the corresponding code; as well as The processor disables exceptions during the first segment of the continued execution of the corresponding code, the exceptions having a corresponding associated interrupt priority level equal to or lower than the corresponding user-defined DISICTL interrupt priority level.
Citation Information
Patent Citations
Interrupt processing method and system, and computer readable storage medium
CN110851384A
