[go: up one dir, main page]

CN1783020A - Interrupt managing method for embedded operation system based on PowerPC system structure - Google Patents

Interrupt managing method for embedded operation system based on PowerPC system structure Download PDF

Info

Publication number
CN1783020A
CN1783020A CN 200510060734 CN200510060734A CN1783020A CN 1783020 A CN1783020 A CN 1783020A CN 200510060734 CN200510060734 CN 200510060734 CN 200510060734 A CN200510060734 A CN 200510060734A CN 1783020 A CN1783020 A CN 1783020A
Authority
CN
China
Prior art keywords
interrupt
task
user
interrupts
stack
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN 200510060734
Other languages
Chinese (zh)
Inventor
赵民德
姜旭锋
厉蒋
李红
郑能干
吴朝晖
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang University ZJU
Original Assignee
Zhejiang University ZJU
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang University ZJU filed Critical Zhejiang University ZJU
Priority to CN 200510060734 priority Critical patent/CN1783020A/en
Publication of CN1783020A publication Critical patent/CN1783020A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Executing Machine-Instructions (AREA)

Abstract

本发明涉及一种基于PowerPC体系结构的嵌入式操作系统的中断管理方法,步骤如下:将中断分为系统中断和用户中断两类,将用户中断服务程序分为一类中断服务程序和二类中断服务程序;用户中断发生时,首先由硬件响应中断;然后保存上下文、堆栈切换、维护中断嵌套,以保证在中断处理完成后被中断的任务能继续运行;中断发生后通过中断源在用户中断向量表中找到并调用相应的中断服务程序,接着再次维护中断嵌套、堆栈切换,最后恢复上下文,处理器继续运行原先被中断的任务。本发明具有如下优点:提高了中断的执行效率和中断的利用效率,方便了中断的控制和使用。防止了由于嵌套中断而引起的堆栈溢出异常,提高了用户堆栈大小的可控性和可预知性。

The invention relates to an interrupt management method of an embedded operating system based on the PowerPC system structure, the steps are as follows: the interrupt is divided into two types: system interrupt and user interrupt, and the user interrupt service program is divided into a first-class interrupt service program and a second-class interrupt Service program; when a user interrupt occurs, the hardware first responds to the interrupt; then save the context, switch the stack, and maintain interrupt nesting to ensure that the interrupted task can continue to run after the interrupt processing is completed; Find and call the corresponding interrupt service program in the vector table, then maintain interrupt nesting, stack switching, and finally restore the context, and the processor continues to run the task that was originally interrupted. The invention has the following advantages: the execution efficiency and utilization efficiency of the interrupt are improved, and the control and use of the interrupt are facilitated. Prevents stack overflow exceptions caused by nested interrupts, and improves the controllability and predictability of the user stack size.

Description

基于PowerPC体系结构的嵌入式操作系统的中断管理方法Interrupt Management Method of Embedded Operating System Based on PowerPC Architecture

技术领域technical field

本发明涉及嵌入式实时操作系统技术,主要是实现一种基于PowerPC体系结构的嵌入式操作系统的中断管理方法。The invention relates to an embedded real-time operating system technology, mainly realizing an interrupt management method of an embedded operating system based on PowerPC system structure.

背景技术Background technique

中断是操作系统必不可少的一种机制,中断用于通知处理器有某个事件的发生。中断一旦被识别,处理器将保存反映当前任务状态的数据(比如寄存器中数值),这些数据被称为“上下文”;保存上下文之后处理器将执行专门的中断服务程序来响应引发中断的事件;最后恢复上下文,继续执行被中断的任务。中断机制被用于处理内部和外部一些不可预期的突发事件。由于其不可预期的特点,那么中断机制的健壮性对于一个操作系统尤其是实时的嵌入式操作系统来说就显得尤为重要。它直接关系到操作系统的稳定性和运行的效率。由于中断机制和操作系统相结合,那么中断机制必然要保证任务的正常运行,这就需要在中断发生和中断退出时做好初始和善后的工作。Interrupts are an essential mechanism for the operating system. Interrupts are used to notify the processor that a certain event has occurred. Once the interrupt is recognized, the processor will save data reflecting the current task state (such as the value in the register), which is called "context"; after saving the context, the processor will execute a special interrupt service routine to respond to the event that caused the interrupt; Finally, the context is restored and the interrupted task continues. The interrupt mechanism is used to deal with some unexpected internal and external emergencies. Due to its unpredictable characteristics, the robustness of the interrupt mechanism is particularly important for an operating system, especially a real-time embedded operating system. It is directly related to the stability of the operating system and the efficiency of operation. Due to the combination of the interrupt mechanism and the operating system, the interrupt mechanism must ensure the normal operation of the task, which requires initial and aftermath work when the interrupt occurs and the interrupt exits.

