Channel register initialization method, device, DMA device, and terminal

The CPU protects the channel register initialization information of the DMA device and generates data movement instructions for unprotection processing, which solves the problem that traditional DMA devices are easily hijacked and improves system security.

CN108446137BActive Publication Date: 2024-08-23NATIONZ TECH INC
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN201810161671.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2018-02-26
Publication Date
2024-08-23
Estimated Expiration
2038-02-26

AI Technical Summary

Technical Problem

Traditional DMA devices are easily hijacked by attackers, thus affecting system security and causing data to be moved under the control of the attacker.

Method used

The CPU configures the initialization information of the channel register, and protects this information according to the protection processing rules to generate data movement instructions. The instruction processor of the DMA device receives and deprotects these instructions to write to the channel register to ensure that the initialization information is not direct exposure.

Benefits of technology

It realizes the safe initialization of DMA device channel register, prevents hijacking by attackers, and improves the security of the system and the reliability of data movement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN108446137B
    Figure CN108446137B
Patent Text Reader

Abstract

The present invention discloses a channel register initialization method, device, DMA device, and terminal. The channel register in the DMA device is initialized by the channel register initialization method provided in this embodiment. The DMA device no longer receives direct initialization information, but data move instructions that have been processed for protection. The initialization information is not directly exposed. This embodiment also provides a channel register initialization device, DMA device, and terminal. Since the deprotection processing rules correspond to the protection processing rules, only the data move instructions obtained by the protection processing rules can be successfully deprotected by the instruction processor to obtain the initialization information. Therefore, the two processes of protection processing and deprotection processing cooperate with each other, which can realize the authentication of the source of the data move instruction, realize the monitoring of DMA data movement, ensure the legitimacy of the data move requester, and thus improve the security of the system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of security technology, and more specifically to a channel register initialization method, device, DMA equipment and terminal. Background Art

[0002] Direct Memory Access (DMA) refers to a technology that allows data to be exchanged directly between storage devices without the intervention of the CPU. DMA devices are responsible for data transfer in the system and are an important part of the system data path. The data they transfer can be a program or ordinary data; they can transfer data between an external storage device and the terminal memory, or between one external storage device and another.

[0003] In traditional DMA, the DMA device obtains the initialization information such as the source address, destination address and size of the data to be moved from the bus, and then initializes its internal channel registers according to these initialization information, so that after the initialized channel register obtains the right to use the DMA device switchboard interface, it automatically moves data according to the corresponding source address, destination address and other information. However, the DMA device does not have the ability to identify the source of the initialization information. Therefore, if the attacker obtains the working process and protocol of the DMA device through various attack methods, such as network attacks and side channel attacks, it is possible to hold the DMA device hostage. At this time, the initialization information such as the source address, destination address and data volume all come from the attacker, not the CPU. In this way, the attacker may bypass the monitoring of the CPU and the operating system and implant the attack program in the memory. After the attack program is implanted in the memory, the CPU will execute these programs at a specific time, thereby being attacked and the system security is threatened.

[0004] Therefore, there is an urgent need to provide a solution to avoid the problem of DMA devices being hijacked and threatening system security. Summary of the invention

[0005] The technical problem to be solved by the present invention is to solve the problem that traditional DMA devices are easily hijacked and data is moved under the control of the attacker, affecting system security. In view of this technical problem, a channel register initialization method, device, DMA device and terminal are provided.

[0006] In order to solve the above technical problems, the present invention provides a channel register initialization method, which is applied to a central processing unit (CPU). The channel register initialization method comprises:

[0007] The CPU configures initialization information for a channel register in a direct memory access (DMA) device according to a data transfer task, wherein the initialization information includes information for indicating at least one of a source address and a destination address in the data transfer task;

[0008] The CPU performs protection processing on the initialization information according to the protection processing rule to obtain a data moving instruction;

[0009] The CPU sends the data moving instruction to the DMA device, so that the DMA device initializes the channel register based on the data moving instruction.

[0010] Furthermore, the present invention provides a channel register initialization method, which is applied to a direct memory access DMA device, and the channel register initialization method comprises:

[0011] The instruction interaction interface of the DMA device receives a data movement instruction;

[0012] The instruction processor of the DMA device performs deprotection processing on the data moving instruction according to the deprotection processing rule to obtain initialization information corresponding to the data moving task, wherein the initialization information includes information for indicating at least one of a source address and a destination address in the data moving task;

[0013] The instruction processor writes the initialization information into an idle channel register in the DMA device to implement the initialization of the channel register.

[0014] Optionally, after the instruction interaction interface of the DMA device receives the data moving instruction, the method further comprises: the instruction interaction interface stores the data moving instruction in the instruction buffer of the DMA device;

[0015] Before the instruction processor of the DMA device performs deprotection processing on the data moving instruction according to the deprotection processing rule, the instruction processor also includes: reading the data moving instruction from the instruction buffer.

[0016] Optionally, the instruction processor of the DMA device performs deprotection processing on the data moving instruction according to a deprotection processing rule, including:

[0017] If the deprotection processing rule includes a decoding rule, the instruction processor performs decoding processing on the data moving instruction according to the decoding rule;

[0018] If the deprotection processing rule includes a decryption rule, the instruction processor decrypts the data moving instruction according to the decryption rule;

[0019] If the deprotection processing rules include both decoding rules and decryption rules, the instruction processor first decodes the data move instruction according to the decoding rules, and then decrypts the decoding result according to the decryption rules; or, the instruction processor first decrypts the data move instruction according to the decryption rules, and then decodes the decryption result according to the decoding rules.

[0020] Optionally, the instruction processor writes the initialization information into an idle channel register in the DMA device, including:

[0021] The instruction processor determines the type of the data movement instruction;

[0022] If the data move instruction is a delayed data move instruction, the instruction processor writes the initialization information into the peripheral information register;

[0023] After receiving the hardware request signal from the external storage device, the instruction processor reads the initialization information from the peripheral information register and selects one of the idle channel registers in the DMA device to write the initialization information.

[0024] Optionally, after the instruction processor determines the type of the data move instruction, the instruction processor further includes:

[0025] If the data movement instruction is an immediate data movement instruction, then after obtaining the initialization information, the instruction processor directly selects one from the idle channel registers in the DMA device to write the initialization information.

[0026] Optionally, each peripheral information register in the DMA device corresponds to each external storage device connected to the bus; the instruction processor writes the initialization information into the peripheral information register, including:

[0027] The instruction processor determines the external storage device targeted by the delayed data migration instruction according to the external storage device identification information in the initialization information;

