CN107832086B - Computer device, program writing method, and program reading method - Google Patents

Computer device, program writing method, and program reading method Download PDF

Info

Publication number
CN107832086B
CN107832086B CN201610826611.0A CN201610826611A CN107832086B CN 107832086 B CN107832086 B CN 107832086B CN 201610826611 A CN201610826611 A CN 201610826611A CN 107832086 B CN107832086 B CN 107832086B
Authority
CN
China
Prior art keywords
converted
pld
program
bios
bios program
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610826611.0A
Other languages
Chinese (zh)
Other versions
CN107832086A (en
Inventor
程志军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Yudeshui Electric Technology Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201610826611.0A priority Critical patent/CN107832086B/en
Publication of CN107832086A publication Critical patent/CN107832086A/en
Application granted granted Critical
Publication of CN107832086B publication Critical patent/CN107832086B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4403Processor initialisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4406Loading of operating system

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The application discloses computer equipment, a program writing method and a program reading method, and belongs to the technical field of computers. The computer device includes: the CPU is connected with the BIOS chip through the PLD, and the storage chip is connected with the PLD; the PLD is used for receiving the BIOS program sent by the CPU; reading a character string stored in a storage chip; the BIOS program is converted according to the character string to obtain the converted BIOS program, and the converted BIOS program is stored in the BIOS chip, wherein the converted BIOS program is different from the BIOS program before conversion, so that the problem that the original BIOS program is stored in the BIOS chip and the safety of the original BIOS program is low is solved, and the effect of improving the safety of the BIOS program in the BIOS chip is achieved.

Description

Computer device, program writing method, and program reading method
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a computer device, a program writing method, and a program reading method.
Background
A computer device typically includes components such as a Central Processing Unit (CPU), an internal memory, an external memory, and a network interface. The various components are mounted on specific locations on the motherboard and communicate with each other via a bus. The main board is usually a rectangular circuit board, and main circuit systems constituting the computer device, such as a Basic Input Output System (BIOS) chip, an I/O (Input/Output) control chip, an indicator light plug, an expansion slot, and a dc power supply plug, are mounted on the main board. The BIOS chip has a characteristic that data stored after power failure is not lost, and may be a Read-Only Memory (ROM) chip or a Flash Memory (Flash) chip. The BIOS chip stores BIOS program. The BIOS program is also called a boot loader (bootloader), and specifically includes a program for configuring a basic input output system of a computer device, a hardware self-test program after booting, and an operating system self-boot program. The BIOS program can read the most basic boot information of a computer device from a Complementary Metal-Oxide-Semiconductor (CMOS). The primary function of the BIOS program is to provide the lowest level, most direct hardware setup and control for the computer device.
Under the existing mainstream computer system architecture, after the computer equipment is powered on, the CPU first reads the BIOS program from the BIOS chip to complete the hardware initialization process of the computer equipment. Since a computer device does not have computing power, e.g., cannot decrypt data, until the operating system initialization is complete, the BIOS program is typically stored unencrypted in the BIOS chip to enable successful initialization.
Because the existing BIOS program is not stored in the BIOS chip in an encrypted way, a machine for taking the BIOS program is provided for illegal users. For example, a hacker may take off a Flash chip storing the BIOS program by physical means, read the content therein by a Flash programmer, perform inverse analysis on the obtained content to obtain a functional module of the BIOS program, and then implant a backdoor program in a suitable place. A hacker can acquire data in the computer device in the initialization process of the computer device through the implanted backdoor program and send the acquired data to a receiver set by the backdoor program in advance, so that the data in the computer device is stolen. More seriously, compared with the general backdoor program embedded in the application program, the backdoor program embedded in the BIOS program is long-term effective due to the characteristic that the data in the BIOS chip is not lost after being powered down. Therefore, the existing storage mode of the BIOS program has potential safety hazard.
Disclosure of Invention
In order to solve the problem that the security of a BIOS program stored in a BIOS chip is not high, embodiments of the present application provide a computer device, a program writing method, and a program reading method.
In a first aspect, a program writing method is provided, and the method includes: a Programmable Logic Device (PLD) in the computer Device receives a BIOS program sent by a Central Processing Unit (CPU) in the computer Device, the BIOS program being for execution by the CPU to complete initialization of the computer Device; then, the PLD reads the character string stored in the storage chip connected with the PLD; then, the PLD converts the BIOS program according to the character string to obtain a converted BIOS program, and stores the converted BIOS program into a BIOS chip in the computer device, wherein the converted BIOS program is different from the BIOS program before conversion.
The method comprises the steps of converting a BIOS program according to a character string stored in a storage chip through a PLD (programmable logic device), storing the converted BIOS program into a BIOS chip after the converted BIOS program is obtained, and enabling the BIOS program stored in the BIOS chip to be the converted BIOS program.
Optionally, the PLD stores the converted BIOS program into a BIOS chip, including: the PLD acquires an expected storage address of a BIOS program sent by the CPU in a BIOS chip; the PLD stores the translated BIOS program to the desired storage address.
Optionally, the PLD stores the converted BIOS program into a BIOS chip, including: the PLD acquires an expected storage address of a BIOS program sent by the CPU in the BIOS chip; (ii) a The PLD converts the expected storage address according to the character string to obtain a converted storage address; the PLD stores the translated BIOS program to a translated memory address, wherein the translated memory address is different from the expected memory address.
The expected storage address of the BIOS program is converted by the PLD according to the character string in the storage chip, and the converted BIOS program is stored to the converted storage address after the converted storage address is obtained, so that each converted BIOS program is stored in the BIOS chip in a hash mode, the difficulty of restoring the BIOS program after an illegal user obtains the BIOS chip is improved, and the safety of the BIOS program in the BIOS chip is improved.
Optionally, the PLD converts the expected storage address according to the character string to obtain a converted storage address, including: acquiring bit width and storage capacity of a BIOS chip; determining the conversion bit number i of the expected storage address according to the bit width and the storage capacity; and converting the last i bit in the expected storage address according to the character string to obtain a converted storage address. Wherein i is a positive integer.
By determining the number i of conversion bits of the expected storage address and converting the last i bits in the expected storage address, compared with the method for converting all the bits of the expected storage address, the method reduces the processing resources consumed by the PLD in converting the expected storage address and improves the efficiency of the PLD in converting the expected storage address.
Optionally, the PLD may convert the BIOS program according to the character string to obtain a converted BIOS program, including: the PLD takes the character string as a first index, takes the data included in the BIOS program as a second index, and inquires the converted BIOS program in a program mapping table; the program mapping table is a two-dimensional index table and stores converted BIOS programs corresponding to the character strings and the data included by the BIOS programs.
Optionally, the PLD queries the converted BIOS program in the program mapping table by using the character string as the first index and using the data included in the BIOS program as the second index, and includes: the PLD divides the BIOS program into at least two sections of subprograms; acquiring a sub-character string corresponding to each sub-program from the character string; for each section of subprogram, the subprogram corresponding to the subprogram is taken as a first index, data included in the subprogram is taken as a second index, and the converted subprogram is inquired in a program mapping table; and determining the converted BIOS program according to each converted subprogram.
The method comprises the steps that a BIOS program is divided into at least two sections of subprograms, a PLD searches each converted subprogram in a program mapping table according to each section of subprogram and a substring corresponding to each section of subprogram, and the converted BIOS program is determined according to each converted subprogram. At this time, because the same BIOS program is converted for a plurality of times, the difficulty of restoring each BIOS program by an illegal user is improved.
Optionally, the PLD converts the expected storage address according to the character string, including: the PLD takes the character string as a first index, takes data included by the expected storage address as a second index, and inquires the converted storage address in an address mapping table; the address mapping table is a two-dimensional index table and stores converted storage addresses corresponding to data included in the character strings and the expected storage addresses.
Optionally, the PLD queries the converted storage address in the data mapping table by using the character string as a first index and using the data included in the expected storage address as a second index, and includes: the PLD divides the storage address into at least two segments of sub-addresses; acquiring a sub-character string corresponding to each sub-address from the character string; for each segment of sub-address, a sub-character string corresponding to the sub-address is used as a first index, data included in the sub-address is used as a second index, and the converted sub-address is inquired in an address mapping table; and determining the converted storage address according to each converted sub-address.
The expected storage address of the BIOS program is divided into at least two segments of sub-addresses, the PLD searches each segment of converted sub-address in an address mapping table according to each segment of sub-address and the sub-character string corresponding to each segment of sub-address, and determines the converted storage address according to each segment of converted sub-address. Therefore, the difficulty of restoring the expected storage address of each BIOS program by an illegal user is improved.
Optionally, the PLD may convert the BIOS program according to the character string to obtain a converted BIOS program, including: the PLD acquires a sub-character string from the character string, wherein the length of the sub-character string is greater than zero and less than or equal to the length of the character string; the PLD carries out first logic operation on the sub-character strings to obtain converted sub-character strings; performing a second logic operation on the BIOS program by using the converted substring to obtain a converted BIOS program; or, the PLD performs a third logic operation on the BIOS program, and performs a fourth logic operation on the BIOS program subjected to the third logic operation by using the substring to obtain a converted BIOS program; or, the PLD performs a fifth logic operation on the sub-character strings to obtain converted sub-character strings; performing a sixth logical operation on the BIOS program, and performing a seventh logical operation on the BIOS program subjected to the sixth logical operation by using the converted substring to obtain a converted BIOS program; or, the PLD performs an eighth logical operation on the BIOS program by using the substring to obtain the converted BIOS program.
Through carrying out logic operation on the character string and the BIOS program, another implementation mode is provided for the PLD to convert the BIOS program.
Optionally, the PLD converts the expected storage address according to the character string, including: the PLD acquires a sub-character string from the character string, wherein the length of the sub-character string is greater than zero and less than or equal to the length of the character string; the PLD carries out first logic operation on the sub-character strings to obtain converted sub-character strings; performing a second logic operation on the expected storage address by using the converted substring to obtain a converted storage address; or, the PLD performs a third logic operation on the expected storage address, and performs a fourth logic operation on the expected storage address subjected to the third logic operation by using the substring to obtain a converted storage address; or, the PLD performs a fifth logic operation on the sub-character strings to obtain converted sub-character strings; performing a sixth logical operation on the expected memory address, and performing a seventh logical operation on the expected memory address subjected to the sixth logical operation by using the converted substring to obtain a converted memory address; or, the PLD performs an eighth logical operation on the expected storage address by using the substring to obtain the converted storage address.
Another implementation is provided for the PLD to translate the expected memory address by logically operating the string with the expected memory address of the BIOS program.
In a second aspect, there is provided a program writing method, including: the method comprises the following steps that a PLD in the computer equipment receives a BIOS program sent by a CPU in the computer equipment and an expected storage address of the BIOS program in a BIOS chip, and the BIOS program is used for being executed by the CPU to complete initialization of the computer equipment; reading a character string stored in a storage chip connected with the PLD by the PLD; the PLD converts the expected storage address according to the character string to obtain a converted storage address, wherein the converted storage address is different from the expected storage address; the PLD stores the BIOS program to the converted storage address.
The expected storage address of the BIOS program is only converted through the PLD, so that the BIOS program is stored in the BIOS chip in a hash mode, the safety of the BIOS program in the BIOS chip is improved, and resources consumed when the PLD converts the BIOS program and the expected storage address at the same time are saved.
In a third aspect, a program reading method is provided, including: the method comprises the steps that a PLD in the computer equipment receives a program reading instruction sent by a CPU in the computer equipment, the program reading instruction is used for reading an original BIOS program from a BIOS chip in the computer equipment, and the original BIOS program is used for being executed by the CPU to complete initialization of the computer equipment; then, reading the character string stored in the storage chip connected with the PLD by the PLD; the PLD reads the converted BIOS program from the BIOS chip, restores the converted BIOS program according to the character string to obtain a restored BIOS program, and sends the restored BIOS program to the CPU. The converted BIOS program is obtained by the PLD converting the original BIOS program according to the character string and storing the converted BIOS program in a BIOS chip; the converted BIOS program is different from the original BIOS program.
When receiving a program reading instruction sent by the CPU, the PLD reads a character string in the storage chip and a converted BIOS program in the BIOS chip, restores the converted BIOS program according to the character string, and sends the restored BIOS program to the CPU after obtaining the restored BIOS program, so that the CPU can run the BIOS program to complete the initialization of the computer equipment.
Optionally, the PLD reading the converted BIOS program from the BIOS chip includes: the PLD acquires an expected storage address carried by a program reading instruction; the PLD reads the translated BIOS program stored in the desired memory address.
Optionally, the PLD reading the converted BIOS program from the BIOS chip includes: the PLD acquires an expected storage address carried by a program reading instruction; the PLD converts the expected storage address according to the character string to obtain a converted storage address, wherein the converted storage address is different from the expected storage address; the PLD reads the translated BIOS program stored in the translated memory address.
Because the PLD may convert the expected storage address of the BIOS program when writing the BIOS program, in order to accurately restore the BIOS program requested to be read by the CPU, the PLD needs to convert the expected storage address carried by the program storage instruction when receiving the program storage instruction sent by the CPU to read the BIOS program requested to be read by the CPU, thereby ensuring the accuracy of restoring the BIOS program.
Optionally, the PLD converts the expected storage address according to the character string to obtain a converted storage address, including: the PLD acquires the bit width and the storage capacity of the BIOS chip; determining the conversion bit number i of the expected storage address according to the bit width and the storage capacity; and converting the last i bit in the expected storage address according to the character string to obtain a converted storage address. Wherein i is a positive integer.
Optionally, the PLD may restore the converted BIOS program according to the character string to obtain a restored BIOS program, including: the PLD takes the character string as a first index, takes the data included in the converted BIOS program as a second index, and inquires the restored BIOS program in a program mapping table; the program mapping table is a two-dimensional index table and stores the character strings and the converted BIOS program corresponding to the data included in the restored BIOS program.
Optionally, the PLD queries the restored BIOS program in the program mapping table by using the character string as the first index and using the data included in the converted BIOS program as the second index, including: the PLD divides the converted BIOS program into at least two converted subprograms according to a preset dividing mode, wherein the preset dividing mode is the same as the dividing mode of the PLD dividing the BIOS program into at least two subprograms when writing the BIOS program into the BIOS chip; the PLD acquires a sub-character string corresponding to each converted subprogram from the character string; for each converted subprogram, the PLD takes the substring corresponding to the converted subprogram as a first index, takes the data included in the converted subprogram as a second index, and queries the restored subprogram in a program mapping table; and the PLD determines the restored BIOS program according to each restored subprogram.
Optionally, the PLD converts the expected storage address according to the character string, including: the PLD takes the character string as a first index, takes data included by the expected storage address as a second index, and inquires the converted storage address in an address mapping table; the address mapping table is a two-dimensional index table and stores converted storage addresses corresponding to data included in the character strings and the expected storage addresses.
Optionally, the PLD queries the converted storage address in the data mapping table by using the character string as a first index and using data included in the expected storage address as a second index, including: the method comprises the steps that a PLD divides an expected storage address into at least two segments of sub-addresses according to a preset division mode, wherein the preset division mode is the same as the division mode of the PLD dividing the expected storage address into at least two segments of sub-addresses when writing a BIOS program into a BIOS chip; acquiring a sub-character string corresponding to each sub-address from the character string; for each segment of sub-address, the PLD takes the sub-character string corresponding to the sub-address as a first index and the data included in the sub-address as a second index, and inquires the converted sub-address in an address mapping table; the PLD determines the translated storage address according to each segment of the translated sub-address.
Optionally, restoring the converted BIOS program according to the character string to obtain a restored BIOS program, including: acquiring a sub-character string from the character string, wherein the length of the sub-character string is greater than zero and less than or equal to the length of the character string; performing a first logic operation on the substring to obtain a converted substring; performing second logic operation on the converted BIOS program by using the converted substring to obtain a restored BIOS program; or performing third logic operation on the converted BIOS program, and performing fourth logic operation on the converted BIOS program subjected to the third logic operation by using the substring to obtain a reduced BIOS program; or, carrying out fifth logic operation on the sub character string to obtain the converted sub character string; performing a sixth logic operation on the converted BIOS program, and performing a seventh logic operation on the converted BIOS program subjected to the sixth logic operation by using the converted substring to obtain a restored BIOS program; or, performing an eighth logic operation on the converted BIOS program by using the substring to obtain the restored BIOS program. Optionally, converting the expected memory address according to the character string includes: acquiring a sub-character string from the character string, wherein the length of the sub-character string is greater than zero and less than or equal to the length of the character string; performing a first logic operation on the substring to obtain a converted substring; performing a second logic operation on the expected storage address by using the converted substring to obtain a converted storage address; or performing third logic operation on the expected memory address, and performing fourth logic operation on the expected memory address subjected to the third logic operation by using the substring to obtain a converted memory address; or, carrying out fifth logic operation on the sub character string to obtain the converted sub character string; performing a sixth logical operation on the expected memory address, and performing a seventh logical operation on the expected memory address subjected to the sixth logical operation by using the converted substring to obtain a converted memory address; or, performing an eighth logic operation on the expected memory address by using the substring to obtain the converted memory address.
In a fourth aspect, there is provided a program reading method including: the method comprises the steps that a PLD in the computer equipment receives a program reading instruction sent by a CPU in the computer equipment and obtains an expected storage address carried by the program reading instruction, the program reading instruction is used for reading a BIOS program from a BIOS chip, and the BIOS program is used for being executed by the CPU to complete initialization of the computer equipment; then, the PLD reads the character string stored in the storage chip connected with the PLD; the PLD converts the expected storage address according to the character string to obtain a converted storage address, reads the BIOS program from the converted storage address, and sends the BIOS program to the CPU, wherein the converted storage address is different from the expected storage address.
When receiving a program reading instruction sent by a CPU, the PLD reads a character string from a storage chip, converts an expected storage address carried by the reading instruction according to the character string, and reads a BIOS program from the converted storage address in the BIOS chip, so that the PLD can accurately read the BIOS program requested to be read by the CPU in the BIOS chip, and the BIOS program can be operated to complete the initialization of the computer equipment.
In a fifth aspect, a program writing apparatus is provided, where the apparatus includes at least one unit configured to implement the program writing method provided in the first aspect or the second aspect.
In a sixth aspect, there is provided a program reading apparatus comprising at least one unit for implementing the program reading method provided in the third or fourth aspect.
In a seventh aspect, a computer device is provided, the computer device comprising: the CPU is connected with the BIOS chip through the PLD, and the storage chip is connected with the PLD;
the PLD is configured to be controlled by a CPU and is used to implement the program writing method provided in the above-described first aspect or second aspect, and the program reading method provided in the third aspect or fourth aspect.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1A is a block diagram of an apparatus provided in one embodiment of the present application;
FIG. 1B is a diagram illustrating a program writing method according to an embodiment of the present application;
FIG. 1C is a diagram illustrating a program read method according to an embodiment of the present application;
fig. 2 is a flowchart of a first program reading and writing method according to an embodiment of the present application;
FIG. 3 is a schematic view of a sliding window provided by an embodiment of the present application;
FIG. 4 is a schematic diagram of a first transformation provided by an embodiment of the present application;
FIG. 5 is a schematic diagram of a second transformation provided by an embodiment of the present application;
FIG. 6 is a schematic diagram of a third transformation provided by an embodiment of the present application;
FIG. 7 is a schematic diagram of a fourth transformation provided by an embodiment of the present application;
FIG. 8 is a schematic diagram of a fifth transformation provided by an embodiment of the present application;
FIG. 9 is a flowchart illustrating a second method for reading and writing a program according to an embodiment of the present application;
FIG. 10 is a flowchart illustrating a third method for reading and writing programs according to an embodiment of the present application;
FIG. 11 is a block diagram of a program writing apparatus provided in one embodiment of the present application;
fig. 12 is a block diagram of a program reading apparatus according to an embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
Reference herein to "a unit" is to a logically partitioned functional structure, and the "unit" may be implemented by pure hardware or a combination of hardware and software.
Referring to fig. 1A, a schematic structural diagram of a computer device 100 according to an exemplary embodiment of the present application is shown. The computer Device 100 may be a Mobile phone (cellphone), a smart phone (smartphone), a computer (computer), a tablet computer (tablet computer), a wearable Device (wearable Device), a Personal Digital Assistant (PDA), a Mobile Internet Device (MID) and an electronic book reader (e-book reader), a server, and the like.
The computer device 100 includes: the CPU120, the BIOS chip 140, the memory chip 160 and the PLD180, wherein the CPU120 is connected with the BIOS chip 140 through the PLD180, and the memory chip 160 is connected with the PLD 180.
The CPU120 is a control center of the computer apparatus 100, and writes a BIOS program to the BIOS chip 140 through the PLD 180. After the computer device 100 is powered on, the CPU120 is further configured to send a program reading instruction to the PLD180 to obtain a BIOS program in the BIOS chip 140 to complete the initialization of the computer device 100. The initialization of the computer device 100 includes initialization of a graphics card, initialization of a memory, and the like, which is not limited in this embodiment.
PLD180 may be a Complex Programmable Logic Device (CPLD), a Field-Programmable Gate Array (FPGA), General Array Logic (GAL), or any combination thereof. Alternatively, PLD180 may be integrated with CPU120 in the same physical chip. The PLD180 is configured to receive a BIOS program to be written into the BIOS chip 140 sent by the CPU120, read a character string from the memory chip 160 through an Inter-Integrated Circuit (I2C) between the PLD180 and the memory chip 160, and store the read character string in a register in the PLD 180.
After the PLD180 reads the character string, in the first case, the received BIOS program is converted by using the character string, and the converted BIOS program is written into the BIOS chip 140. At this time, after the computer device 100 is powered on, the PLD180 is further configured to receive a program reading instruction sent by the CPU120, read the converted BIOS program from the BIOS chip 140 according to an expected storage address carried by the program reading instruction, restore the converted BIOS program, and send the restored BIOS program to the CPU120 after obtaining the restored BIOS program. Specifically, please refer to the embodiment of the method shown in fig. 2.
In the second case, the PLD180 obtains the expected storage address of the BIOS program expected to be stored in the BIOS chip 140, converts the expected storage address using the character string, and writes the received BIOS program into the BIOS chip 140 after obtaining the converted storage address. At this time, after the computer device 100 is powered on, the PLD180 is further configured to receive a program reading instruction sent by the CPU120, convert an expected storage address carried in the program reading instruction, read a BIOS program from the BIOS chip 140 according to the converted storage address after obtaining the converted storage address, and send the read BIOS program to the CPU 120. Specifically, please refer to the method embodiment shown in fig. 9.
In a third case, PLD180 uses the string to translate both the BIOS program and the intended storage address of the BIOS program, and stores the translated BIOS program to the translated storage address. At this time, after the computer device 100 is powered on, the PLD180 is further configured to receive a program reading instruction sent by the CPU120, convert an expected storage address carried by the program reading instruction, read the converted BIOS program from the BIOS chip 140 according to the converted storage address after obtaining the converted storage address, restore the converted BIOS program according to the character string, and send the restored BIOS program to the CPU120 after obtaining the restored BIOS program. Specifically, please refer to the method embodiment shown in fig. 10.
It should be noted that the BIOS program mentioned herein may be a complete BIOS program, or a program in the BIOS program, which is used by the CPU to complete the initialization of the computer device 100, and the present embodiment is not limited thereto.
The BIOS chip 140 is used to store a BIOS program. The BIOS chip 140 is a non-volatile memory (non-volatile memory). The nonvolatile Memory may be a ROM, such as a Programmable Read-Only Memory (PROM), an Erasable Programmable Read-Only Memory (EPROM), and an Electrically Erasable Programmable Read-Only Memory (EEPROM). The nonvolatile memory may also be a flash memory (flash memory), a magnetic memory such as a magnetic tape (magnetic tape), a floppy disk (floppy disk), and a hard disk. The non-volatile memory may also be an optical disc.
The memory chip 160 is used to store a string of characters for the PLD to translate the BIOS program, and/or the intended memory address of the BIOS program. The content of the character string is random, and may specifically be a string of random characters pre-stored in the memory chip 160 by a developer, or may also be an Electronic Serial Number (ESN) written by a manufacturer of the computer device 100 when the device leaves a factory, which is not limited in this embodiment. The ESN may be 16 bytes in length. The memory chip 160 may be an EEPROM, which is also a nonvolatile memory. The type of the memory chip 160 may be the same as the type of the BIOS chip 140, or may be different from the type of the BIOS chip 140, and the embodiment is not limited thereto.
Optionally, the computer device 100 may further include a North Bridge (NB) chip (not shown), which may also be referred to as a host Bridge (host Bridge) chip. The north bridge chip is located between the CPU120 and the PLD, and is the closest chip to the CPU 120. The north bridge chip is used to handle the communication between CPU120 and PLD 180. Alternatively, the north bridge chip may be integrated with the CPU120 in the same physical chip.
Referring to fig. 1B, a diagram of a scenario of a computer device 100 when writing a BIOS program according to an exemplary embodiment of the present application is shown. In fig. 1B, the PLD is referred to as CPLD, the BIOS chip is referred to as ROM, and the memory chip is referred to as EEPROM, and the CPLD converts the BIOS program and the expected memory address of the BIOS program into an example. When receiving a BIOS program A to be written into a ROM, which is sent by a CPU, a CPLD reads a character string B in the EEPROM, and the CPLD converts the A according to the B to obtain a converted BIOS program C; and converting the expected storage address D according to the B to obtain a converted storage address E, and storing the C in a storage space indicated by the E in the ROM by the CPLD.
Accordingly, please refer to fig. 1C, which illustrates a scenario of the computer device 100 when reading the BIOS program according to an exemplary embodiment of the present application. After the CPLD writes the BIOS program a according to the flow shown in fig. 1B, if the CPLD receives a program read instruction requesting to read the BIOS program sent by the CPU, the character string B in the EEPROM is read, the expected storage address D carried by the read instruction is converted by the B to obtain a converted storage address E, the converted BIOS program C is read from the storage space indicated by E in the ROM to obtain the reduced BIOS program a, and the reduced BIOS program a is sent to the CPU.
Referring to fig. 2, a flowchart of a first program reading and writing method provided in an embodiment of the present application is shown, where the program reading and writing method can be applied to the computer device shown in fig. 1A, and the program reading and writing method includes the following steps:
in step 201, a PLD in a computing device receives a BIOS program sent by a CPU in the computing device, where the BIOS program is used for the CPU to execute to complete initialization of the computing device.
Before computer equipment leaves a factory, a developer needs to write a BIOS program which is operated after the CPU is powered on in a BIOS chip through the CPU, at the moment, a PLD installed in the computer equipment receives the BIOS program before the BIOS chip, and the BIOS program is used for being operated by the CPU to complete the initialization of the equipment. Typically the number of BIOS programs is at least one.
At step 202, the PLD reads the string stored in the memory chip coupled to the PLD.
The PLD reads a character string stored in a memory chip connected to the PLD through an I2C (Inter-Integrated Circuit) interface with the memory chip, and stores the read character string in a register in the PLD. The character string may be a hexadecimal string of characters, a decimal string of characters, or a binary string of characters, and the embodiment does not limit the character form of the character string.
When a string is stored in the memory chip, the PLD reads the string stored in the memory chip, which is the simplest way. When at least two character strings are stored in the storage chip, the obtaining, by the PLD, of the character string corresponding to the current BIOS program may be: the PLD reads one of the at least two character strings according to a preset rule.
The preset rules include, but are not limited to, the following implementations:
in a first implementation, the PLD reads one string from at least two strings according to the received order of each BIOS program. Such as: reading a first character string from at least two character strings when the PLD receives a first BIOS program; when the PLD receives the second BIOS program, the second string is read from the at least two strings.
In a second implementation, the PLD reads a specified one of the at least two strings. Such as: the PLD reads a first one of the at least two strings.
In step 203, the PLD converts the BIOS program according to the character string to obtain a converted BIOS program.
Optionally, before the PLD converts the BIOS program, the PLD needs to obtain a sub-string corresponding to the BIOS program from the string, and convert the BIOS program according to the sub-string to obtain the converted BIOS program.
In one implementation, the obtaining, by the PLD, the substring corresponding to the BIOS program includes: the PLD obtains a substring corresponding to the current BIOS program from the string.
The implementation manner of obtaining a sub-string corresponding to a current BIOS program from a string by the PLD includes, but is not limited to, the following implementation manners:
in a first implementation, the PLD intercepts the last n bits from the expected memory address of the BIOS program from the CPU. And determining the value of the last n-bit data, and further determining the starting position of a sliding window with a preset window length as an address indicated by the value represented by the last n-bit data in the register. And intercepting a substring with the bit number being the length of the preset window from the character indicated by the address in the register through the sliding window. Where n is a positive integer, e.g., 4, 32, etc. Wherein the expected memory address is sent when the CPU sends the BIOS program.
Referring to fig. 3, assuming that the expected storage address of the BIOS program is 0x000000000001, the last four bits of data is 0001, and the value represented by the value is 1, the starting position of the sliding window is address 1 in the register, and if the preset window length of the sliding window is 4 characters, as can be seen from fig. 3, the 4-bit substring intercepted by the PLD from character 0 indicated by address 1 is 1000, that is, the substring corresponding to the BIOS program is 1000.
In a second implementation, the PLD extracts a substring corresponding to a current BIOS program from the string according to an extraction rule.
The extraction rule may be that the PLD extracts a character every predetermined number of bits in a predetermined direction from a start character of the character string until the obtained number of bits of the character is the same as the number of bits of the BIOS program. The preset number of bits is far less than the number of bits of the character string, the position of the start character is determined according to the position of the last character of the sub-character string corresponding to the last BIOS program, and if the current BIOS program is the first BIOS program, the start character may be the first bit of the character string, or the last bit of the character string, or any bit of the character string.
Assuming that the character string in the register of the PLD is as shown in fig. 3, when the PLD receives the BIOS program for the first time, the PLD extracts one character every 2 bits from back to front along the arrangement direction of the character string, starting with the last character of the character string, to obtain a sub-character string 0110 corresponding to the BIOS program, and then the PLD takes the character corresponding to two bits apart as the starting character of the next BIOS program. When the PLD receives the BIOD program for the second time, the logic array extracts one character every 2 bits from the start character to obtain the substring 1100 corresponding to the BIOS program.
In another implementation, the obtaining, by the PLD, the substring corresponding to the BIOS program includes: the PLD acquires a plurality of substrings corresponding to the current BIOS program from the character strings. The plurality of substrings correspond to at least two segments of subprograms included in a current BIOS program one by one, and the at least two segments of subprograms are obtained by dividing the current BIOS program by the PLD.
When the PLD divides the BIOS program into at least two segments of subroutines, the number of bits of the divided subroutines may be the same or different, and this embodiment does not limit the manner in which the PLD divides the subroutines and the number of bits of the divided subroutines.
The implementation manner of the PLD obtaining one sub-string corresponding to each sub-program from the string includes, but is not limited to, the following implementation manners:
in a first implementation manner, the PLD determines the starting position of a sliding window with a preset window length, intercepts a sub-string corresponding to a current sub-program from a string by using the sliding window, and slides the sliding window by a preset step length according to the sequence from a low position to a high position of the string, wherein the bit number of the intercepted sub-string is equal to the length of the preset window. The starting position of the sliding window may be the last bit of the character string, or may be any bit of the character string, which is not limited in this embodiment.
Assuming that a character string in a register in the PLD is shown in fig. 3, a BIOS program received by the PLD for the first time is 0x000000000001, the PLD divides the BIOS program into a first section of subroutine 0001, a second section of subroutine 0000, and a third section of subroutine 0000, a start position of a sliding window is a last bit of the character string, if a preset window length of the sliding window is a 4-bit character and a preset step size is a 1-bit character, it can be known from fig. 3 that the 4-bit subroutine corresponding to the first section of subroutine intercepted by the PLD from character 0 is 1000; the 4-bit string corresponding to the second section subprogram is; the 4-bit string corresponding to the second-segment subprogram is 0100; the 4-bit substring corresponding to the third subroutine is 0010.
In a second implementation manner, the PLD extracts a sub-string corresponding to each sub-program from the string according to an extraction rule.
The extraction rule may be that the PLD extracts a character every predetermined number of bits in a predetermined direction, starting from the initial character of the character string, until the number of bits of the obtained character is the same as the number of bits of the subroutine. If the current section of subprogram is the first section of subprogram in the first BIOS program, the initial character may be the first digit of the character string, or the last digit of the character string, or any digit of the character string.
Assuming that the character string in the register of the PLD is as shown in fig. 3, when the PLD receives the BIOS program for the first time and the first segment of the subroutine of the BIOS program is 4 bits, the PLD extracts one character every 2 bits from back to front along the arrangement direction of the character string, starting with the last character of the character string, to obtain a sub-character string 0110 corresponding to the subroutine, and then the PLD uses the character corresponding to two bits at the interval as the starting character of the next segment of the subroutine.
At step 204, the PLD obtains the expected storage address of the BIOS program sent by the CPU in the BIOS chip.
In step 205, the PLD stores the converted BIOS program to the desired storage address in the BIOS chip.
In step 206, the PLD in the computing device receives a program reading instruction sent by the CPU in the computing device, where the program reading instruction is used to read an original BIOS program from a BIOS chip in the computing device, and the original BIOS program is used for the CPU to execute to complete initialization of the computing device.
Step 207, the PLD reads the string stored in the memory chip connected to the PLD.
It should be noted that, in order to ensure that the PLD can accurately restore the BIOS program stored in the BIOS chip, the manner in which the PLD reads the character string in this step should be the same as the manner in which the PLD reads the character string in step 202.
At step 208, the PLD obtains the expected memory address carried by the program read instruction.
The program reading instruction sent by the CPU carries an expected storage address of the BIOS program to be read, which is expected to be stored in the BIOS chip, and the PLD acquires the expected storage address.
In step 209, the PLD reads the converted BIOS program stored in the expected storage address and restores the converted BIOS program according to the character string to obtain a restored BIOS program.
In step 210, the PLD sends the restored BIOS program to the CPU.
It should be noted that, the step 201-205 can be implemented as an embodiment of the program writing method separately; the steps 206-210 can be implemented as an embodiment of a program reading method, and the embodiment is not limited.
To sum up, according to the program read-write method provided in the embodiment of the present application, the PLD converts the BIOS program according to the character string to obtain the converted BIOS program, and stores the converted BIOS program into the BIOS chip, so that the BIOS program stored in the BIOS chip is the converted BIOS program, and thus, a person other than a developer cannot obtain the original BIOS program by obtaining the BIOS chip, thereby solving the problem that the original BIOS program is stored in the BIOS chip, which causes low security of the original BIOS program, and achieving an effect of improving the security of the BIOS program stored in the BIOS chip.
The following describes a specific conversion process of the PLD for the BIOS program process conversion:
after the PLD obtains the substring corresponding to the BIOS program in step 203, the method for converting the BIOS program according to the substring specifically includes: the PLD takes the substring as a first index, takes the data included in the BIOS program as a second index, and inquires the converted BIOS program in a program mapping table; the program mapping table is a two-dimensional index table and stores converted BIOS programs corresponding to the character strings and the data included by the BIOS programs. The program map table is solidified in the PLD by a hardware programming language.
It should be noted that, in order to ensure that the PLD can accurately restore the converted BIOS program to the original BIOS program when the CPU requests to read the BIOS program in the memory, the converted BIOS programs corresponding to different BIOS programs are different.
When the PLD divides the BIOS program into at least two segments of subprograms, the PLD uses the substring as a first index and uses the data included in the BIOS program as a second index, and searches the converted BIOS program in the program mapping table, including: for each section of subprogram, the subprogram corresponding to the subprogram is taken as a first index, the data included in the subprogram is taken as a second index, the converted subprogram is inquired in a program mapping table, and the converted BIOS program is determined according to each section of converted subprogram.
Assume that the program mapping table in the PLD is shown in table one below, where the first row represents data included in each piece of subprogram, the first column represents a substring, and in order to ensure that the PLD can accurately restore the converted BIOS program to the original BIOS program, the converted subprograms in table one do not repeat each other. When the data included in a piece of subroutine in the BIOS program received by the PLD is 0x7 and the obtained substring corresponding to the subroutine is 0x1, the converted subroutine is found to be 0x0 by looking up the table. Wherein 0x means hexadecimal. It should be noted that, in practical implementation, the data included in the substring and the subprogram may be other binary numbers, such as: binary, decimal, etc., and the present embodiment is not limited.
Table one:
Figure BDA0001114558080000171
correspondingly, the specific restoring process of the PLD for restoring the converted BIOS program is as follows:
in one implementation, when the PLD obtains a substring corresponding to a current BIOS program from the string, the PLD restores the converted BIOS program according to the substring to obtain a restored BIOS program, including: the PLD acquires a character string corresponding to the current program reading instruction from the character string, and restores the converted BIOS program by using the sub-character string to acquire the restored BIOS program.
The obtaining manner of the PLD that obtains a sub-string corresponding to the current program reading instruction from the string is the same as the obtaining manner of the PLD that obtains a sub-string corresponding to the current BIOS program from the string in step 203, and is not described herein again.
In another implementation, when the PLD obtains multiple substrings corresponding to a current BIOS program from the string, the PLD converts the BIOS program according to the substrings to obtain a converted BIOS program, including: the PLD divides the converted BIOS program into at least two converted subprograms according to a preset dividing mode, and acquires a substring corresponding to each converted subprogram from the character string; for each converted subprogram, restoring the converted subprogram according to the substring corresponding to the converted subprogram to obtain a restored subprogram; and merging each section of the restored subprogram to obtain the restored BIOS program.
The manner of acquiring the character string corresponding to each converted subprogram from the character string by the PLD is the same as the manner of acquiring the character string corresponding to each subprogram from the character string by the PLD in step 203. The preset dividing manner is the same as the dividing manner of the PLD dividing the BIOS program into at least two sub-programs in step 203, and is not described herein again.
It should be noted that, in this step, the recovery method for the converted BIOS program by the PLD is also determined according to the conversion method for the converted BIOS program by the PLD in step 203.
Specifically, when the PLD queries the converted BIOS program in the program mapping table with a substring corresponding to the BIOS program as the first index and data included in the BIOS program as the second index, the PLD queries the restored BIOS program in the program mapping table with a substring corresponding to the current program reading instruction as the first index and the converted BIOS program as the second index. When the PLD queries the converted subprogram in the program mapping table by using the substring corresponding to the subprogram included in the BIOS program as a first index and using the data included in the subprogram as a second index, the PLD queries the restored subprogram in the program mapping table by using the substring corresponding to the converted subprogram included in the converted BIOS program as the first index and using the converted subprogram as the second index, and determines the restored BIOS program according to each restored subprogram.
Assuming that the program mapping table in the PLD is as shown in the table one above, when the data included in one converted subroutine in the converted BIOS program read by the PLD is 0x0 and the obtained substring corresponding to the converted subroutine is 0x1, the recovered subroutine is 0x7 by looking up the table.
Optionally, in step 202, after the PLD obtains the character string, a sub-character string may be obtained from the character string, where the length of the sub-character string is greater than zero and less than or equal to the length of the character string. The obtaining method of the sub-string please refer to the description in step 203, which is not described herein. At this time, the PLD may convert the BIOS program according to the character string, and may further include the following conversion modes:
in a first conversion mode, the PLD performs a first logic operation on the substring to obtain a converted substring; and performing second logic operation on the BIOS program by using the converted substring to obtain the converted BIOS program.
Fig. 4 is an example of a first conversion scheme. Referring to fig. 4, assuming that the BIOS program sent by the CPU to the PLD is 0b1000, and the PLD obtains the sub-string corresponding to the BIOS program as 0b0010, the PLD first performs negation on the sub-string 0b0010 to obtain a converted sub-string 0b1101, and performs an exclusive or operation on the sub-string 0b1101 and the BIOS program 0b1000 to obtain a converted BIOS program 0b 0101. Where 0b is used to represent a binary number.
Correspondingly, in step 209, when receiving the program reading instruction sent by the CPU, the PLD reads the converted BIOS program from the expected storage address carried by the program reading instruction, and restores the converted BIOS program according to the first conversion method, thereby obtaining a restored BIOS program.
Assume that when the PLD receives a program read instruction sent by the CPU, the converted BIOS program read from the storage address carried by the program read instruction is 0b0101, and the obtained substring is 0b 0010. The PLD first performs negation on the substring 0b0010 to obtain a converted string 0b1101, and performs xor operation on the string 0b1101 and the converted BIOS program 0b0101 to obtain a restored BIOS program 0b 1000.
In a second conversion mode, the PLD performs a third logic operation on the BIOS program, and performs a fourth logic operation on the BIOS program subjected to the third logic operation by using the substring, to obtain a converted BIOS program.
Fig. 5 is an example of a second conversion scheme. Referring to fig. 5, it is assumed that the BIOS program sent by the CPU to the PLD is 0b1000, and the sub-string corresponding to the BIOS program obtained by the PLD is 0b0010, and the value indicated by the sub-string is 2. The PLD first inverts 0b1000 to obtain 0b0111, and circularly shifts left the numerical value represented by the substring for 0b0111 to obtain the converted BIOS program 0b 1101.
Correspondingly, in step 209, when receiving the program reading instruction sent by the CPU, the PLD reads the converted BIOS program from the expected storage address carried by the program reading instruction, and restores the converted BIOS program according to the second conversion method, to obtain the restored BIOS program.
Assume that when the PLD receives a program read instruction sent by the CPU, the converted BIOS program read from the storage address carried by the program read instruction is 0b1101, and the substring is 0b 0010. The PLD first inverts 0b1101 to obtain 0b0010, and circularly right-shifts the 0b0010 by the numerical value represented by the substring to obtain the restored BIOS program 0b 1000.
In a third conversion mode, the PLD performs a fifth logic operation on the sub-character strings to obtain converted sub-character strings; and performing a sixth logical operation on the BIOS program, and performing a seventh logical operation on the BIOS program subjected to the sixth logical operation by using the converted substring to obtain the converted BIOS program.
Fig. 6 is an example of a third conversion manner. Referring to fig. 6, it is assumed that the BIOS program sent by the CPU to the PLD is 0b1000, and the substring corresponding to the BIOS program obtained by the PLD is 0b 0010. The PLD performs negation on the sub-character string to obtain 0b1101, circularly shifts the BIOS program left by 2 bits to obtain 0b0010, and performs exclusive OR on the 0b1101 and the 0b0010 to obtain the converted BIOS program 0b 1111.
Correspondingly, in step 209, when receiving the program reading instruction sent by the CPU, the PLD reads the converted BIOS program from the expected storage address carried by the program reading instruction, and restores the converted BIOS program according to the third conversion method, thereby obtaining the restored BIOS program.
Assume that when the PLD receives a program read instruction sent by the CPU, the converted BIOS program read from the storage address carried by the program read instruction is 0b1111, and the obtained substring is 0b 0010. The PLD first inverts 0b0010 to obtain 0b1101, performs xor on 0b1111 and 0b1101 to obtain 0b0010, and circularly right shifts 0b0010 by 2 to obtain the restored BIOS program 0b 1000.
In the fourth conversion mode, the PLD performs an eighth logical operation on the BIOS program using the substring to obtain the converted BIOS program.
Fig. 7 is an example of a fourth conversion scheme. Referring to fig. 7, it is assumed that the BIOS program sent by the CPU to the PLD is 0b1000, and the substring corresponding to the BIOS program obtained by the PLD is 0b 0010. The PLD performs xor on 0b1000 and 0b0010 to obtain the converted BIOS program 0b 1010.
Correspondingly, in step 209, when receiving the program reading instruction sent by the CPU, the PLD reads the converted BIOS program from the expected storage address carried by the program reading instruction, and restores the converted BIOS program according to the fourth conversion method, to obtain the restored BIOS program.
Assume that when the PLD receives a program read instruction sent by the CPU, the converted BIOS program read from the storage address carried by the program read instruction is 0b1010, and the obtained substring is 0b 0010. And the PLD carries out XOR on the 0b1010 and the 0b0010 to obtain the restored BIOS program 0b 1000.
In the fifth conversion mode, the PLD converts the BIOS program by using at least two of the first conversion mode, the second conversion mode, the third conversion mode, and the fourth conversion mode to obtain the converted BIOS program.
Fig. 8 is an example of a fifth conversion scheme. Referring to fig. 8, assuming that the BIOS program sent by the CPU to the PLD is 0b1000, the PLD obtains that the sub-string corresponding to the BIOS program is 0b0010, and the numerical value represented by the sub-string is 2, the PLD cycles the numerical value represented by the string to the left for 0b1000 to obtain 0b0010, and negates 0b0010 to obtain the converted BIOS program 0b 1101.
Correspondingly, in step 209, when receiving the program reading instruction sent by the CPU, the PLD reads the converted BIOS program from the expected storage address carried by the program reading instruction, and restores the converted BIOS program according to the fifth conversion method, to obtain the restored BIOS program.
Assume that when the PLD receives a program read instruction sent by the CPU, the converted BIOS program read from the storage address carried by the program read instruction is 0b1101, and the obtained substring is 0b 0010. And the PLD inverts 0b1101 to obtain 0b0010, and circularly right-shifts the 0b0010 by the time-telling numerical value of the sub-character string to obtain the restored BIOS program 0b 1000.
It should be noted that, when the PLD writes the BIOS program in the CPU, the cycle left shift is performed on the BIOS program, and after the PLD reads the converted BIOS program, the cycle right shift is performed on the converted BIOS program to restore the converted BIOS program; when the PLD writes the BIOS program in the CPU, the BIOS program is circularly moved to the right, and after the PLD reads the converted BIOS program, the converted BIOS program needs to be circularly moved to the left to restore the converted BIOS program.
Referring to fig. 9, a flowchart of a second program reading and writing method according to an embodiment of the present application is shown, where the program reading and writing method can be applied to the computer device shown in fig. 1A, and the program reading and writing method includes the following steps:
in step 901, a PLD in a computing device receives a BIOS program sent by a CPU in the computing device and an expected storage address of the BIOS program in a BIOS chip, where the BIOS program is used for the CPU to execute to complete initialization of the computing device.
Specifically, please refer to the description in step 201, which is not described herein.
At step 902, the PLD reads a string stored in a memory chip coupled to the PLD.
Specifically, please refer to the description in step 202, which is not repeated herein.
At step 903, the PLD converts the expected storage address according to the character string to obtain a converted storage address, wherein the converted storage address is different from the expected storage address.
Optionally, when the PLD converts the expected storage address, the PLD may first determine the conversion bit number i of the expected storage address, and convert the last i bits in the expected storage address to obtain the converted storage address. Wherein i is a positive integer. In this way, the PLD need not translate all of the data contained in the intended storage address, saving processing resources consumed by the PLD in translating the intended storage address.
Wherein the PLD determines the number of converted bits of the intended storage address, including: the PLD acquires the bit width and the storage capacity of the BIOS chip; determining the conversion bit number i of the expected storage address according to the bit width and the storage capacity; alternatively, the PLD obtains the number of conversion bits i that are solidified in the PLD.
In particular toThe PLD obtains bit width and storage capacity of the BIOS chip, including: the PLD acquires the block size, the block number and the bit width of the BIOS chip through a public interface between the PLD and the BIOS chip, and calculates the storage capacity of the BIOS chip according to the block size and the block number. Where the number of blocks is typically an integer power of 2. Assume that the block size of the BIOS chip is 128 kilobytes (K), and the number of blocks is 2664, the memory capacity of the BIOS chip is 128K 64-213K is 8 megabytes (M).
It should be noted that, for convenience of description, the last i bits of the expected memory address are described as the expected memory address to be converted.
Optionally, before converting the expected memory address to be converted, the PLD needs to obtain a sub-string corresponding to the BIOS program from the string, and convert the expected memory address to be converted according to the sub-string to obtain the converted memory address.
The PLD acquires the substring corresponding to the BIOS program, and the method comprises the following steps: the PLD acquires a sub-character string corresponding to the current BIOS program from the character string; or, the PLD acquires a plurality of substrings corresponding to the current BIOS program from the character strings.
The description of obtaining a sub-string corresponding to the current BIOS program from the string by the PLD refers to the description in step 203, which is not described herein again.
When the PLD obtains a plurality of substrings corresponding to the current BIOS program from the character strings, the PLD divides the expected storage address to be converted into at least two segments of sub-addresses, and obtains one substring corresponding to each segment of sub-address from the character strings. When the PLD divides the expected storage address to be converted into at least two sub-addresses, the number of bits of the divided sub-addresses may be the same or different, and the embodiment does not limit the way in which the PLD divides the sub-addresses and the number of bits of the divided sub-addresses.
The implementation manner of the PLD obtaining one sub-string corresponding to each sub-address from the string includes, but is not limited to, the following implementation manners:
in a first implementation manner, the PLD determines the starting position of a sliding window with a preset window length, intercepts a sub-string corresponding to a current segment of sub-address from the string by using the sliding window, and slides the sliding window by a preset step length according to the sequence from a low order to a high order of the string, wherein the bit number of the intercepted sub-string is equal to the length of the preset window. The starting position of the sliding window may be the last bit of the character string, or may be any bit of the character string, which is not limited in this embodiment.
Assuming that a character string in a register in the PLD is as shown in fig. 3, an expected storage address to be converted of the BIOS program received by the PLD for the first time is 0x000000000001, the PLD divides the expected storage address to be converted into a first segment of sub-address 0001, a second segment of sub-address 0000, and a third segment of sub-address 0000, where a start position of a sliding window is a last position of the character string, and if a preset window length of the sliding window is a 4-bit character and a preset step size is a 1-bit character, it can be known from fig. 3 that a 4-bit sub-character string corresponding to the first segment of sub-address intercepted by the PLD from character 0 is 1000; the 4-bit string corresponding to the second segment subaddress is 0100; the 4-bit substring corresponding to the third segment of the subaddress is 0010.
In a second implementation manner, the PLD extracts a sub-string corresponding to each segment of sub-address from the string according to an extraction rule.
The extraction rule may be that the PLD extracts a character every predetermined number of bits in a predetermined direction from a starting character of the character string until the number of bits of the obtained character is the same as the number of bits of the sub-address. If the current segment of sub-address is the first segment of sub-address in the expected storage address to be converted of the first BIOS program, the starting character may be the first bit of the character string, or the last bit of the character string, or any bit of the character string.
Assuming that the character string in the register of the PLD is as shown in fig. 3, when the PLD receives the BIOS program for the first time and the first segment sub-address of the expected storage address to be converted of the BIOS program is 4 bits, the PLD extracts one character every 2 bits from back to front along the arrangement direction of the character string, starting with the last character of the character string, to obtain a sub-character string 0110 corresponding to the sub-address, and then the PLD uses the character corresponding to two bits at the interval as the starting character of the next segment of sub-address.
At step 904, the PLD stores the BIOS program in the converted memory address.
In step 905, the PLD in the computer device receives a program reading instruction sent by the CPU in the computer device, and obtains an expected storage address carried by the program reading instruction, where the program reading instruction is used to read the BIOS program from the BIOS chip.
At step 906, the PLD reads the string stored in the memory chip coupled to the PLD.
It should be noted that, in order to ensure that the PLD can accurately restore the BIOS program stored in the BIOS chip, the manner in which the PLD reads the character string in this step should be the same as the manner in which the PLD reads the character string in step 902.
At step 907, the PLD converts the expected storage address according to the character string to obtain a converted storage address, and reads the BIOS program from the converted storage address.
The description of the PLD converting the expected storage address according to the character string is the same as the description of the PLD converting the expected storage address according to the character string in step 903, and is not repeated here.
At step 908, the PLD sends the BIOS program to the CPU.
It should be noted that the steps 901-904 can be implemented separately as an embodiment of the program writing method; the steps 905 and 908 can be implemented as an embodiment of a program reading method, and the embodiment is not limited.
To sum up, according to the program read-write method provided in the embodiment of the present application, the PLD converts the expected storage address of the BIOS program according to the character string to obtain the converted storage address, and stores the BIOS program to the converted storage address, so that the BIOS program stored in the BIOS chip is subjected to address hashing, and thus, a person other than a developer cannot obtain the original BIOS program by obtaining the BIOS chip, thereby solving the problem that the original BIOS program is stored in the BIOS chip, which causes low security of the original BIOS program, and achieving an effect of improving the security of the BIOS program stored in the BIOS chip.
The following describes a specific translation process when the PLD translates the expected memory address to be translated:
after the PLD obtains the substring corresponding to the BIOS program in step 903, the PLD converts the expected storage address to be converted according to the substring, which specifically includes: the PLD takes the substring as a first index, takes data included in the expected storage address to be converted as a second index, and inquires the converted storage address in an address mapping table; the address mapping table is a two-dimensional index table and stores the converted storage address corresponding to the character string and the data included in the expected storage address to be converted. The address mapping table is solidified in the PLD by a hardware programming language. It should be noted that the address mapping table may be the same as the program mapping table in the embodiment shown in fig. 2, or may be different from the program mapping table, which is not limited in this embodiment.
It should be noted that, in order to ensure that the PLD can accurately obtain the original BIOS program when the CPU requests to read the BIOS program in the memory, the converted storage addresses corresponding to different expected storage addresses to be converted are different.
When the PLD divides the expected storage address to be converted into at least two segments of sub-addresses, the PLD takes the sub-character strings as a first index and takes the data included in the expected storage address to be converted as a second index, and inquires the converted storage address in an address mapping table, and the method comprises the following steps: for each sub program, the sub character string corresponding to the sub address is used as a first index, the data included in the sub address is used as a second index, the converted sub address is inquired in an address mapping table, and the converted storage address is determined according to each converted sub address.
Assuming that the address mapping table in the PLD is as shown in table one above, at this time, the first row in the table one represents data included in each segment of sub-address, the first column represents a sub-string, and in order to ensure that the PLD can accurately obtain the BIOS program, the translated sub-addresses of each row in the table one are not repeated. When the data included in a segment of sub-address in the storage address to be converted received by the PLD is 0x7 and the sub-string corresponding to the sub-address is obtained as 0x1, the table lookup can find that the converted sub-address is 0x 0. It should be noted that, in practical implementation, the data included in the substring and the sub-address may be other binary numbers, such as: binary, decimal, etc., and the present embodiment is not limited.
Accordingly, when receiving the program reading instruction sent by the CPU, the PLD performs the same process of converting the expected storage address in the program reading instruction as the PLD performs the same process of converting the expected conversion address of the BIOS program when writing the BIOS program, and details are not described here.
Optionally, in step 903, after the PLD obtains the substring corresponding to the BIOS program, the PLD converts the expected storage address to be converted according to the substring, and the following conversion method may be further included:
in a first conversion mode, the PLD performs a first logic operation on the substring to obtain a converted substring; and performing second logic operation on the expected memory address to be converted by using the converted substring to obtain the converted memory address.
In the second conversion mode, the PLD performs a third logic operation on the expected memory address to be converted, and performs a fourth logic operation on the expected memory address to be converted, on which the third logic operation is performed, by using the substring, to obtain a converted memory address.
In a third conversion mode, the PLD performs a fifth logic operation on the sub-character strings to obtain converted sub-character strings; and performing sixth logical operation on the expected memory address to be converted, and performing seventh logical operation on the expected memory address to be converted after the sixth logical operation by using the converted substring to obtain the converted memory address.
In the fourth conversion mode, the PLD performs an eighth logical operation on the expected storage address to be converted by using the substring to obtain a converted storage address.
In the fifth conversion mode, the PLD converts the expected storage address to be converted by using at least two of the first conversion mode, the second conversion mode, the third conversion mode, and the fourth conversion mode to obtain a converted storage address.
It should be noted that, when receiving the program reading instruction sent by the CPU, the PLD performs the same process of converting the expected storage address in the program reading instruction as the PLD performs the same process of converting the expected conversion address of the BIOS program when writing the BIOS program, and details are not described herein.
Referring to fig. 10, a flowchart of a third program reading and writing method according to an embodiment of the present application is shown, where the program reading and writing method can be applied to the computer device shown in fig. 1A, and the program reading and writing method includes the following steps:
in step 1001, a PLD in a computing device receives a BIOS program sent by a CPU in the computing device and an expected storage address of the BIOS program in a BIOS chip, where the BIOS program is used for the CPU to execute to complete initialization of the computing device.
Specifically, see step 201 for details, which are not described herein.
At step 1002, the PLD reads a string stored in a memory chip coupled to the PLD.
Specifically, see step 202 for details, which are not described herein.
At step 1003, the PLD converts the BIOS program according to the character string to obtain a converted BIOS program.
Specifically, the description of the PLD converting the BIOS program according to the character string to obtain the converted BIOS program is the same as the description of the PLD converting the BIOS program according to the character string to obtain the converted BIOS program in the embodiment shown in fig. 2, and is not repeated here.
At step 1004, the PLD translates the desired memory address according to the character string to obtain a translated memory address.
Specifically, the description that the PLD converts the expected storage address according to the character string to obtain the converted storage address is the same as the description that the PLD converts the expected storage address according to the character string to obtain the converted storage address in the implementation described in fig. 9, and details are not repeated here.
At step 1005, the PLD stores the converted BIOS program in the converted storage address.
Step 1006, the PLD in the computer device receives a program reading instruction sent by the CPU in the computer device, and obtains an expected storage address carried by the program reading instruction, where the program reading instruction is used to read the BIOS program from the BIOS chip.
Step 1007, the PLD reads the string stored in the memory chip connected to the PLD.
The manner in which the character string is read by the PLD in this step is the same as the manner in which the character string is read by the PLD in step 1002.
At step 1008, the PLD converts the desired memory address according to the string to obtain a converted memory address.
The manner in which the PLD converts the expected storage address according to the character string in this step is the same as the manner in which the PLD converts the expected storage address according to the character string in step 1004, and is not described herein again.
Step 1009, reading the converted BIOS program from the converted storage address, and restoring the converted BIOS program according to the character string to obtain a restored BIOS program.
Specifically, the description of the PLD restoring the converted BIOS program according to the character string to obtain the restored BIOS program is the same as the description of the PLD restoring the BIOS program according to the character string to obtain the converted BIOS program in the embodiment described in fig. 2
At step 1010, the PLD sends the restored BIOS program to the CPU.
It should be noted that, the steps 1001-1005 can be implemented as an embodiment of the program writing method separately; the steps 1006-1010 can be implemented as an embodiment of a program reading method, and the embodiment is not limited.
To sum up, according to the program read/write method provided in the embodiment of the present application, the PLD converts both the BIOS program and the expected storage address of the BIOS program according to the character string, and stores the converted BIOS program to the converted storage address, so that the difficulty of restoring the BIOS program by a person other than the developer is increased, and the effect of further improving the security of the BIOS program stored in the BIOS chip is achieved.
Referring to fig. 11, a block diagram of a program writing device according to an embodiment of the present application is shown. The program writing means may be implemented as all or part of a computer device in software, hardware or a combination of both. The program writing device may include: a receiving unit 1110, a reading unit 1120, a converting unit 1130, and a storing unit 1140.
The receiving unit 1110 is configured to receive a BIOS program sent by a CPU in the computer device, where the BIOS program is used for being executed by the CPU to complete initialization of the computer device.
A reading unit 1120 for reading a character string stored in a memory chip connected to the PLD.
The conversion unit 1130 is configured to convert the BIOS program according to the character string to obtain a converted BIOS program, where the converted BIOS program is different from the BIOS program before conversion. .
The storage unit 1140 is used to store the converted BIOS program into a BIOS chip in the computer device.
The relevant details may be combined with the method embodiment described with reference to fig. 2.
It should be noted that the receiving unit 1110, the reading unit 1120, the converting unit 1130, and the storing unit 1140 may be implemented by a PLD in a computer device.
Optionally, the receiving unit 1110 is further configured to receive the BIOS program sent by the CPU in the computer device and an expected storage address of the BIOS program in the BIOS chip.
The reading unit 1120 is further configured to read a character string stored in a memory chip connected to the PLD.
The conversion unit 1130 is further configured to convert the expected memory address according to the character string to obtain a converted memory address, where the converted memory address is different from the expected memory address.
The storage unit 1140 is further configured to store the BIOS program to the converted storage address.
Relevant details may be incorporated with the method embodiment with reference to fig. 9.
Optionally, the receiving unit 1110 is further configured to receive the BIOS program sent by the CPU in the computer device and an expected storage address of the BIOS program in the BIOS chip.
The reading unit 1120 is further configured to read a character string stored in a memory chip connected to the PLD.
A conversion unit 1130, further configured to convert the expected storage address according to the character string to obtain a converted storage address, and convert the BIOS program according to the character string to obtain a converted BIOS program, where the converted storage address is different from the expected storage address; the converted BIOS program is different from the BIOS program before conversion.
The storage unit 1140 is further configured to store the converted BIOS program to the converted storage address.
Relevant details may be incorporated with the method embodiment with reference to fig. 10.
Referring to fig. 12, a block diagram of a program reading apparatus according to an embodiment of the present application is shown. The program reading means may be implemented as all or part of a computer device in software, hardware or a combination of both. The program reading device may include: a receiving unit 1210, a reading unit 1220, a restoring unit 1230, and a transmitting unit 1240.
A receiving unit 1210, configured to receive a program reading instruction sent by a CPU in a computer device, where the program reading instruction is used to read an original BIOS program from a BIOS chip in the computer device, and the original BIOS program is used for being executed by the CPU to complete initialization of the computer device.
The reading unit 1220 is configured to read a character string stored in a memory chip connected to the PLD, and read the converted BIOS program from the BIOS chip.
A restoring unit 1230, configured to restore the converted BIOS program according to the character string to obtain a restored BIOS program, where the converted BIOS program is obtained by converting the original BIOS program according to the character string and storing the converted BIOS program in the BIOS chip by the PLD; the converted BIOS program is different from the original BIOS program.
A sending unit 1240, configured to send the restored BIOS program to the CPU.
The relevant details may be combined with the method embodiment described with reference to fig. 2.
It should be noted that the receiving unit 1210, the reading unit 1220, the restoring unit 1230, and the transmitting unit 1240 may be implemented by a PLD in a computer device.
Optionally, the receiving unit 1210 is further configured to receive a program reading instruction sent by a CPU in the computer device, and acquire an expected storage address carried by the program reading instruction.
The reading unit 1220 is further configured to read a character string stored in a memory chip connected to the PLD.
The program reading device may include: a conversion unit 1250 configured to convert the expected memory address according to the character string to obtain a converted memory address, wherein the converted memory address is different from the expected memory address.
The reading unit 1220 is further configured to read the BIOS program from the converted storage address.
The sending unit 1240 is further configured to send the BIOS program to the CPU.
Relevant details may be incorporated with the method embodiment with reference to fig. 9.
It should be noted that the conversion unit 1250 may be implemented by a PLD in a computer device.
Optionally, the receiving unit 1210 is further configured to receive a program reading instruction sent by a CPU in the computer device, and acquire an expected storage address carried by the program reading instruction.
The reading unit 1220 is further configured to read a character string stored in a memory chip connected to the PLD.
The conversion unit 1250 is further configured to convert the expected memory address according to the character string to obtain a converted memory address.
The reading unit 1220 is further configured to read the converted BIOS program from the converted storage address.
The restoring unit 1230 is further configured to restore the converted BIOS program according to the character string to obtain a restored BIOS program.
The sending unit 1240 is further configured to send the restored BIOS program to the CPU.
Relevant details may be incorporated with the method embodiment with reference to fig. 10.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the apparatuses and units described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units may be merely a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (32)

1. A computer device, characterized in that the computer device comprises: the CPU is connected with the BIOS chip through the PLD, and the storage chip is connected with the PLD;
the PLD is used for receiving a BIOS program sent by the CPU, and the BIOS program is used for being executed by the CPU to complete the initialization of the computer equipment;
the PLD is also used for reading the character strings stored in the storage chip;
the PLD is further configured to convert the BIOS program according to the character string to obtain a converted BIOS program, and store the converted BIOS program in the BIOS chip, where the converted BIOS program is different from the BIOS program before conversion.
2. The computer device of claim 1, wherein the PLD stores the converted BIOS program in the BIOS chip, and wherein the PLD is specifically configured to:
acquiring an expected storage address of the BIOS program in the BIOS chip, which is sent by the CPU;
and storing the converted BIOS program to the expected storage address.
3. The computer device of claim 1, wherein the PLD stores the converted BIOS program in the BIOS chip, and wherein the PLD is specifically configured to:
acquiring an expected storage address of the BIOS program in the BIOS chip, which is sent by the CPU;
converting the expected storage address according to the character string to obtain a converted storage address;
storing the converted BIOS program to the converted memory address, wherein the converted memory address is different from the expected memory address.
4. The computer device of claim 1, wherein the PLD converts the BIOS program according to the string to obtain a converted BIOS program, the PLD being configured to:
the converted BIOS program is inquired in a program mapping table by taking the character string as a first index and the data included by the BIOS program as a second index;
the program mapping table is a two-dimensional index table and stores converted BIOS programs corresponding to the character strings and the data included by the BIOS programs.
5. The computer device of claim 4, wherein the PLD queries the converted BIOS program in the program mapping table using the string as a first index and the data included in the BIOS program as a second index, and is specifically configured to:
dividing the BIOS program into at least two sections of subprograms;
acquiring a sub-character string corresponding to each sub-program from the character string;
for each section of subprogram, taking the corresponding substring of the subprogram as the first index, taking the data included in the subprogram as the second index, and inquiring the converted subprogram in the program mapping table;
and determining the converted BIOS program according to each converted subprogram.
6. The computer device of claim 3, wherein the PLD translates the expected storage address according to the string, the PLD specifically configured to:
querying the converted storage address in an address mapping table by taking the character string as a first index and taking the data included in the expected storage address as a second index;
the address mapping table is a two-dimensional index table and stores converted storage addresses corresponding to data included in the character strings and the expected storage addresses.
7. The computer device of claim 6, wherein the PLD looks up the converted storage address in the data mapping table using the string as a first index and the data included in the expected storage address as a second index, the PLD being configured to:
dividing the expected storage address into at least two segments of sub-addresses;
acquiring a sub-character string corresponding to each segment of sub-address from the character string;
for each segment of sub-address, taking the sub-character string corresponding to the sub-address as the first index, taking the data included in the sub-address as the second index, and inquiring the converted sub-address in the data mapping table;
and determining the converted storage address according to each converted sub-address.
8. The computer device of claim 1, wherein the PLD converts the BIOS program according to the string to obtain a converted BIOS program, the PLD being configured to:
acquiring a sub-character string from the character string, wherein the length of the sub-character string is greater than zero and less than or equal to the length of the character string;
performing first logic operation on the substring to obtain a converted substring; performing a second logic operation on the BIOS program by using the converted substring to obtain the converted BIOS program; alternatively, the first and second electrodes may be,
performing a third logic operation on the BIOS program, and performing a fourth logic operation on the BIOS program subjected to the third logic operation by using the substring to obtain the converted BIOS program; alternatively, the first and second electrodes may be,
performing a fifth logical operation on the substring to obtain the converted substring; performing a sixth logical operation on the BIOS program, and performing a seventh logical operation on the BIOS program subjected to the sixth logical operation by using the converted substring to obtain the converted BIOS program; alternatively, the first and second electrodes may be,
and carrying out eighth logic operation on the BIOS program by utilizing the sub-character string to obtain the converted BIOS program.
9. The computer device of claim 3, wherein the PLD translates the expected storage address according to the string, the PLD specifically configured to:
acquiring a sub-character string from the character string, wherein the length of the sub-character string is greater than zero and less than or equal to the length of the character string;
performing first logic operation on the substring to obtain a converted substring; performing a second logic operation on the expected storage address by using the converted substring to obtain the converted storage address; alternatively, the first and second electrodes may be,
performing a third logical operation on the expected storage address, and performing a fourth logical operation on the expected storage address subjected to the third logical operation by using the substring to obtain the converted storage address; alternatively, the first and second electrodes may be,
performing a fifth logical operation on the substring to obtain the converted substring; performing a sixth logical operation on the expected storage address, and performing a seventh logical operation on the expected storage address subjected to the sixth logical operation by using the converted substring to obtain the converted storage address; alternatively, the first and second electrodes may be,
and carrying out eighth logic operation on the expected storage address by utilizing the substring to obtain the converted storage address.
10. A computer device, characterized in that the computer device comprises: the CPU is connected with the BIOS chip through the PLD, and the storage chip is connected with the PLD;
the PLD is used for receiving the BIOS program sent by the CPU and the expected storage address of the BIOS program in the BIOS chip, and the BIOS program is used for being executed by the CPU to complete the initialization of the computer equipment;
the PLD is also used for reading the character strings stored in the storage chip;
the PLD is further configured to convert the expected storage address according to the character string to obtain a converted storage address, wherein the converted storage address is different from the expected storage address;
the PLD is further used for storing the BIOS program to the converted storage address.
11. A computer device, characterized in that the computer device comprises: the CPU is connected with the BIOS chip through the PLD, and the storage chip is connected with the PLD;
the PLD is used for receiving a program reading instruction sent by the CPU, the program reading instruction is used for reading an original BIOS program from the BIOS chip, and the original BIOS program is used for being executed by the CPU to complete the initialization of the computer equipment;
the PLD is also used for reading the character strings stored in the storage chip;
the PLD is further configured to read the converted BIOS program from the BIOS chip and restore the converted BIOS program according to the character string to obtain a restored BIOS program, where the converted BIOS program is obtained by converting the original BIOS program by the PLD according to the character string and storing the converted BIOS program in the BIOS chip; the converted BIOS program is different from the original BIOS program;
and the PLD is also used for sending the restored BIOS program to the CPU.
12. The computer device of claim 11, wherein the PLD reads the converted BIOS program from the BIOS chip, the PLD being configured to:
acquiring an expected storage address carried by the program reading instruction;
reading the translated BIOS program stored in the expected memory address.
13. The computer device of claim 11, wherein the PLD reads the converted BIOS program from the BIOS chip, the PLD being configured to:
acquiring an expected storage address carried by the program reading instruction;
converting the expected storage address according to the character string to obtain a converted storage address, wherein the converted storage address is different from the expected storage address;
reading the translated BIOS program stored in the translated memory address.
14. The computer device of claim 11, wherein the PLD restores the converted BIOS program according to the string to obtain a restored BIOS program, and wherein the PLD is specifically configured to:
the character string is used as a first index, the data included in the converted BIOS program is used as a second index, and the restored BIOS program is inquired in a program mapping table;
the program mapping table is a two-dimensional index table and stores the character strings and the converted BIOS program corresponding to the data included in the restored BIOS program.
15. The computer device of claim 14, wherein the PLD queries the restored BIOS program in a program mapping table using the string as a first index and the data included in the converted BIOS program as a second index, the PLD being specifically configured to:
dividing the converted BIOS program into at least two converted subprograms according to a preset dividing mode, wherein the preset dividing mode is the same as the dividing mode of dividing the BIOS program into at least two subprograms when the PLD writes the BIOS program into the BIOS chip;
acquiring a sub-character string corresponding to each converted sub-program from the character string;
for each converted subprogram, taking the corresponding substring of the converted subprogram as the first index, taking the data included in the converted subprogram as the second index, and inquiring the restored subprogram in the program mapping table;
and determining the restored BIOS program according to each restored subprogram.
16. The computer device of claim 13, wherein the PLD translates the expected storage address according to the string, the PLD being further configured to:
querying the converted storage address in an address mapping table by taking the character string as a first index and taking the data included in the expected storage address as a second index;
the address mapping table is a two-dimensional index table and stores converted storage addresses corresponding to data included in the character strings and the expected storage addresses.
17. The computer device of claim 16, wherein the PLD looks up the converted memory address in the data mapping table using the string as a first index and the data included in the expected memory address as a second index, and is specifically configured to:
dividing the expected storage address into at least two segments of sub-addresses according to a preset dividing mode, wherein the preset dividing mode is the same as the dividing mode of dividing the expected storage address into at least two segments of sub-addresses when the PLD writes the BIOS program into the BIOS chip;
acquiring a sub-character string corresponding to each segment of sub-address from the character string;
for each segment of sub-address, taking the sub-character string corresponding to the sub-address as the first index, taking the data included in the sub-address as the second index, and inquiring the converted sub-address in the address mapping table;
and determining the converted storage address according to each converted sub-address.
18. The computer device of claim 11, wherein the PLD restores the converted BIOS program according to the string to obtain a restored BIOS program, and wherein the PLD is specifically configured to:
acquiring a sub-character string from the character string, wherein the length of the sub-character string is greater than zero and less than or equal to the length of the character string;
performing first logic operation on the substring to obtain a converted substring; performing a second logic operation on the converted BIOS program by using the converted substring to obtain the restored BIOS program; alternatively, the first and second electrodes may be,
performing a third logic operation on the converted BIOS program, and performing a fourth logic operation on the converted BIOS program subjected to the third logic operation by using the substring to obtain the restored BIOS program; alternatively, the first and second electrodes may be,
performing a fifth logical operation on the substring to obtain the converted substring; performing a sixth logical operation on the converted BIOS program, and performing a seventh logical operation on the converted BIOS program subjected to the sixth logical operation by using the converted substring to obtain the restored BIOS program; alternatively, the first and second electrodes may be,
and carrying out eighth logic operation on the converted BIOS program by utilizing the sub-character string to obtain the restored BIOS program.
19. The computer device of claim 13, wherein the PLD translates the expected storage address according to the string, the PLD being further configured to:
acquiring a sub-character string from the character string, wherein the length of the sub-character string is greater than zero and less than or equal to the length of the character string;
performing first logic operation on the substring to obtain a converted substring; performing a second logic operation on the expected storage address by using the converted substring to obtain the converted storage address; alternatively, the first and second electrodes may be,
performing a third logical operation on the expected storage address, and performing a fourth logical operation on the expected storage address subjected to the third logical operation by using the substring to obtain the converted storage address; alternatively, the first and second electrodes may be,
performing a fifth logical operation on the substring to obtain the converted substring; performing a sixth logical operation on the expected storage address, and performing a seventh logical operation on the expected storage address subjected to the sixth logical operation by using the converted substring to obtain the converted storage address; alternatively, the first and second electrodes may be,
and carrying out eighth logic operation on the expected storage address by utilizing the substring to obtain the converted storage address.
20. A computer device, characterized in that the computer device comprises: the CPU is connected with the BIOS chip through the PLD, and the storage chip is connected with the PLD;
the PLD is used for receiving a program reading instruction sent by the CPU and acquiring an expected storage address carried by the program reading instruction, the program reading instruction is used for reading a BIOS program from the BIOS chip, and the BIOS program is used for being executed by the CPU to complete the initialization of the computer equipment;
the PLD is also used for reading the character strings stored in the storage chip;
the PLD is further configured to convert the expected storage address according to the character string to obtain a converted storage address, and read the BIOS program from the converted storage address, wherein the converted storage address is different from the expected storage address;
the PLD is further used for sending the BIOS program to the CPU.
21. A program writing method, the method comprising:
receiving a Basic Input Output System (BIOS) program sent by a Central Processing Unit (CPU) in computer equipment by a Programmable Logic Device (PLD) in the computer equipment, wherein the BIOS program is used for being executed by the CPU to complete the initialization of the computer equipment;
the PLD reads a character string stored in a storage chip connected with the PLD;
and the PLD converts the BIOS program according to the character string to obtain a converted BIOS program, and stores the converted BIOS program into a BIOS chip in the computer equipment, wherein the converted BIOS program is different from the BIOS program before conversion.
22. The method of claim 21, wherein the PLD storing the converted BIOS program in the BIOS chip comprises:
the PLD acquires an expected storage address of the BIOS program sent by the CPU in the BIOS chip;
the PLD stores the converted BIOS program to the expected storage address.
23. The method of claim 21, wherein the PLD storing the converted BIOS program in the BIOS chip comprises:
acquiring an expected storage address of the BIOS program in the BIOS chip, which is sent by the CPU;
the PLD converts the expected storage address according to the character string to obtain a converted storage address;
the PLD stores the converted BIOS program to the converted storage address, wherein the converted storage address is different from the expected storage address.
24. The method of claim 21, wherein the PLD converting the BIOS program according to the string to obtain a converted BIOS program comprises:
the PLD takes the character string as a first index, takes the data included by the BIOS program as a second index, and inquires the converted BIOS program in a program mapping table;
the program mapping table is a two-dimensional index table and stores converted BIOS programs corresponding to the character strings and the data included by the BIOS programs.
25. The method of claim 23, wherein the PLD translating the expected memory address according to the string comprises:
the PLD takes the character string as a first index, takes data included by the expected storage address as a second index, and inquires the converted storage address in an address mapping table;
the address mapping table is a two-dimensional index table and stores converted storage addresses corresponding to data included in the character strings and the expected storage addresses.
26. A program writing method, the method comprising:
receiving a Basic Input Output System (BIOS) program sent by a Central Processing Unit (CPU) in the computer equipment and an expected storage address of the BIOS program in the BIOS chip by a Programmable Logic Device (PLD) in the computer equipment, wherein the BIOS program is used for being executed by the CPU to complete the initialization of the computer equipment;
the PLD reads a character string stored in a storage chip connected with the PLD;
the PLD converts the expected storage address according to the character string to obtain a converted storage address, wherein the converted storage address is different from the expected storage address;
and the PLD stores the BIOS program to the converted storage address.
27. A program reading method, comprising:
receiving a program reading instruction sent by a Central Processing Unit (CPU) in computer equipment by a Programmable Logic Device (PLD) in the computer equipment, wherein the program reading instruction is used for reading an original BIOS program from a Basic Input Output System (BIOS) chip in the computer equipment, and the original BIOS program is used for being executed by the CPU to complete the initialization of the computer equipment;
the PLD reads a character string stored in a storage chip connected with the PLD;
the PLD reads the converted BIOS program from the BIOS chip and restores the converted BIOS program according to the character string to obtain a restored BIOS program, wherein the converted BIOS program is obtained by converting the original BIOS program by the PLD according to the character string and storing the converted BIOS program in the BIOS chip; the converted BIOS program is different from the original BIOS program;
and the PLD sends the restored BIOS program to the CPU.
28. The method of claim 27, wherein reading the converted BIOS program from the BIOS chip by the PLD comprises:
the PLD acquires an expected storage address carried by the program reading instruction;
the PLD reads the translated BIOS program stored in the expected storage address.
29. The method of claim 27, wherein reading the converted BIOS program from the BIOS chip by the PLD comprises:
the PLD acquires an expected storage address carried by the program reading instruction;
the PLD converts the expected storage address according to the character string to obtain a converted storage address, wherein the converted storage address is different from the expected storage address;
the PLD reads the translated BIOS program stored in the translated storage address.
30. The method of claim 27, wherein the PLD restoring the converted BIOS program according to the string to obtain a restored BIOS program comprises:
the PLD takes the character string as a first index, takes the data included in the converted BIOS program as a second index, and inquires the restored BIOS program in a program mapping table;
the program mapping table is a two-dimensional index table and stores the character strings and the converted BIOS program corresponding to the data included in the restored BIOS program.
31. The method of claim 29, wherein the PLD translating the expected memory address according to the string comprises:
the PLD takes the character string as a first index, takes data included by the expected storage address as a second index, and inquires the converted storage address in an address mapping table;
the address mapping table is a two-dimensional index table and stores converted storage addresses corresponding to data included in the character strings and the expected storage addresses.
32. A program reading method, comprising:
receiving a program reading instruction sent by a Central Processing Unit (CPU) in computer equipment by a Programmable Logic Device (PLD) in the computer equipment, and acquiring an expected storage address carried by the program reading instruction, wherein the program reading instruction is used for reading a Basic Input Output System (BIOS) program from a BIOS chip, and the BIOS program is used for being executed by the CPU to complete initialization of the computer equipment;
the PLD reads a character string stored in a storage chip connected with the PLD;
the PLD converts the expected storage address according to the character string to obtain a converted storage address, and reads the BIOS program from the converted storage address, wherein the converted storage address is different from the expected storage address;
and the PLD sends the BIOS program to the CPU.
CN201610826611.0A 2016-09-14 2016-09-14 Computer device, program writing method, and program reading method Active CN107832086B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610826611.0A CN107832086B (en) 2016-09-14 2016-09-14 Computer device, program writing method, and program reading method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610826611.0A CN107832086B (en) 2016-09-14 2016-09-14 Computer device, program writing method, and program reading method

Publications (2)

Publication Number Publication Date
CN107832086A CN107832086A (en) 2018-03-23
CN107832086B true CN107832086B (en) 2020-03-20

Family

ID=61643675

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610826611.0A Active CN107832086B (en) 2016-09-14 2016-09-14 Computer device, program writing method, and program reading method

Country Status (1)

Country Link
CN (1) CN107832086B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7191967B2 (en) 2018-06-30 2022-12-19 華為技術有限公司 NVMe-based data reading method, apparatus and system
CN111542803B (en) 2018-06-30 2021-10-01 华为技术有限公司 NVMe-based data writing method, device and system
CN109254799B (en) * 2018-08-29 2023-03-10 新华三技术有限公司 Boot program starting method and device and communication equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1543602A (en) * 2001-08-06 2004-11-03 System and method for booting from a non-volatile application and file storage device
TW200841234A (en) * 2007-04-11 2008-10-16 Insyde Software Corp Method of protecting write-in of ROMs
CN102955919A (en) * 2012-11-21 2013-03-06 浪潮集团有限公司 Encipherment protection method of BIOS (basic input output system) chip
CN103235921A (en) * 2013-04-24 2013-08-07 华为技术有限公司 Computer system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1543602A (en) * 2001-08-06 2004-11-03 System and method for booting from a non-volatile application and file storage device
TW200841234A (en) * 2007-04-11 2008-10-16 Insyde Software Corp Method of protecting write-in of ROMs
CN102955919A (en) * 2012-11-21 2013-03-06 浪潮集团有限公司 Encipherment protection method of BIOS (basic input output system) chip
CN103235921A (en) * 2013-04-24 2013-08-07 华为技术有限公司 Computer system

Also Published As

Publication number Publication date
CN107832086A (en) 2018-03-23

Similar Documents

Publication Publication Date Title
US11636049B2 (en) Memory protection with hidden inline metadata
EP3358465B1 (en) In-vehicle control device, program update system, and program update software
ES2710887T3 (en) Use of indirect data address words of extended asynchronous data mover
KR102208072B1 (en) Data processing system
US9813079B2 (en) High-throughput compression of data
CN107832086B (en) Computer device, program writing method, and program reading method
US20150103598A1 (en) Protection against side-channel attacks on non-volatile memory
CN104079613A (en) Method and system for multiple tenants to share application program objects
CN111459844A (en) Data storage device and method for accessing logical-to-physical address mapping table
CN108073528B (en) Storage in non-volatile memory
CN111338565A (en) Generating random values based on noise characteristics of memory cells
CN112035857B (en) Data protection method, device, equipment and medium
US11048644B1 (en) Memory mapping in an access device for non-volatile memory
US20130159624A1 (en) Storing the most significant and the least significant bytes of characters at non-contiguous addresses
Chen et al. A cross-layer plausibly deniable encryption system for mobile devices
US11307991B2 (en) Apparatus and method and computer program product for generating a storage mapping table
US10860707B2 (en) Systems and methods for obfuscation of password key and dynamic key pool management
CN114077559B (en) Method and apparatus for access management of storage device
US11994985B2 (en) Method and apparatus for performing access management of memory device in host performance booster architecture with aid of device side table information encoding and decoding
US11995349B2 (en) Method and apparatus for performing access management of memory device in host performance booster architecture with aid of device side table information encoding and decoding
US20240111670A1 (en) Method and apparatus for performing access management of memory device in host performance booster architecture with aid of device side table information encoding and decoding
US20240111451A1 (en) Method and apparatus for performing access management of memory device in host performance booster architecture with aid of device side table information encoding and decoding
WO2016095103A1 (en) Storage space management method and device
CN113536331B (en) Data security for memory and computing systems
CN110489209B (en) Information processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20211129

Address after: 215010 room 704, building 5, No. 556, Changjiang Road, high tech Zone, Suzhou, Jiangsu

Patentee after: SUZHOU YUDESHUI ELECTRICAL TECHNOLOGY Co.,Ltd.

Address before: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen

Patentee before: HUAWEI TECHNOLOGIES Co.,Ltd.