WO2017070861A1 - Interrupt response method, apparatus and base station - Google Patents

Interrupt response method, apparatus and base station Download PDF

Info

Publication number
WO2017070861A1
WO2017070861A1 PCT/CN2015/093041 CN2015093041W WO2017070861A1 WO 2017070861 A1 WO2017070861 A1 WO 2017070861A1 CN 2015093041 W CN2015093041 W CN 2015093041W WO 2017070861 A1 WO2017070861 A1 WO 2017070861A1
Authority
WO
WIPO (PCT)
Prior art keywords
interrupt
target process
stored
state
unit
Prior art date
Application number
PCT/CN2015/093041
Other languages
French (fr)
Chinese (zh)
Inventor
袁张慧
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2015/093041 priority Critical patent/WO2017070861A1/en
Priority to CN201580047811.XA priority patent/CN107003899B/en
Publication of WO2017070861A1 publication Critical patent/WO2017070861A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt

Definitions

  • the embodiments of the present invention relate to the field of communications technologies, and in particular, to an interrupt response method, apparatus, and base station.
  • the working state of the operating system may include a kernel state and a user state
  • the kernel state is a mode in which the operating system kernel runs, and runs on The process of this mode can access system memory, peripherals, etc. without restriction
  • the user state refers to the non-privileged state, and the process running in this state is limited by hardware, and some privileged operations cannot be performed.
  • interrupt When the operating system runs a process, if an external emergency occurs, the operating system will be suspended to process the emergency. After the processing, the suspended process will continue. This process is called interrupt. Since the interrupt needs to be switched from the user mode to the kernel state, when there is a plurality of interrupts when running a certain process, the operating system needs to frequently switch between the user state and the kernel state, which reduces the running efficiency of the process.
  • the embodiment of the invention discloses an interrupt response method, device and base station, which are used for improving the running efficiency of a process.
  • a first aspect of the embodiment of the present invention discloses a base station, including a memory and a central processing unit CPU, wherein the CPU is provided with a memory management unit MMU, and the CPU is further provided with at least two registers, each of which is stored in the register. There is an interrupt number and a process number, where:
  • the memory is used to store processes and programs
  • the CPU is connected to the memory through a memory bus, and the CPU is used to:
  • the target process is continued to be run according to the stored context information of the target process.
  • the CPU is further configured to:
  • the user mode is switched to the kernel mode
  • the kernel mode is switched to the user mode
  • the target process continues to run in the user state according to the stored context information of the target process.
  • the CPU further includes a transmission backup buffer, where the transmission A matching table of virtual addresses to physical addresses is stored in the backing buffer;
  • the CPU is further configured to:
  • the CPU is further configured to:
  • a second aspect of the embodiments of the present invention discloses a terminal response apparatus, where the apparatus is disposed in a base station, where a central processing unit CPU of the base station is provided with a memory management unit MMU, and at least two registers are further disposed in the CPU. Each of the registers stores an interrupt number and a process number, and the device includes:
  • An interrupt unit configured to interrupt a target process running in a user state when receiving an interrupt request carrying an interrupt number
  • a storage unit configured to store context information of a target process interrupted by the interrupt unit
  • An obtaining unit configured to acquire a process ID of a target process interrupted by the interrupt unit
  • a determining unit configured to determine whether a register exists in the at least two registers, and a process number of the target process acquired by the acquiring unit and the interrupt number are stored;
  • a first execution unit configured to: when the judgment result of the determining unit is that the process register and the interrupt number of the target process are stored in the register, execute the interrupt processing program corresponding to the interrupt number in the user state;
  • a first running unit configured to continue to run the target process of the interrupt unit interrupt according to the context information of the target process stored by the storage unit when the interrupt processing program executed by the first execution unit is executed.
  • the device further includes:
  • a switching unit configured to switch from the user state to a kernel state when the judgment result of the determining unit is that the process number of the target process and the interrupt number are stored in the non-existing register
  • a second execution unit configured to execute an interrupt processing program corresponding to the interrupt number in a kernel state of the switching unit switching
  • the switching unit is further configured to: when the interrupt processing program executed by the second execution unit is executed, switch from the kernel state to the user state;
  • a second running unit configured to continue to run the target process of the interrupt unit interrupt according to the context information of the target process stored by the storage unit in the user state.
  • the CPU further includes a transmission backup buffer, where the transmission A matching table of virtual addresses to physical addresses is stored in the backing buffer;
  • the first execution unit is configured to execute, in the user state, an interrupt processing program corresponding to the interrupt number according to a matching table corresponding to a user state stored in the transmission backup buffer;
  • the device also includes:
  • a refreshing unit configured to refresh the matching table corresponding to the user state stored in the transmission backing buffer to a matching table corresponding to the kernel state after the switching unit is to be switched from the user state to the kernel state;
  • the second execution unit is configured to execute, in the kernel state, an interrupt processing program corresponding to the interrupt number according to a matching table corresponding to a kernel state stored in the transport backup buffer;
  • the refreshing unit is further configured to: after the switching unit switches the kernel state to the user state, refresh a matching table corresponding to a kernel state stored in the transmission backing buffer to a matching table corresponding to a user state. .
  • a third aspect of the embodiments of the present invention discloses an interrupt response method, which is applied to a base station of a central processing unit CPU in which a memory management unit MMU is disposed, and the CPU further includes at least two registers, each of the registers. There is an interrupt number and a process number stored in the method, and the method includes:
  • the target process is continued to be run according to the stored context information of the target process.
  • the kernel mode is switched to the user mode
  • the target process continues to run in the user state according to the stored context information of the target process.
  • the CPU further includes a transmission backup buffer, where the transmission A matching table of virtual addresses to physical addresses is stored in the backing buffer;
  • the interrupt processing program corresponding to the execution of the interrupt number in the user state includes:
  • the method further includes:
  • the interrupt processing program corresponding to executing the interrupt number in the kernel state includes:
  • the method further includes:
  • the matching table corresponding to the kernel state stored in the transmission backing buffer is refreshed to a matching table corresponding to the user state.
  • the interrupt response when there is a process number and an interrupt number in which the running process is stored in the register, the interrupt response will be performed in the user state, and the user state is not required to be switched to the kernel state. Therefore, the running efficiency of the process can be improved.
  • FIG. 1 is a structural diagram of a base station according to an embodiment of the present invention.
  • FIG. 2 is a structural diagram of an interrupt response apparatus according to an embodiment of the present invention.
  • FIG. 3 is a flowchart of an interrupt response method according to an embodiment of the present invention.
  • FIG. 4 is a flowchart of another interrupt response method disclosed in an embodiment of the present invention.
  • the embodiment of the invention discloses an interrupt response method, device and base station, which are used for improving the running efficiency of a process. The details are described below separately.
  • a central processing unit (CPU) of the base station is provided with a memory management unit (MMU), and the working states of the base station operating system include a user state and a kernel state.
  • the CPU is further provided with at least two registers, each of which stores an interrupt number and a process number.
  • the CPU is further provided with a Translation Lookaside Buffer (TLB).
  • TLB stores a matching table of virtual addresses to physical addresses.
  • the TLB stores the user state corresponding to The matching table of the virtual address to the physical address.
  • the base station operating system works in the kernel state
  • the TLB stores the matching table of the virtual address to the physical address corresponding to the kernel state. Therefore, the operating system performs between the kernel state and the user state.
  • the TLB needs to be refreshed to refresh the matching table stored in the TLB to the matching table corresponding to the working state.
  • FIG. 1 is a structural diagram of a base station according to an embodiment of the present invention.
  • the base station is the base station introduced above.
  • the base station 100 can include:
  • Memory 101 for storing processes and programs
  • the CPU 102 is connected to the memory 101 via a memory bus 103, and the CPU 102 is configured to:
  • the interrupt processing program corresponding to the interrupt number carried in the interrupt request is executed in the user state
  • the target process continues to run based on the context information of the stored target process.
  • the CPU 102 is further configured to:
  • the user mode is switched to the kernel mode
  • the user process continues to run the target process according to the context information of the stored target process.
  • the manner in which the CPU 102 executes the interrupt processing program corresponding to the interrupt number carried in the interrupt request by the CPU 102 is specifically:
  • the CPU 102 is further configured to:
  • the manner in which the CPU 102 executes the interrupt handler corresponding to the interrupt number carried in the interrupt request in the kernel state is specifically:
  • the CPU 102 is further configured to:
  • the matching table corresponding to the kernel state stored in the transmission backing buffer is refreshed to the matching table corresponding to the user state.
  • the interrupt response will be performed in the user mode, and the user state is not required to be switched to the kernel state, thereby improving the operating efficiency of the process.
  • FIG. 2 is an interrupt response apparatus according to an embodiment of the present invention.
  • the interrupt response device is disposed in the base station described above.
  • the interrupt response apparatus 200 can include:
  • the interrupting unit 201 is configured to interrupt the target process running in the user state when receiving the interrupt request carrying the interrupt number;
  • the storage unit 202 is configured to store context information of the target process interrupted by the interrupt unit 201.
  • the obtaining unit 203 is configured to acquire a process ID of the target process interrupted by the interrupt unit 201.
  • the determining unit 204 is configured to determine whether the register is stored in the at least two registers, and the process ID of the target process acquired by the obtaining unit 203 and the interrupt number carried by the interrupt request are stored;
  • the first execution unit 205 is configured to: when the judgment result of the determining unit 204 is that the process ID of the target process and the interrupt number carried by the interrupt request are stored in the register, the interrupt processing program corresponding to the interrupt number carried in the interrupt request is executed in the user state;
  • the first running unit 206 is configured to continue to run the target process interrupted by the interrupting unit 201 according to the context information of the target process stored by the storage unit 202 when the interrupt processing program executed by the first executing unit 205 is executed.
  • the interrupt response apparatus 200 may further include:
  • the switching unit 207 is configured to switch from the user mode to the kernel mode when the judgment result of the determining unit 204 is that the process number of the target process and the interrupt number carried by the interrupt request are stored in the non-existing register;
  • the second execution unit 208 is configured to execute, in the kernel mode switched by the switching unit 207, an interrupt processing program corresponding to the interrupt number carried by the interrupt request;
  • the switching unit 207 is further configured to switch from the kernel mode to the user state when the interrupt processing program executed by the second execution unit 208 is executed;
  • the second running unit 209 is configured to continue to run the target process interrupted by the interrupting unit 201 according to the context information of the target process stored by the storage unit 202 in the user state.
  • the second running unit 209 is triggered to continue to run the interrupt ticket according to the context information of the target process stored in the user state according to the storage unit 202.
  • the target process interrupted by meta 201.
  • the first execution unit 205 is specifically configured to execute, in the user state, an interrupt processing program corresponding to the interrupt number carried by the interrupt request according to the matching table corresponding to the user state stored in the transmission backup buffer;
  • the interrupt response device 200 can also include:
  • the refreshing unit 210 is configured to refresh the matching table corresponding to the user state stored in the transmission backing buffer to the matching table corresponding to the kernel state after the switching unit 207 switches from the user state to the kernel state;
  • the second execution unit 208 is specifically configured to execute, in the kernel state, an interrupt processing program corresponding to the interrupt number carried by the interrupt request according to the matching table corresponding to the kernel state stored in the transmission backup buffer;
  • the refreshing unit 210 is further configured to refresh the matching table corresponding to the kernel state stored in the transmission backing buffer to the matching table corresponding to the user state after the switching unit 207 switches the kernel state to the user state.
  • the interrupt response apparatus described in FIG. 2 when there is a process number and an interrupt number in which the register stores the running process, the interrupt response will be performed in the user mode, and it is not necessary to switch from the user state to the kernel state, thereby improving the process. operating efficiency.
  • FIG. 3 is a flowchart of an interrupt response method according to an embodiment of the present invention.
  • the interrupt response method is applicable to the base station described above. As shown in FIG. 3, the interrupt response method may include the following steps.
  • the target process in the process of running the target process in the user state, when receiving the interrupt request carrying the interrupt number, the target process needs to be interrupted, and the context information of the target process is stored, so that the target process needs to continue to be run later. It is possible to continue running the portion of the target process that is not running from the interrupted location of the target process.
  • the context information of the target process may include interrupt location information of the target process, part of the running information, and part of the information that is not running.
  • the process ID of the target process is obtained.
  • the step S301 and the step S302 may be performed in series or in parallel, which is not limited in this embodiment.
  • the process ID of the target process and the interrupt number carried by the interrupt request are compared with the process number and the interrupt number stored in each register.
  • the process number stored in one register is the same as the process ID of the target process, and the interrupt number stored in the register is the same as the interrupt number carried in the interrupt request, it indicates that the register is stored in at least two registers.
  • the process ID of the target process and the interrupt number carried by the interrupt request will execute the interrupt handler corresponding to the interrupt number carried in the interrupt request in the user mode.
  • the user state when it is detected that the interrupt handler corresponding to the interrupt number carried by the interrupt request is executed in the user state, the user state continues to run the target process from the interrupted position of the target process according to the stored context information of the target process. The part that runs.
  • the user mode is switched to the kernel mode, and the interrupt handler corresponding to the interrupt number carried in the interrupt request is executed in the kernel state.
  • the process number of the target process and the interrupt number carried by the interrupt request are simultaneously stored, indicating that the process number and the interrupt request of the target process are not stored in the at least two registers.
  • the interrupt number carried will not be able to directly respond to the interrupt in the user mode. Therefore, the user mode is switched to the kernel mode, and the interrupt handler corresponding to the interrupt number carried in the interrupt request is executed in the kernel mode.
  • the target process since the target process needs to be run in the user mode, when it is detected that the interrupt handler corresponding to the interrupt number carried by the interrupt request is executed in the kernel state, the kernel state is switched to the user state, and in the user mode.
  • the non-running portion of the target process continues to run from the interrupted location of the target process based on the context information of the stored target process.
  • FIG. 4 is a flowchart of another interrupt response method according to an embodiment of the present invention.
  • the interrupt response method is applicable to the base station described above. As shown in FIG. 4, the interrupt response method may include the following steps.
  • the process ID of the target process is obtained.
  • the step S401 and the step S402 may be performed in series or in parallel, which is not limited in this embodiment.
  • the process ID of the target process and the interrupt number carried by the interrupt request are compared with the process number and the interrupt number stored in each register.
  • S404 Perform an interrupt processing program corresponding to the interrupt number carried in the interrupt request according to the matching table corresponding to the user state stored in the TLB in the user state.
  • the process number stored in one register is the same as the process ID of the target process, and the interrupt number stored in the register is the same as the interrupt number carried in the interrupt request, it indicates that the register is stored in at least two registers.
  • the process ID of the target process and the interrupt number carried in the interrupt request will execute the interrupt handler corresponding to the interrupt number carried in the interrupt request according to the matching table corresponding to the user mode stored in the TLB.
  • the user state when it is detected that the interrupt handler corresponding to the interrupt number carried by the interrupt request is executed in the user state, the user state continues to run the target process from the interrupted position of the target process according to the stored context information of the target process. The part that runs.
  • the process number of the target process and the interrupt number carried by the interrupt request are simultaneously stored, indicating that the process number and the interrupt request of the target process are not stored in the at least two registers.
  • the interrupt number carried will not be able to directly respond to the interrupt in the user mode. Therefore, the user mode is switched to the kernel mode, and the matching table corresponding to the user mode stored in the TLB is refreshed to the matching table corresponding to the kernel state.
  • the interrupt processing program corresponding to the interrupt number carried in the interrupt request is executed in the kernel state according to the matching table corresponding to the kernel state stored in the TLB.
  • the kernel state is switched to the user state, and the TLB is The matching table corresponding to the stored kernel state is refreshed to the matching table corresponding to the user state.
  • the user mode continues to run the non-running part of the target process from the interrupted location of the target process according to the context information of the stored target process.
  • an embodiment of the present invention further discloses a computer storage medium storing a computer program.
  • the computer program in the computer storage medium is read into a computer, the computer can cause the computer to complete the disclosure of the embodiment of the present invention. All steps of the data transfer method.
  • the program may be stored in a computer readable storage medium, and the storage medium may include: Flash disk, Read-Only Memory (ROM), Random Access Memory (RAM), disk or optical disk.