[0028] The instruction processor writes the initialization information into the peripheral information register corresponding to the external storage device.

[0029] Furthermore, the present invention provides a channel register initialization device, comprising:

[0030] A configuration module, configured to configure initialization information for a channel register in a direct memory access (DMA) device according to a data transfer task, wherein the initialization information includes information for indicating at least one of a source address and a destination address in the data transfer task;

[0031] A protection module, used for performing protection processing on the initialization information according to a protection processing rule to obtain a data migration instruction;

[0032] The interaction module is used to send the data moving instruction to the DMA device, so that the DMA device can initialize the channel register based on the data moving instruction.

[0033] Furthermore, the present invention provides a DMA device, comprising an instruction interaction interface, a channel register and an instruction processor;

[0034] The instruction interaction interface is used to receive data movement instructions; the instruction processor is used to perform deprotection processing on the data movement instructions according to the deprotection processing rules, obtain the initialization information corresponding to the data movement task, and write the initialization information into the idle channel register in the DMA device to implement the initialization of the channel register. The initialization information includes information for indicating at least one of the source address and the destination address in the data movement task.

[0035] Optionally, the DMA device also includes an instruction cache, which is communicatively connected to the instruction processor and the instruction interaction interface respectively; the instruction cache is used to cache data movement instructions received by the instruction interaction interface for the instruction processor to read and perform deprotection processing according to the deprotection processing rules.

[0036] Optionally, the instruction interaction interface is a slave interface of the DMA device.

[0037] Optionally, the instruction processor includes at least one of a decoding module and a decryption module; the decoding module is used to decode the received information according to a decoding rule, and the decryption module is used to decrypt the received information according to a decryption rule.

[0038] Optionally, the DMA device further comprises a peripheral information register; the peripheral information register is communicatively connected with the instruction processor;

[0039] The instruction processor is used to perform deprotection processing on the data move instruction according to the deprotection processing rules, determine the type of the data move instruction after obtaining the initialization information, and write the initialization information into the peripheral information register when determining that the data move instruction is a delayed data move instruction; after receiving a hardware request signal from the external storage device, read the initialization information from the peripheral information register, and select one from the idle channel registers in the DMA device to write the initialization information.

[0040] Optionally, the instruction processor is further configured to directly select one from the idle channel registers in the DMA device to write the initialization information when determining that the data move instruction is an immediate data move instruction.

[0041] Optionally, each of the peripheral information registers in the DMA device corresponds one-to-one to each external storage device connected to the bus; the instruction processor is used to determine the external storage device targeted by the delayed data move instruction based on the external storage device identification information in the initialization information, and write the initialization information into the peripheral information register corresponding to the external storage device.

[0042] Furthermore, the present invention provides a terminal, comprising a bus and a DMA device as described in any one of the above items, wherein an instruction interaction interface of the DMA device is connected to the bus.

[0043] Furthermore, the present invention provides a storage medium, characterized in that the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the channel register initialization method described in the first item above.

[0044] Beneficial Effects

[0045] The present invention provides a channel register initialization method, device, DMA device, and terminal. In view of the problem that traditional DMA devices are easily hijacked by attackers to move data that affects system security, this embodiment provides a channel register initialization method. The CPU configures initialization information for the channel register in the DMA device according to the data transfer task, and the initialization information includes information for indicating at least one of the source address and the destination address in the data transfer task; then, the CPU performs protection processing on the initialization information according to the protection processing rule to obtain a data transfer instruction, and sends the data transfer instruction to the DMA device. After receiving the data transfer instruction, the instruction interaction interface of the DMA device transmits it to the instruction processor. The instruction processor performs deprotection processing on the data transfer instruction according to the deprotection processing rule to obtain the initialization information corresponding to the data transfer task, and then the instruction processor writes the initialization information into the idle channel register in the DMA device to realize the initialization of the channel register. The channel register in the DMA device is initialized by the channel register initialization method provided by this embodiment. The DMA device no longer receives direct initialization information, but a data transfer instruction that has been protected. The initialization information is not directly exposed. This embodiment also provides a channel register initialization device, a DMA device, a terminal and a storage medium. Since the deprotection processing rules correspond to the protection processing rules, only the data move instructions processed by the protection processing rules can be successfully deprotected by the instruction processor to obtain the initialization information. Therefore, the two processes of protection processing and deprotection processing cooperate with each other to realize the authentication of the source of the data move instruction, realize the monitoring of DMA data movement, ensure the legitimacy of the data move requester, and thus improve the security of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] The present invention will be further described below with reference to the accompanying drawings and embodiments, in which:

[0047] Figure 1 A schematic diagram of the structure of a traditional DMA device;

[0048] Figure 2 A flow chart of a channel register initialization method provided in Embodiment 1 of the present invention;

[0049] Figure 3 A schematic diagram of the structure of a DMA device provided in Embodiment 1 of the present invention;

[0050] Figure 4 Another structural schematic diagram of the DMA device provided in the first embodiment of the present invention;

[0051] Figure 5 A flow chart of an instruction processor writing initialization information into a channel register in Embodiment 1 of the present invention;

[0052] Figure 6 A schematic diagram of the structure of a DMA device provided in Embodiment 2 of the present invention;

[0053] Figure 7 A flow chart of a channel register initialization method provided in Embodiment 2 of the present invention;

[0054] Figure 8 A schematic diagram of the structure of a DMA device provided in Embodiment 3 of the present invention;

[0055] Fig. 9 A flow chart of a channel register initialization method provided in Embodiment 3 of the present invention;

[0056] Fig.10 A schematic diagram of the structure of a terminal provided in Embodiment 4 of the present invention;

[0057] Fig.11 A schematic diagram of the structure of a channel register initialization device provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION

[0058] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0059] Before introducing the various solutions of the present invention, the structure of a common DMA device and its data transfer process are briefly described here. Figure 1 :

[0060] The DMA device 10 includes a controller 101, a host interface 102, a slave interface 103, a channel register 104 and an internal cache 105. The internal cache 105 is connected to the host interface 102 in communication. At the same time, the slave interface 103 and the host interface 102 are both connected to the system bus in communication. The slave interface 103 acts as a slave on the bus to receive bus requests from the CPU, such as initialization information for initializing the channel register, or a request to query the channel register information in the DMA device. The host interface 102 acts as a master on the bus to realize data movement, such as initiating a bus read operation to read the source address data and cache it in the internal cache 105, or initiating a bus write operation to write the data in the internal cache 105 to the destination address.