目前较流行的微内核嵌入式操作系统,比如uC/OS等,不提供中断的封装和管理,用户需要自己定义中断服务程序的接口、现场保护、现场恢复以及与中断源绑定等,这给用户编写中断服务程序带来极大不便,必然增加了用户开发的难度,延长开发周期、降低了系统的稳定性。Currently popular microkernel embedded operating systems, such as uC/OS, do not provide interrupt encapsulation and management. Users need to define their own interrupt service program interface, context protection, context recovery, and binding to interrupt sources. It is very inconvenient for users to write interrupt service programs, which will inevitably increase the difficulty of user development, prolong the development cycle and reduce the stability of the system.

中断管理不同于操作系统的任务管理等其他机制,它与硬件体系结构相关性大。因此从稳定性、执行效率和系统开销这三大嵌入式系统的指标考虑,针对不同的体系结构,不同的处理器系列,需要实现特定的中断管理方法。Interrupt management is different from other mechanisms such as task management of the operating system, and it has a great correlation with the hardware architecture. Therefore, considering the three major embedded system indicators of stability, execution efficiency and system overhead, specific interrupt management methods need to be implemented for different architectures and different processor series.

发明内容Contents of the invention

本发明解决了一般中断管理存在的缺陷,而提供一种基于PowerPC体系结构的嵌入式操作系统的中断管理方法。The invention solves the defects in the general interrupt management, and provides an interrupt management method of the embedded operating system based on the PowerPC architecture.

这种基于PowerPC体系结构的嵌入式操作系统的中断管理方法,实现步骤如下:The interrupt management method of this embedded operating system based on PowerPC architecture, the implementation steps are as follows:

1)、将中断分为系统中断和用户中断两类,系统中断由系统集中管理,处理由系统引发的中断,比如由于非正常操作引起的异常、重启(Reset)中断;用户中断处理用户可用的外部中断,比如串口中断、模数转换中断等。系统中断是指除了外部中断和可屏蔽外部断点外的所有中断。系统中断发生时将进入统一的系统中断服务程序入口,在执行中断服务程序之前只保存少量必要的寄存器数据。用户中断是指外部中断和可屏蔽外部断点,外部中断由外部引脚触发,可屏蔽外部断点中断由片内其他模块产生,硬件系统不区分具体的用户中断,而使用统一的用户中断服务程序入口,通过维护一张用户中断向量表来调度用户中断。本发明分别为系统中断和用户中断提供入口封装,所有系统中断统一采用一个系统中断入口,所有用户中断统一采用一个用户中断为入口,在这两个入口内分别对中断进行操作。1) Interrupts are divided into two types: system interrupts and user interrupts. System interrupts are centrally managed by the system to handle interrupts caused by the system, such as exceptions caused by abnormal operations and reset (Reset) interrupts; user interrupts handle user-available External interrupts, such as serial port interrupts, analog-to-digital conversion interrupts, etc. System interrupts refer to all interrupts except external interrupts and maskable external breakpoints. When a system interrupt occurs, it will enter the unified system interrupt service program entry, and only save a small amount of necessary register data before executing the interrupt service program. User interrupts refer to external interrupts and maskable external breakpoints. External interrupts are triggered by external pins, and maskable external breakpoint interrupts are generated by other modules in the chip. The hardware system does not distinguish specific user interrupts, but uses a unified user interrupt service The program entry schedules user interrupts by maintaining a user interrupt vector table. The invention provides entry encapsulation for system interrupt and user interrupt respectively, all system interrupts uniformly use one system interrupt entry, all user interrupts uniformly use one user interrupt as the entry, and interrupts are respectively operated in the two entries.

2)、将用户中断服务程序分为一类中断服务程序和二类中断服务程序,一类中断服务程序中不允许用户调用系统服务,这类中断服务程序中没有影响任务调度的操作,中断服务程序结束后系统将回到中断发生的地方继续运行;二类中断服务程序中允许调用系统服务,当中断服务程序结束时会引发任务调度以保证优先级最高的任务被执行;2) The user interrupt service program is divided into a first-class interrupt service program and a second-class interrupt service program. The user is not allowed to call system services in the first-class interrupt service program. There is no operation that affects task scheduling in this type of interrupt service program. Interrupt service After the program ends, the system will return to the place where the interrupt occurred and continue to run; in the second type of interrupt service program, system services are allowed to be called, and when the interrupt service program ends, task scheduling will be triggered to ensure that the task with the highest priority is executed;

3)、用户中断发生时,首先由硬件响应中断;然后保存上下文、堆栈切换、维护中断嵌套,以保证在中断处理完成后被中断的任务能继续运行;中断发生后通过中断源在用户中断向量表中找到并调用相应的中断服务程序,接着再次维护中断嵌套、堆栈切换,最后恢复上下文,处理器继续运行原先被中断的任务;维护中断嵌套是指在处理中断的过程中,屏蔽低优先级的中断,防止低优先级的中断干扰高优先级的中断服务程序的执行;在用户中断程序返回以后,再恢复被屏蔽中断。在软件层上管理中断嵌套,多级的中断嵌套使用系统的堆栈空间保存上下文,而任务的上下文将被保存在任务的堆栈空间,当处理器在嵌套中断和用户任务间切换时需要进行系统堆栈和任务堆栈的切换。3) When a user interrupt occurs, the hardware first responds to the interrupt; then saves the context, switches the stack, and maintains interrupt nesting to ensure that the interrupted task can continue to run after the interrupt processing is completed; Find and call the corresponding interrupt service program in the vector table, then maintain interrupt nesting, stack switching, and finally restore the context, and the processor continues to run the task that was interrupted; maintaining interrupt nesting means that in the process of processing interrupts, shielding The low-priority interrupt prevents the low-priority interrupt from interfering with the execution of the high-priority interrupt service routine; after the user interrupt program returns, the masked interrupt is resumed. Manage interrupt nesting at the software layer. Multi-level interrupt nesting uses the system's stack space to save the context, while the task's context will be saved in the task's stack space, which is needed when the processor switches between nested interrupts and user tasks. Switch between system stack and task stack.

