Program update method and apparatus, and electronic device and storage medium
By replacing the location of the interrupt handler in physical memory, the problem of system restart in the prior art is solved, and the system update without restarting of the interrupt handler is realized, ensuring the stability and efficiency of the system.
Patent Information
- Application Number
- PCT/CN2024/097869
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-07-12
- Filing Date
- 2024-06-06
- Publication Date
- 2025-01-16
AI Technical Summary
In the prior art, the interrupt handler update requires a system restart and cannot be implemented without restarting the system.
Update the interrupt handler without restarting the system by moving the new interrupt handler to physical memory, obtaining and determining its location based on the upgrade parameters, and replacing it with the location of the interrupt handler to be upgraded.
The interrupt handler is realized without restarting the system update. The new interrupt handler takes effect immediately in physical memory, ensuring the stability and efficiency of the system.
Smart Images

Figure CN2024097869_16012025_PF_FP_ABST
Abstract
Description
Program updating method, device, electronic device and storage medium
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to the Chinese patent application filed with the China Patent Office on July 12, 2023, with application number 202310852111.4, and application name “A program updating method, device, electronic device and storage medium”, all contents of which are incorporated by reference into this application. Technical Field
[0003] The present application relates to the field of computer technology, and more specifically, to a program updating method, device, electronic device, and non-volatile readable storage medium. Background Art
[0004] Processors in computer systems often have high-level interrupt mechanisms. The BIOS (Basic Input Output System) and OS (Operating System) trigger high-level interrupts to enter privileged interrupt handlers. For example, when refreshing the BIOS firmware image under the OS, the OS cannot directly access the BIOS Flash memory to ensure the security of the firmware image. Therefore, a privileged interrupt must be triggered under the OS. The interrupt handler for this interrupt has the highest processor privileges. The BIOS Flash memory is updated through this privileged code. Privileged interrupts can also be used to perform processor-level fault diagnosis, such as accessing processor registers in privileged code to analyze system faults.
[0005] The privileged interrupt handler itself can also have issues. If the privileged code handling high-level functions fails, the system may crash. In related technologies, the BIOS image is flashed to the BIOS Flash through the OS or the BMC (Baseboard Management Controller). After flashing the Flash, the system must be restarted for the privileged code to take effect.
[0006] Therefore, how to update the interrupt handler without restarting the system is a technical problem that needs to be solved by those skilled in the art.
[0007] Summary of the Invention
[0008] The purpose of this application is to provide a program update method, device, electronic device and non-volatile readable storage medium, which realize the update of the interrupt handling program without restarting the system.
[0009] To achieve the above objectives, this application provides a program update method, including:
[0010] Move the new interrupt handler to physical memory;
[0011] Obtaining upgrade parameters, and determining a first location of a new interrupt handler in the physical memory and a second location of an interrupt handler to be upgraded in the physical memory according to the upgrade parameters;
[0012] The new interrupt processing program in the first position is moved to the second position to replace the interrupt processing program to be upgraded.
[0013] In some embodiments of the present application, moving the new interrupt handler to physical memory includes:
[0014] Move the new interrupt handler pre-stored in disk storage to physical memory.
[0015] In some embodiments of the present application, moving the new interrupt handler to physical memory includes:
[0016] Move the new interrupt handler to the first location in physical memory.
[0017] In some embodiments of the present application, after moving the new interrupt handler to the physical memory, the method further includes:
[0018] Write the upgrade parameters into the processor's registers.
[0019] In some embodiments of the present application, obtaining upgrade parameters includes:
[0020] Get the upgrade parameters from the processor's registers.
[0021] In some embodiments of the present application, the upgrade parameters include: the first position of the new interrupt handler in the physical memory, the code length of the new interrupt handler, and the interrupt number of the interrupt handler to be upgraded.
[0022] In some embodiments of the present application, determining a first location of a new interrupt handler in the physical memory and a second location of an interrupt handler to be upgraded in the physical memory according to an upgrade parameter includes:
[0023] Determine the first location of the new interrupt handler in the physical memory according to the upgrade parameter;
[0024] The second position of the interrupt processing program to be upgraded in the physical memory is determined according to the interrupt number of the interrupt processing program to be upgraded in the upgrade parameter.
[0025] In some embodiments of the present application, moving the new interrupt handler in the first location to the second location includes:
[0026] The new interrupt processing program in the first position is moved to the second position according to the code length of the new interrupt processing program in the upgrade parameter.
[0027] In some embodiments of the present application, after the new interrupt handler in the first location is moved to the second location to replace the interrupt handler to be upgraded, the method further includes:
[0028] When an interrupt corresponding to the interrupt handling program is triggered, the processor is triggered to execute the new interrupt handling program in the second location.
[0029] In some embodiments of the present application, after the new interrupt handler in the first location is moved to the second location to replace the interrupt handler to be upgraded, the method further includes:
[0030] The new interrupt handler in the first location is moved to the non-volatile memory.
[0031] In some embodiments of the present application, moving the new interrupt handling program in the first location to the non-volatile memory includes:
[0032] The new interrupt handling program in the first location is moved to the flash memory of the basic input and output system.
[0033] In some embodiments of the present application, after moving the new interrupt handling program in the first location to the flash memory of the basic input and output system, the method further includes:
[0034] When the processor is restarted, the new interrupt handler in the non-volatile memory is moved to the physical memory during the startup process of the basic input and output system.
[0035] In some embodiments of the present application, the interrupt handler includes an interrupt handler with the highest processor privilege.
[0036] In some embodiments of the present application, moving the new interrupt handler to physical memory includes:
[0037] Use the operating system upgrade program to move the new interrupt handler to physical memory.
[0038] In some embodiments of the present application, after the operating system upgrade program is used to move the new interrupt handler to the physical memory, the method further includes:
[0039] The operating system upgrade program is used to write upgrade parameters into the registers of the processor.
[0040] In some embodiments of the present application, after using the operating system upgrade program to write the upgrade parameters into the register of the processor, the method further includes:
[0041] The operating system upgrade program is used to write a preset interrupt number into the interrupt controller, so that the interrupt controller starts the privilege upgrade program after identifying the preset interrupt number.
[0042] In some embodiments of the present application, obtaining upgrade parameters and determining, based on the upgrade parameters, a first location of a new interrupt handler in physical memory and a second location of an interrupt handler to be upgraded in physical memory include:
[0043] The privilege escalation program is used to obtain an upgrade parameter from a register of the processor, and a first position of a new interrupt handler in the physical memory and a second position of an interrupt handler to be upgraded in the physical memory are determined according to the upgrade parameter.
[0044] In some embodiments of the present application, moving the new interrupt handler in the first location to the second location to replace the interrupt handler to be upgraded includes:
[0045] The privilege escalation program is used to move the new interrupt processing program in the first location to the second location to replace the interrupt processing program to be upgraded.
[0046] In some embodiments of the present application, after using the privilege escalation program to move the new interrupt handler in the first location to the second location to replace the interrupt handler to be upgraded, the method further includes:
[0047] The new interrupt handler in the first location is moved to the non-volatile memory using the privilege escalation program.
[0048] To achieve the above objectives, the present application provides a program updating device, comprising:
[0049] A first moving module is used to move the new interrupt handler to the physical memory;
[0050] a determination module, configured to obtain an upgrade parameter and determine, according to the upgrade parameter, a first location of the new interrupt handler in the physical memory and a second location of the interrupt handler to be upgraded in the physical memory;
[0051] The second moving module is used to move the new interrupt processing program in the first position to the second position to replace the interrupt processing program to be upgraded.
[0052] In some embodiments of the present application, the first moving module is specifically configured to move a new interrupt handling program pre-stored in a disk memory to a physical memory.
[0053] In some embodiments of the present application, the first moving module is specifically configured to move the new interrupt handling program to a first location in the physical memory.
[0054] In some embodiments of the present application, further comprising:
[0055] The first writing module is used to write the upgrade parameters into the register of the processor.
[0056] In some embodiments of the present application, the determination module is specifically used to: obtain upgrade parameters from the processor register, and determine the first position of the new interrupt handler in the physical memory and the second position of the interrupt handler to be upgraded in the physical memory according to the upgrade parameters.
[0057] In some embodiments of the present application, the upgrade parameters include: the first position of the new interrupt handler in the physical memory, the code length of the new interrupt handler, and the interrupt number of the interrupt handler to be upgraded.
[0058] In some embodiments of the present application, the determination module is specifically used to: obtain upgrade parameters, determine the first position of the new interrupt handler in the physical memory based on the upgrade parameters, and determine the second position of the interrupt handler to be upgraded in the physical memory based on the interrupt number of the interrupt handler to be upgraded in the upgrade parameters.
[0059] In some embodiments of the present application, the second moving module is specifically configured to move the new interrupt handling program in the first position to the second position according to the code length of the new interrupt handling program in the upgrade parameter.
[0060] In some embodiments of the present application, further comprising:
[0061] The trigger module is used to trigger the processor to execute the new interrupt processing program in the second position when the interrupt corresponding to the interrupt processing program is triggered.
[0062] In some embodiments of the present application, further comprising:
[0063] The third moving module is used to move the new interrupt processing program in the first location to the non-volatile memory.
[0064] In some embodiments of the present application, the third moving module is specifically configured to move the new interrupt handling program in the first location to a flash memory of a basic input and output system.
[0065] In some embodiments of the present application, further comprising:
[0066] The fourth moving module is used to move the new interrupt processing program in the non-volatile memory to the physical memory during the startup process of the basic input and output system when the processor is restarted.
[0067] In some embodiments of the present application, the interrupt handler includes an interrupt handler with the highest processor privilege.
[0068] In some embodiments of the present application, the first migration module is specifically configured to: utilize an operating system upgrade program to migrate a new interrupt handler to the physical memory.
[0069] In some embodiments of the present application, the first writing module is specifically used to: write the upgrade parameters into the registers of the processor using the operating system upgrade program.
[0070] In some embodiments of the present application, further comprising:
[0071] The second writing module is used to write a preset interrupt number into the interrupt controller by using the operating system upgrade program, so that the interrupt controller starts the privilege upgrade program after identifying the preset interrupt number.
[0072] In some embodiments of the present application, the determination module is specifically used to: use the privilege upgrade program to obtain upgrade parameters from the processor's registers, and determine the first position of the new interrupt handler in the physical memory and the second position of the interrupt handler to be upgraded in the physical memory based on the upgrade parameters.
[0073] In some embodiments of the present application, the second moving module is specifically configured to use the privilege escalation program to move the new interrupt handler in the first location to the second location to replace the interrupt handler to be upgraded.
[0074] In some embodiments of the present application, the third migration module is specifically configured to: utilize a privilege escalation program to migrate the new interrupt handling program in the first location to the non-volatile memory.
[0075] To achieve the above objectives, the present application provides an electronic device, comprising:
[0076] memory for storing computer programs;
[0077] A processor is used to implement the steps of the above-mentioned program updating method when executing a computer program.
[0078] To achieve the above objectives, the present application provides a non-volatile readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the program updating method described above are implemented.
[0079] From the above scheme, it can be seen that a program update method provided by the present application includes: moving a new interrupt handler to physical memory; obtaining upgrade parameters, and determining the first position of the new interrupt handler in the physical memory and the second position of the interrupt handler to be upgraded in the physical memory based on the upgrade parameters; moving the new interrupt handler in the first position to the second position to replace the interrupt handler to be upgraded.
[0080] The beneficial effects of this application are as follows: the program update method provided by this application moves the new interrupt handler to the location of the interrupt handler to be upgraded in physical memory. Since the new interrupt handler is in physical memory, it takes effect immediately after exiting the upgrade program, thus enabling the interrupt handler to be updated without restarting the system. This application also discloses a program update device, an electronic device, and a non-volatile readable storage medium, which can also achieve the above technical effects.
[0081] It should be understood that the foregoing general description and the following detailed description are merely illustrative and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0082] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following will briefly introduce the drawings required for the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. The drawings are used to provide a further understanding of the present disclosure and constitute part of the specification. Together with the following specific embodiments, they are used to explain the present disclosure, but do not constitute a limitation of the present disclosure. In the drawings:
[0083] FIG1 is a flowchart illustrating a program updating method according to some exemplary embodiments of the present application;
[0084] FIG2 is a flow chart showing another program updating method according to some exemplary embodiments of the present application;
[0085] FIG3 is a structural diagram of a computer system according to some exemplary embodiments of the present application;
[0086] FIG4 is a structural diagram of a program updating device according to some exemplary embodiments of the present application;
[0087] FIG5 is a structural diagram of an electronic device according to some exemplary embodiments of the present application. DETAILED DESCRIPTION
[0088] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application. In addition, in the embodiments of the present application, "first", "second", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0089] The embodiment of the present application discloses a program update method, which realizes the update of the interrupt handling program without restarting the system.
[0090] Referring to FIG. 1 , a flowchart of a program updating method according to some exemplary embodiments of the present application is shown. As shown in FIG. 1 , the method includes:
[0091] S101: Move the new interrupt handler to the physical memory;
[0092] The purpose of this embodiment is to realize the updating of the interrupt handling program, and the interrupt handling program in this embodiment can be the interrupt handling program with the highest processor authority, that is, the privileged interrupt handling program. In this step, the new interrupt handling program is moved to the physical memory.
[0093] As some feasible implementation methods of the present application, moving the new interrupt processing program to the physical memory includes: moving the new interrupt processing program pre-stored in the disk storage to the physical memory.
[0094] In a specific implementation, the user may pre-store the new interrupt processing program in the disk storage, and the processor moves the new interrupt processing program pre-stored in the disk storage to the physical memory.
[0095] As some feasible implementation methods of the present application, moving the new interrupt processing program to the physical memory includes: moving the new interrupt processing program to the first position in the physical memory.
[0096] In a specific implementation, the processor moves the new interrupt handling program that the user has saved in advance in the disk storage to a specific address location of the system physical memory, that is, the first location.
[0097] S102: Acquire upgrade parameters, and determine a first location of a new interrupt handler in the physical memory and a second location of an interrupt handler to be upgraded in the physical memory according to the upgrade parameters;
[0098] As some feasible implementation methods of the present application, after the new interrupt handling program is moved to the physical memory, the method further includes: writing the upgrade parameters into the registers of the processor.
[0099] In a specific implementation, the processor writes upgrade parameters into a register. The upgrade parameters may include the first location of the new interrupt handler in physical memory, the code length of the new interrupt handler, and the interrupt number of the interrupt handler to be upgraded. The interrupt number corresponds one-to-one with the privileged program to be upgraded and is used to determine the location of the interrupt handler to be upgraded in physical memory, namely the second location.
[0100] In this step, an upgrade parameter is obtained from a register of the processor, and a first position of the new interrupt handler in the physical memory and a second position of the interrupt handler to be upgraded in the physical memory are determined according to the upgrade parameter.
[0101] As some feasible implementation methods of the present application, determining the first position of the new interrupt handler in the physical memory and the second position of the interrupt handler to be upgraded in the physical memory according to the upgrade parameters includes: determining the first position of the new interrupt handler in the physical memory according to the upgrade parameters; determining the second position of the interrupt handler to be upgraded in the physical memory according to the interrupt number of the interrupt handler to be upgraded in the upgrade parameters.
[0102] In a specific implementation, the processor determines the first location of the new interrupt handler in the physical memory according to the upgrade parameters, and determines the second location of the interrupt handler to be upgraded in the physical memory according to the interrupt number of the interrupt handler to be upgraded in the upgrade parameters.
[0103] S103: Move the new interrupt processing program in the first position to the second position to replace the interrupt processing program to be upgraded.
[0104] In this step, the new interrupt handler in the first position in the physical memory is moved to the second position in the physical memory, so as to replace the interrupt handler to be upgraded in the second position in the physical memory with the new interrupt handler.
[0105] As some feasible implementations of the present application, moving the new interrupt handler in the first position to the second position includes: moving the new interrupt handler in the first position to the second position according to the code length of the new interrupt handler in the upgrade parameter.
[0106] In a specific implementation, the processor determines the code length of the new interrupt processing program according to the upgrade parameter, and moves the new interrupt processing program to the second location in the physical memory according to the code length.
[0107] Since the new interrupt handler is in the memory, it takes effect immediately after exiting the upgrade program. When the interrupt corresponding to the interrupt handler is triggered in the subsequent operating system, the processor will be triggered to execute the new interrupt handler. That is, after the interrupt handler in the first position is moved to the second position to replace the interrupt handler to be upgraded, it also includes: when the interrupt corresponding to the interrupt handler is triggered, the processor is triggered to execute the new interrupt handler in the second position.
[0108] Based on this embodiment, as some implementation methods of the present application, after moving the new interrupt handler in the first position to the second position to replace the interrupt handler to be upgraded, it also includes: moving the new interrupt handler in the first position to a non-volatile memory.
[0109] In a specific implementation, the new interrupt handler in the first position in the physical memory is moved to the non-volatile memory, and the moving position is the position of the interrupt handler to be upgraded in the non-volatile memory, that is, the interrupt handler in the non-volatile memory is replaced with the latest code, so as to realize non-volatile storage of the interrupt handler, that is, it can be saved even after power failure, and ensure that when the system is started subsequently, the new interrupt handler in the non-volatile memory is moved to the physical memory during the BIOS startup process, that is, after the new interrupt handler in the first position is moved to the flash memory of the basic input and output system, it also includes: when the processor is restarted, the new interrupt handler in the non-volatile memory is moved to the physical memory during the startup process of the basic input and output system.
[0110] As some feasible implementations of the present application, moving the new interrupt handler in the first location to the non-volatile memory includes: moving the new interrupt handler in the first location to the flash memory of the basic input and output system. In a specific implementation, the new interrupt handler is moved to the BIOS Flash.
[0111] The program update method provided in the embodiment of the present application moves the new interrupt handler to the location of the interrupt handler to be upgraded in the physical memory. Since the new interrupt handler is in the physical memory, it takes effect immediately after exiting the upgrade program, thereby realizing the update of the interrupt handler without restarting the system.
[0112] The embodiment of the present application discloses a program update method. Compared with some of the above embodiments, this embodiment further illustrates and optimizes the technical solution. Specifically:
[0113] Referring to FIG. 2 , a flowchart of another program updating method according to some exemplary embodiments of the present application is shown. As shown in FIG. 2 , the method includes:
[0114] S201: Using the operating system upgrade program to move the new interrupt handler to the physical memory.
[0115] This embodiment is applied to the computer system provided in Figure 3. As shown in Figure 3, the computer system includes a processor, disk storage, physical memory and non-volatile memory. The processor includes an operating system, an interrupt controller and registers. The operating system runs an operating system upgrade program, and the registers are used to store upgrade parameters.
[0116] In this embodiment, the operating system upgrade program is responsible for initiating the update process. First, the operating system upgrade program moves the new interrupt handler saved by the user in the disk storage in advance to a specific address location of the system physical memory, that is, the first location, see 1 in Figure 3.
[0117] S202: Using the operating system upgrade program to write upgrade parameters into the registers of the processor.
[0118] In this step, the operating system upgrade program writes upgrade parameters into the CPU (Central Processing Unit) registers (see 2 in Figure 3 ). The upgrade parameters may include the first physical memory location of the new interrupt handler, the code length of the new interrupt handler, and the interrupt number of the interrupt handler to be upgraded. The interrupt number corresponds one-to-one with the privileged program to be upgraded and is used to determine the physical memory location of the interrupt handler to be upgraded, which is the second physical memory location.
[0119] S203: Using the operating system upgrade program to write a preset interrupt number into the interrupt controller, so that the interrupt controller starts the privilege upgrade program after identifying the preset interrupt number.
[0120] In this step, the operating system upgrade program writes a preset interrupt number to the interrupt controller, see 3 in Figure 3. The preset interrupt number corresponds one-to-one with the privilege upgrade program. After receiving the preset interrupt number, the interrupt controller will enter the high-level interrupt processing mode to execute the privilege upgrade program, see 4 in Figure 3.
[0121] The privilege escalation program is used to upgrade the interrupt handler. It is written into the Flash memory when the computer leaves the factory. After the BIOS is started, the privilege escalation program is moved to a fixed location in the fixed privilege mode address space of the memory. The program is configured with a fixed interrupt number, also known as the preset interrupt number. During the BIOS startup process, the association between the preset interrupt number and the privilege escalation program is written into the interrupt controller. That is, the interrupt controller recognizes the preset interrupt number to temporarily trigger the processor to execute the privilege escalation program.
[0122] S204: Obtain upgrade parameters from the processor register using the privilege upgrade program, and determine a first location of the new interrupt handler in the physical memory and a second location of the interrupt handler to be upgraded in the physical memory according to the upgrade parameters.
[0123] In this step, after the privilege escalation program is executed, the upgrade parameters will be obtained from the agreed CPU registers. According to the upgrade parameters, the first position of the new interrupt handler in the physical memory, the code length of the new interrupt handler, and the second position of the interrupt handler to be upgraded in the physical memory are determined.
[0124] S205: Using the privilege escalation program, move the new interrupt handler in the first location to the second location to replace the interrupt handler to be upgraded.
[0125] In this step, the privilege escalation program moves the new interrupt handler to the second physical memory location of the interrupt handler to be upgraded, based on its code length (see 5 in Figure 3). After the upgrade is complete, the interrupt handler to be upgraded in the second physical memory location is replaced with the new interrupt handler. Since the new interrupt handler is already in memory, it takes effect immediately after exiting the privilege escalation program. Subsequent interrupts triggered by the OS trigger the processor to execute the new interrupt handler.
[0126] S206: Using the privilege escalation program, move the new interrupt processing program in the first location to the non-volatile memory.
[0127] In this step, the privilege escalation program moves the new interrupt handler in the first position in the physical memory to the non-volatile memory, see 6 in Figure 3. The non-volatile memory here can be BIOS Flash, and the moving position is the position of the interrupt handler to be upgraded in the non-volatile memory, that is, the interrupt handler in the non-volatile memory is replaced with the latest code, realizing non-volatile storage of the interrupt handler, that is, it can be saved even after power failure, ensuring that when the system is subsequently started, the new interrupt handler in the non-volatile memory is moved to the physical memory during the BIOS startup process.
[0128] As can be seen, this embodiment implements a logical architecture for whole-machine upgrades. The operating system upgrade program triggers the privilege escalation program through the interrupt controller, which then updates the interrupt handler in physical memory and the interrupt handler in non-volatile memory. The privilege escalation program implements interrupt handler updates. The privilege escalation program first updates the interrupt handler in physical memory, ensuring online, non-stop updates. The privilege escalation program then updates the old interrupt handler in non-volatile memory, maintaining consistency with the one in physical memory and ensuring the non-loss of the new interrupt handler.
[0129] A program updating device provided in an embodiment of the present application is introduced below. The program updating device described below and the program updating method described above can be referenced to each other.
[0130] Referring to FIG4 , a structural diagram of a program updating apparatus according to some exemplary embodiments of the present application is shown, as shown in FIG4 , including:
[0131] A first moving module 401 is used to move the new interrupt processing program to the physical memory;
[0132] The purpose of this embodiment is to realize the updating of the interrupt handling program, and the interrupt handling program in this embodiment can be the interrupt handling program with the highest processor authority, that is, the privileged interrupt handling program. In this step, the new interrupt handling program is moved to the physical memory.
[0133] In a specific implementation, the user may pre-store the new interrupt processing program in the disk storage, and the processor moves the new interrupt processing program pre-stored in the disk storage to the physical memory.
[0134] In a specific implementation, the processor moves the new interrupt handling program that the user has saved in advance in the disk storage to a specific address location of the system physical memory, that is, the first location.
[0135] A determination module 402 is configured to obtain an upgrade parameter and determine a first location of a new interrupt handler in the physical memory and a second location of an interrupt handler to be upgraded in the physical memory according to the upgrade parameter;
[0136] In a specific implementation, the processor writes upgrade parameters into a register. The upgrade parameters may include the first physical memory location of the new interrupt handler, the code length of the new interrupt handler, and the interrupt number of the interrupt handler to be upgraded. The interrupt number corresponds one-to-one with the privileged program to be upgraded and is used to determine the physical memory location of the interrupt handler to be upgraded, i.e., the second physical memory location. The processor then retrieves the upgrade parameters from the register and determines the first physical memory location of the new interrupt handler and the second physical memory location of the interrupt handler to be upgraded based on the upgrade parameters.
[0137] In a specific implementation, the processor determines the first location of the new interrupt handler in the physical memory according to the upgrade parameters, and determines the second location of the interrupt handler to be upgraded in the physical memory according to the interrupt number of the interrupt handler to be upgraded in the upgrade parameters.
[0138] The second moving module 403 is configured to move the new interrupt processing program in the first location to the second location to replace the interrupt processing program to be upgraded.
[0139] In a specific implementation, the new interrupt handler in the first position in the physical memory is moved to the second position in the physical memory, so as to replace the interrupt handler to be upgraded in the second position in the physical memory with the new interrupt handler.
[0140] In a specific implementation, the processor determines the code length of the new interrupt processing program according to the upgrade parameter, and moves the new interrupt processing program to the second location in the physical memory according to the code length.
[0141] Since the new interrupt handler is in the memory, it takes effect immediately after exiting the upgrade program. When the interrupt corresponding to the interrupt handler is triggered in the subsequent operating system, the processor will be triggered to execute the new interrupt handler. That is, after the new interrupt handler in the first position is moved to the second position to replace the interrupt handler to be upgraded, it also includes: when the interrupt corresponding to the interrupt handler is triggered, the processor is triggered to execute the new interrupt handler in the second position.
[0142] In a specific implementation, the new interrupt handler in the first location of the physical memory is moved to the non-volatile memory. The moving location is the location of the interrupt handler to be upgraded in the non-volatile memory. That is, the interrupt handler in the non-volatile memory is replaced with the latest code, achieving non-volatile preservation of the interrupt handler. That is, it can be preserved even after power failure. This ensures that when the system is subsequently started, the new interrupt handler in the non-volatile memory is moved to the physical memory during the BIOS startup process. That is, after the new interrupt handler in the first location is moved to the flash memory of the basic input and output system, the method also includes: when the processor is restarted, the new interrupt handler in the non-volatile memory is moved to the physical memory during the startup process of the basic input and output system. The non-volatile memory may include BIOS Flash.
[0143] The program updating device provided in the embodiment of the present application moves the new interrupt handler to the location of the interrupt handler to be upgraded in the physical memory. Since the new interrupt handler is in the physical memory, it takes effect immediately after exiting the upgrade program, thereby realizing the update of the interrupt handler without restarting the system.
[0144] On the basis of the above embodiments, as some preferred implementations of the present application, the first moving module 401 is specifically used to move the new interrupt handling program pre-stored in the disk storage to the physical memory.
[0145] On the basis of the above embodiments, as some preferred implementations of the present application, the first moving module 401 is specifically used to: move the new interrupt processing program to the first position in the physical memory.
[0146] On the basis of the above embodiments, some preferred implementations of this application further include:
[0147] The first writing module is used to write the upgrade parameters into the register of the processor.
[0148] Based on the above embodiments, as some preferred implementations of the present application, the determination module 402 is specifically used to: obtain upgrade parameters from the processor's registers, and determine the first position of the new interrupt handler in the physical memory and the second position of the interrupt handler to be upgraded in the physical memory based on the upgrade parameters.
[0149] Based on the above embodiments, as some preferred implementations of the present application, the upgrade parameters include: the first position of the new interrupt handler in the physical memory, the code length of the new interrupt handler, and the interrupt number of the interrupt handler to be upgraded.
[0150] Based on the above embodiments, as some preferred implementations of the present application, the determination module 402 is specifically used to: obtain upgrade parameters, determine the first position of the new interrupt handler in the physical memory according to the upgrade parameters, and determine the second position of the interrupt handler to be upgraded in the physical memory according to the interrupt number of the interrupt handler to be upgraded in the upgrade parameters.
[0151] Based on the above embodiments, as some preferred implementations of the present application, the second moving module 403 is specifically used to move the new interrupt handler in the first position to the second position according to the code length of the new interrupt handler in the upgrade parameters.
[0152] On the basis of the above embodiments, some preferred implementations of the present application further include:
[0153] The trigger module is used to trigger the processor to execute the new interrupt processing program in the second position when the interrupt corresponding to the interrupt processing program is triggered.
[0154] On the basis of the above embodiments, some preferred implementations of the present application further include:
[0155] The third moving module is used to move the new interrupt processing program in the first location to the non-volatile memory.
[0156] On the basis of the above embodiments, as some preferred implementations of the present application, the third moving module is specifically used to: move the new interrupt processing program in the first location to the flash memory of the basic input and output system.
[0157] On the basis of the above embodiments, some preferred implementations of the present application further include:
[0158] The fourth moving module is used to move the new interrupt processing program in the non-volatile memory to the physical memory during the startup process of the basic input and output system when the processor is restarted.
[0159] Based on the above embodiments, as some preferred implementations of the present application, the interrupt handler includes an interrupt handler with the highest processor privilege.
[0160] On the basis of the above embodiments, as some preferred implementations of the present application, the first moving module 401 is specifically used to: move the new interrupt handling program to the physical memory using the operating system upgrade program.
[0161] In this embodiment, the operating system upgrade program is responsible for initiating the update process. First, the operating system upgrade program moves the new interrupt handler saved in the disk storage in advance by the user to a specific address location of the system physical memory, namely the first location.
[0162] On the basis of the above embodiments, as some preferred implementations of the present application, the first writing module is specifically used to: write the upgrade parameters into the registers of the processor using the operating system upgrade program.
[0163] In a specific implementation, the operating system upgrade program writes upgrade parameters into CPU registers. The upgrade parameters may include the first physical memory location of the new interrupt handler, the code length of the new interrupt handler, and the interrupt number of the interrupt handler to be upgraded. The interrupt number corresponds one-to-one with the privileged program to be upgraded and is used to determine the physical memory location of the interrupt handler to be upgraded, i.e., the second physical memory location.
[0164] On the basis of the above embodiments, some preferred implementations of the present application further include:
[0165] The second writing module is used to write a preset interrupt number into the interrupt controller by using the operating system upgrade program, so that the interrupt controller starts the privilege upgrade program after identifying the preset interrupt number.
[0166] In a specific implementation, the operating system upgrade program writes a preset interrupt number to the interrupt controller, and the preset interrupt number corresponds to the privilege upgrade program one by one. After receiving the preset interrupt number, the interrupt controller will enter a high-level interrupt processing mode to execute the privilege upgrade program.
[0167] The privilege escalation program is used to upgrade the interrupt handler. It is written into the Flash memory when the computer leaves the factory. After the BIOS is started, the privilege escalation program is moved to a fixed location in the fixed privilege mode address space of the memory. The program is configured with a fixed interrupt number, also known as the preset interrupt number. During the BIOS startup process, the association between the preset interrupt number and the privilege escalation program is written into the interrupt controller. That is, the interrupt controller recognizes the preset interrupt number to temporarily trigger the processor to execute the privilege escalation program.
[0168] Based on the above embodiments, as some preferred implementation methods of the present application, the determination module 402 is specifically used to: use the privilege upgrade program to obtain upgrade parameters from the processor's registers, and determine the first position of the new interrupt handler in the physical memory and the second position of the interrupt handler to be upgraded in the physical memory according to the upgrade parameters.
[0169] In a specific implementation, after the privilege escalation program is executed, the upgrade parameters will be obtained from the agreed CPU register, and the first position of the new interrupt handler in the physical memory, the code length of the new interrupt handler, and the second position of the interrupt handler to be upgraded in the physical memory will be determined based on the upgrade parameters.
[0170] Based on the above embodiments, as some preferred implementations of the present application, the second moving module 403 is specifically used to: use the privilege escalation program to move the new interrupt handler in the first location to the second location to replace the interrupt handler to be upgraded.
[0171] In a specific implementation, the privilege escalation program moves the new interrupt handler to the second physical memory location of the interrupt handler to be upgraded, based on its code length. After the upgrade is complete, the interrupt handler to be upgraded in the second physical memory location is replaced with the new interrupt handler. Because the new interrupt handler is in memory, it takes effect immediately after exiting the privilege escalation program. Subsequent interrupts triggered by the OS trigger the processor to execute the new interrupt handler.
[0172] On the basis of the above embodiments, as some preferred implementations of the present application, the third migration module is specifically used to: utilize the privilege escalation program to migrate the new interrupt handling program in the first location to the non-volatile memory.
[0173] In a specific implementation, the privilege escalation program moves the new interrupt handler in the first position in the physical memory to the non-volatile memory. The non-volatile memory here can be BIOS Flash, and the moving position is the position of the interrupt handler to be upgraded in the non-volatile memory, that is, the interrupt handler in the non-volatile memory is replaced with the latest code to achieve non-volatile storage of the interrupt handler, that is, it can be saved even after power failure, ensuring that when the system is started later, the new interrupt handler in the non-volatile memory is moved to the physical memory during the BIOS startup process.
[0174] As can be seen, this embodiment implements a logical architecture for whole-machine upgrades. The operating system upgrade program triggers the privilege escalation program through the interrupt controller, which then updates the interrupt handler in physical memory and the interrupt handler in non-volatile memory. The privilege escalation program implements interrupt handler updates. The privilege escalation program first updates the interrupt handler in physical memory, ensuring online, non-stop updates. The privilege escalation program then updates the old interrupt handler in non-volatile memory, maintaining consistency with the one in physical memory and ensuring the non-loss of the new interrupt handler.
[0175] Regarding the apparatus in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0176] Based on the hardware implementation of the above program modules, and in order to implement the method of the embodiments of the present application, the embodiments of the present application further provide an electronic device. FIG5 is a structural diagram of an electronic device according to some exemplary embodiments of the present application. As shown in FIG5 , the electronic device includes:
[0177] Communication interface 1, capable of exchanging information with other devices such as network devices;
[0178] The processor 2 is connected to the communication interface 1 to implement information exchange with other devices and is used to execute the program update method provided by one or more of the above technical solutions when running the computer program. The computer program is stored in the memory 3.
[0179] Of course, in actual applications, the various components in the electronic device are coupled together via bus system 4. It will be appreciated that bus system 4 is used to enable communication between these components. In addition to a data bus, bus system 4 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in FIG5 , all of these buses are labeled as bus system 4.
[0180] The memory 3 in the embodiment of the present application is used to store various types of data to support the operation of the electronic device. Examples of such data include: any computer program used to operate on the electronic device.
[0181] It is understood that the memory 3 can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a magnetic disk memory or a magnetic tape memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct rambus random access memory (DRRAM).The memory 3 described in the embodiments of the present application is intended to include but is not limited to these and any other suitable types of memories.
[0182] The methods disclosed in the above embodiments of the present application can be applied to processor 2 or implemented by processor 2. Processor 2 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by the hardware integrated logic circuit in processor 2 or by instructions in the form of software. The above processor 2 may be a general-purpose processor, a DSP (digital signal processor), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Processor 2 can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the methods disclosed in the embodiments of the present application can be directly embodied as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium, which is located in memory 3. Processor 2 reads the program in memory 3 and completes the steps of the above method in combination with its hardware.
[0183] When the processor 2 executes the program, the corresponding processes in each method of the embodiment of the present application are implemented. For the sake of brevity, they are not repeated here.
[0184] In an exemplary embodiment, the present application also provides a storage medium, namely, a computer storage medium, specifically a non-volatile readable storage medium, such as a memory 3 storing a computer program. The computer program can be executed by a processor 2 to perform the aforementioned method steps. The non-volatile readable storage medium can be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface storage, optical disk, CD-ROM, etc.
[0185] Those skilled in the art will understand that all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a non-volatile readable storage medium. When the program is executed, it executes the steps of the above-mentioned method embodiment; and the aforementioned storage medium includes: mobile storage devices, ROM, RAM, disks or optical disks, etc. Various media that can store program codes.
[0186] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a non-volatile readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a non-volatile readable storage medium and includes a number of instructions for enabling an electronic device (which can be a personal computer, server, network device, etc.) to execute all or part of the methods of each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.
[0187] The above are only specific embodiments of the present application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.
Claims
1. A program updating method, characterized in that: include: Move the new interrupt handler to physical memory; Acquire upgrade parameters, and determine a first position of the new interrupt handler in the physical memory and a second position of the interrupt handler to be upgraded in the physical memory according to the upgrade parameters; The new interrupt processing program in the first position is moved to the second position to replace the interrupt processing program to be upgraded.
2. The program updating method according to claim 1, characterized in that: The moving of the new interrupt handler to the physical memory includes: Move the new interrupt handler pre-stored in disk storage to physical memory.
3. The program updating method according to claim 1, characterized in that: The moving of the new interrupt handler to the physical memory includes: Move the new interrupt handler to the first location in physical memory.
4. The program updating method according to claim 1, characterized in that: After the new interrupt processing program is moved to the physical memory, the following steps are also included: Write the upgrade parameters into the processor's registers.
5. The program updating method according to claim 4, characterized in that: The obtaining of the upgrade parameters includes: The upgrade parameters are obtained from the registers of the processor.
6. The program updating method according to claim 1, characterized in that: The upgrade parameters include: the first position of the new interrupt handler in the physical memory, the code length of the new interrupt handler, and the interrupt number of the interrupt handler to be upgraded.
7. The program updating method according to claim 6, characterized in that: The step of determining the first position of the new interrupt handler in the physical memory and the second position of the interrupt handler to be upgraded in the physical memory according to the upgrade parameter includes: Determine a first position of the new interrupt handler in the physical memory according to the upgrade parameter; The second position of the interrupt processing program to be upgraded in the physical memory is determined according to the interrupt number of the interrupt processing program to be upgraded in the upgrade parameter.
8. The program updating method according to claim 6, characterized in that: Moving the new interrupt processing program in the first position to the second position includes: The new interrupt processing program in the first position is moved to the second position according to the code length of the new interrupt processing program in the upgrade parameter.
9. The program updating method according to claim 1, characterized in that: After the new interrupt processing program in the first position is moved to the second position to replace the interrupt processing program to be upgraded, the method further includes: When an interrupt corresponding to the interrupt handler is triggered, the processor is triggered to execute the new interrupt handler in the second location.
10. The program updating method according to claim 1, characterized in that: After the new interrupt processing program in the first position is moved to the second position to replace the interrupt processing program to be upgraded, the method further includes: The new interrupt processing program in the first location is moved to a non-volatile memory.
11. The program updating method according to claim 10, characterized in that: Moving the new interrupt handling program in the first location to a non-volatile memory includes: The new interrupt processing program in the first location is moved to the flash memory of the basic input and output system.
12. The program updating method according to claim 10, characterized in that: After the new interrupt processing program in the first position is moved to the flash memory of the basic input and output system, the method further includes: When the processor is restarted, the new interrupt processing program in the non-volatile memory is moved to the physical memory during the startup process of the basic input and output system.
13. The program updating method according to claim 1, characterized in that: The interrupt processing program includes an interrupt processing program with the highest processor authority.
14. The program updating method according to claim 1, characterized in that: The moving of the new interrupt handler to the physical memory includes: Use the operating system upgrade program to move the new interrupt handler to physical memory.
15. The program updating method according to claim 14, characterized in that: After the operating system upgrade program is used to move the new interrupt processing program to the physical memory, the method further includes: The operating system upgrade program is used to write upgrade parameters into the register of the processor.
16. The program updating method according to claim 15, characterized in that: After the upgrade parameters are written into the register of the processor by the operating system upgrade program, the method further includes: The operating system upgrade program is used to write a preset interrupt number into the interrupt controller so that the interrupt controller starts the privilege upgrade program after identifying the preset interrupt number.
17. The program updating method according to claim 16, characterized in that: The obtaining of the upgrade parameters and determining, according to the upgrade parameters, a first position of the new interrupt handler in the physical memory and a second position of the interrupt handler to be upgraded in the physical memory include: The privilege escalation program is used to obtain an upgrade parameter from a register of the processor, and the first position of the new interrupt handler in the physical memory and the position of the interrupt handler to be upgraded in the physical memory are determined according to the upgrade parameter. The second location in physical memory.
18. The program updating method according to claim 17, characterized in that: Moving the new interrupt processing program in the first position to the second position to replace the interrupt processing program to be upgraded includes: The privilege escalation program is used to move the new interrupt processing program in the first location to the second location to replace the interrupt processing program to be upgraded.
19. The program updating method according to claim 18, characterized in that: After using the privilege escalation program to move the new interrupt handler in the first position to the second position to replace the interrupt handler to be upgraded, the method further includes: The new interrupt handler in the first location is moved to a non-volatile memory using the privilege escalation program.
20. A program updating device, characterized in that: include: A first moving module, used for moving a new interrupt processing program to a physical memory; a determination module, configured to obtain an upgrade parameter, and determine a first position of the new interrupt handler in the physical memory and a second position of the interrupt handler to be upgraded in the physical memory according to the upgrade parameter; The second moving module is used to move the new interrupt processing program in the first position to the second position to replace the interrupt processing program to be upgraded.
21. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the program updating method as claimed in any one of claims 1 to 19 when executing the computer program.
22. A non-volatile readable storage medium, characterized in that: The non-volatile readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the program updating method according to any one of claims 1 to 19 are implemented.
Citation Information
Patent Citations
A responder software upgrading method based on single-chip online loading
CN109683941A
Remote upgrading method for embedded DSP program based on C6455 chip
CN110471674A
Program updating method and device, electronic equipment and storage medium
CN116578327A
Program upgrade method and apparatus, electronic device and storage medium
WO2021115477A1
Application upgrading method and apparatus, and computing device and chip system
WO2023061172A1