[0061] The slave interface 103 is connected to the channel register 104 in communication. After the slave interface 103 obtains the initialization information from the bus, it can be written into the channel register 104. When the channel register 104 obtains the right to use the host interface 102, the controller 101 will read the initialization information in the channel register 104 and write it into the host interface 102, initialize the host interface 102, and control the host interface 102 to implement the corresponding data moving task according to the written initialization information. Usually, only the initialization information corresponding to one data moving request can be written into a channel register 104. Therefore, the channel register 104 that has been written with the initialization information and has not yet completed the corresponding data moving task is occupied. If there is currently a data moving task, it can only be written to those idle channel registers 104 that have not yet been written with the initialization information. The DMA device 10 may include one or more channel registers 104, which may be collectively referred to as a "channel register stack". Although the channel register stack may store initialization information corresponding to multiple data transfer tasks at the same time, in fact, the host interface 102 can only execute one data transfer task at the same time. Therefore, at the same time, at most one channel register 104 has the right to use the host interface 102. In order to determine which channel register 104 has the right to use the host interface 102 at the current time, the DMA device 10 also includes a channel arbitrator ( Figure 1 The channel arbiter is used to manage the right to use the host interface 102.

[0062] Normally, there is a need for data movement not only in the CPU, but also in the external storage device (hereinafter referred to as “peripheral device”) connected to the bus. The CPU can directly send the initialization information to the slave interface 103 through the bus, and then the slave interface 103 writes the initialization information into the idle channel register 104 to initialize the channel register 104. However, the situation is different when the peripheral initiates a data movement request: when the peripheral needs the DMA device 10 to perform DMA data movement, it can send a hardware request signal to the controller 101, and the controller 101 controls the host interface 102 to access the peripheral device to obtain the initialization information corresponding to the data movement task. After obtaining the initialization information, the host interface 102 can write it into the idle channel register. In some examples, the host interface 102 can first send the obtained initialization information to the controller 101, and the controller 101 writes it into the idle channel register 104. However, in other examples, the host interface 102 can directly communicate with the channel register 104 and write the initialization information obtained from the peripheral device into an idle channel register 104.

[0063] It can be seen that when the traditional DMA device 10 initializes the channel register 104, the slave interface 103 or the host interface 102 obtains the initialization information to be written into the channel register 104 through the bus. Therefore, if the bus is monitored, the attacker may obtain the working process and the protocol used by the DMA device 10, and can send the initialization information by itself, thereby hijacking the DMA device 10 to move the data specified by the attacker to the location specified by the attacker, for example, hijacking the DMA device 10 to move the Trojan program to the terminal memory, and let the CPU read and execute the Trojan program to control the terminal.

[0064] Therefore, the traditional DMA device and its data migration process have great security risks. In order to improve the security of the terminal, the present invention provides a channel register initialization method, device, DMA device, and terminal. The channel register initialization method, terminal, and DMA device in the present invention are introduced through various embodiments below:

[0065] Embodiment 1:

[0066] The channel register initialization method of this embodiment can be executed by the CPU and the DMA device together. Figure 2 The process of initializing the channel register is introduced as follows:

[0067] S202: The CPU configures initialization information for a channel register in a direct memory access DMA device according to the data transfer task.

[0068] In this embodiment, the initialization information corresponding to the data moving task is sent by the CPU to the DMA device. Therefore, whether it is a data moving task from the CPU itself or a data moving task for a peripheral device, the initialization information of the channel register is configured by the CPU. In this embodiment, the initialization information is information used to indicate at least one of the source address and the destination address in each data moving task. For example, in some examples of this embodiment, the initialization information includes both the source address and the destination address of the data moving. In this case, after obtaining the initialization information, the DMA device may not need to obtain other information and can move data according to the initialization information. In other examples of this embodiment, the initialization information includes the source address of the data moving, but does not include the destination address. In this case, the DMA device may need to obtain the destination address of the data moving in other ways. For example, if the actual destination address of the data moving task is a peripheral device, the DMA device can receive a hardware request signal initiated by the peripheral device before executing the data moving task, and determine the destination address corresponding to the data moving task according to the hardware request signal. In some other examples, the initialization information includes the destination address but does not include the source address. In this case, the DMA device can also obtain the source address in other ways. For example, the DMA device first initializes the channel register according to the initialization information configured by the CPU. When a peripheral device needs to request the DMA device to move its internally stored data to the destination address specified in the initialization information, it can specify the source address of the data move to the DMA device through a hardware request signal.

[0069] It should be understood that the initialization information may include, in addition to information for specifying the source address and / or destination address corresponding to the data transfer task to the DMA device, information for specifying the amount of data to be transferred, as well as control information during the data transfer process, such as information on the data bits read each time during the data transfer process.

[0070] S204: The CPU performs protection processing on the initialization information according to the protection processing rule to obtain a data moving instruction.

[0071] After the CPU configures the initialization information for initializing the channel register, it can first perform protection processing on the initialization information to obtain the data moving instruction, so that the initialization information is not directly exposed to the bus and is directly monitored by the malicious attacker, thereby giving the malicious attacker an opportunity to understand the initialization process of the DMA device. In this embodiment, the CPU can perform protection processing on the initialization information by encoding it according to a preset encoding rule, or by encrypting it according to a preset encryption rule. Of course, in order to further improve the security of the initialization information, it can be protected and encoded and encrypted at the same time. When the protection processing includes encoding and encryption processing at the same time, the protection processing rules include encoding rules and encryption rules at the same time. The CPU can first encode the initialization information according to the encoding, and then encrypt the obtained information according to the encryption rules, thereby obtaining the data moving instruction. Of course, the CPU can also first encrypt the initialization information according to the preset encryption rules, and then encode the encrypted information according to the encoding rules, thereby obtaining the data moving instruction.

[0072] In some examples of this embodiment, the CPU will encode and encrypt the initialization information at the same time. Unlike the above scheme, the data moving instruction may include two parts of information. The first part is the encoded information obtained by encoding the initialization information according to the preset encoding rule; the second part is the encrypted information obtained by encrypting the initialization information according to the preset encryption rule. In this way, when the DMA device receives the data moving instruction, it needs to decode the first part of the information in the data moving instruction according to the decoding rule corresponding to the CPU side encoding rule to obtain the first initialization information. In addition, it is necessary to decrypt the second part of the information according to the decryption rule corresponding to the CPU side encryption rule to obtain the second initialization information. In order to ensure security, the DMA device can initialize the channel register according to the obtained initialization information only when the first initialization information is consistent with the second initialization information.

[0073] S206: The CPU sends the data moving instruction to the instruction interaction interface of the DMA device.

[0074] In this embodiment, the data movement instruction received by the instruction interaction interface of the DMA device comes from the CPU, but it can be understood that in other examples, the data movement instruction can also be sent to the instruction interaction interface by other objects.

[0075] After the CPU performs protection processing on the initialization information to obtain a data moving instruction, the data moving instruction can be sent to the DMA device. In order to facilitate those skilled in the art to understand the initialization method of the channel register, the structure of the DMA device provided in this embodiment is briefly introduced here. Figure 3 :

[0076] The DMA device 30 includes an instruction interaction interface 301, a channel register 302, and an instruction processor 303, wherein the instruction processor 303 is respectively connected to the instruction interaction interface 301 and the channel register 302. In an example of this embodiment, the CPU can transmit data movement instructions to the DMA device through the system bus. On the DMA device 30 side, the instruction interaction interface 301 can receive the data movement instructions sent by the CPU from the bus, and then transmit the data movement instructions to the instruction processor 303. It should be understood that the instruction interaction interface 301 and the instruction processor 303 in the DMA device 30 can be directly connected to each other, such as Figure 3 As shown, after receiving the data movement instruction, the instruction interaction interface 301 directly transmits it to the instruction processor 303 .

[0077] In addition, the instruction interaction interface in the DMA device and the instruction processor may also be indirectly connected in communication. In some examples of this embodiment, for example Figure 4 As shown, the DMA device 40 includes, in addition to the instruction interaction interface 401, the channel register 402 and the instruction processor 403, an instruction buffer 404. After the instruction interaction interface 401 receives the data move instruction, it first buffers the data move instruction into the instruction buffer 404 of the DMA device 40, so that the instruction processor 403 reads the data move instruction from the instruction buffer 404 for deprotection processing when the processing conditions are met. Therefore, the DMA devices (such as Figure 3 In the DMA device 30 shown in FIG. 1 , the instruction interaction interface is directly connected to the instruction processor, while in other examples, the DMA devices provided (such as Figure 4 In the DMA device 40 shown in the figure, an instruction buffer is provided between the instruction interaction interface and the instruction processor to temporarily buffer the data movement instructions received by the instruction interaction interface. It is understandable that the instruction buffer needs to follow the principle of "cannot write when full, cannot read when empty".

[0078] S208: The instruction processor of the DMA device performs deprotection processing on the data moving instruction according to the deprotection processing rule, and obtains initialization information corresponding to the data moving task.

[0079] The deprotection processing process of the DMA device for the data protection instruction and the protection processing process of the CPU for the initialization information are two opposite processes, and the deprotection processing rules are also matched with the protection processing rules. If the protection processing is to encode the initialization information according to the preset encoding rules, the deprotection processing is to decode the data moving instruction according to the decoding rules corresponding to the encoding rules, so as to obtain the original initialization information. If the protection processing is to encrypt the initialization information according to the preset encryption rules, the deprotection processing process is to decrypt the data moving instruction according to the preset decryption rules to obtain the initialization information. Of course, if the CPU encodes the initialization information and then encrypts it, the instruction processor should first decrypt the data moving instruction and then decode it to obtain the initialization information. If the CPU first encrypts the initialization information and then encodes the encrypted information, the instruction processor of the DMA device should first decode the data moving instruction according to the decoding rules, and then decrypt the decoded information according to the decryption rules, so as to obtain the initialization information.

[0080] Since the CPU can perform various protection processes on initialization information, the instruction processor can also perform various deprotection processes on data movement instructions, as long as the rules used by the two correspond to each other and the initialization information can be protected while ensuring that the instruction processor can restore the information for initializing the channel registers.

[0081] S210: The instruction processor writes the initialization information into the idle channel register in the DMA device to implement the initialization of the channel register.

[0082] After the instruction processor obtains the initialization information according to the data movement instruction and the protection deprotection processing rules corresponding to the protection processing rules, the obtained initialization information can be written into the idle channel register in the DMA device to implement the initialization of the channel register, so that in the subsequent process the host interface of the DMA device can perform the corresponding data movement task according to the initialization information in the channel register.

[0083] It is understandable that after the instruction processor obtains the initialization information, it can immediately write it into an idle channel register in the channel register stack, or it can first write the initialization information into other registers used to temporarily store the initialization information, and then read the initialization information from these temporary registers and write it into the idle channel register when the conditions are met. For example, in some examples of this embodiment, the instruction processor will decide whether to immediately write the initialization information into the channel register according to the type of data movement instruction, see Figure 5 :

[0084] S502: The instruction processor determines whether the type of the data movement instruction is an immediate data movement instruction.

[0085] If the judgment result is yes, then enter S504. Otherwise, execute S506. In these examples, the data moving instructions are divided into immediate data moving instructions and delayed data moving instructions, wherein the immediate data moving instructions are usually initiated due to the data moving needs of the CPU, requiring the DMA device to respond as soon as possible to complete the data moving task. Usually, the initialization information corresponding to the immediate data moving instruction includes the source address, the destination address, the amount of data to be moved, and the control information. The delayed data moving instruction is initiated for the peripheral device, and the delayed data moving instruction cannot control the DMA device alone to complete the data moving task, because it needs to cooperate with the hardware request signal sent by the peripheral device to the instruction processor. Therefore, the data moving instruction sent by the CPU is only to pre-specify to the DMA device part of the information in the data moving task, such as the source address or the destination address. In some examples, it can further include the amount of data to be moved, and even control information.

[0086] In some examples of this embodiment, the DMA device can determine the type of the data move instruction based on the initialization information obtained after deprotecting the data move instruction. If the initialization information is complete and no other information needs to be obtained, the instruction is an immediate data move instruction; if the initialization information lacks one or more information necessary to perform the data move task and needs to be obtained in other ways, the data move instruction is a delayed data move instruction. In other examples of this embodiment, the CPU can carry identification information used to characterize the type when generating the data move instruction, for example, "1" is used to characterize the type of the data move instruction as an immediate data move instruction, and "0" is used to characterize the delayed data move instruction.

[0087] S504: The instruction processor directly selects one of the idle channel registers to write the initialization information.

[0088] If the data move instruction is an immediate data move instruction, the instruction processor directly selects a write initialization information from an idle channel register in the DMA device after obtaining the initialization information. In some examples of this embodiment,

[0089] S506: The instruction processor writes the initialization information into the peripheral information register.

[0090] In some examples of this embodiment, the DMA device is provided with a peripheral information register for temporarily storing initialization information, see Figure 6DMA device 60 includes instruction interaction interface 601, channel register 602, instruction processor 603, instruction buffer 604 and peripheral information register 605. Peripheral information register 605 is in communication with instruction processor 603. When instruction processor 603 reads a data moving instruction from instruction buffer 604 and after deprotection processing, it is determined that the data moving instruction is a delayed data moving instruction. Therefore, instruction processor 603 can store initialization information obtained by deprotection processing into peripheral information register 605.

[0091] It is understandable that there may be multiple peripherals connected to the system bus. In this case, the data moving instruction will carry identification information indicating the peripheral to which the data moving instruction is directed. For example, if a delayed data moving instruction is sent to peripheral A, the instruction carries "A", and another delayed data moving instruction is sent to peripheral B, the instruction carries "B" to inform the DMA device that the delayed data moving instruction is initiated for peripheral B. In this way, when the DMA device writes the initialization information corresponding to the data moving instruction into the peripheral information register, it can distinguish and store it according to the different peripherals, so that after receiving the hardware request signal of the peripheral subsequently, it can accurately read the initialization information corresponding to the peripheral.

[0092] In some examples of the embodiments, each peripheral information register of the DMA device can be open to all peripherals. For example, for one of the peripheral information registers, it can store initialization information for peripheral A and initialization information for peripheral B. However, in the peripheral information register, different storage spaces are allocated to different peripherals. Or the peripheral information register can carry corresponding peripheral identification information in the stored initialization information. In this way, when it is necessary to read the initialization information for a certain peripheral, the instruction processor can extract it from the corresponding position, or read the initialization information carrying the peripheral identification information.

[0093] In some other examples of this embodiment, each peripheral information register in the DMA device uniquely corresponds to a peripheral. For example, four peripherals A, B, C, and D can be connected to the system bus. Correspondingly, the DMA device also includes four peripheral information registers a, b, c, and d, wherein the peripheral information register a is used to store the initialization information corresponding to the data moving task for the peripheral A, and the peripheral information register b is used to store the initialization information corresponding to the data moving task for the peripheral B... and so on. Therefore, when the instruction processor determines that a certain data moving instruction belongs to a delayed data moving instruction, and determines that the delayed data moving instruction is for the peripheral C, the corresponding initialization information can be written into the peripheral information register c. In this embodiment, the peripheral information register allocates 4 registers for each peripheral to store the address and control information of the channel. Each peripheral information register has a default value. If there is initialization information that needs to be written into a certain peripheral information register, the current information can be used to overwrite the old information in the peripheral information register.

[0094] S508: After receiving the hardware request signal from the external storage device, the instruction processor reads the initialization information from the peripheral information register and selects one of the idle channel registers in the DMA device to write the initialization information.

[0095] When a peripheral has a data movement requirement, it can send a hardware request signal to the DMA device. After receiving the hardware request signal, the instruction processor in the DMA device determines which peripheral initiated the hardware request signal, and then reads the previously stored initialization information from the corresponding peripheral information register. Then, it selects a currently idle channel register in the channel register stack to write the read initialization information to complete the initialization of the channel register.

[0096] The channel register initialization method and DMA device provided in this embodiment add an instruction processor between the instruction interaction interface of the DMA device and the channel register, so that the CPU can first protect the initialization information before sending it down, so as to avoid direct exposure of the initialization information when it is transmitted on the bus, and prevent the attacker from understanding the initialization process of the channel register by monitoring the bus, thereby ensuring the reliability of the DMA device in data movement and improving the system security.

[0097] Embodiment 2:

[0098] This embodiment will continue to introduce the process of the channel register initialization method on the DMA device side based on the first embodiment. Here, the data movement instruction issued by the CPU is an instant data movement instruction, and the instruction interaction interface is the slave interface of the DMA device. Figure 7 :

[0099] S701: The slave interface receives a data transfer instruction from the bus;

[0100] S702: The slave interface determines whether the instruction buffer is full;

[0101] If the instruction buffer is full, the slave interface cannot cache the received data move instruction into the instruction buffer. Therefore, if the judgment result is yes, S703 is executed; otherwise, S704 is executed.

[0102] S703: The slave interface feeds back to the CPU information indicating that the DMA device is temporarily unable to respond;

[0103] For example, in this embodiment, the slave interface may send a RETRY (retry) or SPLIT (leave) response to the CPU via the system bus, informing the CPU to resend the data movement instruction at an appropriate time.

[0104] S704: The slave interface writes the data moving instruction into the instruction buffer;

[0105] In this embodiment, the data movement instructions stored in the instruction cache are written by the slave interface and read by the instruction processor. The instruction cache adopts a first-in-first-out structure, and the instruction that first enters the instruction cache is read out first. Its empty and full signals are controlled by the read-write pointer, which is maintained internally by the instruction cache. The slave interface and the instruction processor only give read-write enable signals.

[0106] S705: The instruction processor determines whether there is an idle channel register;

[0107] If the judgment result is no, the instruction processor waits for a period of time and then continues to execute S705 , and if the judgment result is yes, the instruction processor reads a data move instruction from the instruction buffer and enters S706 .

[0108] S706: The instruction processor performs deprotection processing on the read data move instruction.

[0109] In some examples of the present embodiment, the instruction processor includes at least one of a decoding module and a decryption module. The decoding module is used to decode the received information according to the decoding rules, and the decryption module is used to decrypt the received information according to the decryption rules. It should be understood that when the instruction processor includes both the decoding module and the decryption module, the connection relationship between the decoding module and the decryption module will affect the deprotection processing flow. For example, if the decoding module is respectively connected to the instruction cache and the decryption module for communication, the deprotection processing flow is that the decoding module first decodes the data moving instruction according to the decoding rules, and then the decryption module decrypts the decoding result according to the decryption rules, thereby obtaining the initialization information.

[0110] In an example of this embodiment, the instruction processor only includes a decoding module, and the instruction processor can obtain corresponding initialization information after decoding the data move instruction read from the instruction cache according to the decoding rule.

[0111] S707: The instruction processor writes initialization information into an idle channel register.

[0112] When the instruction processor deprotects the data move instruction, it will determine its type. In this embodiment, since the data move instruction is an immediate data move instruction, after the instruction processor obtains the initialization information, it can directly write it into the idle channel register to complete the initialization of the channel register.

[0113] In some examples of the present embodiment, the channel arbiter manages the right to use the host interface on a "first in, first out" basis: the channel register that is initialized first obtains the right to use the host interface first, that is, the channel register currently at the top of the channel register stack has the right to use the host interface. After a channel register is initialized, it can apply to the channel arbiter for the right to use the host interface. If it is not currently allowed to use the host interface, the channel register can continue to apply until it obtains the right to use the host interface. If a channel register obtains the right to use the host interface, the controller of the DMA device can initialize the host interface according to the initialization information in the channel register, and start the host interface to perform the corresponding data movement task.

[0114] Generally, the direct memory storage data movement of DMA devices is divided into two processes: process one, reading data from the source address and writing it to the internal cache of the DMA device; process two, writing data from the internal cache of the DMA device to the specified destination address. In order to complete these two processes, the DMA device will request bus ownership twice. The data movement task can be successfully completed. In this case, the channel register releases the host interface, and the controller initializes the host interface according to the initialization information in the next channel register. The data movement task can also end in error. In this scenario, the host interface sends an error interrupt to the CPU, the channel register releases the host interface, and marks the channel register as idle, and the controller initializes the host interface according to the initialization information in the next channel register. The data movement task can also be retried or ended in blocks. At this time, the channel register releases the host interface and saves the current transmission information at the end of the channel register stack. At the same time, the controller initializes the host interface according to the initialization information in the next channel register. In addition, the data movement task can also be terminated early. At this time, the channel register releases the host interface and saves the current transmission information at the end of the channel register stack. The controller initializes the host interface according to the initialization information in the next channel register.

[0115] The channel register initialization method provided in this embodiment adds an instruction buffer for caching data movement instructions between the slave interface of the DMA device and the channel register, and an instruction processor for deprotecting the data movement instructions. The CPU will encode the initialization information of the channel register to form a data movement instruction, so as to avoid direct exposure of the initialization information to the outside when it is transmitted on the bus, thereby exposing the channel register initialization process of the DMA device. After the DMA device receives the protected initialization information, it needs to be decoded by the instruction processor to complete the deprotection of the initialization information and then complete the initialization of the channel register. This channel register initialization method improves the reliability of data movement of the DMA device and the security of the system.

[0116] Embodiment three:

[0117] In order to solve the problem in the prior art that when initializing the channel register in the DMA device, the initialization information is directly transmitted, which makes the DMA device easily hijacked by a malicious attacker, thereby moving the data specified by the malicious attacker and threatening the system security, this embodiment provides a DMA device. Figure 8 and Fig. 9 The structure of the DMA device and the initialization process of the channel register in the DMA device are introduced:

[0118] The DMA device 80 includes a slave interface 801, an instruction buffer 802, an instruction processor 803, a channel register 804, a peripheral information register 805, a controller 806, a host interface 807, and an internal cache 808. The slave interface 801 is connected to the instruction buffer 802. The instruction buffer 802 can be used to store the data movement instructions received by the slave interface 801 for reading by the instruction processor 803, and perform deprotection processing according to a preset deprotection processing rule. The instruction processor 803 is connected to the channel register 804 and the peripheral information register 805. After obtaining the initialization information for the channel register, the instruction processor 803 can choose to write the initialization information into the channel register 804 or the peripheral information register 805 according to the type of the data movement instruction. If the initialization information is written into the peripheral information register 805, when the instruction processor 803 receives the hardware request signal initiated by the corresponding peripheral, it can read the initialization information and write it into the channel register 804. The channel register 804 is in communication connection with the controller 806. The controller 806 can read out the initialization information in the channel register 804 that currently has the right to use the host interface 807, and initialize the host interface 807 according to the read information, so that the host interface 807 performs the data movement task corresponding to the initialization information after initialization.

[0119] The slave interface 801 and the host interface 807 are respectively used for communication connection with the system bus. The host interface 807 acts as a host on the bus to realize data movement, such as initiating a bus read operation to read the source address data and cache it in the internal cache 808, or initiating a bus write operation to write the data in the internal cache 808 to the destination address, etc. The host interface 807 includes a group of registers and a host interface state machine. The host interface 807 receives the data in the source address from the bus and reads it into the internal cache. When writing the bus, the data in the internal cache 808 is broadcast to the bus.

[0120] When the host interface 807 works in the transmission mode, it performs a read operation of a specified length and then performs a write operation of a specified length. At this time, the channel register 804 occupies the host interface 807 in a locked form, that is, when a certain channel register 804 has the right to use the host interface 807, other channel registers cannot apply for or occupy the host interface 807 at the same time, otherwise an alarm signal is issued. The host interface 807 is also responsible for maintaining the address of the internal cache 808 of the DMA device 80.

[0121] The working process of the host interface 807 is as follows:

[0122] 1. The host interface 807 receives the start signal from the controller 806, generates a bus request signal and a request lock signal, and initializes the host interface register.

[0123] Specifically, the host interface 807 receives the start signal of the controller 806 to initialize the host interface, including configuring the request lock register, bus ownership register, mode register, host interface source address register, host interface destination address register, address accumulation register, read and write control register, transfer size register, transfer status register, burst type register, read remaining length register, and write and read remaining length register. The host interface 807 calculates the values ​​of the burst register and the current burst remaining length register according to the remaining length register and the burst type.

[0124] The address information is given by the source / destination address register of each channel register. The transfer size information is given by the transfer size register of each channel register. The read remaining length register, write read remaining length register and current burst remaining length register are used to determine the transfer direction of the current transfer.

[0125] 2. After receiving the highest priority response from the bus arbiter, the host interface 807 drives the read address signal and the read control signal to the bus. The data read from the source address through the bus is stored in the internal cache 808. If the data length exceeds the length of a burst, the bus is continuously applied until all the specified data is read from the given address and stored in the internal cache 808.

[0126] 3. In the transmission mode, the host interface 807 applies for the bus to initiate a write operation, drives the write address signal and the write control signal to the bus, and writes the data in the internal cache 808 to the specified destination address.

[0127] 4. The transmission is completed.

[0128] The slave interface 801 acts as a slave on the bus and can receive data movement instructions from the CPU. In addition, since the channel register 804, the instruction processor 803, the instruction cache 802 and the slave interface 801 can communicate bidirectionally, when the slave interface 801 receives an instruction from the CPU, it can also read the information in the channel register 804 and write it to the bus, so that the CPU can monitor the status of each channel register in the DMA device 80.

[0129] According to the above introduction, the data moving instruction can be an immediate data moving instruction or a delayed data moving instruction. This embodiment takes the delayed data moving instruction initiated for the peripheral D as an example for introduction:

[0130] S901: The slave interface receives a data transfer instruction via the bus;

[0131] S902: The slave interface determines whether the instruction buffer is full;

[0132] If the instruction buffer is full, the slave interface cannot cache the received data move instruction into the instruction buffer, so if the judgment result is yes, execute S903; otherwise, execute S904.

[0133] S903: The slave interface feeds back to the CPU information indicating that the DMA device is temporarily unable to respond;

[0134] For example, in this embodiment, the slave interface may send a RETRY or SPLIT response to the CPU via the system bus, informing the CPU to resend the data movement instruction at an appropriate time.

[0135] S904: The slave interface writes the data moving instruction into the instruction buffer;

[0136] S905: The instruction processor performs deprotection processing on the read delayed data move instruction.

[0137] The deprotection processing process of the instruction processor for the delayed data move instruction is described in the second embodiment, which will not be repeated here. In this embodiment, the initialization information corresponding to the data move task of the peripheral device may include the destination address of the data move, the number of bytes transferred, the burst type and the transfer length. In this embodiment, the peripheral device D can be a data acquisition device, which needs a DMA device to move the collected data to the terminal memory after collecting enough data.

[0138] S906: The instruction processor writes the initialization information into the corresponding peripheral information register d.

[0139] While the instruction processor is deprotecting the delayed data move instruction, it can be determined that the type of the data move instruction currently being processed belongs to the delayed data move instruction. Therefore, after obtaining the initialization information in the data move instruction, the instruction processor can write the initialization information into the corresponding peripheral information register. Since the delayed data move instruction is initiated for peripheral D, the instruction processor can write the initialization information into the peripheral information register d, and use the current initialization information to overwrite the original information in the peripheral information register d.

[0140] In this embodiment, because there is a one-to-one correspondence between the peripherals connected to the bus communication and the peripheral information registers, if the instruction processor parses a data move instruction and finds that there is no peripheral information register that can store the initialization information corresponding to the data move instruction, it means that the data move instruction is not for any peripheral, and therefore the data move instruction is illegal, and the DMA device does not need to execute the corresponding data move task.

[0141] S907: The instruction processor receives a hardware request signal initiated by the peripheral device D;

[0142] S908: The instruction processor reads initialization information from the peripheral information register d and writes it into an idle channel register.

[0143] After the instruction processor writes the initialization information read from the peripheral information register d into the idle channel register, the channel register can apply to the channel arbitrator for the right to use the host interface. If it is not currently allowed to use the host interface, the channel register can continue to apply until it obtains the right to use the host interface. If the channel register obtains the right to use the host interface, the controller of the DMA device can initialize the host interface according to the initialization information in the channel register and start the host interface to perform the corresponding data movement task.

[0144] The channel register initialization method provided in this embodiment does not require the controller of the DMA device to control the host interface to access the peripheral device to obtain initialization information for the data movement task of the peripheral device. Instead, the CPU issues data movement instructions uniformly to avoid the host interface accessing the peripheral device to obtain initialization information, which makes it easy for the initialization information to be obtained by the attacker who monitors the bus. The initialization process of the channel register of the DMA device can be understood based on the initialization information, and the DMA device can be held hostage to move unsafe data, affecting system security.

[0145] Moreover, since each peripheral information register in the DMA device corresponds to each peripheral connected to the bus, this one-to-one correspondence can ensure that each peripheral information register only stores initialization information for the corresponding peripheral. Therefore, the legitimacy of the source of the data transfer instruction can be authenticated to a certain extent.

[0146] Embodiment 4:

[0147] This embodiment provides a terminal, which includes the DMA device provided in the above embodiments. The instruction interaction interface of the DMA device is connected to the bus of the terminal, and can communicate with other devices connected to the bus in the terminal through the bus. Fig.10 Terminal 1 includes a CPU 11, a memory 12, a bus 13 and a DMA device 14. The CPU 11, the memory 12 and the DMA device 14 are communicatively connected via the bus 13. The structure of the DMA device 14 can refer to the introduction in any of the aforementioned embodiments.

[0148] This embodiment also provides a channel register initialization device. The structure of the channel register initialization device is introduced below. Fig.11 :

[0149] The channel register initialization device 110 includes a configuration module 111, a protection module 112 and an interaction module 113, wherein the configuration module 111 is used to configure the initialization information of the channel register in the direct memory access DMA device according to the data transfer task. The protection module 112 is used to perform protection processing on the initialization information according to the protection processing rule to obtain the data transfer instruction. The interaction module 113 is used to send the data transfer instruction to the DMA device, so that the DMA device can realize the initialization of the channel register based on the data transfer instruction.

[0150] The specific details of the corresponding functions of each module in the channel register initialization device 110 can be found in the introduction of the above embodiment, and will not be repeated here. Fig.10 The CPU 11 is used to implement this.

[0151] This embodiment also provides a storage medium, which may store a computer program for implementing the channel register initialization method described in the above embodiments. In some examples of this embodiment, the storage medium may only store a first computer program, which can be read, compiled and executed by one or more processors, thereby implementing the channel register initialization method on the CPU side; in another example of this embodiment, the storage medium may only store a second computer program, which can be read, compiled and executed by one or more processors, thereby implementing the steps of the channel register initialization method on the DMA device side.

[0152] In the terminal provided in this embodiment, since the deprotection processing rules on the CPU side correspond to the protection processing rules on the DMA device side, when the CPU performs protection processing on the initialization information according to the protection processing rules, the initialization information can only be obtained after being processed by the deprotection processing rules on the DMA device side. Therefore, the two processes of protection processing and deprotection processing cooperate with each other, which can not only prevent the initialization information from being directly exposed to the bus for transmission, but also realize the authentication of the source of the data movement instruction, realize the monitoring of DMA data movement, ensure the legitimacy of the data movement requester, and thus improve the security of the system.

[0153] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0154] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0155] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0156] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are within the protection of the present invention.