4)、对于二类中断服务程序,当从中断返回任务层时需要进行任务调度以保证高优先级的任务能即使运行;保存和恢复上下文时,对于一类中断只保存和恢复易失性寄存器的值,而对于二类中断还需要保存和恢复非易失性寄存器的值。4), for the second type of interrupt service program, when returning to the task layer from the interrupt, task scheduling is required to ensure that the high priority task can run immediately; when saving and restoring the context, only the volatile register is saved and restored for the first type of interrupt value, and for the second type of interrupt, it is also necessary to save and restore the value of the non-volatile register.

本发明具有如下优点:The present invention has the following advantages:

1.本发明将中断和中断服务程序进行分类。中断分为系统中断和用户中断,对不同类型的中断服务程序使用不同的处理机制,从而提高了中断的执行效率。1. The present invention classifies interrupts and interrupt service routines. Interrupts are divided into system interrupts and user interrupts. Different processing mechanisms are used for different types of interrupt service routines, thereby improving the execution efficiency of interrupts.

2.在本发明中,支持基于PowerPC体系的中断嵌套,最大可以支持16层的嵌套,提高了中断的利用效率,方便了中断的控制和使用。2. In the present invention, interrupt nesting based on the PowerPC system is supported, and a maximum of 16 layers of nesting can be supported, which improves the utilization efficiency of interrupts and facilitates the control and use of interrupts.

3.本发明提供统一的中断管理接口,用户可以通过调用这些接口来配置中断服务程序的属性。本发明隐藏了复杂的中断处理细节,提高了用户在PowerPC体系结构中开发中断服务程序的效率和方便性。3. The present invention provides a unified interrupt management interface, and the user can configure the attributes of the interrupt service program by calling these interfaces. The invention hides complex interrupt processing details, and improves the efficiency and convenience for users to develop interrupt service programs in the PowerPC architecture.

4.本发明引入系统堆栈来处理嵌套中断,有效防止了由于嵌套中断而引起的堆栈溢出异常,提高了用户堆栈大小的可控性和可预知性,节省了内存的开销。4. The present invention introduces the system stack to handle nested interrupts, which effectively prevents stack overflow exceptions caused by nested interrupts, improves the controllability and predictability of the user stack size, and saves memory overhead.

此中断机制在PowerPC体系结构的MPC555硬件平台上经过严格测试,证明该机制具有良好的性能和稳定性。This interrupt mechanism has been strictly tested on the MPC555 hardware platform of the PowerPC architecture, which proves that the mechanism has good performance and stability.

附图说明Description of drawings

图1本发明中系统中断处理流程图;System interrupt processing flowchart in Fig. 1 of the present invention;

图2本发明中一类用户中断处理流程图;A flow chart of a class of user interruption processing in Fig. 2 of the present invention;

图3本发明中二类用户中断处理流程图。Fig. 3 is a flow chart of the second type of user interruption processing in the present invention.

具体实施方式Detailed ways

下面结合PowerPC体系结构的MPC555平台对本发明作进一步介绍:Below in conjunction with the MPC555 platform of PowerPC architecture, the present invention is further introduced:

本发明将整个中断系统分为两类,一类是系统中断,一类是用户中断,这两类中断共同组成了PowerPC体系结构的中断体系。The present invention divides the whole interrupt system into two types, one is system interrupt and the other is user interrupt, and these two types of interrupts together constitute the interrupt system of the PowerPC architecture.

●系统中断●System interruption

在PowerPC体系结构中,系统中断是指除了外部中断和可屏蔽外部断点外的所有中断。系统中断发生时将进入统一的系统中断服务程序入口,在执行中断服务程序之前只保存少量必要的寄存器数据。例如在MPC555硬件平台上浮点数异常中断就属于系统中断,如图1所示,该中断发生时的处理过程如下:In the PowerPC architecture, system interrupts refer to all interrupts except external interrupts and maskable external breakpoints. When a system interrupt occurs, it will enter the unified system interrupt service program entry, and only save a small amount of necessary register data before executing the interrupt service program. For example, on the MPC555 hardware platform, the floating-point number exception interrupt belongs to the system interrupt, as shown in Figure 1, the processing process when the interrupt occurs is as follows:

1.中断发生,硬件从中断向量表中找到统一的系统中断入口,从该入口开始执行以下步骤。1. When an interrupt occurs, the hardware finds a unified system interrupt entry from the interrupt vector table, and executes the following steps from this entry.

2.保存相应的寄存器数据,在MPC555硬件平台上这些寄存器包括通用整型寄存器GPR0-GPR13,LR,CR,MSR,SRR0,SRR1,XER,CTR。2. Save the corresponding register data. On the MPC555 hardware platform, these registers include general integer registers GPR0-GPR13, LR, CR, MSR, SRR0, SRR1, XER, and CTR.

3.从特定寄存器获取中断源,根据中断源调用系统中断服务程序,在本例中调用的是浮点数异常系统中断服务程序。3. Obtain the interrupt source from a specific register, and call the system interrupt service routine according to the interrupt source. In this example, the floating-point number exception system interrupt service routine is called.

4.恢复在步骤2中保存的寄存器数据。4. Restore the register data saved in step 2.

5.中断返回,从中断发生的地方继续运行程序。5. Interrupt return, continue to run the program from the place where the interrupt occurred.

●用户中断● User Interrupt

PowerPC体系结构中,用户中断是指外部中断和可屏蔽外部断点。外部中断由外部引脚触发,可屏蔽外部断点中断由片内其他模块产生。在本发明中,硬件系统不区分具体的用户中断,而使用统一的用户中断服务程序入口,本发明通过维护一张用户中断向量表来调度用户中断。用户中断服务程序被分为一类用户中断服务程序和二类中断服务程序。In the PowerPC architecture, user interrupts refer to external interrupts and maskable external breakpoints. The external interrupt is triggered by an external pin, and the maskable external breakpoint interrupt is generated by other modules on-chip. In the present invention, the hardware system does not distinguish specific user interrupts, but uses a unified user interrupt service program entry. The present invention schedules user interrupts by maintaining a user interrupt vector table. The user interrupt service routine is divided into a type of user interrupt service routine and a second type of interrupt service routine.

例如在PowerPC体系结构的MPC555平台上的一个实例中,用户为一个串口中断配置了一段一类中断服务程序,当该串口中断发生时,中断服务程序负责进行一些简单的数据处理,如图2所示,该中断处理过程如下:For example, in an example on the MPC555 platform of the PowerPC architecture, the user configures a class I interrupt service program for a serial port interrupt. When the serial port interrupt occurs, the interrupt service program is responsible for some simple data processing, as shown in Figure 2 Shown, the interrupt handling process is as follows:

6.中断发生,硬件从中断向量表中找到统一的用户中断入口,从该入口开始执行以下步骤。6. When an interrupt occurs, the hardware finds a unified user interrupt entry from the interrupt vector table, and executes the following steps from this entry.

7.保存返回地址以及少量的要在以下步骤中使用的寄存器,比如通用寄存器GPR2~GPR3。7. Save the return address and a small number of registers to be used in the following steps, such as general registers GPR2-GPR3.

8.如果是从任务进入中断需要从任务堆栈切换到系统堆栈,如果是嵌套中断则不需要进行堆栈切换。8. If it is from the task to enter the interrupt, it needs to switch from the task stack to the system stack. If it is a nested interrupt, it does not need to switch the stack.

9.屏蔽比该中断优先级低的中断。9. Mask interrupts with a lower priority than this interrupt.

10.获得中断源,然后根据该值从用户中断向量表找到该串口中断的用户中断服务程序并执行。10. Obtain the interrupt source, and then find the user interrupt service program of the serial port interrupt from the user interrupt vector table according to the value and execute it.

11.如果是从中断中退回任务需要从系统堆栈切换回任务堆栈,如果从嵌套中断退出则不需要进行堆栈切换。11. If the task is returned from an interrupt, it needs to switch from the system stack back to the task stack. If it exits from a nested interrupt, it does not need to switch the stack.

12.恢复在步骤2中保存的寄存器。12. Restore the registers saved in step 2.

13.从该中断中退出,继续执行被中断的程序。13. Exit from the interrupt and continue to execute the interrupted program.

在同一个实例中,用户为一个模数转换中断配置了一个二类中断服务程序,当该中断发生时,中断服务程序会激活一个具有较高优先级的处理模数转换的任务,以保证在中断退出后,该任务能即使被运行,该中断处理过程如下:In the same instance, the user configures a class 2 interrupt service program for an analog-to-digital conversion interrupt. When the interrupt occurs, the interrupt service program will activate a task with a higher priority for processing analog-to-digital conversion to ensure After the interrupt exits, the task can be executed even if the interrupt processing process is as follows:

1.中断发生,硬件从中断向量表中找到统一的用户中断入口,从该入口开始执行以下步骤。1. When an interrupt occurs, the hardware finds a unified user interrupt entry from the interrupt vector table, and executes the following steps from this entry.

2.保存返回地址以及少量的要在以下步骤中使用的寄存器,比如通用寄存器GPR2~GPR3。2. Save the return address and a small number of registers to be used in the following steps, such as general registers GPR2-GPR3.

