The present application claims the benefit of priority to Taiwan patent application No. 103113662, filed on Apr. 15, 2014, entitled “Computer Readable Storage Media and Updating Method Thereof”, which is hereby incorporated by reference in its entirety.
The present invention relate to an update method for a computer readable storage medium, and more particularly to a method for updating the computer readable storage medium which stores program instructions and data for execution in a computing system.
In computing or information processing system, processors have to rely on storage media to store firmware, embedded within computing or information processing systems, which refers to program instructions for controlling the operation of hardware components associated with the computing or information processing systems. Especially, a consumer electronic product typically has a short development cycle, therefore, it may be necessary to update firmware or data resided in storage media of the consumer electronic product after the products have been sold in the market for correcting problems or improving functionality in the released version. As such. it is a fundamental functionality that users can easily update program instructions and data stored therein storage media in terms of consumer electronic products.
When the electronic device is reset, interrupts are generally disabled during processor initialization. The IVT stored in the memory is initialized before enabling interrupts. The above-mentioned interrupt vector table (IVT) segment 110 stores interrupt vectors that redirect the processor to a right address in the electronic device when an interrupt occurs. Each interrupt vector, or each entry in the IVT 110, generally points to a starting address of a dispatch code, an interrupt service routine (ISR) or a list of ISRs. The base address of the IVT is recorded in the processor. Accordingly, when the processor in the electronic device receives an external or internal interrupt request, it knows which interrupt vector is corresponding to the interrupt based on the interrupt vectors stored in the IVT 110. Typically, the processor suspends the currently executing program, the instruction pointer (IP) is set to the starting address of the dispatch code, and the ISR or the list of ISRs respond to an interrupt when the interrupt occurs. Eventually, the processor returns to where it left off once the ISR has finished.
Referring to
In summary, there is a need of reducing the interrupt latency when the data content of the storage media in the electronic device is required to be updated.
In an embodiment of the present invention, there is provided a computer-readable storage medium divided into a plurality of segments to store program instructions and data for execution of a processor, said computer-readable storage medium comprising: an IVT (interrupt vector table) segment for storing a plurality of interrupt vectors; an ISR (interrupt service routine) segment for storing a plurality of ISRs, wherein each of the plurality of interrupt vectors points to one of the plurality of ISRs; an application segment for storing a plurality of application programs of the processor, wherein each of the plurality of ISRs is configured to call a corresponding one of the plurality of application programs; an update IVT segment for storing a plurality of update interrupt vectors; an update ISR segment for storing a plurality of update ISRs, wherein each of the plurality of update interrupt vectors points to one of the plurality of update ISRs; and an update utility segment for storing a plurality of update programs for updating the IVT segment, the ISR segment and the application segment, wherein the plurality of update ISRs are configured to call a corresponding one of the plurality of update programs.
In another embodiment of the present invention, there is provided a update method for a computer-readable storage medium which is divided into a plurality of segments including an IVT (interrupt vector table) segment, an ISR (interrupt service routine) segment, an application segment, an update IVT segment, an update ISR segment, and an update utility segment to store instructions and data for execution of a processor, said update method comprising: performing an ISR in the ISR segment when an interrupt is received to determine whether an update requirement is met; activating a duplicate program in the application segment to reproduce data in the update IVT segment to the IVT segment; resetting the processor after completion of the said reproducing data in the update IVT segment to the IVT segment; performing an update ISR in the update ISR segment according to the IVT segment pointing to the update ISR segment, and thereby activate an update program in the update utility segment; and updating the IVT segment, the ISR segment, and application segment.
In still another embodiment of the present invention, there is provided a computing system, said computing system comprising: a host system, a processor connected to the host system for processing interrupts, a computer-readable storage medium divided into a plurality of segments to store instructions and data for execution of the processor, comprising: an IVT (interrupt vector table) segment for storing a plurality of interrupt vectors; an ISR (interrupt service routine) segment for storing a plurality of ISRs, wherein each of the plurality of interrupt vectors points to one of the plurality of ISRs; an application segment for storing a plurality of application programs, wherein each of the plurality of ISRs is configured to call a corresponding one of the plurality of application programs; an update IVT segment for storing a plurality of update interrupt vectors; an update ISR segment for storing a plurality of ISRs, wherein each of the plurality of interrupt vectors points to one of the plurality of ISRs; and an update utility segment for storing a plurality of update programs, wherein each of the plurality of ISRs is configured to call a corresponding one of the plurality of update programs.
It is to be noted that any arbitrary combination or rearrangement of the above-described structural components and so forth is effective as and encompassed by the present embodiments. Moreover, this summary of the invention does not necessarily describe all necessary features so that the invention may also be a sub-combination of these described features.
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings. While the present invention will be described in conjunction with embodiments, it will be understood that the descriptions are not intended to limit the present invention to these embodiments. On the contrary, the descriptions are intended to cover alternatives, modifications and equivalents, which may be included within the spirit and scope as defined by the appended claims. Furthermore, in the following detailed description, numerous specific details are set forth in order to provide a thorough understanding of embodiments of the present invention. However, one of ordinary skill in the art will understand that embodiments of the present invention may be practiced without these specific details. In other instances, well known methods, procedures, components, and circuits have not been described in detail as not to unnecessarily obscure aspects of the present invention.
Referring to
As the embodiment illustrated in
Referring to
In one embodiment, the segments of the storage medium 200 are arranged in a sequential order as shown in
In one embodiment, the size of the update IVT segment 240 and the size of the IVT segment 210 are equal. In another embodiment, the size of the update IVT segment 240 is smaller than the size of the IVT segment 210.
Next, in block 320, according to the interrupt vector in the IVT segment 210, a corresponding starting address of an ISR resided in the ISR segment 220 is found. In the succeeding block 330, the ISR performs to determine whether a requirement of an updating operation is met. When it is determined that the update requirement is not met, the corresponding application resided in the application segment 230 is called. Consequently, the stored content in the storage medium 200 remains no change because no any update operation is performed, and the method does not proceed to a next step.
When it is determined in that the requirement of the updating operation is met, the method proceeds to block 340. In block 340, a duplicate application resided in the application segment 230 is activated such that the data content in the update IVT segment 240 is reproduced to some entries in the IVT segment 210. In other words, a part of data content in the IVT segment 210 is overwritten by the data content in the update IVT segment 240. Furthermore, the processor is reset after completion of the reproducing data in the update IVT segment to the IVT segment in block 350.
After the processor is reset in block 350, the method proceeds to block 360. In block 360, when a new interrupt occurs, a corresponding starting address of the new ISR is found according to the overwritten part of data content in the IVT segment 210, i.e. the data content from the update IVT segment 240. As mentioned, the update IVT segment 240 points to the update ISR segment 250 so the new ISR in the update ISR segment 250 is performed. Namely, the corresponding update program resided in the update utility segment 260 is called in block 360.
In block 370, some segments such as the IVT 210, the ISR segment 220, and/or the application segment 230 are updated with new data contents after the update program resided in the update utility segment 260 has been executed. If necessary, other segments such as the update IVT segment 240, the update ISR segment 250, and/or the update utility segment 260 are also updated with new data content.
The processor is reset again to its initial state upon completion of all actions in the block 360. When the processor reboots, the updated interrupt services are provided according to the information in the IVT segment 210, the ISR segment 220, and/or the application segment 230.
Although the computing system 400 includes only one processor 430 shown in
It will further be appreciated by those skilled in the art that the processor 430 is used to perform an update task for the computer readable storage medium with the control flow as shown in
In summary, the characteristics of the invention provides as indicated in the description and the drawings are to provide two set of IVTs and its associated ISRs and program instructions in the computer readable storage medium. In this manner, the system can make the updating task for the data content of the computer readable storage medium go more smoothly and less interrupt latency.
In the foregoing specification, the invention has been described with reference to specific exemplary embodiments thereof. It will, however, be evident that various modifications and changes may be made to the specific exemplary embodiments without departing from the broader spirit and scope of the invention as set forth in the appended claims. Accordingly, the specification and drawings are to be regarded in an illustrative rather than a restrictive sense.