Abstract

An embodiment of the present invention discloses an interrupt response method, an apparatus, and a base station. The method can be applied to a base station whose CPU is provided with an MMU and at least two registers, each of the registers containing an interrupt number and a process number. The method comprises: interrupting a target process running under a user mode when receiving an interrupt request carrying the interrupt number, and storing context information of the target process; acquiring the process number of the target process; judging whether there is a target register in which the process number of the target process and the interrupt number are stored among the at least two registers; if there is a register in which the process number of the target process and the interrupt number are stored, then executing an interrupt handler corresponding to the interrupt number under the user mode; and when the execution of the interrupt handler is complete, continuing running the target process according to the stored context information of the target process. By implementing the embodiment of the present invention, the running efficiency of the process can be improved.

Description

一种中断响应方法、装置及基站Interrupt response method, device and base station 技术领域Technical field
本发明实施例涉及通信技术领域,尤其涉及一种中断响应方法、装置及基站。The embodiments of the present invention relate to the field of communications technologies, and in particular, to an interrupt response method, apparatus, and base station.
背景技术Background technique
当中央处理器(Central Processing Unit,CPU)包括内存管理单元(Memory Management Unit,MMU)时,操作系统的工作状态可以包括内核态和用户态,内核态是操作系统内核所运行的模式,运行在该模式的进程,可以无限制地对系统内存、外设等进行访问;用户态指非特权状态,运行在该状态下的进程被硬件限制,不能进行某些特权操作。When the central processing unit (CPU) includes a memory management unit (MMU), the working state of the operating system may include a kernel state and a user state, and the kernel state is a mode in which the operating system kernel runs, and runs on The process of this mode can access system memory, peripherals, etc. without restriction; the user state refers to the non-privileged state, and the process running in this state is limited by hardware, and some privileged operations cannot be performed.
当操作系统运行进程时,如果外界发生紧急情况,将要求操作系统暂停进程的运行转去处理这个紧急事件,处理完后,再继续运行暂停的进程,这样的过程称为中断。由于中断需要从用户态切换至内核态,因此,当运行某个进程时,如果存在多个中断,将需要操作系统在用户态和内核态之间进行频繁切换,降低了进程的运行效率。When the operating system runs a process, if an external emergency occurs, the operating system will be suspended to process the emergency. After the processing, the suspended process will continue. This process is called interrupt. Since the interrupt needs to be switched from the user mode to the kernel state, when there is a plurality of interrupts when running a certain process, the operating system needs to frequently switch between the user state and the kernel state, which reduces the running efficiency of the process.
发明内容Summary of the invention
本发明实施例公开了一种中断响应方法、装置及基站,用于提高进程的运行效率。The embodiment of the invention discloses an interrupt response method, device and base station, which are used for improving the running efficiency of a process.
本发明实施例第一方面公开一种基站,包括内存和中央处理器CPU,所述CPU中设置有内存管理单元MMU,所述CPU中还设置有至少两个寄存器,每个所述寄存器中存储有一个中断号和一个进程号,其中:A first aspect of the embodiment of the present invention discloses a base station, including a memory and a central processing unit CPU, wherein the CPU is provided with a memory management unit MMU, and the CPU is further provided with at least two registers, each of which is stored in the register. There is an interrupt number and a process number, where:
所述内存,用于存储进程和程序;The memory is used to store processes and programs;
所述CPU通过内存总线与所述内存连接,所述CPU用于:The CPU is connected to the memory through a memory bus, and the CPU is used to:
当接收到携带有中断号的中断请求时,中断用户态下运行的目标进程,并存储所述目标进程的上下文信息;When receiving an interrupt request carrying an interrupt number, interrupting a target process running in a user state, and storing context information of the target process;
获取所述目标进程的进程号; Obtaining the process ID of the target process;
判断所述至少两个寄存器中是否存在寄存器存储有所述目标进程的进程号和所述中断号;Determining whether a register exists in the at least two registers, where the process number of the target process and the interrupt number are stored;
若存在寄存器存储有所述目标进程的进程号和所述中断号,则在所述用户态执行所述中断号对应的中断处理程序;If there is a register storing the process ID of the target process and the interrupt number, executing an interrupt processing program corresponding to the interrupt number in the user state;
当所述中断处理程序执行完时,根据存储的所述目标进程的上下文信息继续运行所述目标进程。When the interrupt handler is executed, the target process is continued to be run according to the stored context information of the target process.
结合本发明实施例第一方面,在本发明实施例第一方面的第一种可能的实现方式中,所述CPU还用于:With reference to the first aspect of the embodiments of the present invention, in a first possible implementation manner of the first aspect of the embodiments, the CPU is further configured to:
若不存在寄存器存储有所述目标进程的进程号和所述中断号,将由所述用户态切换至内核态;If there is no register storing the process number of the target process and the interrupt number, the user mode is switched to the kernel mode;
在所述内核态执行所述中断号对应的中断处理程序;Executing, in the kernel state, an interrupt processing program corresponding to the interrupt number;
当所述中断处理程序执行完时,将由所述内核态切换至所述用户态;When the interrupt handler is executed, the kernel mode is switched to the user mode;
在所述用户态根据存储的所述目标进程的上下文信息继续运行所述目标进程。The target process continues to run in the user state according to the stored context information of the target process.
结合本发明实施例第一方面的第一种可能的实现方式,在本发明实施例第一方面的第二种可能的实现方式中,所述CPU中还设置有传输后备缓冲器,所述传输后备缓冲器中存储有虚拟地址到物理地址的匹配表;With reference to the first possible implementation manner of the first aspect of the embodiments of the present invention, in a second possible implementation manner of the first aspect of the embodiments, the CPU further includes a transmission backup buffer, where the transmission A matching table of virtual addresses to physical addresses is stored in the backing buffer;
所述CPU在所述用户态执行所述中断号对应的中断处理程序的方式具体为:The manner in which the CPU executes the interrupt processing program corresponding to the interrupt number in the user state is specifically:
在所述用户态根据所述传输后备缓冲器中存储的用户态对应的匹配表执行所述中断号对应的中断处理程序;Performing, in the user state, an interrupt processing program corresponding to the interrupt number according to a matching table corresponding to a user state stored in the transmission backing buffer;
所述CPU将由所述用户态切换至内核态之后,所述CPU还用于:After the CPU is switched from the user mode to the kernel mode, the CPU is further configured to:
将所述传输后备缓冲器中存储的用户态对应的匹配表刷新为内核态对应的匹配表;Refreshing the matching table corresponding to the user state stored in the transmission backing buffer to a matching table corresponding to the kernel state;
所述CPU在所述内核态执行所述中断号对应的中断处理程序的方式具体为:The manner in which the CPU executes the interrupt processing program corresponding to the interrupt number in the kernel state is specifically:
在所述内核态根据所述传输后备缓冲器中存储的内核态对应的匹配表执行所述中断号对应的中断处理程序;Performing, in the kernel state, an interrupt processing program corresponding to the interrupt number according to a matching table corresponding to a kernel state stored in the transport backup buffer;
所述CPU将由所述内核态切换至所述用户态之后,所述CPU还用于: After the CPU is switched from the kernel mode to the user mode, the CPU is further configured to:
将所述传输后备缓冲器中存储的内核态对应的匹配表刷新为用户态对应的匹配表。The matching table corresponding to the kernel state stored in the transmission backing buffer is refreshed to a matching table corresponding to the user state.
本发明实施例第二方面公开一种终端响应装置,所述装置设置于基站中,所述基站的中央处理器CPU中设置有内存管理单元MMU,所述CPU中还设置有至少两个寄存器,每个所述寄存器中存储有一个中断号和一个进程号,所述装置包括:A second aspect of the embodiments of the present invention discloses a terminal response apparatus, where the apparatus is disposed in a base station, where a central processing unit CPU of the base station is provided with a memory management unit MMU, and at least two registers are further disposed in the CPU. Each of the registers stores an interrupt number and a process number, and the device includes:
中断单元,用于当接收到携带有中断号的中断请求时,中断用户态下运行的目标进程;An interrupt unit, configured to interrupt a target process running in a user state when receiving an interrupt request carrying an interrupt number;
存储单元,用于存储所述中断单元中断的目标进程的上下文信息;a storage unit, configured to store context information of a target process interrupted by the interrupt unit;
获取单元,用于获取所述中断单元中断的目标进程的进程号;An obtaining unit, configured to acquire a process ID of a target process interrupted by the interrupt unit;
判断单元,用于判断所述至少两个寄存器中是否存在寄存器存储有所述获取单元获取的目标进程的进程号和所述中断号;a determining unit, configured to determine whether a register exists in the at least two registers, and a process number of the target process acquired by the acquiring unit and the interrupt number are stored;
第一执行单元,用于当所述判断单元的判断结果为存在寄存器存储有所述目标进程的进程号和所述中断号时,在所述用户态执行所述中断号对应的中断处理程序;a first execution unit, configured to: when the judgment result of the determining unit is that the process register and the interrupt number of the target process are stored in the register, execute the interrupt processing program corresponding to the interrupt number in the user state;
第一运行单元,用于当所述第一执行单元执行的中断处理程序执行完时,根据所述存储单元存储的所述目标进程的上下文信息继续运行所述中断单元中断的目标进程。a first running unit, configured to continue to run the target process of the interrupt unit interrupt according to the context information of the target process stored by the storage unit when the interrupt processing program executed by the first execution unit is executed.
结合本发明实施例第二方面,在本发明实施例第二方面的第一种可能的实现方式中,所述装置还包括:With reference to the second aspect of the embodiments of the present invention, in a first possible implementation manner of the second aspect of the embodiment, the device further includes:
切换单元,用于当所述判断单元的判断结果为不存在寄存器存储有所述目标进程的进程号和所述中断号时,将由所述用户态切换至内核态;a switching unit, configured to switch from the user state to a kernel state when the judgment result of the determining unit is that the process number of the target process and the interrupt number are stored in the non-existing register;
第二执行单元,用于在所述切换单元切换的内核态执行所述中断号对应的中断处理程序;a second execution unit, configured to execute an interrupt processing program corresponding to the interrupt number in a kernel state of the switching unit switching;
所述切换单元,还用于当所述第二执行单元执行的中断处理程序执行完时,将由所述内核态切换至所述用户态;The switching unit is further configured to: when the interrupt processing program executed by the second execution unit is executed, switch from the kernel state to the user state;
第二运行单元,用于在所述用户态根据所述存储单元存储的所述目标进程的上下文信息继续运行所述中断单元中断的目标进程。 a second running unit, configured to continue to run the target process of the interrupt unit interrupt according to the context information of the target process stored by the storage unit in the user state.
结合本发明实施例第二方面的第一种可能的实现方式,在本发明实施例第二方面的第二种可能的实现方式中,所述CPU中还设置有传输后备缓冲器,所述传输后备缓冲器中存储有虚拟地址到物理地址的匹配表;With reference to the first possible implementation manner of the second aspect of the embodiment of the present invention, in a second possible implementation manner of the second aspect of the embodiment, the CPU further includes a transmission backup buffer, where the transmission A matching table of virtual addresses to physical addresses is stored in the backing buffer;
所述第一执行单元,具体用于在所述用户态根据所述传输后备缓冲器中存储的用户态对应的匹配表执行所述中断号对应的中断处理程序;The first execution unit is configured to execute, in the user state, an interrupt processing program corresponding to the interrupt number according to a matching table corresponding to a user state stored in the transmission backup buffer;
所述装置还包括:The device also includes:
刷新单元,用于在所述切换单元将由所述用户态切换至内核态之后,将所述传输后备缓冲器中存储的用户态对应的匹配表刷新为内核态对应的匹配表;a refreshing unit, configured to refresh the matching table corresponding to the user state stored in the transmission backing buffer to a matching table corresponding to the kernel state after the switching unit is to be switched from the user state to the kernel state;
所述第二执行单元,具体用于在所述内核态根据所述传输后备缓冲器中存储的内核态对应的匹配表执行所述中断号对应的中断处理程序;The second execution unit is configured to execute, in the kernel state, an interrupt processing program corresponding to the interrupt number according to a matching table corresponding to a kernel state stored in the transport backup buffer;
所述刷新单元,还用于在所述切换单元将由所述内核态切换至所述用户态之后,将所述传输后备缓冲器中存储的内核态对应的匹配表刷新为用户态对应的匹配表。The refreshing unit is further configured to: after the switching unit switches the kernel state to the user state, refresh a matching table corresponding to a kernel state stored in the transmission backing buffer to a matching table corresponding to a user state. .
本发明实施例第三方面公开一种中断响应方法,所述方法应用于中央处理器CPU中设置有内存管理单元MMU的基站,所述CPU中还设置有至少两个寄存器,每个所述寄存器中存储有一个中断号和一个进程号,所述方法包括:A third aspect of the embodiments of the present invention discloses an interrupt response method, which is applied to a base station of a central processing unit CPU in which a memory management unit MMU is disposed, and the CPU further includes at least two registers, each of the registers. There is an interrupt number and a process number stored in the method, and the method includes:
当接收到携带有中断号的中断请求时,中断用户态下运行的目标进程,并存储所述目标进程的上下文信息;When receiving an interrupt request carrying an interrupt number, interrupting a target process running in a user state, and storing context information of the target process;
获取所述目标进程的进程号;Obtaining the process ID of the target process;
判断所述至少两个寄存器中是否存在寄存器存储有所述目标进程的进程号和所述中断号;Determining whether a register exists in the at least two registers, where the process number of the target process and the interrupt number are stored;
若存在寄存器存储有所述目标进程的进程号和所述中断号,则在所述用户态执行所述中断号对应的中断处理程序;If there is a register storing the process ID of the target process and the interrupt number, executing an interrupt processing program corresponding to the interrupt number in the user state;
当所述中断处理程序执行完时,根据存储的所述目标进程的上下文信息继续运行所述目标进程。When the interrupt handler is executed, the target process is continued to be run according to the stored context information of the target process.
结合本发明实施例第三方面,在本发明实施例第三方面的第一种可能的实现方式中,所述方法还包括:With reference to the third aspect of the embodiments of the present invention, in a first possible implementation manner of the third aspect of the embodiments, the method further includes:
若不存在寄存器存储有所述目标进程的进程号和所述中断号,将由所述用 户态切换至内核态;If there is no register storing the process number of the target process and the interrupt number, the Switch to the kernel mode;
在所述内核态执行所述中断号对应的中断处理程序;Executing, in the kernel state, an interrupt processing program corresponding to the interrupt number;
当所述中断处理程序执行完时,将由所述内核态切换至所述用户态;When the interrupt handler is executed, the kernel mode is switched to the user mode;
在所述用户态根据存储的所述目标进程的上下文信息继续运行所述目标进程。The target process continues to run in the user state according to the stored context information of the target process.
结合本发明实施例第三方面的第一种可能的实现方式,在本发明实施例第三方面的第二种可能的实现方式中,所述CPU中还设置有传输后备缓冲器,所述传输后备缓冲器中存储有虚拟地址到物理地址的匹配表;With reference to the first possible implementation manner of the third aspect of the embodiments of the present invention, in a second possible implementation manner of the third aspect of the embodiments, the CPU further includes a transmission backup buffer, where the transmission A matching table of virtual addresses to physical addresses is stored in the backing buffer;
所述在所述用户态执行所述中断号对应的中断处理程序包括:The interrupt processing program corresponding to the execution of the interrupt number in the user state includes:
在所述用户态根据所述传输后备缓冲器中存储的用户态对应的匹配表执行所述中断号对应的中断处理程序;Performing, in the user state, an interrupt processing program corresponding to the interrupt number according to a matching table corresponding to a user state stored in the transmission backing buffer;
所述将由所述用户态切换至内核态之后,所述方法还包括:After the user mode is switched to the kernel mode, the method further includes:
将所述传输后备缓冲器中存储的用户态对应的匹配表刷新为内核态对应的匹配表;Refreshing the matching table corresponding to the user state stored in the transmission backing buffer to a matching table corresponding to the kernel state;
所述在所述内核态执行所述中断号对应的中断处理程序包括:The interrupt processing program corresponding to executing the interrupt number in the kernel state includes:
在所述内核态根据所述传输后备缓冲器中存储的内核态对应的匹配表执行所述中断号对应的中断处理程序;Performing, in the kernel state, an interrupt processing program corresponding to the interrupt number according to a matching table corresponding to a kernel state stored in the transport backup buffer;
所述将由所述内核态切换至所述用户态之后,所述方法还包括:After the switching from the kernel mode to the user mode, the method further includes:
将所述传输后备缓冲器中存储的内核态对应的匹配表刷新为用户态对应的匹配表。The matching table corresponding to the kernel state stored in the transmission backing buffer is refreshed to a matching table corresponding to the user state.
本发明实施例中,当存在寄存器存储有运行进程的进程号和中断号时,将在用户态进行中断响应,不需要由用户态切换至内核态,因此,可以提高进程的运行效率。In the embodiment of the present invention, when there is a process number and an interrupt number in which the running process is stored in the register, the interrupt response will be performed in the user state, and the user state is not required to be switched to the kernel state. Therefore, the running efficiency of the process can be improved.
附图说明DRAWINGS
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。 In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings to be used in the embodiments will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the present invention. Those skilled in the art can also obtain other drawings based on these drawings without paying for creative labor.
图1是本发明实施例公开的一种基站的结构图;1 is a structural diagram of a base station according to an embodiment of the present invention;
图2是本发明实施例公开的一种中断响应装置的结构图;2 is a structural diagram of an interrupt response apparatus according to an embodiment of the present invention;
图3是本发明实施例公开的一种中断响应方法的流程图;3 is a flowchart of an interrupt response method according to an embodiment of the present invention;
图4是本发明实施例公开的另一种中断响应方法的流程图。FIG. 4 is a flowchart of another interrupt response method disclosed in an embodiment of the present invention.
具体实施方式detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
本发明实施例公开了一种中断响应方法、装置及基站,用于提高进程的运行效率。以下分别进行详细说明。The embodiment of the invention discloses an interrupt response method, device and base station, which are used for improving the running efficiency of a process. The details are described below separately.
为了更好地理解本发明实施例,下面先对本发明实施例的应用场景进行描述。在本发明实施例中,基站的中央处理器(Central Processing Unit,CPU)中设置有内存管理单元(Memory Management Unit,MMU),基站操作系统的工作状态包括用户态和内核态。此外,CPU中还设置有至少两个寄存器,每个寄存器中存储有一个中断号和一个进程号,当在用户态运行一个寄存器中存储的进程号对应的进程时,如果接收到一个中断请求,且这个中断请求携带的中断号为这个寄存器中存储的中断号,基站操作系统可以直接在用户态响应这个中断请求。此外,CPU还设置有传输后备缓冲器(Translation Lookaside Buffer,TLB),TLB中存储有虚拟地址到物理地址的匹配表,当基站操作系统工作在用户态时,TLB中存储的是用户态对应的虚拟地址到物理地址的匹配表,当基站操作系统工作在内核态时,TLB中存储的是内核态对应的虚拟地址到物理地址的匹配表,因此,操作系统在内核态和用户态之间进行切换时,需要刷新TLB,以便将TLB中存储的匹配表刷新为对应的工作态对应的匹配表。For a better understanding of the embodiments of the present invention, the application scenarios of the embodiments of the present invention are described below. In the embodiment of the present invention, a central processing unit (CPU) of the base station is provided with a memory management unit (MMU), and the working states of the base station operating system include a user state and a kernel state. In addition, the CPU is further provided with at least two registers, each of which stores an interrupt number and a process number. When a process corresponding to the process number stored in a register is run in the user mode, if an interrupt request is received, And the interrupt number carried by the interrupt request is the interrupt number stored in this register, and the base station operating system can respond to the interrupt request directly in the user state. In addition, the CPU is further provided with a Translation Lookaside Buffer (TLB). The TLB stores a matching table of virtual addresses to physical addresses. When the base station operating system works in the user state, the TLB stores the user state corresponding to The matching table of the virtual address to the physical address. When the base station operating system works in the kernel state, the TLB stores the matching table of the virtual address to the physical address corresponding to the kernel state. Therefore, the operating system performs between the kernel state and the user state. When switching, the TLB needs to be refreshed to refresh the matching table stored in the TLB to the matching table corresponding to the working state.
请参阅图1,图1是本发明实施例公开的一种基站的结构图。其中,该基站为上述介绍的基站。如图1所示,该基站100可以包括:Please refer to FIG. 1. FIG. 1 is a structural diagram of a base station according to an embodiment of the present invention. The base station is the base station introduced above. As shown in FIG. 1, the base station 100 can include:
内存101,用于存储进程和程序; Memory 101 for storing processes and programs;
CPU102通过内存总线103与内存101连接,CPU102用于: The CPU 102 is connected to the memory 101 via a memory bus 103, and the CPU 102 is configured to:
当接收到携带有中断号的中断请求时,中断用户态下运行的目标进程,并存储目标进程的上下文信息;When receiving the interrupt request carrying the interrupt number, interrupting the target process running in the user state, and storing the context information of the target process;
获取目标进程的进程号;Get the process ID of the target process;
判断至少两个寄存器中是否存在寄存器存储有目标进程的进程号和中断请求携带的中断号;Determining whether there is a register in the at least two registers, wherein the process number of the target process and the interrupt number carried by the interrupt request are stored;
若存在寄存器存储有目标进程的进程号和中断请求携带的中断号,则在用户态执行中断请求携带的中断号对应的中断处理程序;If there is a register storing the process number of the target process and the interrupt number carried by the interrupt request, the interrupt processing program corresponding to the interrupt number carried in the interrupt request is executed in the user state;
当中断处理程序执行完时,根据存储的目标进程的上下文信息继续运行目标进程。When the interrupt handler finishes executing, the target process continues to run based on the context information of the stored target process.
作为一种可能的实施方式,CPU102还用于:As a possible implementation manner, the CPU 102 is further configured to:
若不存在寄存器存储有目标进程的进程号和中断请求携带的中断号,将由用户态切换至内核态;If there is no register to store the process number of the target process and the interrupt number carried by the interrupt request, the user mode is switched to the kernel mode;
在内核态执行中断请求携带的中断号对应的中断处理程序;Executing an interrupt handler corresponding to the interrupt number carried in the interrupt request in the kernel state;
当中断处理程序执行完时,将由内核态切换至用户态;When the interrupt handler finishes executing, it will be switched from kernel mode to user mode;
在用户态根据存储的目标进程的上下文信息继续运行目标进程。The user process continues to run the target process according to the context information of the stored target process.
作为一种可能的实施方式,CPU102在用户态执行中断请求携带的中断号对应的中断处理程序的方式具体为:As a possible implementation manner, the manner in which the CPU 102 executes the interrupt processing program corresponding to the interrupt number carried in the interrupt request by the CPU 102 is specifically:
在用户态根据传输后备缓冲器中存储的用户态对应的匹配表执行中断请求携带的中断号对应的中断处理程序;And executing, in the user state, an interrupt processing program corresponding to the interrupt number carried by the interrupt request according to the matching table corresponding to the user state stored in the transmission backup buffer;
CPU102将由用户态切换至内核态之后,CPU102还用于:After the CPU 102 is switched from the user mode to the kernel mode, the CPU 102 is further configured to:
将传输后备缓冲器中存储的用户态对应的匹配表刷新为内核态对应的匹配表;Refreshing the matching table corresponding to the user state stored in the transmission backing buffer to a matching table corresponding to the kernel state;
CPU102在内核态执行中断请求携带的中断号对应的中断处理程序的方式具体为:The manner in which the CPU 102 executes the interrupt handler corresponding to the interrupt number carried in the interrupt request in the kernel state is specifically:
在内核态根据传输后备缓冲器中存储的内核态对应的匹配表执行中断请求携带的中断号对应的中断处理程序;Performing, in the kernel state, an interrupt processing program corresponding to the interrupt number carried in the interrupt request according to the matching table corresponding to the kernel state stored in the transmission backing buffer;
CPU102将由内核态切换至用户态之后,CPU102还用于:After the CPU 102 is switched from the kernel mode to the user mode, the CPU 102 is further configured to:
将传输后备缓冲器中存储的内核态对应的匹配表刷新为用户态对应的匹配表。 The matching table corresponding to the kernel state stored in the transmission backing buffer is refreshed to the matching table corresponding to the user state.
在图1所描述的基站中,当存在寄存器存储有运行进程的进程号和中断号时,将在用户态进行中断响应,不需要由用户态切换至内核态,因此,可以提高进程的运行效率。In the base station described in FIG. 1, when there is a process number and an interrupt number in which the running process is stored in the register, the interrupt response will be performed in the user mode, and the user state is not required to be switched to the kernel state, thereby improving the operating efficiency of the process. .
请参阅图2,图2是本发明实施例公开的一种中断响应装置。其中,该中断响应装置设置于上述介绍的基站中。如图2所示,该中断响应装置200可以包括:Please refer to FIG. 2. FIG. 2 is an interrupt response apparatus according to an embodiment of the present invention. The interrupt response device is disposed in the base station described above. As shown in FIG. 2, the interrupt response apparatus 200 can include:
中断单元201,用于当接收到携带有中断号的中断请求时,中断用户态下运行的目标进程;The interrupting unit 201 is configured to interrupt the target process running in the user state when receiving the interrupt request carrying the interrupt number;
存储单元202,用于存储中断单元201中断的目标进程的上下文信息;The storage unit 202 is configured to store context information of the target process interrupted by the interrupt unit 201.
获取单元203,用于获取中断单元201中断的目标进程的进程号;The obtaining unit 203 is configured to acquire a process ID of the target process interrupted by the interrupt unit 201.
判断单元204,用于判断至少两个寄存器中是否存在寄存器存储有获取单元203获取的目标进程的进程号和中断请求携带的中断号;The determining unit 204 is configured to determine whether the register is stored in the at least two registers, and the process ID of the target process acquired by the obtaining unit 203 and the interrupt number carried by the interrupt request are stored;
第一执行单元205,用于当判断单元204的判断结果为存在寄存器存储有目标进程的进程号和中断请求携带的中断号时,在用户态执行中断请求携带的中断号对应的中断处理程序;The first execution unit 205 is configured to: when the judgment result of the determining unit 204 is that the process ID of the target process and the interrupt number carried by the interrupt request are stored in the register, the interrupt processing program corresponding to the interrupt number carried in the interrupt request is executed in the user state;
第一运行单元206,用于当第一执行单元205执行的中断处理程序执行完时,根据存储单元202存储的目标进程的上下文信息继续运行中断单元201中断的目标进程。The first running unit 206 is configured to continue to run the target process interrupted by the interrupting unit 201 according to the context information of the target process stored by the storage unit 202 when the interrupt processing program executed by the first executing unit 205 is executed.
作为一种可能的实施方式,该中断响应装置200还可以包括:As a possible implementation, the interrupt response apparatus 200 may further include:
切换单元207,用于当判断单元204的判断结果为不存在寄存器存储有目标进程的进程号和中断请求携带的中断号时,将由用户态切换至内核态;The switching unit 207 is configured to switch from the user mode to the kernel mode when the judgment result of the determining unit 204 is that the process number of the target process and the interrupt number carried by the interrupt request are stored in the non-existing register;
第二执行单元208,用于在切换单元207切换的内核态执行中断请求携带的中断号对应的中断处理程序;The second execution unit 208 is configured to execute, in the kernel mode switched by the switching unit 207, an interrupt processing program corresponding to the interrupt number carried by the interrupt request;
切换单元207,还用于当第二执行单元208执行的中断处理程序执行完时,将由内核态切换至用户态;The switching unit 207 is further configured to switch from the kernel mode to the user state when the interrupt processing program executed by the second execution unit 208 is executed;
第二运行单元209,用于在用户态根据存储单元202存储的目标进程的上下文信息继续运行中断单元201中断的目标进程。The second running unit 209 is configured to continue to run the target process interrupted by the interrupting unit 201 according to the context information of the target process stored by the storage unit 202 in the user state.
具体地,切换单元207由内核态切换至用户态之后,将触发第二运行单元209在用户态根据存储单元202存储的目标进程的上下文信息继续运行中断单 元201中断的目标进程。Specifically, after the switching unit 207 is switched from the kernel mode to the user state, the second running unit 209 is triggered to continue to run the interrupt ticket according to the context information of the target process stored in the user state according to the storage unit 202. The target process interrupted by meta 201.
作为一种可能的实施方式,第一执行单元205,具体用于在用户态根据传输后备缓冲器中存储的用户态对应的匹配表执行中断请求携带的中断号对应的中断处理程序;As a possible implementation manner, the first execution unit 205 is specifically configured to execute, in the user state, an interrupt processing program corresponding to the interrupt number carried by the interrupt request according to the matching table corresponding to the user state stored in the transmission backup buffer;
该中断响应装置200还可以包括:The interrupt response device 200 can also include:
刷新单元210,用于在切换单元207将由用户态切换至内核态之后,将传输后备缓冲器中存储的用户态对应的匹配表刷新为内核态对应的匹配表;The refreshing unit 210 is configured to refresh the matching table corresponding to the user state stored in the transmission backing buffer to the matching table corresponding to the kernel state after the switching unit 207 switches from the user state to the kernel state;
第二执行单元208,具体用于在内核态根据传输后备缓冲器中存储的内核态对应的匹配表执行中断请求携带的中断号对应的中断处理程序;The second execution unit 208 is specifically configured to execute, in the kernel state, an interrupt processing program corresponding to the interrupt number carried by the interrupt request according to the matching table corresponding to the kernel state stored in the transmission backup buffer;
刷新单元210,还用于在切换单元207将由内核态切换至用户态之后,将传输后备缓冲器中存储的内核态对应的匹配表刷新为用户态对应的匹配表。The refreshing unit 210 is further configured to refresh the matching table corresponding to the kernel state stored in the transmission backing buffer to the matching table corresponding to the user state after the switching unit 207 switches the kernel state to the user state.
在图2所描述的中断响应装置中,当存在寄存器存储有运行进程的进程号和中断号时,将在用户态进行中断响应,不需要由用户态切换至内核态,因此,可以提高进程的运行效率。In the interrupt response apparatus described in FIG. 2, when there is a process number and an interrupt number in which the register stores the running process, the interrupt response will be performed in the user mode, and it is not necessary to switch from the user state to the kernel state, thereby improving the process. operating efficiency.
请参阅图3,图3是本发明实施例公开的一种中断响应方法的流程图。其中,该中断响应方法适用于上述介绍的基站。如图3所示,该中断响应方法可以包括以下步骤。Please refer to FIG. 3. FIG. 3 is a flowchart of an interrupt response method according to an embodiment of the present invention. The interrupt response method is applicable to the base station described above. As shown in FIG. 3, the interrupt response method may include the following steps.
S301、当接收到携带有中断号的中断请求时,中断用户态下运行的目标进程,并存储目标进程的上下文信息。S301. When receiving the interrupt request carrying the interrupt number, interrupt the target process running in the user state, and store the context information of the target process.
本实施例中,在用户态运行目标进程的过程中,当接收到携带有中断号的中断请求时,将需要中断目标进程,并存储目标进程的上下文信息,以便后续需要继续运行目标进程时,可以从目标进程的中断位置继续运行目标进程中未运行的部分。其中,目标进程的上下文信息可以包括目标进程的中断位置信息、已运行部分信息和未运行部分信息。In this embodiment, in the process of running the target process in the user state, when receiving the interrupt request carrying the interrupt number, the target process needs to be interrupted, and the context information of the target process is stored, so that the target process needs to continue to be run later. It is possible to continue running the portion of the target process that is not running from the interrupted location of the target process. The context information of the target process may include interrupt location information of the target process, part of the running information, and part of the information that is not running.
S302、获取目标进程的进程号。S302. Obtain a process ID of the target process.
本实施例中,当接收到携带有中断号的中断请求时,将获取目标进程的进程号。其中,步骤S301与步骤S302可以串行执行,也可以并行执行,本实施例不作限定。 In this embodiment, when an interrupt request carrying an interrupt number is received, the process ID of the target process is obtained. The step S301 and the step S302 may be performed in series or in parallel, which is not limited in this embodiment.
S303、判断至少两个寄存器中是否存在寄存器存储有目标进程的进程号和中断请求携带的中断号,若存在,则执行步骤S304,若未存在,则执行步骤S306。S303. Determine whether a register has a process number of the target process and an interrupt number carried by the interrupt request in the at least two registers. If yes, execute step S304. If not, execute step S306.
本实施例中,获取到目标进程的进程号之后,将目标进程的进程号和中断请求携带的中断号与每个寄存器中存储的进程号和中断号进行比较。In this embodiment, after the process number of the target process is obtained, the process ID of the target process and the interrupt number carried by the interrupt request are compared with the process number and the interrupt number stored in each register.
S304、在用户态执行中断号对应的中断处理程序。S304. Execute an interrupt processing program corresponding to the interrupt number in the user mode.
本实施例中,当有一个寄存器中存储的进程号与目标进程的进程号相同,且这个寄存器中存储的中断号与中断请求携带的中断号相同时,表明至少两个寄存器中存在寄存器存储有目标进程的进程号和中断请求携带的中断号,将在用户态执行中断请求携带的中断号对应的中断处理程序。In this embodiment, when the process number stored in one register is the same as the process ID of the target process, and the interrupt number stored in the register is the same as the interrupt number carried in the interrupt request, it indicates that the register is stored in at least two registers. The process ID of the target process and the interrupt number carried by the interrupt request will execute the interrupt handler corresponding to the interrupt number carried in the interrupt request in the user mode.
S305、当中断处理程序执行完时,根据存储的目标进程的上下文信息继续运行目标进程。S305. When the interrupt handler is executed, continue to run the target process according to the context information of the stored target process.
本实施例中,当检测到中断请求携带的中断号对应的中断处理程序在用户态执行完时,将在用户态根据存储的目标进程的上下文信息从目标进程的中断位置继续运行目标进程中未运行的部分。In this embodiment, when it is detected that the interrupt handler corresponding to the interrupt number carried by the interrupt request is executed in the user state, the user state continues to run the target process from the interrupted position of the target process according to the stored context information of the target process. The part that runs.
S306、将由用户态切换至内核态,并在内核态执行中断请求携带的中断号对应的中断处理程序。S306. The user mode is switched to the kernel mode, and the interrupt handler corresponding to the interrupt number carried in the interrupt request is executed in the kernel state.
本实施例中,当至少两个寄存器中无寄存器中同时存储有目标进程的进程号和中断请求携带的中断号时,表明至少两个寄存器中不存在寄存器存储有目标进程的进程号和中断请求携带的中断号,将无法在用户态直接进行中断响应,因此,将由用户态切换至内核态,并在内核态执行中断请求携带的中断号对应的中断处理程序。In this embodiment, when there is no register in at least two registers, the process number of the target process and the interrupt number carried by the interrupt request are simultaneously stored, indicating that the process number and the interrupt request of the target process are not stored in the at least two registers. The interrupt number carried will not be able to directly respond to the interrupt in the user mode. Therefore, the user mode is switched to the kernel mode, and the interrupt handler corresponding to the interrupt number carried in the interrupt request is executed in the kernel mode.
S307、当中断处理程序执行完时,将由内核态切换至用户态,并在用户态根据存储的目标进程的上下文信息继续运行目标进程。S307. When the interrupt handler is executed, the kernel state is switched to the user state, and the user process continues to run the target process according to the context information of the stored target process.
本实施例中,由于目标进程需要在用户态进行运行,因此,当检测到中断请求携带的中断号对应的中断处理程序在内核态执行完时,将由内核态切换至用户态,并在用户态根据存储的目标进程的上下文信息从目标进程的中断位置继续运行目标进程的未运行部分。In this embodiment, since the target process needs to be run in the user mode, when it is detected that the interrupt handler corresponding to the interrupt number carried by the interrupt request is executed in the kernel state, the kernel state is switched to the user state, and in the user mode. The non-running portion of the target process continues to run from the interrupted location of the target process based on the context information of the stored target process.
在图3所描述的中断响应方法中,当存在寄存器存储有运行进程的进程号和中断号时,将在用户态进行中断响应,不需要由用户态切换至内核态,因此, 可以提高进程的运行效率。In the interrupt response method described in FIG. 3, when there is a process number and an interrupt number in which the register stores the running process, the interrupt response will be performed in the user mode, and it is not necessary to switch from the user state to the kernel state. Can improve the efficiency of the process.
请参阅图4,图4是本发明实施例公开的另一种中断响应方法的流程图。其中,该中断响应方法适用于上述介绍的基站。如图4所示,该中断响应方法可以包括以下步骤。Please refer to FIG. 4. FIG. 4 is a flowchart of another interrupt response method according to an embodiment of the present invention. The interrupt response method is applicable to the base station described above. As shown in FIG. 4, the interrupt response method may include the following steps.
S401、当接收到携带有中断号的中断请求时,中断用户态下运行的目标进程,并存储目标进程的上下文信息。S401. When receiving the interrupt request carrying the interrupt number, interrupt the target process running in the user state, and store the context information of the target process.
本实施例中,在用户态运行目标进程的过程中,当接收到携带有中断号的中断请求时,将需要中断目标进程,并存储目标进程的上下文信息,以便后续需要继续运行目标进程时,可以从目标进程的中断位置继续运行目标进程中未运行的部分。其中,目标进程的上下文信息可以包括目标进程的中断位置信息、已运行部分信息和未运行部分信息。In this embodiment, in the process of running the target process in the user state, when receiving the interrupt request carrying the interrupt number, the target process needs to be interrupted, and the context information of the target process is stored, so that the target process needs to continue to be run later. It is possible to continue running the portion of the target process that is not running from the interrupted location of the target process. The context information of the target process may include interrupt location information of the target process, part of the running information, and part of the information that is not running.
S402、获取目标进程的进程号。S402. Obtain a process ID of the target process.
本实施例中,当接收到携带有中断号的中断请求时,将获取目标进程的进程号。其中,步骤S401与步骤S402可以串行执行,也可以并行执行,本实施例不作限定。In this embodiment, when an interrupt request carrying an interrupt number is received, the process ID of the target process is obtained. The step S401 and the step S402 may be performed in series or in parallel, which is not limited in this embodiment.
S403、判断至少两个寄存器中是否存在寄存器存储有目标进程的进程号和该中断号,若存储有,则执行步骤S404,若未存储有,则执行步骤S406。S403. Determine whether a process number of the target process and the interrupt number are stored in the at least two registers. If yes, execute step S404. If not, execute step S406.
本实施例中,获取到目标进程的进程号之后,将目标进程的进程号和中断请求携带的中断号与每个寄存器中存储的进程号和中断号进行比较。In this embodiment, after the process number of the target process is obtained, the process ID of the target process and the interrupt number carried by the interrupt request are compared with the process number and the interrupt number stored in each register.
S404、在用户态根据TLB中存储的用户态对应的匹配表执行中断请求携带的中断号对应的中断处理程序。S404: Perform an interrupt processing program corresponding to the interrupt number carried in the interrupt request according to the matching table corresponding to the user state stored in the TLB in the user state.
本实施例中,当有一个寄存器中存储的进程号与目标进程的进程号相同,且这个寄存器中存储的中断号与中断请求携带的中断号相同时,表明至少两个寄存器中存在寄存器存储有目标进程的进程号和中断请求携带的中断号,将在用户态根据TLB中存储的用户态对应的匹配表执行中断请求携带的中断号对应的中断处理程序。In this embodiment, when the process number stored in one register is the same as the process ID of the target process, and the interrupt number stored in the register is the same as the interrupt number carried in the interrupt request, it indicates that the register is stored in at least two registers. The process ID of the target process and the interrupt number carried in the interrupt request will execute the interrupt handler corresponding to the interrupt number carried in the interrupt request according to the matching table corresponding to the user mode stored in the TLB.
S405、当中断处理程序执行完时,根据存储的目标进程的上下文信息继续运行目标进程。 S405. When the interrupt handler is executed, continue to run the target process according to the context information of the stored target process.
本实施例中,当检测到中断请求携带的中断号对应的中断处理程序在用户态执行完时,将在用户态根据存储的目标进程的上下文信息从目标进程的中断位置继续运行目标进程中未运行的部分。In this embodiment, when it is detected that the interrupt handler corresponding to the interrupt number carried by the interrupt request is executed in the user state, the user state continues to run the target process from the interrupted position of the target process according to the stored context information of the target process. The part that runs.
S406、将由用户态切换至内核态,并将TLB中存储的用户态对应的匹配表刷新为内核态对应的匹配表。S406. The user state is switched to the kernel state, and the matching table corresponding to the user state stored in the TLB is refreshed to a matching table corresponding to the kernel state.
本实施例中,当至少两个寄存器中无寄存器中同时存储有目标进程的进程号和中断请求携带的中断号时,表明至少两个寄存器中不存在寄存器存储有目标进程的进程号和中断请求携带的中断号,将无法在用户态直接进行中断响应,因此,将由用户态切换至内核态,并将TLB中存储的用户态对应的匹配表刷新为内核态对应的匹配表。In this embodiment, when there is no register in at least two registers, the process number of the target process and the interrupt number carried by the interrupt request are simultaneously stored, indicating that the process number and the interrupt request of the target process are not stored in the at least two registers. The interrupt number carried will not be able to directly respond to the interrupt in the user mode. Therefore, the user mode is switched to the kernel mode, and the matching table corresponding to the user mode stored in the TLB is refreshed to the matching table corresponding to the kernel state.
S407、在内核态根据TLB中存储的内核态对应的匹配表执行中断请求携带的中断号对应的中断处理程序。S407. The interrupt processing program corresponding to the interrupt number carried in the interrupt request is executed in the kernel state according to the matching table corresponding to the kernel state stored in the TLB.
S408、当中断处理程序执行完时,将由内核态切换至用户态,并将TLB中存储的内核态对应的匹配表刷新为用户态对应的匹配表。S408. When the interrupt processing program is executed, the kernel state is switched to the user state, and the matching table corresponding to the kernel state stored in the TLB is refreshed to the matching table corresponding to the user state.
本实施例中,由于目标进程需要在用户态进行运行,因此,当检测到中断请求携带的中断号对应的中断处理程序在内核态执行完时,将由内核态切换至用户态,并将TLB中存储的内核态对应的匹配表刷新为用户态对应的匹配表。In this embodiment, since the target process needs to be run in the user mode, when it is detected that the interrupt handler corresponding to the interrupt number carried by the interrupt request is executed in the kernel state, the kernel state is switched to the user state, and the TLB is The matching table corresponding to the stored kernel state is refreshed to the matching table corresponding to the user state.
S409、在用户态根据存储的目标进程的上下文信息继续运行目标进程。S409. The user process continues to run the target process according to the context information of the stored target process.
本实施例中,在用户态根据存储的目标进程的上下文信息从目标进程的中断位置继续运行目标进程的未运行部分。In this embodiment, the user mode continues to run the non-running part of the target process from the interrupted location of the target process according to the context information of the stored target process.
在图4所描述的中断响应方法中,当存在寄存器存储有运行进程的进程号和中断号时,将在用户态进行中断响应,不需要由用户态切换至内核态,因此,可以提高进程的运行效率。In the interrupt response method described in FIG. 4, when there is a process number and an interrupt number in which the register stores the running process, the interrupt response will be performed in the user state, and it is not necessary to switch from the user state to the kernel state, thereby improving the process. operating efficiency.
一个实施例中,本发明实施例进一步公开一种计算机存储介质,该计算机存储介质存储有计算机程序,当计算机存储介质中的计算机程序被读取到计算机时,能够使得计算机完成本发明实施例公开的数据传输方法的全部步骤。In one embodiment, an embodiment of the present invention further discloses a computer storage medium storing a computer program. When the computer program in the computer storage medium is read into a computer, the computer can cause the computer to complete the disclosure of the embodiment of the present invention. All steps of the data transfer method.
需要说明的是,对于前述的各个方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本发明并不受所描述 的动作顺序的限制,因为依据本发明,某一些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本发明所必须的。It should be noted that, for the foregoing various method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should know that the present invention is not described. The order of the actions is limited, as some steps may be performed in other orders or simultaneously in accordance with the present invention. In addition, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储介质中,存储介质可以包括:闪存盘、只读存储器(Read-Only Memory,ROM)、随机存取器(Random Access Memory,RAM)、磁盘或光盘等。A person skilled in the art may understand that all or part of the various steps of the foregoing embodiments may be performed by a program to instruct related hardware. The program may be stored in a computer readable storage medium, and the storage medium may include: Flash disk, Read-Only Memory (ROM), Random Access Memory (RAM), disk or optical disk.
以上对本发明实施例所提供的中断响应方法、装置及基站进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。 The interrupt response method, device and base station provided by the embodiments of the present invention are described in detail. The principles and embodiments of the present invention are described in the following. The description of the above embodiments is only for helping to understand the present invention. The method and its core idea; at the same time, those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation and application scope. In summary, the content of the specification should not be understood as Limitations of the invention.