3.如果是从任务进入中断需要从任务堆栈切换到系统堆栈,如果是嵌套中断则不需要进行堆栈切换。3. If it is from the task to enter the interrupt, it needs to switch from the task stack to the system stack. If it is a nested interrupt, it does not need to switch the stack.

4.保存非易失性寄存器,在MPC555硬件平台上非易失性寄存器包括通用整型寄存器GPR14-GPR31、CR、XER、CTR,所以处理二类中断时要比处理一类中断时保存和恢复更多寄存器的值。4. Save the non-volatile registers. On the MPC555 hardware platform, the non-volatile registers include general-purpose integer registers GPR14-GPR31, CR, XER, and CTR. Therefore, it is better to save and restore the second type of interrupt than the first type of interrupt. Values of more registers.

5.屏蔽比该中断优先级低的中断。5. Mask interrupts with a lower priority than this interrupt.

6.获得中断源,从用户中断向量表找到该串口中断的用户中断服务程序并执行,该程序激活了一个高优先级的任务。6. Obtain the interrupt source, find the user interrupt service program of the serial port interrupt from the user interrupt vector table and execute it. This program activates a high-priority task.

7.如果是从中断中退回任务需要从系统堆栈切换回任务堆栈并恢复非易失性寄存器的值,如果从嵌套中断退出则不需要进行堆栈切换。7. If the task is returned from the interrupt, it needs to switch from the system stack back to the task stack and restore the value of the non-volatile register. If it exits from the nested interrupt, it does not need to switch the stack.

8.恢复步骤2和步骤4保存的所有寄存器。8. Restore all registers saved in step 2 and step 4.

9.从该中断中退出,如果从嵌套中断中退出,则继续运行中断服务程序;如果退回任务层,由于一个高优先级的任务被激活,所以引发调度程序,运行该高优先级任务而不是继续执行被中断的程序。9. Exit from the interrupt. If you exit from the nested interrupt, continue to run the interrupt service program; if you return to the task layer, because a high-priority task is activated, the scheduler is triggered to run the high-priority task instead. Instead of continuing to execute the interrupted program.

Claims (7)

