Protection bit rewriting method and device, equipment and storage medium
By introducing the first switch bit and status register in the memory, receiving and verifying the overwrite instruction, the problem that the area protection bit cannot be changed is solved, and flexible changes to the protected area and data reliability are achieved.
Patent Information
- Application Number
- CN202310546399.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-15
- Publication Date
- 2024-11-15
AI Technical Summary
In the existing memory technology, once the area protection bit enters a specific state, it cannot be changed, resulting in the user that the protected bit may be miswrite-write to the protected bit when changing the protected storage area, resulting in the protection bit being permanently protected and the protected storage area cannot be changed.
By introducing the first switch bit and status register in the memory, receiving and verifying the overwrite instruction, rewritten the first protection bit based on the data to be rewritten, ensuring that the overwrite value will not be lost after the memory is powered off or restarted, and the protection area can be realized. Flexible changes.
Flexible changes to the protection area are achieved, permanent protection problems caused by miswrite-protected bits are avoided, and data reliability and flexibility are ensured.
Smart Images

Figure CN118963833A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of memory technology, and in particular to a protection bit rewriting method, device, computer equipment, and computer-readable storage medium. Background Art
[0002] In the field of memory technology, in order to meet customers' application requirements for different memory scenarios, different storage areas of the memory need to be flexibly protected to prevent erasure, so that the data in the protected area is not changed.
[0003] In the related art, the regional protection bit of the memory is rewritten through instructions, so that the storage area (an area on the storage array) corresponding to the regional protection bit is protected. However, there is a corresponding protection bit for the regional protection bit. Once the protection bit enters a specific state, the regional protection bit can no longer be changed, that is, the storage area corresponding to the regional protection bit is permanently protected. In actual use, when changing the protected storage area, the user may mistakenly write the protection bit, causing the protection bit to enter a specific state, making it impossible to change the regional protection bit, and accordingly, the protected storage area cannot be changed. Summary of the invention
[0004] The purpose of the present disclosure is to provide a protection bit rewriting method, device, equipment and storage medium, which can rewrite the protection bit corresponding to the area protection bit, thereby realizing the change of the protection area.
[0005] An embodiment of the present disclosure provides a protection bit rewriting method, wherein a memory includes a main storage area and a first status register, the main storage area includes a function configuration storage area and at least one data storage area, the function configuration storage area includes a first switch bit, the first status register includes a first protection bit and a regional protection bit, the regional protection bit stores a value representing the corresponding data storage area, the method includes: if the first switch bit is enabled and turned on, receiving a first rewrite instruction; if the first rewrite instruction is successfully verified, receiving data to be rewritten; rewriting the first protection bit according to the data to be rewritten, wherein the first protection bit is used to indicate the protection state of the regional protection bit.
[0006] In some exemplary embodiments of the present disclosure, the first rewrite instruction includes format information and operation information; wherein, if the first rewrite instruction is successfully verified, receiving the data to be rewritten includes: if the format information is successfully verified, executing the operation information, and receiving the data to be rewritten.
[0007] In some exemplary embodiments of the present disclosure, rewriting the first protection bit according to the data to be rewritten includes: rewriting the value on the first protection bit to a first numerical value according to the data to be rewritten, and the first numerical value will not be lost after the memory is powered off or restarted.
[0008] In some exemplary embodiments of the present disclosure, the memory also includes a latch, which is used to latch the latched overwrite value to be written to the first protection bit, and the functional configuration storage area also includes a second switch bit; the method also includes: if the first switch bit is enabled to be turned off and the second switch bit is enabled to be turned on, then receiving a second overwrite instruction, the second overwrite instruction includes the operation information and the data to be overwritten; executing the operation information, and overwriting the first protection bit and / or the latched overwrite value according to the data to be overwritten.
[0009] In some exemplary embodiments of the present disclosure, the memory also includes a second status register, which includes a second protection bit; wherein, rewriting the first protection bit and / or the latched rewrite value according to the data to be rewritten includes: when the second protection bit is a first preset value, rewriting the first protection bit and the latched rewrite value according to the data to be rewritten, rewriting the latched rewrite value to a first value, and rewriting the value on the first protection bit to the first value, and the first value on the first protection bit will not be lost after the memory is powered off or restarted.
[0010] In some exemplary embodiments of the present disclosure, the memory also includes a second status register, which includes a second protection bit; wherein, rewriting the first protection bit and / or the latched rewrite value according to the data to be rewritten includes: when the second protection bit is a second preset value, rewriting the latched rewrite value according to the data to be rewritten, and rewriting the latched rewrite value to a first value, and the first value will be lost after the memory is powered off or restarted.
[0011] In some exemplary embodiments of the present disclosure, the memory also includes a latch, which is used to latch a latched overwrite value to be written to the first protection bit; the method also includes: if the first switch bit is enabled and turned on, receiving a first overwrite instruction, the first overwrite instruction including format information and operation information; if the format information verification fails, executing the operation information and receiving the data to be overwritten; rewriting the latched overwrite value according to the data to be overwritten, and rewriting the latched overwrite value to a first value, which will be lost after the memory is powered off or restarted.
[0012] In some exemplary embodiments of the present disclosure, the memory is coupled to an input device for transmitting the first rewrite instruction and / or the second rewrite instruction.
[0013] In some exemplary embodiments of the present disclosure, the format information causes the chip select pin of the memory to be pulled down to a low level twice; the operation information includes enable information and write information, the enable information causes the chip select pin of the memory to be pulled down to a low level once, and the write information is used to indicate that the data to be rewritten is written into the memory.
[0014] In some exemplary embodiments of the present disclosure, the number of external pins of the memory used to transmit one or more of the first rewrite instruction, the second rewrite instruction, and the data to be rewritten is 1 or an even number.
[0015] According to another aspect of the present disclosure, a protection bit rewriting device is provided, wherein the memory includes a main storage area and a first status register, the main storage area includes a function configuration storage area and at least one data storage area, the function configuration storage area includes a first switch bit, the first status register includes a first protection bit and a regional protection bit, the regional protection bit stores a value representing the corresponding data storage area, and the device includes a receiving module and a rewriting module. The receiving module is used to receive a first rewriting instruction if the first switch bit is enabled and turned on; the receiving module is also used to receive data to be rewritten if the first rewriting instruction is successfully verified; the rewriting module is used to rewrite the first protection bit according to the data to be rewritten, wherein the first protection bit is used to indicate the protection state of the regional protection bit.
[0016] According to another aspect of the present disclosure, a computer device is provided, comprising one or more processors; and a memory configured to store one or more programs, so that when the one or more programs are executed by the one or more processors, the computer device implements the protection bit rewriting method in any embodiment of the present disclosure.
[0017] According to another aspect of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, wherein the computer program is suitable for being loaded and executed by a processor so that a computer device having the processor executes the protection bit rewriting method in any embodiment of the present disclosure.
[0018] According to another aspect of the present disclosure, a computer program product is provided. When the computer program is executed by a processor, the protection bit rewriting method in any embodiment of the present disclosure is implemented.
[0019] The protection bit rewriting method, device, equipment and storage medium provided by the embodiments of the present disclosure receive a first rewrite instruction if the first switch bit is enabled and turned on, receive data to be rewritten if the first rewrite instruction is successfully verified, and rewrite the first protection bit according to the data to be rewritten. The present disclosure receives the first rewrite instruction when the first switch bit is enabled and turns on, and verifies the first rewrite instruction, and rewrites the first protection bit if the verification is successful, thereby changing the protection area.
[0020] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0022] Figure 1 A functional block diagram of a status register in an embodiment of the present disclosure is shown;
[0023] Figure 2 A schematic diagram showing a protection bit rewriting system according to an embodiment of the present disclosure;
[0024] Figure 3 A flow chart of a protection bit rewriting method according to an embodiment of the present disclosure is shown;
[0025] Figure 4 A flow chart of a protection bit rewriting method in one embodiment of the present disclosure is shown;
[0026] Figure 5 A flow chart of a protection bit rewriting method in another embodiment of the present disclosure is shown;
[0027] Figure 6 A schematic diagram of a protection bit rewriting device in an embodiment of the present disclosure is shown;
[0028] Figure 7 A schematic diagram showing the structure of a computer device in an embodiment of the present disclosure is shown;
[0029] Figure 8 A schematic diagram of a computer-readable storage medium in an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0030] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the disclosure will be more comprehensive and complete and to fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0031] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0032] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0033] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0034] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise clearly indicated in the context, it should be understood as "one or more", where "plurality" refers to two or more.
[0035] The present disclosure is described by taking the application of a non-volatile memory to a memory of a basic input / output system of a computer system as an example, but is not limited thereto.
[0036] The memory is a memory component used to store programs and various data information. In order to meet the user's application requirements for memory in different scenarios, different storage areas of the memory need to be flexibly protected to prevent erasure, so that the data in the protected area is not changed. For example, the parameter setting program stored in the memory on the smart device needs to be protected.
[0037] In the related art, the regional protection bit of the memory is rewritten through instructions, so that the storage area (an area on the storage array) corresponding to the regional protection bit is protected. However, there is a corresponding protection bit for the regional protection bit. Once the protection bit enters a specific state, the regional protection bit can no longer be changed, that is, the storage area corresponding to the regional protection bit is permanently protected. In actual use, when changing the protected storage area, the user may mistakenly write the protection bit, causing the protection bit to enter a specific state, making it impossible to change the regional protection bit, and accordingly, the protected storage area cannot be changed.
[0038] The inventors have found that non-volatile storage devices such as non-volatile memories generally include multiple data storage areas. Once these data storage areas enter a protected / locked state, they cannot be read or rewritten. The area protection bit stores a value representing the corresponding data storage area. Figure 1 As shown, 10 is used to indicate the data storage area, BP2, BP1 and BP0 are used to indicate the regional protection bit, SRP1 (status register protection bit1) is used to indicate the protection bit (hereinafter referred to as the first protection bit), and the value of SRP1 is used to indicate whether the regional protection bit is in an overwritable state. For example, if the value of SRP1 is 1, the regional protection bits BP2, BP1 and BP0 cannot be overwritten, and the data storage area 10 corresponding to BP2, BP1 and BP0 is locked and cannot be read or written. It should be noted that the values stored on BP2, BP1 and BP0 correspond to the data storage area 10. For example, if the values of BP2, BP1 and BP0 are 000, then they correspond to data storage area 0. In other words, data storage area 0 is in a protected / locked state. The regional protection bit and the first protection bit are usually set in the status register. The first protection bit can prevent the regional protection bit in the status register from being arbitrarily overwritten, and the first protection bit can be used to indicate the protection mode of the status register. For example, Figure 1 As shown, the value of the first protection bit on the status register 1 is 1, indicating that the corresponding status register 1 cannot be rewritten, that is, the first protection bit enters a specific state and the regional protection bit cannot be rewritten.
[0039] Based on this, the embodiments of the present disclosure provide a protection bit rewriting method, device, equipment and storage medium, which can be applied in the field of memory technology, and exemplarily, can be applied in the specific scenario of non-volatile memory protection bit rewriting. The present disclosure receives a first rewriting instruction when the first switch bit is enabled and verifies the first rewriting instruction. If the verification is successful, the first protection bit is rewritten, thereby realizing the change of the protection area.
[0040] In order to facilitate the overall understanding of the technical solution provided by the embodiment of the present disclosure, the protection bit rewriting system provided by the embodiment of the present disclosure is first described below. Figure 2 As shown, the protection bit rewriting system may include a logic module 21, a row and column decoder 22 and a main storage area 23, wherein the main storage area 23 is a memory storage cell array, the main storage area 23 is used to store user data, and the memory storage cell array other than the main storage area 23 is called a fixed area. That is to say, the memory storage cell array may include multiple storage areas, the storage area used to store user data in the storage area is the main storage area, and the other storage areas are storage areas outside the main storage area (also called fixed areas). The main storage area 23 may include a function configuration storage area, a main storage array and a status register, wherein the main storage array may include multiple data storage areas, and the function configuration storage area may include a first switch bit. The status register may include a first status register and / or a second status register, the first status register may include a first protection bit and a regional protection bit, and the second status register may include a second protection bit.
[0041] Exemplarily, the logic module 21 can obtain the value stored on the first switch bit through the row-column decoder 22, thereby obtaining the state of the first switch bit, that is, whether the first switch bit is enabled to be turned on or the first switch bit is enabled to be turned off. For example, the value of the first switch bit is 1, which enables it to be turned on; the value of the first switch bit is 0, which enables it to be turned off. The logic module 21 can also receive a first rewrite instruction through an external signal interface connected to an external electronic device when the first switch bit is enabled to be turned on, and verify whether the first rewrite instruction is correct. If the first rewrite instruction is successfully verified, the data to be rewritten is received, and the first protection bit on the first status register is rewritten through the row-column decoder 22. The first protection bit is used to indicate the protection state of the regional protection bit. It should be noted that since the value of the status register is stored in the storage cell array of the memory, the value on the status register will not be lost after the memory is powered off or restarted.
[0042] Exemplarily, the protection bit rewrite system may further include a page cache 24, which may include a latch for latching a latched rewrite value to be written to the first protection bit. For example, when the first switch bit is enabled and turned on, the logic module 21 receives a first rewrite instruction through an external signal interface connected to an external electronic device, and verifies whether the first rewrite instruction is correct. If the first rewrite instruction is successfully verified, the data to be rewritten is received, and the latched rewrite value on the latch is rewritten through the row and column decoder 22. It should be noted that the latched rewrite value is the value to be written to the first protection bit, which will be lost after the memory is powered off or restarted.
[0043] The logic module 21 can be connected to an electronic device through an external signal interface, and the electronic device includes but is not limited to a smart phone, a tablet computer, a laptop computer, a desktop computer, a wearable device, an augmented reality device, a virtual reality device, etc. The present disclosure can input one or more of the first rewrite instruction, the data to be rewritten, and the second rewrite instruction through the electronic device. Exemplarily, an input device is connected to the electronic device, and the first rewrite instruction, the data to be rewritten, and the second rewrite instruction can be input through input devices such as a mouse and a keyboard, and the first rewrite instruction, the data to be rewritten, and the second rewrite instruction can also be input through other devices that communicate with the electronic device. For example, the first rewrite instruction is input to the electronic device through a computer that communicates with the electronic device. The communication method between the electronic device and the computer can adopt a wireless network or a wired network.
[0044] The wireless network or wired network described above uses standard communication technology and / or protocol. The network is usually the Internet, but it can also be any network, including but not limited to a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile, wired or wireless network, a dedicated network or any combination of a virtual private network). In some embodiments, the data exchanged through the network is represented by technologies and / or formats including Hyper Text Mark-up Language (HTML), Extensible Markup Language (XML), etc. In addition, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), Internet Protocol Security (IPsec) can also be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technologies can also be used to replace or supplement the above data communication technologies. It should be noted that the logic module 21 may be a controller or a logic circuit, but the present disclosure is not limited thereto, and any device that can implement the above functions may be used.
[0045] A protection bit rewriting method is provided in an embodiment of the present disclosure. The method can be executed by any electronic device with information protection capability. Exemplarily, the electronic device with information protection capability can be a memory.
[0046] Figure 3A protection bit rewriting method in an embodiment of the present disclosure is shown, the memory may include a main storage area and a first state register, the main storage area may include a function configuration storage area and at least one data storage area, the function configuration storage area may include a first switch bit, the first state register may include a first protection bit and a regional protection bit, the regional protection bit stores a value representing the corresponding data storage area, such as Figure 3 As shown, the protection bit rewriting method provided in the embodiment of the present disclosure may include the following S301 to S303.
[0047] S301: If the first switch bit is enabled and turned on, a first rewrite instruction is received.
[0048] In the disclosed embodiment, the first switch bit is used to indicate whether to receive the first rewrite instruction. For example, if the first switch bit is 1, the first rewrite instruction is received; if the first switch bit is 0, the first rewrite instruction is not received. The first switch bit is a configuration information storage bit set in the function configuration storage area. For example, in the main storage area, in addition to the main storage array (data storage area), a part of the area that cannot be rewritten by the software is also set. For example, the non-rewritable area is the function configuration storage area.
[0049] It should be noted that the function configuration storage area is used to store the function configuration information of the memory. For example, the function configuration information may be a trim bit, and the first switch bit may be one of the trim bits. The value of the first switch bit is burned in the factory.
[0050] S302: If the first rewrite instruction is successfully verified, the data to be rewritten is received.
[0051] In the embodiment of the present disclosure, the first rewrite instruction may include format information and operation information. If the first rewrite instruction is successfully verified, receiving the data to be rewritten may include: if the format information is successfully verified, executing the operation information and receiving the data to be rewritten.
[0052] The format information is used to identify the first rewrite instruction, that is, only the first rewrite instruction containing the format information can be a correct instruction, and the format information is used to verify whether the first rewrite instruction is successful. Exemplarily, the format information can cause the chip select pin of the memory to be pulled down to a low level twice. For example, the format information can be a binary code, and the format information can be 1010101001010101, and only the first rewrite instruction containing 10101010 01010101 can be successfully verified. The format information may include one or more forms of text, letters, numbers, symbols, etc. The specific form of the format information is not limited in the embodiment of the present disclosure, and can be set according to specific application scenarios and experience. The format information in the embodiment of the present disclosure can cause the chip select pin of the memory to be pulled down to a low level twice, so that the memory can recognize the format information.
[0053] The operation information can be used to enable the memory and instruct the memory to read the data to be rewritten. Exemplarily, the operation information may include enable information and write information, the enable information causes the chip select pin of the memory to be pulled down to a low level once, and the write information is used to indicate that the data to be rewritten is written to the memory. It should be noted that the chip select pin of the memory is pulled down to a low level, indicating an input state, indicating that the memory is in an enabled state. For example, the enable information of the operation information may be an enable instruction, and the write information of the operation information may be a write instruction. The write instruction is used to indicate the write information, the enable instruction is used to enable the memory, and the write instruction is used to indicate that the memory can read 2 bytes of data from the outside. Regarding the specific form of the operation information, the present disclosure is not limited, as long as the information that can realize the above functions is all right. For example, the enable instruction is 00000110, and the write instruction is 00000001.
[0054] The present disclosure does not limit how to verify the first rewrite instruction. Exemplarily, a first preset verification instruction is stored in the memory, and when the first rewrite instruction is consistent with the first preset verification instruction, the verification is successful. For example, assuming that the first preset verification instruction is 10101010 0101010100000110 00000001, when the first rewrite instruction is 1010101001010101 0000011000000001, the verification is successful. When the first rewrite instruction is inconsistent with the first preset verification instruction, the verification fails. It should be noted that the failure of the verification of the first rewrite instruction may include two situations, the first situation being that the first rewrite instruction is partially lost. For example, assuming that the first preset verification instruction is 10101010 0101010100000110 00000001, when the first rewrite instruction is 10101010 01010101, the verification fails. The second case is that the first rewrite instruction is an incorrect instruction. For example, assuming that the first preset verification instruction is 10101010 010101010000011000000001, when the first rewrite instruction is 10101011 01110101 00000110 00000001, the verification fails.
[0055] The first rewrite instruction of the embodiment of the present disclosure includes not only operation information but also format information. The security of the verification of the first rewrite instruction is improved by adding format information to the first rewrite instruction. It can effectively prevent hackers from invading the memory and stealing data stored in the memory. In other words, the embodiment of the present disclosure has stricter requirements on the form of the first rewrite instruction, which is not easy to crack.
[0056] S303, rewriting the first protection bit according to the data to be rewritten, wherein the first protection bit is used to indicate the protection state of the regional protection bit.
[0057] In an exemplary embodiment, rewriting the first protection bit according to the data to be rewritten may include: rewriting the value on the first protection bit to a first value according to the data to be rewritten, and the first value will not be lost after the memory is powered off or restarted.
[0058] For example, it is assumed that the value on the first protection bit is 1, the first protection bit is in a specific state, and the first numerical value is 0. Since the value of the first protection bit is 1, the regional protection bit cannot be modified, that is, the protection area corresponding to the regional protection bit cannot be changed. Through the embodiment of the present disclosure, the value 1 on the first protection bit can be rewritten to 0. Thus, the change of the protection area is achieved.
[0059] In another exemplary embodiment, rewriting the first protection bit according to the data to be rewritten may include: rewriting the value on the first protection bit to a second value according to the data to be rewritten, and the second value will not be lost after the memory is powered off or restarted.
[0060] For example, it is assumed that the value of the first protection bit is 0, and the first protection bit is in a normal state. The second value is 1. Through the embodiment of the present disclosure, the value 0 of the first protection bit can be rewritten to 1, thereby achieving protection or locking of the protection area.
[0061] It should be noted that the first protection bit is a protection bit on the first status register. Since the value of the first status register is stored in the memory cell array of the memory, the value on the first status register will not be lost after the memory is powered off or restarted. In other words, the rewritten value (the first value and the second value) on the first protection bit will not be lost after the memory is powered off or restarted.
[0062] There are two ways to rewrite the first protection bit. The first way is to rewrite only the latch rewrite value used to cache the first protection bit to be written. The latch rewrite value is stored in the cache bit of the latch. The second way is to rewrite the latch rewrite value and the first protection bit. When the second way is selected, the value of the first protection bit will not be lost after the memory is powered off or restarted.
[0063] The above two exemplary embodiments are the second rewriting mode, in which the first protection bit and the latched rewriting value are rewritten according to the data to be rewritten. After the rewriting, the value on the first protection bit will not be lost after the memory is powered off or restarted.
[0064] The disclosed embodiment can not only rewrite the first protection bit after the first protection bit enters a specific state, but can also be used to rewrite the first protection bit when the first protection bit is in a normal state. In other words, no matter what state the first protection bit is in, the disclosed embodiment can rewrite the first protection bit, and the value of the rewritten first protection bit will not be lost.
[0065] In the embodiment of the present disclosure, when the first switch bit is enabled and turned on, a first rewrite instruction is received and the first rewrite instruction is verified. If the verification is successful, the first protection bit is rewritten to achieve a change in the protection area.
[0066] The following describes the situation where the first switch position enables closing.
[0067] In an exemplary embodiment, the memory may further include a latch for latching a latched rewrite value to be written into the first protection bit, and the function configuration storage area may further include a second switch bit. The protection bit rewrite method may further include the following S401 and S402.
[0068] S401, if the first switch bit is enabled to be closed and the second switch bit is enabled to be opened, a second rewrite instruction is received, the second rewrite instruction includes operation information and data to be rewritten.
[0069] The second switch bit is used to indicate whether to receive the second rewrite instruction. In other words, the second switch bit determines whether to turn on the "SRP1 function". The SRP1 function is a function that controls whether the first protection bit is rewritten through the second switch bit and the second rewrite instruction. Exemplarily, if the second switch bit is 1, the second rewrite instruction is received; if the second switch bit is 0, the second rewrite instruction is not received. The second switch bit is also a configuration information storage bit set in the function configuration storage area. The value of the second switch bit is also burned in at the factory. The operation information and the data to be rewritten have been described in the above exemplary embodiments and will not be repeated here.
[0070] S402, executing the operation information, and rewriting the first protection bit and / or the latched rewrite value according to the data to be rewritten.
[0071] In one embodiment, the memory may further include a second state register, and the second state register may include a second protection bit. Rewriting the first protection bit and / or the latch rewrite value according to the data to be rewritten may include: when the second protection bit is a first preset value, rewriting the first protection bit and the latch rewrite value according to the data to be rewritten, rewriting the latch rewrite value to a first value, rewriting the value on the first protection bit to the first value, and the first value on the first protection bit will not be lost after the memory is powered off or restarted.
[0072] The specific details of the data to be rewritten have been explained in the above exemplary embodiments and will not be repeated here.
[0073] When the first switch bit is enabled and the second switch bit is enabled, the value of the second protection bit is used to determine whether to rewrite the first protection bit according to the data to be rewritten or to rewrite the latched rewrite value. Figure 1 As shown, the memory may further include a second status register (status register 2), and the second status register may include a second protection bit SRP0. Assuming that the first preset value is 1 and the second protection bit is 1, the first protection bit and the latch rewrite value can be rewritten according to the data to be rewritten. The first value on the first protection bit will not be lost after the memory is powered off or restarted. That is to say, when the second protection bit is the first preset value, the first protection bit is modified by the second first protection bit rewriting method in the above embodiment.
[0074] Under the premise that the first switch bit is enabled and turned off, the present disclosure can also cooperate with the second protection bit through the second switch bit, and rewrite the first protection bit according to the data to be rewritten, thereby realizing the change of the protection area.
[0075] In another embodiment, the memory may further include a second state register, and the second state register may include a second protection bit. Rewriting the first protection bit and / or the latch rewrite value according to the data to be rewritten may include: when the second protection bit is a second preset value, rewriting the latch rewrite value according to the data to be rewritten, and rewriting the latch rewrite value to a first value, which will be lost after the memory is powered off or restarted.
[0076] As for the specific data to be rewritten, it has been explained in the above exemplary embodiment and will not be repeated here. Assuming that the second preset value is 0, when the second protection bit is 0, the latch rewrite value can only be rewritten according to the data to be rewritten. The rewritten latch rewrite value (first value) will be lost after the memory is powered off or restarted. That is to say, when the second protection bit is the second preset value, the first protection bit is rewritten (the latch rewrite value is rewritten) by the first first protection bit rewriting method in the above embodiment. It should be noted that the latch rewrite value latched in the latch can be written into the first protection bit in some way. Exemplarily, the latch rewrite value after rewriting is written into the first protection bit after the latch rewrite value is rewritten and maintained for a period of time through the logic module control. For example, the logic module controls the latch rewrite value after rewriting to be written into the first protection bit after the latch rewrite value is rewritten and maintained for 5 minutes, but the present disclosure is not limited to this.
[0077] Under the premise that the first switch bit is enabled and closed, the present invention can also cooperate with the second protection bit through the second switch bit to rewrite the latched rewrite value according to the data to be rewritten, thereby preparing for writing the rewritten latched rewrite value into the first protection bit.
[0078] When the first switch bit is enabled and turned on, whether the second switch bit is enabled and turned on or off, it does not affect the working state of the first switch bit being enabled and turned on. In other words, whether the second switch bit is enabled and turned on or off, as long as the first switch bit is enabled and turned on, and the received first rewrite instruction is successfully verified, the data to be rewritten will be received to rewrite the first protection bit. It should be noted that, in general, if the first switch bit is enabled and turned on, the second switch bit is enabled and turned on by default. For example, when the value of the first switch bit is 1, the value of the second switch bit is 1 by default. The function enable table of the first switch bit, the second switch bit, and the second protection bit is shown in Table 1 below.
[0079] Table 1 Function Enable Table
[0080]
[0081] In Table 1, when the value of the first switch bit is 1, it indicates that the first switch bit is enabled and turned on; when the value of the first switch bit is 0, it indicates that the first switch bit is enabled and turned off; when the value of the second switch bit is 1, it indicates that the second switch bit is enabled and turned on; when the value of the second switch bit is 0, it indicates that the second switch bit is enabled and turned off. The second protection bit is X, which means that the second protection bit can be 1 or 0. The first rewrite instruction is in an illegal format, which is used to indicate that the format information included in the first rewrite instruction is wrong or missing. It should be noted that the operation information included in the first rewrite instruction cannot be wrong, otherwise the rewrite operation cannot be performed.
[0082] It can be seen from rows 1-2 in Table 1 that when the first switch bit is enabled, whether the second switch bit is enabled or disabled, it does not affect the normal operation of the first switch bit. In summary, when the first switch bit is enabled and the first rewrite instruction is correct, the latched rewrite value and the value on the first protection bit can be rewritten. When the first switch bit is enabled and the first rewrite instruction is in an illegal format, only the latched rewrite value can be rewritten. In other words, the operation information in the first rewrite instruction cannot be wrong. If the format information is wrong or there is no format information, only the latched rewrite value can be rewritten. It should be noted that when the first switch bit is enabled and the value on the second protection bit is invalid, that is, the value on the second protection bit does not work. When the first switch bit is enabled and enabled, the second switch bit is set to enable and open by default.
[0083] In Table 1, when the value of the second protection bit is 1, it means that the second protection bit is the first preset value; when the value of the second protection bit is 0, it means that the second protection bit is the second preset value. It can be seen from rows 3-6 in Table 1 that when the first switch bit enable is turned off, the second switch bit enable is turned on, and the second protection bit is the first preset value, the latched rewrite value and the value on the first protection bit can be rewritten. When the first switch bit enable is turned off, the second switch bit enable is turned on, and the second protection bit is the second preset value, only the latched rewrite value can be rewritten. When the first switch bit enable is turned off and the second switch bit enable is turned off, no matter the value on the second protection bit is the first preset value or the second preset value, the latched rewrite value and the value on the first protection bit cannot be rewritten.
[0084] In the embodiment of the present disclosure, when the first switch bit is enabled and turned off, the rewriting of the first protection bit is controlled by the second switch bit and the second protection bit, thereby providing more rewriting methods for the first protection bit.
[0085] The following describes the situation where the first switch enables the format information verification to fail.
[0086] In an exemplary embodiment, the memory may further include a latch for latching a latched rewrite value to be written into the first protection bit. Figure 5As shown, the protection bit rewriting method may further include the following S501 to S503.
[0087] S501, if the first switch bit is enabled and turned on, a first rewrite instruction is received, where the first rewrite instruction includes format information and operation information.
[0088] The content of S501 in the embodiment of the present disclosure has been described in S301 and will not be repeated here.
[0089] S502: If the format information verification fails, the operation information is executed and the data to be rewritten is received.
[0090] The specific format information has been described in S302 and will not be repeated here. The memory stores the preset format information. When the first rewrite instruction does not contain the same format information as the preset format information, verification fails. For example, the preset format information is 1010101001010101, and only the first rewrite instruction containing 10101010 01010101 can be successfully verified.
[0091] S503, rewriting the latched rewrite value according to the data to be rewritten, and rewriting the latched rewrite value to a first value, which will be lost after the memory is powered off or restarted.
[0092] In the embodiment of the present disclosure, when the first switch bit is enabled, even if the format information verification fails, the latched rewrite value will be rewritten. The embodiment of the present disclosure is described below through the function enable table in Table 2.
[0093] Table 2 Function Enable Table
[0094]
[0095] In Table 2, when the value of the first switch bit is 1, it means that the first switch bit is enabled to be turned on; when the value of the first switch bit is 0, it means that the first switch bit is enabled to be turned off; when the value of the second switch bit is 1, it means that the second switch bit is enabled to be turned on; when the value of the second switch bit is 0, it means that the second switch bit is enabled to be turned off. When the value of the second protection bit is 1, it means that the second protection bit is the first preset value; when the value of the second protection bit is 0, it means that the second protection bit is the second preset value.
[0096] It can be seen from Table 2 that when the first switch bit is enabled and turned on, and the first rewrite instruction is in an illegal format (format information verification fails, but the operation information is correct), no matter whether the second switch bit is enabled or turned on, and whether the second rewrite instruction is correct, the latched rewrite value can be rewritten, but the first protection bit cannot be rewritten. It should be noted that if the latched rewrite value can be rewritten, the operation information must be correct.
[0097] In the embodiment of the present disclosure, when the first switch bit is enabled, even if the format information verification fails, the latch rewrite value is rewritten. The latch rewrite value is rewritten according to the data to be rewritten, so as to prepare for writing the rewritten latch rewrite value into the first protection bit.
[0098] The following describes how the memory receives the first rewrite instruction, the second rewrite instruction, and the data to be rewritten.
[0099] In an exemplary embodiment, the memory is coupled to an input device for transmitting a first rewrite instruction and / or a second rewrite instruction. The input device can increase the pressure that the memory can withstand, and is convenient for transmitting the first rewrite instruction and the second rewrite instruction. The present disclosure does not limit what the input device is specifically, as long as it is a device that can achieve the above functions. For example, the input device can be a metal block (Passivation opening, PAD), and the PAD is inside the memory. The signal line inside the memory needs to be led to the outside for packaging, but because the width of the signal line is too thin and cannot withstand the pressure of welding, it needs to be connected to the PAD first, with the PAD as a support. The PAD can not only withstand the pressure of welding, but also transmit the first rewrite instruction and the second rewrite instruction. Thereby, it is convenient to rewrite the latched rewrite value and / or the value on the first protection bit.
[0100] In another exemplary embodiment, the number of external pins of the memory used to transmit one or more of the first rewrite instruction, the second rewrite instruction, and the data to be rewritten is 1 or an even number. Exemplarily, the number of external pins of the memory used to transmit the first rewrite instruction, the second rewrite instruction, and the data to be rewritten is 2 or 4.
[0101] Based on the same inventive concept, the present disclosure also provides a protection bit rewriting device, as described in the following embodiments. Since the principle of solving the problem in the device embodiment is similar to that in the above method embodiment, the implementation of the device embodiment can refer to the implementation of the above method embodiment, and the repeated parts will not be repeated.
[0102] Figure 6 A schematic diagram of a protection bit rewriting device in an embodiment of the present disclosure is shown, wherein the memory includes a main storage area and a first state register, the main storage area includes a function configuration storage area and at least one data storage area, the function configuration storage area includes a first switch bit, the first state register includes a first protection bit and a regional protection bit, and the regional protection bit stores a value representing the corresponding data storage area, such as Figure 6As shown, the device may include a receiving module 61 and a rewriting module 62. The receiving module 61 may be used to receive a first rewriting instruction if the first switch bit is enabled and turned on; the receiving module 61 may also be used to receive data to be rewritten if the first rewriting instruction is successfully verified; the rewriting module 62 may be used to rewrite the first protection bit according to the data to be rewritten, wherein the first protection bit is used to indicate the protection state of the regional protection bit.
[0103] In one embodiment, the first rewrite instruction includes format information and operation information; the receiving module 61 can also be used to execute the operation information and receive the data to be rewritten if the format information verification is successful.
[0104] In one embodiment, the rewriting module 62 can also be used to rewrite the value on the first protection bit into a first value according to the data to be rewritten, and the first value will not be lost after the memory is powered off or restarted.
[0105] In one embodiment, the memory also includes a latch, which is used to latch the latched rewrite value to be written to the first protection bit, and the functional configuration storage area also includes a second switch bit; the receiving module 61 can also be used to receive a second rewrite instruction if the first switch bit is enabled and turned off, and the second switch bit is enabled and turned on, and the second rewrite instruction includes operation information and data to be rewritten; the rewrite module 62 can also be used to execute the operation information and rewrite the first protection bit and / or the latched rewrite value according to the data to be rewritten.
[0106] In one embodiment, the memory also includes a second status register, which includes a second protection bit; the rewrite module 62 can also be used to rewrite the first protection bit and the latched rewrite value according to the data to be rewritten when the second protection bit is a first preset value, rewrite the latched rewrite value to a first value, and rewrite the value on the first protection bit to the first value. The first value on the first protection bit will not be lost after the memory is powered off or restarted.
[0107] In one embodiment, the memory also includes a second status register, which includes a second protection bit; the rewrite module 62 can also be used to rewrite the latched rewrite value according to the data to be rewritten when the second protection bit is a second preset value, and rewrite the latched rewrite value to a first value, which will be lost after the memory is powered off or restarted.
[0108] In one embodiment, the memory also includes a latch, which is used to latch the latched rewrite value to be written to the first protection bit; the receiving module 61 can also be used to receive a first rewrite instruction if the first switch bit is enabled and turned on, and the first rewrite instruction includes format information and operation information; if the format information verification fails, the operation information is executed and the data to be rewritten is received; the rewrite module 62 can also be used to rewrite the latched rewrite value according to the data to be rewritten, and rewrite the latched rewrite value to a first value, which will be lost after the memory is powered off or restarted.
[0109] In one embodiment, the memory is coupled to an input device for transmitting the first rewrite instruction or the second rewrite instruction.
[0110] In one embodiment, the format information causes the chip select pin of the memory to be pulled down to a low level twice; the operation information includes enable information and write information, the enable information causes the chip select pin of the memory to be pulled down to a low level once, and the write information is used to indicate that the data to be rewritten is written into the memory.
[0111] In one embodiment, the number of external pins of the memory used to transmit one or more of the first rewrite instruction, the second rewrite instruction, and the data to be rewritten is 1 or an even number.
[0112] The protection bit rewriting device of the embodiment of the present disclosure can not only rewrite the first protection bit after the first protection bit enters a specific state, but can also be used to rewrite the first protection bit when the first protection bit is in a normal state. In other words, no matter what state the first protection bit is in, the protection bit rewriting device of the embodiment of the present disclosure can rewrite the first protection bit, and the value of the rewritten first protection bit will not be lost. When the first switch bit is enabled and turned on, the protection bit rewriting device of the embodiment of the present disclosure receives the first rewrite instruction and verifies the first rewrite instruction. If the verification is successful, the first protection bit is rewritten, thereby realizing the change of the protection area.
[0113] See also Figure 7 , Figure 7 Schematic diagram of a computer device provided by an embodiment of the present disclosure. Figure 7 As shown, the computer device in the embodiment of the present disclosure may include: one or more processors 701, a memory 702, and an input-output interface 703. The processor 701, the memory 702, and the input-output interface 703 are connected via a bus 704. The memory 702 is used to store a computer program, which includes program instructions. The input-output interface 703 is used to receive data and output data, such as for data interaction between a host machine and a computer device, or for data interaction between various virtual machines in a host machine; the processor 701 is used to execute the program instructions stored in the memory 702.
[0114] Among them, the processor 701 can perform the following operations: if the first switch bit is enabled and turned on, receive the first rewrite instruction; if the first rewrite instruction is verified successfully, receive the data to be rewritten; rewrite the first protection bit according to the data to be rewritten, wherein the first protection bit is used to indicate the protection status of the regional protection bit.
[0115] The memory 702 may include a read-only memory and a random access memory, and provide instructions and data to the processor 701 and the input / output interface 703. A portion of the memory 702 may also include a non-volatile random access memory. In a specific implementation, the computer device may execute the implementation methods provided by the various steps in any of the above method embodiments through its built-in functional modules, and the implementation methods provided by the various steps in the figure shown in the above method embodiments may be referred to, and will not be repeated here.
[0116] The embodiments of the present disclosure provide a computer device, including a processor, an input / output interface, and a memory. The processor obtains a computer program in the memory to execute each step of the method shown in any of the above embodiments.
[0117] The present disclosure also provides a computer-readable storage medium storing a computer program. Figure 8 A schematic diagram of a computer-readable storage medium in an embodiment of the present disclosure is shown. Figure 8 As shown, a program product capable of implementing the above method of the present disclosure is stored on the computer-readable storage medium 800. The computer program is suitable for being loaded by the processor and executing the protection bit rewriting method provided in each step of any of the above embodiments.
[0118] The present disclosure also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the method provided in any of the above-mentioned optional modes.
[0119] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are to be considered exemplary only, and the true scope and concept of the present disclosure are indicated by the claims.
Claims
1. A protection bit rewriting method, characterized in that: The memory includes a main storage area and a first status register, the main storage area includes a function configuration storage area and at least one data storage area, the function configuration storage area includes a first switch bit, the first status register includes a first protection bit and a region protection bit, the region protection bit stores a value indicating a protection state corresponding to the data storage area, and the method includes: If the first switch bit is enabled and turned on, receiving a first rewrite instruction; If the first rewrite instruction is successfully verified, receiving the data to be rewritten; The first protection bit is rewritten according to the data to be rewritten, wherein the first protection bit is used to indicate a protection state of the regional protection bit.
2. The method according to claim 1, characterized in that The first rewrite instruction includes format information and operation information; If the first rewrite instruction is successfully verified, receiving the data to be rewritten includes: If the format information verification is successful, the operation information is executed and the data to be rewritten is received.
3. The method according to claim 1, characterized in that The rewriting of the first protection bit according to the data to be rewritten includes: The value on the first protection bit is rewritten to a first value according to the data to be rewritten, and the first value will not be lost after the memory is powered off or restarted.
4. The method according to claim 2, characterized in that The memory further includes a latch, the latch being used to latch a latch rewrite value to be written into the first protection bit, and the function configuration storage area further includes a second switch bit; The method further comprises: If the first switch bit is enabled to be closed and the second switch bit is enabled to be opened, receiving a second rewrite instruction, wherein the second rewrite instruction includes the operation information and the data to be rewritten; The operation information is executed, and the first protection bit and / or the latched rewrite value are rewritten according to the data to be rewritten.
5. The method according to claim 4, characterized in that The memory further includes a second status register, the second status register including a second protection bit; Wherein, rewriting the first protection bit and / or the latched rewrite value according to the data to be rewritten includes: When the second protection bit is a first preset value, the first protection bit and the latched rewrite value are rewritten according to the data to be rewritten, the latched rewrite value is rewritten to a first value, and the value on the first protection bit is rewritten to the first value. The first value on the first protection bit will not be lost after the memory is powered off or restarted.
6. The method according to claim 4, characterized in that The memory further includes a second status register, the second status register including a second protection bit; Wherein, rewriting the first protection bit and / or the latched rewrite value according to the data to be rewritten includes: When the second protection bit is a second preset value, the latched rewrite value is rewritten according to the data to be rewritten, and the latched rewrite value is rewritten to a first value, which will be lost after the memory is powered off or restarted.
7. The method according to claim 1, characterized in that The memory further comprises a latch, wherein the latch is used to latch a latched rewrite value to be written into the first protection bit; The method further comprises: If the first switch bit is enabled and turned on, a first rewrite instruction is received, wherein the first rewrite instruction includes format information and operation information; If the format information verification fails, executing the operation information and receiving the data to be rewritten; The latched rewrite value is rewritten according to the data to be rewritten, and the latched rewrite value is rewritten to a first value, which will be lost after the memory is powered off or restarted.
8. The method according to any one of claims 1 to 7, characterized in that The memory is coupled to an input device for transmitting a first rewrite instruction and / or a second rewrite instruction.
9. The method according to claim 2 or 7, characterized in that: The format information causes the chip select pin of the memory to be pulled down to a low level twice; The operation information includes enable information and write information. The enable information causes the chip select pin of the memory to be pulled down to a low level once, and the write information is used to indicate that the data to be rewritten is written into the memory.
10. The method according to claim 8, characterized in that The number of external pins of the memory used to transmit one or more of the first rewrite instruction, the second rewrite instruction and the data to be rewritten is 1 or an even number.
11. A protection bit rewriting device, characterized in that: The memory includes a main storage area and a first status register, the main storage area includes a function configuration storage area and at least one data storage area, the function configuration storage area includes a first switch bit, the first status register includes a first protection bit and a region protection bit, the region protection bit stores a value indicating a protection state corresponding to the data storage area, and the device includes: A receiving module, configured to receive a first rewrite instruction if the first switch bit is enabled and turned on; The receiving module is further configured to receive the data to be rewritten if the first rewrite instruction is successfully verified; A rewriting module is used to rewrite the first protection bit according to the data to be rewritten, wherein the first protection bit is used to indicate the protection state of the regional protection bit.
12. A computer device, characterized in that: include: one or more processors; The memory is configured to store one or more programs, and when the one or more programs are executed by the one or more processors, the computer device implements the method according to any one of claims 1 to 10.
13. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed on a computer, the computer is caused to execute the method according to any one of claims 1 to 10.