Claims (9)

  1. 一种基站,其特征在于,包括内存和中央处理器CPU,所述CPU中设置有内存管理单元MMU,所述CPU中还设置有至少两个寄存器,每个所述寄存器中存储有一个中断号和一个进程号,其中:A base station, comprising: a memory and a central processing unit CPU, wherein the CPU is provided with a memory management unit MMU, wherein the CPU is further provided with at least two registers, and each of the registers stores an interrupt number And a process number where:
    所述内存,用于存储进程和程序;The memory is used to store processes and programs;
    所述CPU通过内存总线与所述内存连接,所述CPU用于:The CPU is connected to the memory through a memory bus, and the CPU is used to:
    当接收到携带有中断号的中断请求时,中断用户态下运行的目标进程,并存储所述目标进程的上下文信息;When receiving an interrupt request carrying an interrupt number, interrupting a target process running in a user state, and storing context information of the target process;
    获取所述目标进程的进程号;Obtaining the process ID of the target process;
    判断所述至少两个寄存器中是否存在寄存器存储有所述目标进程的进程号和所述中断号;Determining whether a register exists in the at least two registers, where the process number of the target process and the interrupt number are stored;
    若存在寄存器存储有所述目标进程的进程号和所述中断号,则在所述用户态执行所述中断号对应的中断处理程序;If there is a register storing the process ID of the target process and the interrupt number, executing an interrupt processing program corresponding to the interrupt number in the user state;
    当所述中断处理程序执行完时,根据存储的所述目标进程的上下文信息继续运行所述目标进程。When the interrupt handler is executed, the target process is continued to be run according to the stored context information of the target process.
  2. 根据权利要求1所述的基站,其特征在于,所述CPU还用于:The base station according to claim 1, wherein the CPU is further configured to:
    若不存在寄存器存储有所述目标进程的进程号和所述中断号,将由所述用户态切换至内核态;If there is no register storing the process number of the target process and the interrupt number, the user mode is switched to the kernel mode;
    在所述内核态执行所述中断号对应的中断处理程序;Executing, in the kernel state, an interrupt processing program corresponding to the interrupt number;
    当所述中断处理程序执行完时,将由所述内核态切换至所述用户态;When the interrupt handler is executed, the kernel mode is switched to the user mode;
    在所述用户态根据存储的所述目标进程的上下文信息继续运行所述目标进程。The target process continues to run in the user state according to the stored context information of the target process.
  3. 根据权利要求2所述的基站,其特征在于,所述CPU中还设置有传输后备缓冲器,所述传输后备缓冲器中存储有虚拟地址到物理地址的匹配表;The base station according to claim 2, wherein the CPU further includes a transmission backup buffer, wherein the transmission backup buffer stores a matching table of a virtual address to a physical address;
    所述CPU在所述用户态执行所述中断号对应的中断处理程序的方式具体为:The manner in which the CPU executes the interrupt processing program corresponding to the interrupt number in the user state is specifically:
    在所述用户态根据所述传输后备缓冲器中存储的用户态对应的匹配表执 行所述中断号对应的中断处理程序;Performing, in the user state, a matching table corresponding to a user state stored in the transmission backup buffer Interrupting the interrupt handler corresponding to the interrupt number;
    所述CPU将由所述用户态切换至内核态之后,所述CPU还用于:After the CPU is switched from the user mode to the kernel mode, the CPU is further configured to:
    将所述传输后备缓冲器中存储的用户态对应的匹配表刷新为内核态对应的匹配表;Refreshing the matching table corresponding to the user state stored in the transmission backing buffer to a matching table corresponding to the kernel state;
    所述CPU在所述内核态执行所述中断号对应的中断处理程序的方式具体为:The manner in which the CPU executes the interrupt processing program corresponding to the interrupt number in the kernel state is specifically:
    在所述内核态根据所述传输后备缓冲器中存储的内核态对应的匹配表执行所述中断号对应的中断处理程序;Performing, in the kernel state, an interrupt processing program corresponding to the interrupt number according to a matching table corresponding to a kernel state stored in the transport backup buffer;
    所述CPU将由所述内核态切换至所述用户态之后,所述CPU还用于:After the CPU is switched from the kernel mode to the user mode, the CPU is further configured to:
    将所述传输后备缓冲器中存储的内核态对应的匹配表刷新为用户态对应的匹配表。The matching table corresponding to the kernel state stored in the transmission backing buffer is refreshed to a matching table corresponding to the user state.
  4. 一种终端响应装置,所述装置设置于基站中,所述基站的中央处理器CPU中设置有内存管理单元MMU,其特征在于,所述CPU中还设置有至少两个寄存器,每个所述寄存器中存储有一个中断号和一个进程号,所述装置包括:A terminal response device, the device is disposed in a base station, and the central processing unit CPU of the base station is provided with a memory management unit MMU, wherein the CPU is further provided with at least two registers, each of the The register stores an interrupt number and a process number, and the device includes:
    中断单元,用于当接收到携带有中断号的中断请求时,中断用户态下运行的目标进程;An interrupt unit, configured to interrupt a target process running in a user state when receiving an interrupt request carrying an interrupt number;
    存储单元,用于存储所述中断单元中断的目标进程的上下文信息;a storage unit, configured to store context information of a target process interrupted by the interrupt unit;
    获取单元,用于获取所述中断单元中断的目标进程的进程号;An obtaining unit, configured to acquire a process ID of a target process interrupted by the interrupt unit;
    判断单元,用于判断所述至少两个寄存器中是否存在寄存器存储有所述获取单元获取的目标进程的进程号和所述中断号;a determining unit, configured to determine whether a register exists in the at least two registers, and a process number of the target process acquired by the acquiring unit and the interrupt number are stored;
    第一执行单元,用于当所述判断单元的判断结果为存在寄存器存储有所述目标进程的进程号和所述中断号时,在所述用户态执行所述中断号对应的中断处理程序;a first execution unit, configured to: when the judgment result of the determining unit is that the process register and the interrupt number of the target process are stored in the register, execute the interrupt processing program corresponding to the interrupt number in the user state;
    第一运行单元,用于当所述第一执行单元执行的中断处理程序执行完时,根据所述存储单元存储的所述目标进程的上下文信息继续运行所述中断单元中断的目标进程。a first running unit, configured to continue to run the target process of the interrupt unit interrupt according to the context information of the target process stored by the storage unit when the interrupt processing program executed by the first execution unit is executed.
  5. 根据权利要求4所述的装置,其特征在于,所述装置还包括: The device according to claim 4, wherein the device further comprises:
    切换单元,用于当所述判断单元的判断结果为不存在寄存器存储有所述目标进程的进程号和所述中断号时,将由所述用户态切换至内核态;a switching unit, configured to switch from the user state to a kernel state when the judgment result of the determining unit is that the process number of the target process and the interrupt number are stored in the non-existing register;
    第二执行单元,用于在所述切换单元切换的内核态执行所述中断号对应的中断处理程序;a second execution unit, configured to execute an interrupt processing program corresponding to the interrupt number in a kernel state of the switching unit switching;
    所述切换单元,还用于当所述第二执行单元执行的中断处理程序执行完时,将由所述内核态切换至所述用户态;The switching unit is further configured to: when the interrupt processing program executed by the second execution unit is executed, switch from the kernel state to the user state;
    第二运行单元,用于在所述用户态根据所述存储单元存储的所述目标进程的上下文信息继续运行所述中断单元中断的目标进程。a second running unit, configured to continue to run the target process of the interrupt unit interrupt according to the context information of the target process stored by the storage unit in the user state.
  6. 根据权利要求5所述的装置,其特征在于,所述CPU中还设置有传输后备缓冲器,所述传输后备缓冲器中存储有虚拟地址到物理地址的匹配表;The apparatus according to claim 5, wherein the CPU further comprises a transmission backup buffer, wherein the transmission backup buffer stores a matching table of a virtual address to a physical address;
    所述第一执行单元,具体用于在所述用户态根据所述传输后备缓冲器中存储的用户态对应的匹配表执行所述中断号对应的中断处理程序;The first execution unit is configured to execute, in the user state, an interrupt processing program corresponding to the interrupt number according to a matching table corresponding to a user state stored in the transmission backup buffer;
    所述装置还包括:The device also includes:
    刷新单元,用于在所述切换单元将由所述用户态切换至内核态之后,将所述传输后备缓冲器中存储的用户态对应的匹配表刷新为内核态对应的匹配表;a refreshing unit, configured to refresh the matching table corresponding to the user state stored in the transmission backing buffer to a matching table corresponding to the kernel state after the switching unit is to be switched from the user state to the kernel state;
    所述第二执行单元,具体用于在所述内核态根据所述传输后备缓冲器中存储的内核态对应的匹配表执行所述中断号对应的中断处理程序;The second execution unit is configured to execute, in the kernel state, an interrupt processing program corresponding to the interrupt number according to a matching table corresponding to a kernel state stored in the transport backup buffer;
    所述刷新单元,还用于在所述切换单元将由所述内核态切换至所述用户态之后,将所述传输后备缓冲器中存储的内核态对应的匹配表刷新为用户态对应的匹配表。The refreshing unit is further configured to: after the switching unit switches the kernel state to the user state, refresh a matching table corresponding to a kernel state stored in the transmission backing buffer to a matching table corresponding to a user state. .
  7. 一种中断响应方法,所述方法应用于中央处理器CPU中设置有内存管理单元MMU的基站,其特征在于,所述CPU中还设置有至少两个寄存器,每个所述寄存器中存储有一个中断号和一个进程号,所述方法包括:An interrupt response method, the method being applied to a base station provided with a memory management unit MMU in a CPU of a central processing unit, wherein at least two registers are further disposed in the CPU, and one of each of the registers is stored The interrupt number and a process number, the method includes:
    当接收到携带有中断号的中断请求时,中断用户态下运行的目标进程,并存储所述目标进程的上下文信息;When receiving an interrupt request carrying an interrupt number, interrupting a target process running in a user state, and storing context information of the target process;
    获取所述目标进程的进程号;Obtaining the process ID of the target process;
    判断所述至少两个寄存器中是否存在寄存器存储有所述目标进程的进程 号和所述中断号;Determining whether there is a process in the at least two registers that stores the target process Number and the interrupt number;
    若存在寄存器存储有所述目标进程的进程号和所述中断号,则在所述用户态执行所述中断号对应的中断处理程序;If there is a register storing the process ID of the target process and the interrupt number, executing an interrupt processing program corresponding to the interrupt number in the user state;
    当所述中断处理程序执行完时,根据存储的所述目标进程的上下文信息继续运行所述目标进程。When the interrupt handler is executed, the target process is continued to be run according to the stored context information of the target process.
  8. 根据权利要求7所述的方法,其特征在于,所述方法还包括:The method of claim 7, wherein the method further comprises:
    若不存在寄存器存储有所述目标进程的进程号和所述中断号,将由所述用户态切换至内核态;If there is no register storing the process number of the target process and the interrupt number, the user mode is switched to the kernel mode;
    在所述内核态执行所述中断号对应的中断处理程序;Executing, in the kernel state, an interrupt processing program corresponding to the interrupt number;
    当所述中断处理程序执行完时,将由所述内核态切换至所述用户态;When the interrupt handler is executed, the kernel mode is switched to the user mode;
    在所述用户态根据存储的所述目标进程的上下文信息继续运行所述目标进程。The target process continues to run in the user state according to the stored context information of the target process.
  9. 根据权利要求8所述的方法,其特征在于,所述CPU中还设置有传输后备缓冲器,所述传输后备缓冲器中存储有虚拟地址到物理地址的匹配表;The method according to claim 8, wherein the CPU further comprises a transmission backup buffer, wherein the transmission backup buffer stores a matching table of virtual addresses to physical addresses;
    所述在所述用户态执行所述中断号对应的中断处理程序包括:The interrupt processing program corresponding to the execution of the interrupt number in the user state includes:
    在所述用户态根据所述传输后备缓冲器中存储的用户态对应的匹配表执行所述中断号对应的中断处理程序;Performing, in the user state, an interrupt processing program corresponding to the interrupt number according to a matching table corresponding to a user state stored in the transmission backing buffer;
    所述将由所述用户态切换至内核态之后,所述方法还包括:After the user mode is switched to the kernel mode, the method further includes:
    将所述传输后备缓冲器中存储的用户态对应的匹配表刷新为内核态对应的匹配表;Refreshing the matching table corresponding to the user state stored in the transmission backing buffer to a matching table corresponding to the kernel state;
    所述在所述内核态执行所述中断号对应的中断处理程序包括:The interrupt processing program corresponding to executing the interrupt number in the kernel state includes:
    在所述内核态根据所述传输后备缓冲器中存储的内核态对应的匹配表执行所述中断号对应的中断处理程序;Performing, in the kernel state, an interrupt processing program corresponding to the interrupt number according to a matching table corresponding to a kernel state stored in the transport backup buffer;
    所述将由所述内核态切换至所述用户态之后,所述方法还包括:After the switching from the kernel mode to the user mode, the method further includes:
    将所述传输后备缓冲器中存储的内核态对应的匹配表刷新为用户态对应的匹配表。 The matching table corresponding to the kernel state stored in the transmission backing buffer is refreshed to a matching table corresponding to the user state.