1、一种基于PowerPC体系结构的嵌入式操作系统的中断管理方法,其特征在于:实现步骤如下:1, a kind of interrupt management method based on the embedded operating system of PowerPC architecture, it is characterized in that: the realization step is as follows: 1)、将中断分为系统中断和用户中断两类,系统中断由系统集中管理,处理由系统引发的中断;用户中断处理用户可用的外部中断;1) Interrupts are divided into two types: system interrupts and user interrupts. System interrupts are managed centrally by the system to handle interrupts caused by the system; user interrupts handle external interrupts available to users; 2)、将用户中断服务程序分为一类中断服务程序和二类中断服务程序,一类中断服务程序中不允许用户调用系统服务,这类中断服务程序中没有影响任务调度的操作,中断服务程序结束后系统将回到中断发生的地方继续运行;二类中断服务程序中允许调用系统服务,当中断服务程序结束时会引发任务调度以保证优先级最高的任务被执行;2) The user interrupt service program is divided into a first-class interrupt service program and a second-class interrupt service program. The user is not allowed to call system services in the first-class interrupt service program. There is no operation that affects task scheduling in this type of interrupt service program. Interrupt service After the program ends, the system will return to the place where the interrupt occurred and continue to run; in the second type of interrupt service program, system services are allowed to be called, and when the interrupt service program ends, task scheduling will be triggered to ensure that the task with the highest priority is executed; 3)、用户中断发生时,首先由硬件响应中断;然后保存上下文、堆栈切换、维护中断嵌套,以保证在中断处理完成后被中断的任务能继续运行;中断发生后通过中断源在用户中断向量表中找到并调用相应的中断服务程序,接着再次维护中断嵌套、堆栈切换,最后恢复上下文,处理器继续运行原先被中断的任务;3) When a user interrupt occurs, the hardware first responds to the interrupt; then saves the context, switches the stack, and maintains interrupt nesting to ensure that the interrupted task can continue to run after the interrupt processing is completed; Find and call the corresponding interrupt service routine in the vector table, then maintain interrupt nesting, stack switching, and finally restore the context, and the processor continues to run the previously interrupted task; 4)、对于二类中断服务程序,当从中断返回任务层时需要进行任务调度以保证高优先级的任务能即使运行;保存和恢复上下文时,对于一类中断只保存和恢复在该工程中使用的易失性寄存器的值,而对于二类中断还需要保存和恢复非易失性寄存器的值。4) For the second-type interrupt service program, when returning from the interrupt to the task layer, task scheduling is required to ensure that high-priority tasks can run immediately; when saving and restoring the context, only save and restore in the project for a type of interrupt The value of the volatile register used, and the value of the non-volatile register needs to be saved and restored for the second type of interrupt. 2、根据权利要求1所述的基于PowerPC体系结构的嵌入式操作系统的中断管理方法,其特征在于:维护中断嵌套是指在处理中断的过程中,屏蔽低优先级的中断,防止低优先级的中断干扰高优先级的中断服务程序的执行;在用户中断程序返回以后,再恢复被屏蔽中断。2. The interrupt management method of the embedded operating system based on PowerPC architecture according to claim 1, characterized in that: maintaining interrupt nesting means that in the process of interrupting, shielding low-priority interrupts prevents low-priority Interrupts at the highest level interfere with the execution of the high-priority interrupt service routine; after the user interrupt routine returns, the masked interrupt is resumed. 3、根据权利要求1所述的基于PowerPC体系结构的嵌入式操作系统的中断管理方法,其特征在于:在软件层上管理中断嵌套,多级的中断嵌套使用系统的堆栈空间保存上下文,而任务的上下文将被保存在任务的堆栈空间,当处理器在嵌套中断和用户任务间切换时需要进行系统堆栈和任务堆栈的切换。3, the interrupt management method based on the embedded operating system of PowerPC architecture according to claim 1, it is characterized in that: manage interrupt nesting on software layer, the stack space of multi-level interrupt nesting uses system to preserve context, The context of the task will be saved in the stack space of the task. When the processor switches between nested interrupts and user tasks, it needs to switch between the system stack and the task stack. 4、根据权利要求1所述的基于PowerPC体系结构的嵌入式操作系统的中断管理方法,其特征在于:系统中断是指除了外部中断和可屏蔽外部断点外的所有中断。系统中断发生时将进入统一的系统中断服务程序入口,在执行中断服务程序之前只保存少量必要的寄存器数据。4. The interrupt management method of an embedded operating system based on PowerPC architecture according to claim 1, wherein: system interrupts refer to all interrupts except external interrupts and maskable external breakpoints. When a system interrupt occurs, it will enter the unified system interrupt service program entry, and only save a small amount of necessary register data before executing the interrupt service program. 5、根据权利要求1所述的基于PowerPC体系结构的嵌入式操作系统的中断管理方法,其特征在于:用户中断是指外部中断和可屏蔽外部断点,外部中断由外部引脚触发,可屏蔽外部断点中断由片内其他模块产生,硬件系统不区分具体的用户中断,而使用统一的用户中断服务程序入口,通过维护一张用户中断向量表来调度用户中断。5, the interrupt management method based on the embedded operating system of PowerPC architecture according to claim 1 is characterized in that: user interrupt refers to external interrupt and shieldable external breakpoint, external interrupt is triggered by external pin, shieldable External breakpoint interrupts are generated by other modules in the chip. The hardware system does not distinguish specific user interrupts, but uses a unified user interrupt service program entry to schedule user interrupts by maintaining a user interrupt vector table. 6、根据权利要求1所述的基于PowerPC体系结构的嵌入式操作系统的中断管理方法,其特征在于:用户为一个串口中断配置了一段一类中断服务程序,当该串口中断发生时,该中断处理过程如下:6. The interrupt management method of the embedded operating system based on PowerPC architecture according to claim 1, characterized in that: the user has configured a section of a class of interrupt service program for a serial port interrupt, and when the serial port interrupt occurred, the interrupt The process is as follows: 1)、中断发生,硬件从中断向量表中找到统一的用户中断入口,从该入口开始执行以下步骤;1), when an interrupt occurs, the hardware finds a unified user interrupt entry from the interrupt vector table, and executes the following steps from this entry; 2)、保存返回地址以及少量的要在以下步骤中使用的寄存器;2), save the return address and a small number of registers to be used in the following steps; 3)、如果是从任务进入中断需要从任务堆栈切换到系统堆栈,如果是嵌套中断则不需要进行堆栈切换;3) If it is from the task to enter the interrupt, it needs to switch from the task stack to the system stack, if it is a nested interrupt, it does not need to switch the stack; 4)、屏蔽比该中断优先级低的中断;4) Shield interrupts with a lower priority than the interrupt; 5)、获得中断源,然后根据该值从用户中断向量表找到该串口中断的用户中断服务程序并执行;5), obtain the interrupt source, then find and execute the user interrupt service program of the serial port interrupt from the user interrupt vector table according to the value; 6)、如果是从中断中退回任务需要从系统堆栈切换回任务堆栈,如果从嵌套中断退出则不需要进行堆栈切换;6) If the task is returned from the interrupt, it needs to switch from the system stack back to the task stack, and if it exits from the nested interrupt, it does not need to switch the stack; 7)、恢复在步骤2中保存的寄存器;7), restore the register saved in step 2; 8)、从该中断中退出,继续执行被中断的程序。8) Exit from the interrupt and continue to execute the interrupted program. 7、根据权利要求1所述的基于PowerPC体系结构的嵌入式操作系统的中断管理方法,其特征在于:用户为一个模数转换中断配置了一个二类中断服务程序,当该中断发生时,中断服务程序会激活一个具有较高优先级的处理模数转换的任务,以保证在中断退出后,该任务能即使被运行,该中断处理过程如下:7, the interrupt management method based on the embedded operating system of PowerPC architecture according to claim 1, is characterized in that: the user has configured a second class interrupt service program for an analog-to-digital conversion interrupt, and when this interrupt occurred, interrupt The service program will activate a task with a higher priority to process analog-to-digital conversion to ensure that the task can be run even after the interrupt exits. The interrupt processing process is as follows: 1)、中断发生,硬件从中断向量表中找到统一的用户中断入口,从该入口开始执行以下步骤;1), when an interrupt occurs, the hardware finds a unified user interrupt entry from the interrupt vector table, and executes the following steps from this entry; 2)、保存返回地址以及少量的要在以下步骤中使用的寄存器;2), save the return address and a small number of registers to be used in the following steps; 3)、如果是从任务进入中断需要从任务堆栈切换到系统堆栈,如果是嵌套中断则不需要进行堆栈切换;3) If it is from the task to enter the interrupt, it needs to switch from the task stack to the system stack, if it is a nested interrupt, it does not need to switch the stack; 4)、保存非易失性寄存器,在MPC555硬件平台上非易失性寄存器包括通用整型寄存器GPR14-GPR31、CR、XER、CTR;4), save the non-volatile registers, on the MPC555 hardware platform, the non-volatile registers include general integer registers GPR14-GPR31, CR, XER, CTR; 5)、屏蔽比该中断优先级低的中断;5) Shield interrupts with a lower priority than the interrupt; 6)、获得中断源,从用户中断向量表找到该串口中断的用户中断服务程序并执行,该程序激活了一个高优先级的任务;6), obtain the interrupt source, find and execute the user interrupt service program of the serial port interrupt from the user interrupt vector table, and this program activates a high-priority task; 7)、如果是从中断中退回任务需要从系统堆栈切换回任务堆栈并恢复非易失性寄存器的值,如果从嵌套中断退出则不需要进行堆栈切换;7) If the task is returned from the interrupt, it needs to switch from the system stack back to the task stack and restore the value of the non-volatile register. If it exits from the nested interrupt, it does not need to switch the stack; 8)、恢复步骤2和步骤4保存的所有寄存器;8), restore all registers saved in step 2 and step 4; 9)、从该中断中退出,如果从嵌套中断中退出,则继续运行中断服务程序;如果退回任务层,由于一个高优先级的任务被激活,所以引发调度程序,运行该高优先级任务而不是继续执行被中断的程序。9) Exit from the interrupt, if exit from the nested interrupt, continue to run the interrupt service routine; if return to the task layer, because a high-priority task is activated, the scheduler is triggered to run the high-priority task Instead of continuing to execute the interrupted program.
CN 200510060734 2005-09-12 2005-09-12 Interrupt managing method for embedded operation system based on PowerPC system structure Pending CN1783020A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 200510060734 CN1783020A (en) 2005-09-12 2005-09-12 Interrupt managing method for embedded operation system based on PowerPC system structure

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 200510060734 CN1783020A (en) 2005-09-12 2005-09-12 Interrupt managing method for embedded operation system based on PowerPC system structure