Claims

1. A channel register initialization method, applied to a central processing unit (CPU), characterized in that: The channel register initialization method comprises: The CPU configures initialization information for a channel register in a direct memory access (DMA) device according to a data transfer task, wherein the initialization information includes information for indicating at least one of a source address and a destination address in the data transfer task; The CPU encodes the initialization information according to a preset encoding rule, or encrypts the initialization information according to a preset encryption rule, or encodes and encrypts the initialization information at the same time to obtain a data migration instruction; The CPU sends the data moving instruction to the DMA device, so that the DMA device initializes the channel register based on the data moving instruction.

2. A channel register initialization method, applied to a direct memory access DMA device, characterized in that: The channel register initialization method comprises: The instruction interaction interface of the DMA device receives a data movement instruction; The instruction processor of the DMA device performs deprotection processing on the data moving instruction according to the deprotection processing rule to obtain initialization information corresponding to the data moving task, wherein the initialization information includes information for indicating at least one of a source address and a destination address in the data moving task; the instruction processor of the DMA device performs deprotection processing on the data moving instruction according to the deprotection processing rule, including: Decoding the data moving instruction according to the decoding rule corresponding to the encoding rule; or, Decrypt the data moving instruction according to the preset decryption rules; or, First decrypt the data movement instruction and then decode it; or, First, the data moving instruction is decoded according to the decoding rules, and then the decoded information is decrypted according to the decryption rules; The instruction processor writes the initialization information into an idle channel register in the DMA device to implement the initialization of the channel register.