PCT/CN2015/093041 2015-10-28 2015-10-28 Interrupt response method, apparatus and base station WO2017070861A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2015/093041 WO2017070861A1 (en) 2015-10-28 2015-10-28 Interrupt response method, apparatus and base station
CN201580047811.XA CN107003899B (en) 2015-10-28 2015-10-28 Interrupt response method, device and base station

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2015/093041 WO2017070861A1 (en) 2015-10-28 2015-10-28 Interrupt response method, apparatus and base station

Publications (1)

Publication Number Publication Date
WO2017070861A1 true WO2017070861A1 (en) 2017-05-04

Family

ID=58629669

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/093041 WO2017070861A1 (en) 2015-10-28 2015-10-28 Interrupt response method, apparatus and base station

Country Status (2)

Country Link
CN (1) CN107003899B (en)
WO (1) WO2017070861A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111176869A (en) * 2019-08-01 2020-05-19 腾讯科技(深圳)有限公司 Timeout detection method, device, equipment and storage medium
CN113010275A (en) * 2019-12-20 2021-06-22 大唐移动通信设备有限公司 Interrupt processing method and device
CN114020427A (en) * 2021-10-22 2022-02-08 苏州浪潮智能科技有限公司 Interrupt setting method, interrupt processing method, device and storage medium

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112395005B (en) * 2019-08-19 2022-07-12 无锡江南计算技术研究所 Performance optimization method for floating point SIMD context switching
CN113296900A (en) * 2020-02-21 2021-08-24 大唐移动通信设备有限公司 Task switching method and device
CN114090273A (en) * 2020-07-30 2022-02-25 华为技术有限公司 Method and device for interprocess communication and computer storage medium
CN115599505A (en) * 2021-06-28 2023-01-13 华为技术有限公司(Cn) User mode interrupt request processing method and device
CN117407054A (en) * 2022-07-07 2024-01-16 华为技术有限公司 Interrupt processing method, electronic device, and storage medium
CN115080122A (en) * 2022-07-22 2022-09-20 飞腾信息技术有限公司 Processor, device, method and chip for saving and restoring context data

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101226487A (en) * 2008-01-30 2008-07-23 中国船舶重工集团公司第七〇九研究所 Method for implementing inner core level thread library based on built-in Linux operating system
CN102486758A (en) * 2010-12-01 2012-06-06 中兴通讯股份有限公司 Method and device for accessing coprocessor register
CN103440169A (en) * 2013-08-21 2013-12-11 华为技术有限公司 Process interruption processing method and device
CN104239237A (en) * 2013-06-20 2014-12-24 华为技术有限公司 TLB (translation lookaside buffer) management method and device
CN104424034A (en) * 2013-09-04 2015-03-18 华为技术有限公司 Hardware resource access method and hardware resource access device

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020083254A1 (en) * 2000-12-22 2002-06-27 Hummel Mark D. System and method of implementing interrupts in a computer processing system having a communication fabric comprising a plurality of point-to-point links
US7836450B2 (en) * 2003-08-28 2010-11-16 Mips Technologies, Inc. Symmetric multiprocessor operating system for execution on non-independent lightweight thread contexts
CN100465899C (en) * 2007-07-25 2009-03-04 湖南大学 Method for implementing checkpoint of Linux program at user level based on virtual kernel object
CN102426538B (en) * 2011-08-26 2014-05-28 深圳市迪威视讯股份有限公司 Interrupt response device and method thereof
CN102439577B (en) * 2011-10-31 2014-01-22 华为技术有限公司 Method and device for constructing memory access model
CN103744716B (en) * 2014-01-15 2016-09-07 上海交通大学 A kind of dynamically interruption Well-Balanced Mapping method based on current VCPU dispatch state

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101226487A (en) * 2008-01-30 2008-07-23 中国船舶重工集团公司第七〇九研究所 Method for implementing inner core level thread library based on built-in Linux operating system
CN102486758A (en) * 2010-12-01 2012-06-06 中兴通讯股份有限公司 Method and device for accessing coprocessor register
CN104239237A (en) * 2013-06-20 2014-12-24 华为技术有限公司 TLB (translation lookaside buffer) management method and device
CN103440169A (en) * 2013-08-21 2013-12-11 华为技术有限公司 Process interruption processing method and device
CN104424034A (en) * 2013-09-04 2015-03-18 华为技术有限公司 Hardware resource access method and hardware resource access device

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111176869A (en) * 2019-08-01 2020-05-19 腾讯科技(深圳)有限公司 Timeout detection method, device, equipment and storage medium
CN111176869B (en) * 2019-08-01 2022-05-10 腾讯云计算(北京)有限责任公司 Timeout detection method, device, equipment and storage medium
CN113010275A (en) * 2019-12-20 2021-06-22 大唐移动通信设备有限公司 Interrupt processing method and device
CN113010275B (en) * 2019-12-20 2024-01-30 大唐移动通信设备有限公司 Interrupt processing method and device
CN114020427A (en) * 2021-10-22 2022-02-08 苏州浪潮智能科技有限公司 Interrupt setting method, interrupt processing method, device and storage medium
CN114020427B (en) * 2021-10-22 2023-11-03 苏州浪潮智能科技有限公司 Interrupt setting method, interrupt processing method, device and storage medium