Publications (1)

Publication Number Publication Date
CN1783020A true CN1783020A (en) 2006-06-07

Family

ID=36773239

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 200510060734 Pending CN1783020A (en) 2005-09-12 2005-09-12 Interrupt managing method for embedded operation system based on PowerPC system structure

Country Status (1)

Country Link
CN (1) CN1783020A (en)

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100573461C (en) * 2008-05-07 2009-12-23 浙江大学 Methods for analyzing stack usage in embedded systems
GB2473910A (en) * 2009-09-10 2011-03-30 Miniweb Technologies Ltd Backup for user invoked interruptions
CN102033779A (en) * 2010-12-17 2011-04-27 青岛海信信芯科技有限公司 Interrupt processing method and microcontroller
CN101290591B (en) * 2008-06-03 2011-10-12 北京中星微电子有限公司 Embedded operating system task switching method and unit
CN101290590B (en) * 2008-06-03 2012-01-11 北京中星微电子有限公司 Embedded operating system task switching method and unit
CN101441609B (en) * 2007-11-21 2012-07-04 Arm有限公司 Interrupt jitter suppression
CN101639791B (en) * 2009-08-31 2012-12-05 浙江大学 Method for improving interruption delay of embedded type real-time operation system
CN103412796A (en) * 2013-08-30 2013-11-27 北京经纬恒润科技有限公司 Stack allocation method and stack allocation unit for tasks in operating system
CN103676727A (en) * 2013-11-27 2014-03-26 南京国电南自美卓控制系统有限公司 Preemptible and nestable interrupt control method based on embedded chip
CN101349975B (en) * 2008-07-29 2014-04-23 北京中星微电子有限公司 Method for implementing interrupt bottom semi-section mechanism in embedded operation system
CN106874072A (en) * 2015-12-14 2017-06-20 中国航空工业第六八研究所 A kind of processing method of the embedded OS subregion virtual interrupt based on Power PC Processor
CN110362396A (en) * 2019-07-23 2019-10-22 天津国芯科技有限公司 Based on powerpc framework and support the external interrupt management method and system of interrupt nesting
CN114327776A (en) * 2021-12-30 2022-04-12 支付宝(杭州)信息技术有限公司 Debugging method, debugging equipment and debugging system for intelligent contract
CN117056062A (en) * 2023-10-13 2023-11-14 武汉天喻信息产业股份有限公司 Method and device for forcedly exiting interrupt service routine
CN119312339A (en) * 2024-09-23 2025-01-14 西安热工研究院有限公司 Trusted DCS controller executable file security measurement method and related equipment