3. The channel register initialization method according to claim 2, characterized in that: After the instruction interaction interface of the DMA device receives the data moving instruction, the method further includes: the instruction interaction interface stores the data moving instruction in the instruction buffer of the DMA device; Before the instruction processor of the DMA device performs deprotection processing on the data moving instruction according to the deprotection processing rule, the instruction processor also includes: reading the data moving instruction from the instruction buffer.

4. The channel register initialization method according to claim 2, characterized in that: The instruction processor of the DMA device performs deprotection processing on the data moving instruction according to a deprotection processing rule, including: If the deprotection processing rule includes a decoding rule, the instruction processor performs decoding processing on the data moving instruction according to the decoding rule; If the deprotection processing rule includes a decryption rule, the instruction processor decrypts the data moving instruction according to the decryption rule; If the deprotection processing rules include both decoding rules and decryption rules, the instruction processor first decodes the data move instruction according to the decoding rules, and then decrypts the decoding result according to the decryption rules; or, the instruction processor first decrypts the data move instruction according to the decryption rules, and then decodes the decryption result according to the decoding rules.

5. The channel register initialization method according to any one of claims 2 to 4, characterized in that: The instruction processor writes the initialization information into an idle channel register in the DMA device, including: The instruction processor determines the type of the data movement instruction; If the data move instruction is a delayed data move instruction, the instruction processor writes the initialization information into the peripheral information register; After receiving a hardware request signal from an external storage device, the instruction processor reads the initialization information from the peripheral information register and selects one of the idle channel registers in the DMA device to write the initialization information.