Also Published As

Publication number Publication date
CN107003899B (en) 2020-10-23
CN107003899A (en) 2017-08-01

Similar Documents

Publication Publication Date Title
WO2017070861A1 (en) Interrupt response method, apparatus and base station
US10592279B2 (en) Multi-processor apparatus and method of detection and acceleration of lagging tasks
US10592454B2 (en) System-on-chip, mobile terminal, and method for operating the system-on-chip
US11797464B2 (en) Delivering interrupts to user-level applications
CN105095128B (en) Interrupt processing method and interrupt controller
CN102067083B (en) Lazy handling of end of interrupt messages in a virtualized environment
US9354952B2 (en) Application-driven shared device queue polling
JP2016507849A5 (en)
US9092255B2 (en) Multi-core processor system, computer product, and control method for interrupt execution
US10366228B2 (en) Detection and mitigation of malicious invocation of sensitive code
US9009702B2 (en) Application-driven shared device queue polling in a virtualized computing environment
JP2018523201A (en) Firmware related event notification
US10089247B2 (en) System and method for coupling a host device to secure and non-secure devices
US7725895B2 (en) Processor control register virtualization to minimize virtual machine exits
WO2016127600A1 (en) Exception handling method and apparatus
US9699093B2 (en) Migration of virtual machine based on proximity to peripheral device in NUMA environment
US20160350233A1 (en) Zero copy memory reclaim for applications using memory offlining
US9904567B2 (en) Limited hardware assisted dirty page logging
US9766917B2 (en) Limited virtual device polling based on virtual CPU pre-emption
US9852100B2 (en) Guest-programmable location of advanced configuration and power interface (ACPI) tables in virtualized systems
US9594707B2 (en) Data input/output (I/O) handling for computer network communications links
JP2015197802A (en) Information processing device, information processing method and program
WO2014206222A1 (en) Method and device for acquiring branch target address
WO2021062798A1 (en) Method and device for detecting stack overflow, electronic apparatus, and storage medium
US9740660B2 (en) CPU control method, electronic system control method and electronic system for improved CPU utilization in executing functions

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15906927

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15906927

Country of ref document: EP

Kind code of ref document: A1