Cited By (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101441609B (en) * 2007-11-21 2012-07-04 Arm有限公司 Interrupt jitter suppression
CN100573461C (en) * 2008-05-07 2009-12-23 浙江大学 Methods for analyzing stack usage in embedded systems
CN101290590B (en) * 2008-06-03 2012-01-11 北京中星微电子有限公司 Embedded operating system task switching method and unit
CN101290591B (en) * 2008-06-03 2011-10-12 北京中星微电子有限公司 Embedded operating system task switching method and unit
CN101349975B (en) * 2008-07-29 2014-04-23 北京中星微电子有限公司 Method for implementing interrupt bottom semi-section mechanism in embedded operation system
CN101639791B (en) * 2009-08-31 2012-12-05 浙江大学 Method for improving interruption delay of embedded type real-time operation system
US11438667B2 (en) 2009-09-10 2022-09-06 Mphc Ltd Communications system, apparatus and method
GB2473910A (en) * 2009-09-10 2011-03-30 Miniweb Technologies Ltd Backup for user invoked interruptions
US9918137B2 (en) 2009-09-10 2018-03-13 Mt Digital Media Limited Content item receiver module and method
US10171881B2 (en) 2009-09-10 2019-01-01 Mt Digital Media Limited Backup module and method
CN102033779B (en) * 2010-12-17 2013-04-03 青岛海信信芯科技有限公司 Interrupt processing method and microcontroller
CN102033779A (en) * 2010-12-17 2011-04-27 青岛海信信芯科技有限公司 Interrupt processing method and microcontroller
CN103412796A (en) * 2013-08-30 2013-11-27 北京经纬恒润科技有限公司 Stack allocation method and stack allocation unit for tasks in operating system
CN103676727A (en) * 2013-11-27 2014-03-26 南京国电南自美卓控制系统有限公司 Preemptible and nestable interrupt control method based on embedded chip
CN106874072A (en) * 2015-12-14 2017-06-20 中国航空工业第六八研究所 A kind of processing method of the embedded OS subregion virtual interrupt based on Power PC Processor
CN110362396A (en) * 2019-07-23 2019-10-22 天津国芯科技有限公司 Based on powerpc framework and support the external interrupt management method and system of interrupt nesting
CN114327776A (en) * 2021-12-30 2022-04-12 支付宝(杭州)信息技术有限公司 Debugging method, debugging equipment and debugging system for intelligent contract
CN117056062A (en) * 2023-10-13 2023-11-14 武汉天喻信息产业股份有限公司 Method and device for forcedly exiting interrupt service routine
CN117056062B (en) * 2023-10-13 2024-04-02 武汉天喻信息产业股份有限公司 Method and device for forcedly exiting interrupt service routine
CN119312339A (en) * 2024-09-23 2025-01-14 西安热工研究院有限公司 Trusted DCS controller executable file security measurement method and related equipment

Similar Documents

Publication Publication Date Title
CN1783020A (en) Interrupt managing method for embedded operation system based on PowerPC system structure
CN1208721C (en) Hierarchical Task Switching Method Based on PowerPC Processor Architecture
CN1112636C (en) Method and apparatus for selecting thread switch events in multithreaded processor
US8424015B2 (en) Transactional memory preemption mechanism
CN1230740C (en) Digital signal processing apparatus
US20040168078A1 (en) Apparatus, system and method for protecting function return address
CN102779047B (en) A kind of embedded software supports platform
EP2764433A1 (en) Maintaining operand liveness information in a computer system
CN1943160A (en) System for calling a privileged function in a device
CN100351792C (en) A real-time task management and scheduling method
Weisberg et al. Enhancing Transportation System Networks Reliability by Securer Operating System
CN1326567A (en) Job-parallel processor
CN101639791B (en) Method for improving interruption delay of embedded type real-time operation system
CN1529233A (en) Binary Search Task Scheduling Method for Embedded Real-time Operating System
CN103309734A (en) Embedded task scheduling method based on priority grouping
CN107015931A (en) Method and accelerator unit for interrupt processing
CN116893894A (en) Synchronous microthreading
Al-Husainy Best-job-first CPU scheduling algorithm
CN107526622A (en) Rapid exception handling method and device for Linux
CN1818875A (en) Grouped hard realtime task dispatching method of built-in operation system
CN1912833A (en) Embedded operation system driver dynamic update method
US7818558B2 (en) Method and apparatus for EFI BIOS time-slicing at OS runtime
WO2022174600A1 (en) Interrupt control system and method based on risc-v
CN105868003B (en) An Optimization Method of Task Context Switching Based on TMS320C6747
Murtaza et al. Silicon real time operating system for embedded DSPs

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C12 Rejection of a patent application after its publication
RJ01 Rejection of invention patent application after publication