6. The channel register initialization method according to claim 5, characterized in that: After the instruction processor determines the type of the data moving instruction, the further step further includes: If the data movement instruction is an immediate data movement instruction, then after obtaining the initialization information, the instruction processor directly selects one from the idle channel registers in the DMA device to write the initialization information.

7. The channel register initialization method according to claim 5, characterized in that: Each peripheral information register in the DMA device corresponds to each external storage device connected to the bus; the instruction processor writes the initialization information into the peripheral information register, including: The instruction processor determines the external storage device targeted by the delayed data migration instruction according to the external storage device identification information in the initialization information; The instruction processor writes the initialization information into the peripheral information register corresponding to the external storage device.

8. A channel register initialization device, characterized in that: include: A configuration module, configured to configure initialization information for a channel register in a direct memory access (DMA) device according to a data transfer task, wherein the initialization information includes information for indicating at least one of a source address and a destination address in the data transfer task; A protection module, used to encode the initialization information according to a preset encoding rule, or encrypt the initialization information according to a preset encryption rule, or encode and encrypt the initialization information at the same time to obtain a data migration instruction; The interaction module is used to send the data moving instruction to the DMA device, so that the DMA device can initialize the channel register based on the data moving instruction.

9. A DMA device, characterized in that: Including instruction interaction interface, channel register and instruction processor; The instruction interaction interface is used to receive a data moving instruction; the instruction processor is used to perform a deprotection process on the data moving instruction according to a deprotection process rule, obtain initialization information corresponding to the data moving task, and write the initialization information into an idle channel register in the DMA device to implement initialization of the channel register, wherein the initialization information includes information for indicating at least one of a source address and a destination address in the data moving task; The deprotection processing of the data moving instruction according to the deprotection processing rule includes: Decoding the data moving instruction according to the decoding rule corresponding to the encoding rule; or, Decrypt the data moving instruction according to the preset decryption rules; or, First decrypt the data movement instruction and then decode it; or, The data moving instruction is first decoded according to the decoding rules, and then the decoded information is decrypted according to the decryption rules.

10. The DMA device according to claim 9, characterized in that The DMA device also includes an instruction cache, which is communicatively connected to the instruction processor and the instruction interaction interface respectively; the instruction cache is used to cache the data movement instructions received by the instruction interaction interface for the instruction processor to read and perform deprotection processing according to the deprotection processing rules.

11. The DMA device according to claim 9, wherein: The instruction interaction interface is a slave interface of the DMA device.

12. The DMA device according to claim 9, wherein: The instruction processor includes at least one of a decoding module and a decryption module; the decoding module is used to decode the received information according to the decoding rule, and the decryption module is used to decrypt the received information according to the decryption rule.

13. The DMA device according to any one of claims 9 to 12, characterized in that: The DMA device further comprises a peripheral information register; the peripheral information register is communicatively connected with the instruction processor; The instruction processor is used to perform deprotection processing on the data move instruction according to the deprotection processing rules, determine the type of the data move instruction after obtaining the initialization information, and write the initialization information into the peripheral information register when determining that the data move instruction is a delayed data move instruction; after receiving a hardware request signal from an external storage device, read the initialization information from the peripheral information register, and select one from the idle channel registers in the DMA device to write the initialization information.

14. The DMA device according to claim 13, wherein: The instruction processor is also used to directly select one from the idle channel registers in the DMA device to write the initialization information when determining that the data move instruction is an immediate data move instruction.

15. The DMA device according to claim 13, wherein: Each of the peripheral information registers in the DMA device corresponds one-to-one to each external storage device connected to the bus; the instruction processor is used to determine the external storage device targeted by the delayed data move instruction based on the external storage device identification information in the initialization information, and write the initialization information into the peripheral information register corresponding to the external storage device.

16. A terminal, characterized in that: The terminal includes a bus and a DMA device as described in any one of claims 9 to 15, and a command interaction interface of the DMA device is connected to the bus.

Citation Information

Patent Citations

  • DMA (direct memory access) controller for controlling security data transfer in SOC (system on a chip) chip system

    CN102591824A

  • Information assurance system for secure program execution

    CN107346401A

  • Block encrypting device for fast session switching andmethod of operating the same

    KR1020030083100A

  • Method and apparatus for protecting data during storage / retrieval

    US20050005092A1

  • Input / output memory management unit with protection mode for preventing memory access by I / O devices

    US20130080726A1