WO2017162049A1 - Method and device for monitoring memory data of drive module - Google Patents

Method and device for monitoring memory data of drive module Download PDF

Info

Publication number
WO2017162049A1
WO2017162049A1 PCT/CN2017/076290 CN2017076290W WO2017162049A1 WO 2017162049 A1 WO2017162049 A1 WO 2017162049A1 CN 2017076290 W CN2017076290 W CN 2017076290W WO 2017162049 A1 WO2017162049 A1 WO 2017162049A1
Authority
WO
WIPO (PCT)
Prior art keywords
checksum
memory
memory space
memory data
current
Prior art date
Application number
PCT/CN2017/076290
Other languages
French (fr)
Chinese (zh)
Inventor
罗忠明
熊飞
吴胜楠
陈明宇
梁建明
张雲瑞
Original Assignee
广州广电运通金融电子股份有限公司
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 广州广电运通金融电子股份有限公司 filed Critical 广州广电运通金融电子股份有限公司
Publication of WO2017162049A1 publication Critical patent/WO2017162049A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07FCOIN-FREED OR LIKE APPARATUS
    • G07F19/00Complete banking systems; Coded card-freed arrangements adapted for dispensing or receiving monies or the like and posting such transactions to existing accounts, e.g. automatic teller machines
    • G07F19/20Automatic teller machines [ATMs]
    • G07F19/209Monitoring, auditing or diagnose of functioning of ATMs

Definitions

  • the present application relates to the field of memory data protection technologies, and more particularly, to a technique for monitoring memory data of a driver module.
  • an automatic teller machine (hereinafter referred to as an ATM machine) is associated with a plurality of input and output devices, such as a card reader, a printer, and a PIN pad. These input and output devices each have a drive module, and each drive module has its own private data.
  • each driver module When each driver module is running, it needs to share the memory of the ATM machine. There is a possibility that the memory data of a certain driver module is damaged by other driver modules of the error. For example, a driver module itself has a pointer running away, an array is out of bounds, and the like. The driver module that has made a mistake overwrites the memory data of other driver modules. As a result, the ATM machine may eventually fail to function or even crash.
  • the ATM machine is provided with three drive modules A, B, and C. In the normal working state, the memory areas of the drive module A, the drive module B, and the drive module C are independent, if the drive module B is Overwriting or rewriting the memory area of drive module A in the memory area will cause the ATM machine program to be abnormal.
  • the present application provides a method for monitoring memory data of a driving module for monitoring whether memory data of a driving module is destroyed.
  • the present application also provides a drive module memory data monitoring device for ensuring the application and implementation of the method in practice.
  • a first aspect of the present application provides a method for monitoring a memory data of a driver module, where the memory data of the driver module is monitored, and the memory data is stored in a memory space of a preset structure, and the method includes:
  • the second aspect of the present application provides a drive module memory data monitoring device for monitoring memory data of a drive module, where the memory data is stored in a memory space of a preset structure, the device includes:
  • a current checksum determining module configured to determine a current checksum of the memory space if a processing request for the memory data is received, wherein the current checksum is used to represent a current memory of the memory space Occupation situation;
  • An original checksum obtaining module configured to obtain an original checksum of the memory space, where the original checksum is used to record a memory occupation situation of the memory space after a last write operation;
  • a checksum processing module configured to perform a processing operation corresponding to the processing request on the memory data if the current checksum is the same as the original checksum
  • the checksum different processing module is configured to perform a preset error processing operation if the current checksum is different from the original checksum.
  • the present application provides a method for monitoring memory data of a driving module, which pre-stores the memory data of the driving module in a memory space of a preset structure, and receives the memory space each time.
  • the current checksum of the memory space is calculated and the original checksum of the memory space is obtained. If the two are the same, the memory data may be processed. If the two are not the same, the memory space is represented. The memory data is destroyed, and the preset error handling operation needs to be performed.
  • This application can not only monitor the memory data of the driver module in real time, but also can accurately locate The faulty drive module allows the fault to be processed in a timely and accurate manner.
  • Embodiment 1 is a flowchart of Embodiment 1 of a method for monitoring memory data of a driving module provided by the present application;
  • FIG. 2 is a diagram showing an example of a state of a memory data of a driver module provided by the present application
  • FIG. 3 is a code example of requesting allocation of a memory space to a system according to the present application.
  • 4a, 4b are flowcharts of the process of reading the memory data of the monitoring driver module provided by the present application.
  • 5a, 5b are flow charts of the process of writing memory data of the monitoring driver module provided by the present application.
  • FIG. 6 is a schematic structural diagram of Embodiment 1 of a memory module data monitoring device of a driving module provided by the present application.
  • a specific application scenario of the present application is to monitor the memory data related to the driver module of the ATM machine. It can be known that the input and output devices of the ATM machine have their own drive modules, and the drive modules have their own private data. According to the actual needs, which private data needs to be protected, the private data can be stored in the memory space of the preset structure in advance. It should be noted that each driver module of the ATM machine has its own corresponding memory space, and the memory space corresponding to different driver modules is different.
  • the application is not limited to protecting the memory data of the ATM machine driver module, and the monitoring of the memory data of the driver module of other devices may also use the method provided by the present application without departing from the protection of the present application. Range of protection.
  • the following is an example of a drive module of an ATM machine.
  • Embodiment 1 of a method for monitoring memory data of a driving module provided by the present application is shown. As shown in FIG. 1 , this embodiment may specifically include steps S101 to S104.
  • Step S101 Determine a current checksum of the memory space if a processing request for the memory data is received, where the current checksum is used to indicate the current memory usage of the memory space.
  • the private data of the driver module of the ATM machine is stored in a memory space of a preset structure. Therefore, other modules of the ATM machine, such as a central processing unit, cannot directly directly access the memory when processing the private data of the driver module.
  • the data is processed, but a processing request needs to be sent to the execution module of the present embodiment.
  • the normal processing request for the driver module triggers the execution of the present application, that is, the normal processing request for the driver module is sent to the execution module of the embodiment to trigger the execution of the embodiment.
  • the execution module of the embodiment After receiving the processing request, the execution module of the embodiment first calculates a checksum of the memory space. In order to distinguish from the original checksum of the memory space, the checksum calculated in this step may be referred to as a current checksum. . It can be understood that the memory space is a memory space for storing the memory data corresponding to the processing request.
  • Step S102 Acquire an original checksum of the memory space; wherein the original checksum is used to record the memory usage of the memory space after the last write operation.
  • the original checksum can be saved in the memory space, and the original checksum can be obtained directly in the memory space.
  • the original checksum records the memory footprint of the memory space after the most recent write operation.
  • the last write operation may be a write operation performed at the time of initialization, or may be a write operation to the memory space at any time after initialization.
  • the write operation may directly write data that does not exist in the memory space, or modify the original data in the memory space.
  • this step may be performed simultaneously with the above step S102, or step S102 may be performed first and then step S101 may be performed.
  • the ATM machine is provided with three drive modules A, B, and C. Under normal working conditions, the ATM machine drives the module A and the drive module B. The memory area of the driver module C is independent. If the memory area of the driver module B overwrites or rewrites the memory area of the driver module A, the ATM program is abnormal.
  • the present application can determine whether the data in the memory space is modified according to the memory occupancy. Specifically, the current checksum of the memory space is compared with the original checksum of the memory space, and the following step S103 or step S104 is performed according to the comparison result.
  • Step S103 If the current checksum is the same as the original checksum, the processing operation corresponding to the processing request is performed on the memory data.
  • the current checksum is the same as the original checksum, indicating that the memory space is not in error after the last write operation, and the processing operation corresponding to the processing request may be performed on the memory data normally, and the processing operation is performed, such as reading or Write and so on.
  • Step S104 If the current checksum is different from the original checksum, the preset error processing operation is performed.
  • the error processing operation may be storing the memory data of the memory space that is in error and the visitor to the memory space for subsequent error analysis.
  • the method for monitoring memory data of a driving module pre-stores the memory data of the driving module in a memory space of a preset structure, and receives a processing request for the memory space each time.
  • the current checksum of the memory space is calculated and the original checksum of the memory space is obtained. If the two are the same, the memory data may be processed. If the two are not the same, the memory of the memory space is represented. The data is corrupted and the preset error handling operations need to be performed.
  • the application not only can monitor the memory data of the driving module in real time, but also can accurately locate the faulty driving module, so that the fault can be processed in time and accurately.
  • the log only records the faulty drive module. As shown in FIG. 2, the memory data of the drive module B is incorrectly changed, and the drive module A is abnormally changed. The log records that the driver module A has an abnormality. However, if the abnormal code is not found in the driver module A, the drive module B that is actually faulty cannot be located, and the fault cannot be processed in time.
  • the application can store the memory data of the driver module B in the memory space of the preset structure, and monitor the memory occupancy of the memory space. If the memory usage of the memory space changes, the driver module can be determined.
  • B is an error module, and a preset error processing operation can be performed on the drive module B.
  • the driving module B abnormally rewrites or overwrites the memory data of the driving module A due to its own error, and the driving is monitored during the memory data monitoring process of the driving module A.
  • the current checksum of module A is different from the original checksum, and the memory data of the drive module A error and the visitor drive module B can be written to the file.
  • the driver module B has abnormal access to the driver module A.
  • the drive module B itself is also monitored. Once the drive module B is in error, the error state of the drive module B can be found, and the error processing operation can be performed on the drive module B.
  • the memory data of the drive module B is stored in the memory space of the preset structure.
  • the address of the memory space is continuous, and the end address indicates the checksum variable.
  • the address of the checksum variable is immediately after the address of the memory data, and the checksum variable is used to store the original checksum.
  • the following allocates a memory space by allocating a memory example of memory space for memory data.
  • codes M1 to M4 are used to allocate a memory space to the system request.
  • the code M1 declares the type name of the memory space to be protected
  • the code M2 declares the memory variable to be protected (the memory variable is used to store the private data of the driver module, the private data is the memory data)
  • the code M3 declares the checksum variable
  • the code M4 requests to allocate a memory space instance.
  • the compiler of the ATM system can generate a memory space for storing private data according to the codes M1 to M4.
  • the code shown in Figure 3 is just an example.
  • the code shown in FIG. 3 is described using the C language, and programming codes written in other programming languages that are consistent with the implementation ideas of the present application are within the scope of the present application.
  • the steps of calculating the checksum include:
  • the difference between the memory address of the checksum variable and the first address of the memory space is determined as the length of the memory space, and the memory space is located according to the first address of the memory space and the length of the memory space; the checksum algorithm is used to calculate the The checksum of the current memory data in the memory space and the calculated checksum as the current checksum.
  • the system when the system allocates memory space, it is dynamically allocated according to the compile instruction and execution status, and the first address of the memory space is random. Although the first address of the memory space is random, the memory address of the checksum variable minus the first address of the memory space can determine the length of the memory space. After determining the length of the memory space, the memory is located according to the first address and the length, and the memory data currently stored in the memory space is obtained, and the checksum of the memory data is calculated by using a checksum algorithm. In order to distinguish from the checksum stored in the checksum variable, the currently calculated checksum is referred to as the current checksum. .
  • checksum algorithm used in this application may be, but not limited to, CRC (Cyclical Redundancy Check), MD5 (Message-Digest Algorithm 5), SHA ( Algorithms such as Secure Hash Algorithm.
  • the above step of calculating the checksum may calculate the original checksum of the memory data, and may also determine the current checksum of the memory data after receiving the processing request for the drive module memory data.
  • the reading of the memory data can be monitored. The monitoring process will be described in detail below with reference to FIG. 4a and FIG. 4b.
  • the monitoring process may include steps S401 to S404.
  • Step S401 Determine a current checksum of the memory space if a read request for the memory data is received; wherein the current checksum is used to indicate the current memory usage of the memory space.
  • Step S402 Acquire an original checksum of the memory space; wherein the original checksum is used to record the memory usage of the memory space after the last execution of the write operation.
  • Step S403 If the current checksum is the same as the original checksum, the memory data is read from the memory space.
  • Step S404 If the current checksum is different from the original checksum, the preset error processing operation is performed.
  • the preset error processing operation may include: writing memory data of the memory space into the file, and triggering the error handler to perform system maintenance operations. At the same time, visitors to the memory space can also be written to the file. This file is similar to an error report that saves illegally changed memory data to facilitate subsequent analysis of the source of illegally changed memory data.
  • the system API interface can also be invoked to perform a dump dump operation to save the running site of the process for subsequent analysis.
  • the monitoring process for reading the memory data may specifically include steps S411 to S414.
  • Step S411 After receiving the read request for the memory data, calculate the current checksum of the memory space.
  • Step S412 Compare the current checksum with the original checksum. If the comparison result is equal, step S413 is performed to read the memory data; if the comparison results are not equal, step S414 is performed to perform error processing.
  • the original checksum is obtained from the original checksum variable and compared with the current checksum, and different processing actions are performed according to the comparison result.
  • the monitoring process may specifically include steps S501 to S504.
  • Step S501 Determine a current checksum of the memory space if a write request for the memory data is received; wherein the current checksum is used to indicate the current memory usage of the memory space.
  • Step S502 Acquire an original checksum of the memory space; wherein the original checksum is used to record the memory usage of the memory space after the last execution of the write operation.
  • Step S503 If the current checksum is the same as the original checksum, write new memory data into the memory space, and determine a new checksum of the memory space, and update the original checksum to a new checksum.
  • the original checksum is stored in the checksum variable of the storage space, and the new checksum is stored in the checksum variable, so that the original checksum can be updated to a new checksum.
  • Step S504 If the current checksum is different from the original checksum, the preset error processing operation is performed.
  • the method may include: writing the memory data of the memory space to the file, and triggering the error handler to perform system maintenance operations.
  • the monitoring process for writing the memory data may specifically include steps S511 to S516.
  • Step S511 If a write request for the memory data is received, the current checksum of the memory space is calculated.
  • Step S512 Compare whether the current checksum and the original checksum are equal. If they are equal, step S513 is performed, and if not, step S516 is performed.
  • Step S513 Write the memory data into the memory space.
  • Step S514 Calculate a new checksum of the memory space after writing the memory data, that is, calculate a new checksum of the written memory data.
  • Step S515 Write the new checksum to the checksum variable to update the original checksum in the checksum variable.
  • Step S516 Perform error processing. For specific error handling, refer to the above description, which is not described here.
  • Embodiment 1 of the above-mentioned driving module memory data monitoring method provides a driving module memory data monitoring device Embodiment 1.
  • This embodiment is used to monitor the memory data of the driver module, and the memory data is stored in the memory space of the preset structure.
  • the embodiment may specifically include: a current checksum determining module 601, an original checksum obtaining module 602, a checksum identical processing module 603, and a checksum different processing module 604. among them:
  • the current checksum determining module 601 is configured to determine a current checksum of the memory space if the processing request for the memory data is received, where the current checksum is used to indicate the current memory usage of the memory space;
  • the original checksum obtaining module 602 is configured to obtain an original checksum of the memory space; wherein, the original The checksum is used to record the memory usage of the memory space after the last write operation;
  • a checksum identical processing module 603, configured to perform a processing operation corresponding to the processing request on the memory data if the current checksum is the same as the original checksum;
  • the checksum different processing module 604 is configured to perform a preset error processing operation if the current checksum is different from the original checksum.
  • the monitoring device for the memory data of the driving module stores the memory data of the driving module in a preset memory space in advance, and the current checksum determining module 601 receives the memory space each time.
  • the current checksum of the memory space is calculated, and the original checksum obtaining module 602 obtains the original checksum of the memory space. If the two are the same, the checksum same processing module 603 can access the memory data. The processing operation is performed. If the two are not the same, it indicates that the memory data of the memory space is destroyed, and the checksum different processing module 604 needs to perform a preset error processing operation.
  • the application not only can monitor the memory data of the driving module in real time, but also can accurately locate the faulty driving module, so that the fault can be processed in time and accurately.
  • the memory space preset by the driver module memory data monitoring device has the following characteristics, that is, the address is continuous, and the end address indicates the checksum variable, and the address of the checksum variable is immediately after the address of the memory data.
  • the checksum variable is used to store the original checksum.
  • the current checksum determining module 601 may specifically include: a memory space length determining submodule and a current checksum calculating submodule. among them:
  • the memory space locating submodule is configured to determine the difference between the memory address of the checksum variable and the first address of the memory space when receiving the processing request for the memory data, and determine the length of the memory space according to the first address of the memory space and The length of the memory space, and the memory space is located;
  • the current checksum calculation sub-module is configured to calculate a checksum of the current memory data in the memory space using the checksum algorithm, and use the calculated checksum as the current checksum.
  • the checksum same processing module 603 may specifically include: an in-memory data reading sub-module and an in-memory data writing sub-module. among them:
  • the memory data reading submodule is configured to: if the current checksum is the same as the original checksum, and the processing request is Read the request, then read the memory data from the memory space;
  • the memory data is written into the submodule, and if the current checksum is the same as the original checksum and the processing request is a write request, the new memory data is written into the memory space, and a new checksum of the memory space is determined. Update the original checksum to a new checksum.
  • the checksum different processing module 604 can specifically include: a checksum different processing sub-module. among them:
  • the checksum different processing submodule is used to write the memory data in the memory space to the file if the current checksum is different from the original checksum, and trigger the error handler to perform system maintenance operations.

Abstract

A method for monitoring memory data of a drive module. In the method, memory data of a drive module is pre-stored in a memory space with a pre-set structure; and each time a processing request regarding the memory space is received, a current checksum of the memory space is calculated (S101), and an original checksum of the memory space is acquired (S102); if the two checksums are the same, a processing operation can be executed on the memory data (S103); and if the two checksums are different, it indicates that the memory data of the memory space is broken, and a pre-set error processing operation needs to be executed (S104). In the method, memory data of a drive module can be monitored in real time, and an erroneous drive module can also be accurately positioned, thus being able to accurately process a fault in time. Furthermore, a device for monitoring memory data of a drive module is provided, so as to ensure the application and realization of the method in practice.

Description

驱动模块内存数据监测方法及装置Drive module memory data monitoring method and device
本申请要求于2016年03月24日提交中国专利局、申请号为201610180088.9、发明名称为“驱动模块内存数据监测方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The present application claims priority to Chinese Patent Application No. 201610180088.9, entitled "Driving Module Memory Data Monitoring Method and Apparatus", filed on March 24, 2016, the entire contents of which is hereby incorporated by reference. in.
技术领域Technical field
本申请涉及内存数据保护技术领域,更具体地,涉及驱动模块的内存数据的监测技术。The present application relates to the field of memory data protection technologies, and more particularly, to a technique for monitoring memory data of a driver module.
背景技术Background technique
通常地,自动取款机(Automatic Teller Machine,以下简称为ATM机)关联有多个输入输出设备,如读卡器、打印机及密码键盘等。此些输入输出设备均具有驱动模块,每个驱动模块具有各自的私有数据。Generally, an automatic teller machine (hereinafter referred to as an ATM machine) is associated with a plurality of input and output devices, such as a card reader, a printer, and a PIN pad. These input and output devices each have a drive module, and each drive module has its own private data.
各个驱动模块在运行时,需要共享ATM机的内存,存在某个驱动模块的内存数据被错误的其他驱动模块破坏的可能,例如,某个驱动模块自身出现了指针跑飞、数组越界等错误,出错的该驱动模块改写了其他驱动模块的内存数据。从而,最终可能导致ATM机无法正常运行甚至崩溃。例如,ATM机内设置有A、B、及C三个驱动模块,ATM机在正常工作状态下,驱动模块A、驱动模块B及驱动模块C的内存区域是各自独立的,若驱动模块B的内存区域覆盖或改写驱动模块A的内存区域,则会导致ATM机程序异常。When each driver module is running, it needs to share the memory of the ATM machine. There is a possibility that the memory data of a certain driver module is damaged by other driver modules of the error. For example, a driver module itself has a pointer running away, an array is out of bounds, and the like. The driver module that has made a mistake overwrites the memory data of other driver modules. As a result, the ATM machine may eventually fail to function or even crash. For example, the ATM machine is provided with three drive modules A, B, and C. In the normal working state, the memory areas of the drive module A, the drive module B, and the drive module C are independent, if the drive module B is Overwriting or rewriting the memory area of drive module A in the memory area will cause the ATM machine program to be abnormal.
因此,需要一种技术方案,来实现对驱动模块内存数据的监测。Therefore, a technical solution is needed to implement monitoring of the memory data of the drive module.
发明内容Summary of the invention
有鉴于此,本申请提供了一种驱动模块内存数据监测方法,用于监测驱动模块的内存数据是否被破坏。另外,本申请还提供了一种驱动模块内存数据监测装置,用以保证所述方法在实际中的应用及实现。In view of this, the present application provides a method for monitoring memory data of a driving module for monitoring whether memory data of a driving module is destroyed. In addition, the present application also provides a drive module memory data monitoring device for ensuring the application and implementation of the method in practice.
为实现所述目的,本申请提供的技术方案如下: To achieve the stated object, the technical solution provided by the present application is as follows:
本申请的第一方面提供了一种驱动模块内存数据监测方法,用于对驱动模块的内存数据进行监测,所述内存数据存储在预设结构的内存空间中,该方法包括:A first aspect of the present application provides a method for monitoring a memory data of a driver module, where the memory data of the driver module is monitored, and the memory data is stored in a memory space of a preset structure, and the method includes:
若接收到对所述内存数据的处理请求,确定所述内存空间的当前校验和;其中,所述当前校验和用于表示所述内存空间当前的内存占用情况;Determining a current checksum of the memory space if a processing request for the memory data is received; wherein the current checksum is used to indicate a current memory usage of the memory space;
获取所述内存空间的原始校验和;其中,所述原始校验和用于记录所述内存空间在最近一次执行写入操作后的内存占用情况;Obtaining an original checksum of the memory space; wherein the original checksum is used to record a memory usage of the memory space after a last write operation;
若所述当前校验和与所述原始校验和相同,则对所述内存数据执行所述处理请求对应的处理操作;And if the current checksum is the same as the original checksum, performing a processing operation corresponding to the processing request on the memory data;
若所述当前校验和与所述原始校验和不同,则执行预设出错处理操作。If the current checksum is different from the original checksum, a preset error processing operation is performed.
本申请的第二方面提供了一种驱动模块内存数据监测装置,用于对驱动模块的内存数据进行监测,所述内存数据存储在预设结构的内存空间中,该装置包括:The second aspect of the present application provides a drive module memory data monitoring device for monitoring memory data of a drive module, where the memory data is stored in a memory space of a preset structure, the device includes:
当前校验和确定模块,用于若接收到对所述内存数据的处理请求,确定所述内存空间的当前校验和;其中,所述当前校验和用于表示所述内存空间当前的内存占用情况;a current checksum determining module, configured to determine a current checksum of the memory space if a processing request for the memory data is received, wherein the current checksum is used to represent a current memory of the memory space Occupation situation;
原始校验和获取模块,用于获取所述内存空间的原始校验和;其中,所述原始校验和用于记录所述内存空间在最近一次执行写入操作后的内存占用情况;An original checksum obtaining module, configured to obtain an original checksum of the memory space, where the original checksum is used to record a memory occupation situation of the memory space after a last write operation;
校验和相同处理模块,用于若所述当前校验和与所述原始校验和相同,则对所述内存数据执行所述处理请求对应的处理操作;a checksum processing module, configured to perform a processing operation corresponding to the processing request on the memory data if the current checksum is the same as the original checksum;
校验和不同处理模块,用于若所述当前校验和与所述原始校验和不同,则执行预设出错处理操作。The checksum different processing module is configured to perform a preset error processing operation if the current checksum is different from the original checksum.
由以上技术方案可知,本申请提供了一种驱动模块内存数据的监测方法,该方法预先将驱动模块的内存数据存储在预设结构的内存空间内,并在每次接收到对该内存空间的处理请求时,便计算该内存空间的当前校验和以及获取该内存空间的原始校验和,若两者相同,则可以对内存数据执行处理操作,若两者并不相同,则表示内存空间的内存数据被破坏,进而需要执行预设的出错处理操作。本申请不仅可以实时地监测驱动模块的内存数据,并且可以准确定位 出错的驱动模块,从而可以及时准确地对故障进行处理。It can be seen from the above technical solution that the present application provides a method for monitoring memory data of a driving module, which pre-stores the memory data of the driving module in a memory space of a preset structure, and receives the memory space each time. When the request is processed, the current checksum of the memory space is calculated and the original checksum of the memory space is obtained. If the two are the same, the memory data may be processed. If the two are not the same, the memory space is represented. The memory data is destroyed, and the preset error handling operation needs to be performed. This application can not only monitor the memory data of the driver module in real time, but also can accurately locate The faulty drive module allows the fault to be processed in a timely and accurate manner.
附图说明DRAWINGS
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings to be used in the embodiments or the prior art description will be briefly described below. Obviously, the drawings in the following description are only It is an embodiment of the present application, and those skilled in the art can obtain other drawings according to the provided drawings without any creative work.
图1为本申请提供的驱动模块内存数据监测方法实施例1的流程图;1 is a flowchart of Embodiment 1 of a method for monitoring memory data of a driving module provided by the present application;
图2为本申请提供的驱动模块内存数据状态示例图;2 is a diagram showing an example of a state of a memory data of a driver module provided by the present application;
图3为本申请提供的向系统请求分配内存空间的代码示例;FIG. 3 is a code example of requesting allocation of a memory space to a system according to the present application; FIG.
图4a、4b为本申请提供的监测驱动模块内存数据读取过程的流程图;4a, 4b are flowcharts of the process of reading the memory data of the monitoring driver module provided by the present application;
图5a、5b为本申请提供的监测驱动模块内存数据写入过程的流程图;5a, 5b are flow charts of the process of writing memory data of the monitoring driver module provided by the present application;
图6为本申请提供的驱动模块内存数据监测装置实施例1的结构示意图。FIG. 6 is a schematic structural diagram of Embodiment 1 of a memory module data monitoring device of a driving module provided by the present application.
具体实施方式detailed description
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application are clearly and completely described in the following with reference to the drawings in the embodiments of the present application. It is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present application without departing from the inventive scope are the scope of the present application.
本申请的一个具体应用场景是对ATM机的驱动模块相关的内存数据进行监测。可以知道的是,ATM机的输入输出设备具有各自的驱动模块,驱动模块具有各自的私有数据。根据实际需求,需要对哪些私有数据进行保护,则可以预先将此些私有数据存储在预设结构的内存空间内。需要说明的是,ATM机每个驱动模块具有各自所对应的内存空间,不同的驱动模块所对应的内存空间不同。A specific application scenario of the present application is to monitor the memory data related to the driver module of the ATM machine. It can be known that the input and output devices of the ATM machine have their own drive modules, and the drive modules have their own private data. According to the actual needs, which private data needs to be protected, the private data can be stored in the memory space of the preset structure in advance. It should be noted that each driver module of the ATM machine has its own corresponding memory space, and the memory space corresponding to different driver modules is different.
当然,本申请并不局限于保护ATM机驱动模块的内存数据,对其他设备的驱动模块内存数据的监测也可以使用本申请提供的方法,而不脱离本申请的保 护范围。Of course, the application is not limited to protecting the memory data of the ATM machine driver module, and the monitoring of the memory data of the driver module of other devices may also use the method provided by the present application without departing from the protection of the present application. Range of protection.
以下以ATM机的驱动模块为例,对本申请进行说明。The following is an example of a drive module of an ATM machine.
参见图1,其示出了本申请提供的驱动模块内存数据监测方法实施例1的流程。如图1所示,本实施例可以具体包括步骤S101~步骤S104。Referring to FIG. 1 , a flow of Embodiment 1 of a method for monitoring memory data of a driving module provided by the present application is shown. As shown in FIG. 1 , this embodiment may specifically include steps S101 to S104.
步骤S101:若接收到对内存数据的处理请求,确定内存空间的当前校验和;其中,当前校验和用于表示内存空间当前的内存占用情况。Step S101: Determine a current checksum of the memory space if a processing request for the memory data is received, where the current checksum is used to indicate the current memory usage of the memory space.
如上,ATM机的驱动模块的私有数据被存储在一个预设结构的内存空间内,因此,ATM机的其他模块如中央处理器等,想要处理驱动模块的私有数据时,并不能直接对内存数据进行处理,而是需要向本实施例的执行模块发送处理请求。需要说明的是,对驱动模块的正常处理请求均会触发本申请的执行,即对驱动模块正常的处理请求会被发送至本实施例的执行模块,以触发本实施例的执行。As above, the private data of the driver module of the ATM machine is stored in a memory space of a preset structure. Therefore, other modules of the ATM machine, such as a central processing unit, cannot directly directly access the memory when processing the private data of the driver module. The data is processed, but a processing request needs to be sent to the execution module of the present embodiment. It should be noted that the normal processing request for the driver module triggers the execution of the present application, that is, the normal processing request for the driver module is sent to the execution module of the embodiment to trigger the execution of the embodiment.
本实施例的执行模块接收到该处理请求后,首先计算内存空间的校验和,为了与内存空间的原始校验和进行区分,可以将本步骤计算获得的校验和称为当前校验和。可以理解的是,该内存空间即存储处理请求所对应的内存数据的内存空间。After receiving the processing request, the execution module of the embodiment first calculates a checksum of the memory space. In order to distinguish from the original checksum of the memory space, the checksum calculated in this step may be referred to as a current checksum. . It can be understood that the memory space is a memory space for storing the memory data corresponding to the processing request.
步骤S102:获取内存空间的原始校验和;其中,原始校验和用于记录内存空间在最近一次执行写入操作后的内存占用情况。Step S102: Acquire an original checksum of the memory space; wherein the original checksum is used to record the memory usage of the memory space after the last write operation.
其中,原始校验和可以保存在内存空间中,进而可以直接在内存空间获取原始校验和。原始校验和记录的是内存空间在最近一次执行写入操作后的内存占用情况。The original checksum can be saved in the memory space, and the original checksum can be obtained directly in the memory space. The original checksum records the memory footprint of the memory space after the most recent write operation.
需要说明的是,最近一次执行写入操作可以是在初始化时执行的写入操作,也可以是初始化后任意一次对内存空间的写入操作。写入操作可以是直接向内存空间内写入原来并不存在的数据,也可以是对内存空间原来存在的数据进行修改。It should be noted that the last write operation may be a write operation performed at the time of initialization, or may be a write operation to the memory space at any time after initialization. The write operation may directly write data that does not exist in the memory space, or modify the original data in the memory space.
另外,本步骤与步骤S101的执行顺序并不影响本申请的实现,因此,本步骤可以与上述步骤S102同时执行,或者,可以先执行步骤S102再执行步骤S101。In addition, the execution order of this step and step S101 does not affect the implementation of the present application. Therefore, this step may be performed simultaneously with the above step S102, or step S102 may be performed first and then step S101 may be performed.
可以理解的是,若内存空间内的数据被非法处理,则内存空间的内存占用 情况则可能发生变化。参见图2所示的一种内存数据出错情况,如图2所示,ATM机内设置有A、B、及C三个驱动模块,ATM机在正常工作状态下,驱动模块A、驱动模块B及驱动模块C的内存区域是各自独立的,若驱动模块B的内存区域覆盖或改写驱动模块A的内存区域,则会导致ATM机程序异常。It can be understood that if the data in the memory space is illegally processed, the memory space of the memory space is occupied. The situation may change. Referring to a memory data error situation shown in Figure 2, as shown in Figure 2, the ATM machine is provided with three drive modules A, B, and C. Under normal working conditions, the ATM machine drives the module A and the drive module B. The memory area of the driver module C is independent. If the memory area of the driver module B overwrites or rewrites the memory area of the driver module A, the ATM program is abnormal.
因此,本申请可以根据内存占用情况,来判断内存空间内的数据是否被修改。具体地,将内存空间的当前校验和与内存空间的原始校验和进行比较,根据比较结果分别执行下述步骤S103或者步骤S104。Therefore, the present application can determine whether the data in the memory space is modified according to the memory occupancy. Specifically, the current checksum of the memory space is compared with the original checksum of the memory space, and the following step S103 or step S104 is performed according to the comparison result.
步骤S103:若当前校验和与原始校验和相同,则对内存数据执行处理请求对应的处理操作。Step S103: If the current checksum is the same as the original checksum, the processing operation corresponding to the processing request is performed on the memory data.
其中,当前校验和与原始校验和相同,则表示内存空间在上一次执行写入操作之后,并未出错,则可以正常对内存数据执行处理请求对应的处理操作,处理操作如读取或者写入等。The current checksum is the same as the original checksum, indicating that the memory space is not in error after the last write operation, and the processing operation corresponding to the processing request may be performed on the memory data normally, and the processing operation is performed, such as reading or Write and so on.
步骤S104:若当前校验和与原始校验和不同,则执行预设出错处理操作。Step S104: If the current checksum is different from the original checksum, the preset error processing operation is performed.
其中,当前校验和与原始校验和并不同,则表示内存空间在上一次执行写入操作之后,已经出错,则需要执行预设的出错处理操作。其中,出错处理操作可以是保存出错的该内存空间的内存数据以及对该内存空间的访问者,以供后续出错分析。If the current checksum is different from the original checksum, it means that the memory space has been wrong after the last write operation, and the preset error processing operation needs to be performed. The error processing operation may be storing the memory data of the memory space that is in error and the visitor to the memory space for subsequent error analysis.
由以上技术方案可知,本申请提供的驱动模块内存数据的监测方法,该方法预先将驱动模块的内存数据存储在预设结构的内存空间内,并在每次接收到对该内存空间的处理请求时,便计算该内存空间的当前校验和以及获取该内存空间的原始校验和,若两者相同,则可以对内存数据执行处理操作,若两者并不相同,则表示内存空间的内存数据被破坏,进而需要执行预设的出错处理操作。本申请不仅可以实时地监测驱动模块的内存数据,并且可以准确定位出错的驱动模块,从而可以及时准确地对故障进行处理。According to the above technical solution, the method for monitoring memory data of a driving module provided by the present application, the method pre-stores the memory data of the driving module in a memory space of a preset structure, and receives a processing request for the memory space each time. The current checksum of the memory space is calculated and the original checksum of the memory space is obtained. If the two are the same, the memory data may be processed. If the two are not the same, the memory of the memory space is represented. The data is corrupted and the preset error handling operations need to be performed. The application not only can monitor the memory data of the driving module in real time, but also can accurately locate the faulty driving module, so that the fault can be processed in time and accurately.
具体地,现有的ATM机故障处理方式中,日志仅仅记录出错的驱动模块,如图2所示,由于驱动模块B的内存数据错误更改了驱动模块A的内存数据,导致驱动模块A发生异常,日志记录的是驱动模块A发生异常,但是,在驱动模块A内确找不到异常代码,也就无法定位真正出错的驱动模块B,进而也就无法及时处理故障。 Specifically, in the existing ATM machine fault processing mode, the log only records the faulty drive module. As shown in FIG. 2, the memory data of the drive module B is incorrectly changed, and the drive module A is abnormally changed. The log records that the driver module A has an abnormality. However, if the abnormal code is not found in the driver module A, the drive module B that is actually faulty cannot be located, and the fault cannot be processed in time.
然而,本申请可以将驱动模块B的内存数据存储在预设结构的内存空间内,并对该内存空间的内存占用情况进行监测,若该内存空间的内存占用情况发生变化,则可以确定驱动模块B为出错模块,并可以对该驱动模块B执行预设的出错处理操作。However, the application can store the memory data of the driver module B in the memory space of the preset structure, and monitor the memory occupancy of the memory space. If the memory usage of the memory space changes, the driver module can be determined. B is an error module, and a preset error processing operation can be performed on the drive module B.
具体来讲,在图2所示的示例中,假设驱动模块B因为自身出错非正常地改写或覆盖了驱动模块A的内存数据,在对驱动模块A的内存数据监测过程中,监测到该驱动模块A的当前校验和与原始校验和不同,则可以将驱动模块A出错的内存数据及访问者驱动模块B写入文件。通过对该文件的分析,可以获知驱动模块B对驱动模块A进行了非正常的访问。Specifically, in the example shown in FIG. 2, it is assumed that the driving module B abnormally rewrites or overwrites the memory data of the driving module A due to its own error, and the driving is monitored during the memory data monitoring process of the driving module A. The current checksum of module A is different from the original checksum, and the memory data of the drive module A error and the visitor drive module B can be written to the file. Through the analysis of the file, it can be known that the driver module B has abnormal access to the driver module A.
当然,驱动模块B自身也在被监测,一旦驱动模块B出错,便可以发现驱动模块B的出错状态,并可以对驱动模块B执行出错处理操作。Of course, the drive module B itself is also monitored. Once the drive module B is in error, the error state of the drive module B can be found, and the error processing operation can be performed on the drive module B.
如上,驱动模块B的内存数据被存储在预设结构的内存空间内。内存空间的地址连续,且末尾地址指示校验和变量,校验和变量的地址紧接在内存数据的地址之后,校验和变量用于存储原始校验和。As above, the memory data of the drive module B is stored in the memory space of the preset structure. The address of the memory space is continuous, and the end address indicates the checksum variable. The address of the checksum variable is immediately after the address of the memory data, and the checksum variable is used to store the original checksum.
具体地,以下通过为内存数据分配内存空间的一个代码示例,来说明分配的内存空间。Specifically, the following allocates a memory space by allocating a memory example of memory space for memory data.
如图3所示,代码M1~M4用于向系统请求分配一块内存空间。其中,代码M1申明需保护的内存空间的类型名,代码M2申明需保护的内存变量(内存变量用来存储驱动模块的私有数据,私有数据即内存数据),代码M3申明校验和变量,代码M4请求分配内存空间实例。ATM系统的编译器可以根据代码M1~M4,生成存储私有数据的内存空间。As shown in FIG. 3, codes M1 to M4 are used to allocate a memory space to the system request. Wherein, the code M1 declares the type name of the memory space to be protected, and the code M2 declares the memory variable to be protected (the memory variable is used to store the private data of the driver module, the private data is the memory data), and the code M3 declares the checksum variable, the code M4 requests to allocate a memory space instance. The compiler of the ATM system can generate a memory space for storing private data according to the codes M1 to M4.
当然,图3所示的代码仅仅是说明示例,内存空间的名称、内存变量的名称、内存变量的类型、内存变量的个数、校验和变量的类型、校验和变量的名称等均可以是其他,而不局限于图3所示。另外,图3所示的代码是使用C语言描述的,使用其他编程语言编写的、与本申请的实现思想一致的编程代码均在本申请的保护范围之内。Of course, the code shown in Figure 3 is just an example. The name of the memory space, the name of the memory variable, the type of the memory variable, the number of memory variables, the type of the checksum variable, the name of the checksum variable, etc. It is the other, not limited to the one shown in Figure 3. In addition, the code shown in FIG. 3 is described using the C language, and programming codes written in other programming languages that are consistent with the implementation ideas of the present application are within the scope of the present application.
初始化上述内存空间后,需要计算内存空间的校验和,并将校验和存储在校验和变量中。当然,每次正常向内存空间执行写入操作后,需要重新计算该 内存空间的校验和,并将重新计算的校验和保存在该校验和变量中。校验和变量中存储的校验和称为原始校验和。After initializing the above memory space, you need to calculate the checksum of the memory space and store the checksum in the checksum variable. Of course, every time you normally write to the memory space, you need to recalculate the The checksum of the memory space and the recalculated checksum is stored in the checksum variable. The checksum stored in the checksum variable is called the original checksum.
具体地,计算校验和的步骤包括:Specifically, the steps of calculating the checksum include:
将校验和变量的内存地址与内存空间的首地址之差,确定为内存空间的长度,并根据内存空间的首地址及内存空间的长度,定位内存空间;使用校验和算法,计算所述内存空间内当前内存数据的校验和,并将计算的校验和作为当前校验和。The difference between the memory address of the checksum variable and the first address of the memory space is determined as the length of the memory space, and the memory space is located according to the first address of the memory space and the length of the memory space; the checksum algorithm is used to calculate the The checksum of the current memory data in the memory space and the calculated checksum as the current checksum.
其中,系统分配内存空间时是根据编译指令与执行情况动态分配的,内存空间的首地址便是随机的。虽然,内存空间的首地址随机,但是,校验和变量的内存地址减去内存空间的首地址后,便可以确定内存空间的长度。在确定内存空间的长度后,便根据首地址及长度定位到一段内存空间,获取该内存空间当前存储的内存数据,使用校验和算法,计算该内存数据的校验和。为了与校验和变量中存储的校验和区分,将当前计算出的校验和称为当前校验和。。Among them, when the system allocates memory space, it is dynamically allocated according to the compile instruction and execution status, and the first address of the memory space is random. Although the first address of the memory space is random, the memory address of the checksum variable minus the first address of the memory space can determine the length of the memory space. After determining the length of the memory space, the memory is located according to the first address and the length, and the memory data currently stored in the memory space is obtained, and the checksum of the memory data is calculated by using a checksum algorithm. In order to distinguish from the checksum stored in the checksum variable, the currently calculated checksum is referred to as the current checksum. .
需要说明的是,本申请使用的校验和算法可以是但不限定于CRC(Cyclical Redundancy Check,循环冗余码校验)、MD5(Message-Digest Algorithm 5,信息-摘要算法5)、SHA(Secure Hash Algorithm,安全散列算法)等算法。It should be noted that the checksum algorithm used in this application may be, but not limited to, CRC (Cyclical Redundancy Check), MD5 (Message-Digest Algorithm 5), SHA ( Algorithms such as Secure Hash Algorithm.
以上计算校验和的步骤可以计算内存数据的原始校验和,也可以在接收到对驱动模块内存数据的处理请求后,确定内存数据的当前校验和。The above step of calculating the checksum may calculate the original checksum of the memory data, and may also determine the current checksum of the memory data after receiving the processing request for the drive module memory data.
若接收到对驱动模块内存数据的读取请求,则可以对内存数据的读取进行监测,下面结合图4a及图4b对监测流程进行详细说明。If the read request for the memory data of the drive module is received, the reading of the memory data can be monitored. The monitoring process will be described in detail below with reference to FIG. 4a and FIG. 4b.
如图4a所示,在一个示例中,监测流程可以包括步骤S401~步骤S404。As shown in FIG. 4a, in one example, the monitoring process may include steps S401 to S404.
步骤S401:若接收到对内存数据的读取请求,确定内存空间的当前校验和;其中,当前校验和用于表示内存空间当前的内存占用情况。Step S401: Determine a current checksum of the memory space if a read request for the memory data is received; wherein the current checksum is used to indicate the current memory usage of the memory space.
步骤S402:获取内存空间的原始校验和;其中,原始校验和用于记录内存空间在最近一次执行写入操作后的内存占用情况。Step S402: Acquire an original checksum of the memory space; wherein the original checksum is used to record the memory usage of the memory space after the last execution of the write operation.
步骤S403:若当前校验和与原始校验和相同,则从内存空间读取内存数据。Step S403: If the current checksum is the same as the original checksum, the memory data is read from the memory space.
步骤S404:若当前校验和与原始校验和不同,则执行预设出错处理操作。 Step S404: If the current checksum is different from the original checksum, the preset error processing operation is performed.
其中,预设的出错处理操作可以包括:将内存空间的内存数据写入文件,并触发出错处理程序执行系统维护操作。同时,也可以将内存空间的访问者写入文件。该文件类似错误报告,保存非法更改的内存数据,以方便后续分析非法更改的内存数据的来源。在另一示例中,还可以调用系统API接口,执行dump转储操作,以保存进程的运行现场,方便后续分析。The preset error processing operation may include: writing memory data of the memory space into the file, and triggering the error handler to perform system maintenance operations. At the same time, visitors to the memory space can also be written to the file. This file is similar to an error report that saves illegally changed memory data to facilitate subsequent analysis of the source of illegally changed memory data. In another example, the system API interface can also be invoked to perform a dump dump operation to save the running site of the process for subsequent analysis.
需要说明的是,本实施例中的原始校验和、当前校验和的确定方式可以参见以上校验和的计算步骤,此处并不赘述。It should be noted that the method for determining the original checksum and the current checksum in this embodiment can be referred to the calculation steps of the above checksum, and details are not described herein.
如图4b所示,在一个更具体的示例中,对读取内存数据的监测流程可以具体包括步骤S411~步骤S414。As shown in FIG. 4b, in a more specific example, the monitoring process for reading the memory data may specifically include steps S411 to S414.
步骤S411:接收到对内存数据的读取请求后,计算内存空间的当前校验和。Step S411: After receiving the read request for the memory data, calculate the current checksum of the memory space.
步骤S412:比较当前校验和与原始校验和。若比较结果为相等,则执行步骤S413读取内存数据;若比较结果不相等,则执行步骤S414进行错误处理。Step S412: Compare the current checksum with the original checksum. If the comparison result is equal, step S413 is performed to read the memory data; if the comparison results are not equal, step S414 is performed to perform error processing.
从原始校验和变量中获取原始校验和,并将其与当前校验和进行比较,根据比较结果,执行不同的处理动作。The original checksum is obtained from the original checksum variable and compared with the current checksum, and different processing actions are performed according to the comparison result.
若接收到对驱动模块内存数据的写入请求,则可以对向驱动模块的内存空间内写入内存数据的过程进行监测,下面结合图5a及图5b对监测流程进行详细说明。If a write request for the drive module memory data is received, the process of writing the memory data into the memory space of the drive module can be monitored. The monitoring process will be described in detail below with reference to FIGS. 5a and 5b.
如图5a所示,在一个示例中,监测流程可以具体包括步骤S501~步骤S504。As shown in FIG. 5a, in an example, the monitoring process may specifically include steps S501 to S504.
步骤S501:若接收到对内存数据的写入请求,确定内存空间的当前校验和;其中,当前校验和用于表示内存空间当前的内存占用情况。Step S501: Determine a current checksum of the memory space if a write request for the memory data is received; wherein the current checksum is used to indicate the current memory usage of the memory space.
步骤S502:获取内存空间的原始校验和;其中,原始校验和用于记录内存空间在最近一次执行写入操作后的内存占用情况。Step S502: Acquire an original checksum of the memory space; wherein the original checksum is used to record the memory usage of the memory space after the last execution of the write operation.
步骤S503:若当前校验和与原始校验和相同,则向内存空间内写入新的内存数据,并确定内存空间新的校验和,将原始校验和更新为新的校验和。Step S503: If the current checksum is the same as the original checksum, write new memory data into the memory space, and determine a new checksum of the memory space, and update the original checksum to a new checksum.
其中,原始校验和存储在存储空间的校验和变量中,将新的校验和存储入该校验和变量,便可以将原始校验和更新为新的校验和。The original checksum is stored in the checksum variable of the storage space, and the new checksum is stored in the checksum variable, so that the original checksum can be updated to a new checksum.
步骤S504:若当前校验和与原始校验和不同,则执行预设出错处理操作。Step S504: If the current checksum is different from the original checksum, the preset error processing operation is performed.
参见以上对驱动模块内存数据读取的监测流程的说明,预设的出错处理操 作可以包括:将内存空间的内存数据写入文件,并触发出错处理程序执行系统维护操作。See the above description of the monitoring process of the drive module memory data reading, the default error handling operation The method may include: writing the memory data of the memory space to the file, and triggering the error handler to perform system maintenance operations.
同样,本实施例中的原始校验和、当前校验和以及新的校验和的确定方式可以参见以上校验和的计算步骤,此处并不赘述。For the determination of the original checksum, the current checksum, and the new checksum in this embodiment, refer to the calculation steps of the checksum above, and details are not described herein.
如图5b所示,在一个更具体的示例中,对写入内存数据的监测流程可以具体包括步骤S511~步骤S516。As shown in FIG. 5b, in a more specific example, the monitoring process for writing the memory data may specifically include steps S511 to S516.
步骤S511:若接收到对内存数据的写入请求,计算内存空间的当前校验和。Step S511: If a write request for the memory data is received, the current checksum of the memory space is calculated.
步骤S512:比较当前校验和与原始校验和两者是否相等。若相等,则执行步骤S513,若不等,则执行步骤S516。Step S512: Compare whether the current checksum and the original checksum are equal. If they are equal, step S513 is performed, and if not, step S516 is performed.
步骤S513:将内存数据写入内存空间。Step S513: Write the memory data into the memory space.
步骤S514:计算写入内存数据后的内存空间的新的校验和,即计算写入的该内存数据的新的校验和。Step S514: Calculate a new checksum of the memory space after writing the memory data, that is, calculate a new checksum of the written memory data.
步骤S515:将该新的校验和写入校验和变量,以更新校验和变量中的原始校验和。Step S515: Write the new checksum to the checksum variable to update the original checksum in the checksum variable.
步骤S516:进行错误处理。具体的错误处理可以参见上述说明,此处并不赘述。Step S516: Perform error processing. For specific error handling, refer to the above description, which is not described here.
以下对本申请提供的驱动模块内存数据监测装置进行介绍,需要说明的是,下文有关驱动模块内存数据监测装置的说明可以参见上文提供的驱动模块内存数据监测方法,以下并不赘述。The following describes the drive module memory data monitoring device provided by the present application. It should be noted that the following description of the drive module memory data monitoring device can be referred to the above-mentioned drive module memory data monitoring method, which is not described below.
与上述驱动模块内存数据监测方法实施例1相对应,本申请提供了一种驱动模块内存数据监测装置实施例1。本实施例用于对驱动模块的内存数据进行监测,内存数据存储在预设结构的内存空间中。Corresponding to Embodiment 1 of the above-mentioned driving module memory data monitoring method, the present application provides a driving module memory data monitoring device Embodiment 1. This embodiment is used to monitor the memory data of the driver module, and the memory data is stored in the memory space of the preset structure.
如图6所示,本实施例可以具体包括:当前校验和确定模块601、原始校验和获取模块602、校验和相同处理模块603及校验和不同处理模块604。其中:As shown in FIG. 6, the embodiment may specifically include: a current checksum determining module 601, an original checksum obtaining module 602, a checksum identical processing module 603, and a checksum different processing module 604. among them:
当前校验和确定模块601,用于若接收到对内存数据的处理请求,确定内存空间的当前校验和;其中,当前校验和用于表示内存空间当前的内存占用情况;The current checksum determining module 601 is configured to determine a current checksum of the memory space if the processing request for the memory data is received, where the current checksum is used to indicate the current memory usage of the memory space;
原始校验和获取模块602,用于获取内存空间的原始校验和;其中,原始 校验和用于记录内存空间在最近一次执行写入操作后的内存占用情况;The original checksum obtaining module 602 is configured to obtain an original checksum of the memory space; wherein, the original The checksum is used to record the memory usage of the memory space after the last write operation;
校验和相同处理模块603,用于若当前校验和与原始校验和相同,则对内存数据执行处理请求对应的处理操作;a checksum identical processing module 603, configured to perform a processing operation corresponding to the processing request on the memory data if the current checksum is the same as the original checksum;
校验和不同处理模块604,用于若当前校验和与原始校验和不同,则执行预设出错处理操作。The checksum different processing module 604 is configured to perform a preset error processing operation if the current checksum is different from the original checksum.
由以上技术方案可知,本申请提供的驱动模块内存数据的监测装置,预先将驱动模块的内存数据存储在预设的内存空间内,当前校验和确定模块601在每次接收到对该内存空间的处理请求时,便计算该内存空间的当前校验和,原始校验和获取模块602获取该内存空间的原始校验和,若两者相同,则校验和相同处理模块603可以对内存数据执行处理操作,若两者并不相同,则表示内存空间的内存数据被破坏,进而校验和不同处理模块604需要执行预设的出错处理操作。本申请不仅可以实时地监测驱动模块的内存数据,并且可以准确定位出错的驱动模块,从而可以及时准确地对故障进行处理。It can be seen from the above technical solution that the monitoring device for the memory data of the driving module provided by the present application stores the memory data of the driving module in a preset memory space in advance, and the current checksum determining module 601 receives the memory space each time. When the request is processed, the current checksum of the memory space is calculated, and the original checksum obtaining module 602 obtains the original checksum of the memory space. If the two are the same, the checksum same processing module 603 can access the memory data. The processing operation is performed. If the two are not the same, it indicates that the memory data of the memory space is destroyed, and the checksum different processing module 604 needs to perform a preset error processing operation. The application not only can monitor the memory data of the driving module in real time, but also can accurately locate the faulty driving module, so that the fault can be processed in time and accurately.
在一个具体示例中,驱动模块内存数据监测装置预设的内存空间具有如下特征,即地址连续,且末尾地址指示校验和变量,校验和变量的地址紧接在内存数据的地址之后,校验和变量用于存储原始校验和。In a specific example, the memory space preset by the driver module memory data monitoring device has the following characteristics, that is, the address is continuous, and the end address indicates the checksum variable, and the address of the checksum variable is immediately after the address of the memory data. The checksum variable is used to store the original checksum.
在一个具体示例中,当前校验和确定模块601可以具体包括:内存空间长度确定子模块及当前校验和计算子模块。其中:In a specific example, the current checksum determining module 601 may specifically include: a memory space length determining submodule and a current checksum calculating submodule. among them:
内存空间定位子模块,用于若接收到对内存数据的处理请求,将校验和变量的内存地址与内存空间的首地址之差,确定为内存空间的长度,并根据内存空间的首地址及内存空间的长度,定位所述内存空间;The memory space locating submodule is configured to determine the difference between the memory address of the checksum variable and the first address of the memory space when receiving the processing request for the memory data, and determine the length of the memory space according to the first address of the memory space and The length of the memory space, and the memory space is located;
当前校验和计算子模块,用于使用校验和算法,计算内存空间内当前内存数据的校验和,并将计算的校验和作为当前校验和。The current checksum calculation sub-module is configured to calculate a checksum of the current memory data in the memory space using the checksum algorithm, and use the calculated checksum as the current checksum.
在一个具体示例中,校验和相同处理模块603可以具体包括:内存数据读取子模块及内存数据写入子模块。其中:In a specific example, the checksum same processing module 603 may specifically include: an in-memory data reading sub-module and an in-memory data writing sub-module. among them:
内存数据读取子模块,用于若当前校验和与原始校验和相同且处理请求为 读取请求,则从内存空间读取内存数据;The memory data reading submodule is configured to: if the current checksum is the same as the original checksum, and the processing request is Read the request, then read the memory data from the memory space;
内存数据写入子模块,用于若当前校验和与原始校验和相同且处理请求为写入请求,则向内存空间内写入新的内存数据,并确定内存空间新的校验和,将原始校验和更新为新的校验和。The memory data is written into the submodule, and if the current checksum is the same as the original checksum and the processing request is a write request, the new memory data is written into the memory space, and a new checksum of the memory space is determined. Update the original checksum to a new checksum.
在一个具体示例中,校验和不同处理模块604可以具体包括:校验和不同处理子模块。其中:In one specific example, the checksum different processing module 604 can specifically include: a checksum different processing sub-module. among them:
校验和不同处理子模块,用于若当前校验和与原始校验和不同,将内存空间内的内存数据写入文件,并触发出错处理程序执行系统维护操作。The checksum different processing submodule is used to write the memory data in the memory space to the file if the current checksum is different from the original checksum, and trigger the error handler to perform system maintenance operations.
需要说明的是,本说明书中的各个实施例均采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似的部分互相参见即可。It should be noted that each embodiment in the specification is described in a progressive manner, and each embodiment focuses on differences from other embodiments, and the same similar parts between the embodiments are referred to each other. can.
还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括上述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should also be noted that, in this context, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, without necessarily requiring or implying such entities or operations. There is any such actual relationship or order between them. Furthermore, the term "comprises" or "comprises" or "comprises" or any other variations thereof is intended to encompass a non-exclusive inclusion, such that a process, method, article, or device that comprises a plurality of elements includes not only those elements but also Other elements, or elements that are inherent to such a process, method, item, or device. An element that is defined by the phrase "comprising a ..." does not exclude the presence of additional elements in the process, method, article, or device that comprises the above described elements.
对所公开的实施例的上述说明,使本领域专业技术人员能够实现或使用本申请。对这些实施例的多种修改对本领域的专业技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本申请的精神或范围的情况下,在其它实施例中实现。因此,本申请将不会被限制于本文所示的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。 The above description of the disclosed embodiments enables those skilled in the art to make or use the application. Various modifications to these embodiments are obvious to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the application. Therefore, the application is not limited to the embodiments shown herein, but is to be accorded the broadest scope of the principles and novel features disclosed herein.

Claims (10)

  1. 一种驱动模块内存数据监测方法,其特征在于,用于对驱动模块的内存数据进行监测,所述内存数据存储在预设结构的内存空间中,该方法包括:A method for monitoring a memory data of a driving module, configured to monitor memory data of a driving module, where the memory data is stored in a memory space of a preset structure, the method comprising:
    若接收到对所述内存数据的处理请求,确定所述内存空间的当前校验和;其中,所述当前校验和用于表示所述内存空间当前的内存占用情况;Determining a current checksum of the memory space if a processing request for the memory data is received; wherein the current checksum is used to indicate a current memory usage of the memory space;
    获取所述内存空间的原始校验和;其中,所述原始校验和用于记录所述内存空间在最近一次执行写入操作后的内存占用情况;Obtaining an original checksum of the memory space; wherein the original checksum is used to record a memory usage of the memory space after a last write operation;
    若所述当前校验和与所述原始校验和相同,则对所述内存数据执行所述处理请求对应的处理操作;And if the current checksum is the same as the original checksum, performing a processing operation corresponding to the processing request on the memory data;
    若所述当前校验和与所述原始校验和不同,则执行预设出错处理操作。If the current checksum is different from the original checksum, a preset error processing operation is performed.
  2. 根据权利要求1所述的驱动模块内存数据监测方法,其特征在于,所述内存空间的地址连续,且末尾地址指示校验和变量,所述校验和变量的地址紧接在所述内存数据的地址之后,所述校验和变量用于存储所述原始校验和。The method for monitoring memory data of a driving module according to claim 1, wherein the address of the memory space is continuous, and the end address indicates a checksum variable, and the address of the checksum variable is immediately adjacent to the memory data. After the address, the checksum variable is used to store the original checksum.
  3. 根据权利要求2所述的驱动模块内存数据监测方法,其特征在于,所述确定所述内存空间的当前校验和,包括:The method for monitoring a memory data of a driving module according to claim 2, wherein the determining a current checksum of the memory space comprises:
    将所述校验和变量的内存地址与所述内存空间的首地址之差,确定为所述内存空间的长度,并根据所述内存空间的首地址及所述内存空间的长度,定位所述内存空间;Determining a difference between a memory address of the checksum variable and a first address of the memory space as a length of the memory space, and positioning the location according to a first address of the memory space and a length of the memory space Memory space
    使用校验和算法,计算所述内存空间内当前内存数据的校验和,并将计算的校验和作为当前校验和。Using the checksum algorithm, a checksum of the current memory data in the memory space is calculated, and the calculated checksum is used as the current checksum.
  4. 根据权利要求1所述的驱动模块内存数据监测方法,其特征在于,所述对所述内存数据执行所述处理请求对应的处理操作,包括:The method for monitoring the memory data of the driving module according to claim 1, wherein the performing the processing operation corresponding to the processing request on the memory data comprises:
    若所述处理请求为读取请求,则从所述内存空间读取内存数据;If the processing request is a read request, reading the memory data from the memory space;
    若所述处理请求为写入请求,则向所述内存空间内写入新的内存数据,并确定所述内存空间新的校验和,将所述原始校验和更新为所述新的校验和。If the processing request is a write request, write new memory data into the memory space, and determine a new checksum of the memory space, and update the original checksum to the new school Check and.
  5. 根据权利要求1所述的驱动模块内存数据监测方法,其特征在于,所述执行预设出错处理操作,包括:The method for monitoring a memory data of a driving module according to claim 1, wherein the performing a preset error processing operation comprises:
    将所述内存空间内的内存数据写入文件,并触发出错处理程序执行系统维护操作。 Writes the memory data in the memory space to a file and triggers an error handler to perform system maintenance operations.
  6. 一种驱动模块内存数据监测装置,其特征在于,用于对驱动模块的内存数据进行监测,所述内存数据存储在预设结构的内存空间中,该装置包括:A driving module memory data monitoring device is configured to monitor memory data of a driving module, where the memory data is stored in a memory space of a preset structure, the device includes:
    当前校验和确定模块,用于若接收到对所述内存数据的处理请求,确定所述内存空间的当前校验和;其中,所述当前校验和用于表示所述内存空间当前的内存占用情况;a current checksum determining module, configured to determine a current checksum of the memory space if a processing request for the memory data is received, wherein the current checksum is used to represent a current memory of the memory space Occupation situation;
    原始校验和获取模块,用于获取所述内存空间的原始校验和;其中,所述原始校验和用于记录所述内存空间在最近一次执行写入操作后的内存占用情况;An original checksum obtaining module, configured to obtain an original checksum of the memory space, where the original checksum is used to record a memory occupation situation of the memory space after a last write operation;
    校验和相同处理模块,用于若所述当前校验和与所述原始校验和相同,则对所述内存数据执行所述处理请求对应的处理操作;a checksum processing module, configured to perform a processing operation corresponding to the processing request on the memory data if the current checksum is the same as the original checksum;
    校验和不同处理模块,用于若所述当前校验和与所述原始校验和不同,则执行预设出错处理操作。The checksum different processing module is configured to perform a preset error processing operation if the current checksum is different from the original checksum.
  7. 根据权利要求6所述的驱动模块内存数据监测装置,其特征在于,所述内存空间的地址连续,且末尾地址指示校验和变量,所述校验和变量的地址紧接在所述内存数据的地址之后,所述校验和变量用于存储所述原始校验和。The drive module memory data monitoring apparatus according to claim 6, wherein the address of the memory space is continuous, and the end address indicates a checksum variable, and the address of the checksum variable is immediately adjacent to the memory data. After the address, the checksum variable is used to store the original checksum.
  8. 根据权利要求7所述的驱动模块内存数据监测装置,其特征在于,所述当前校验和确定模块包括:The device for monitoring the memory data of the driving module according to claim 7, wherein the current checksum determining module comprises:
    内存空间定位子模块,用于若接收到对所述内存数据的处理请求,将所述校验和变量的内存地址与所述内存空间的首地址之差,确定为所述内存空间的长度,并根据所述内存空间的首地址及所述内存空间的长度,定位所述内存空间;a memory space locating submodule, configured to determine, as a processing request for the memory data, a difference between a memory address of the checksum variable and a first address of the memory space as a length of the memory space, And positioning the memory space according to the first address of the memory space and the length of the memory space;
    当前校验和计算子模块,用于使用校验和算法,计算所述内存空间内当前内存数据的校验和,并将计算的校验和作为当前校验和。The current checksum calculation submodule is configured to calculate a checksum of the current memory data in the memory space by using a checksum algorithm, and use the calculated checksum as the current checksum.
  9. 根据权利要求6所述的驱动模块内存数据监测装置,其特征在于,所述校验和相同处理模块包括:The device for monitoring memory data of a driving module according to claim 6, wherein the same processing module of the checksum comprises:
    内存数据读取子模块,用于若所述当前校验和与所述原始校验和相同且所述处理请求为读取请求,则从所述内存空间读取内存数据;a memory data reading submodule, configured to read the memory data from the memory space if the current checksum is the same as the original checksum and the processing request is a read request;
    内存数据写入子模块,用于若所述当前校验和与所述原始校验和相同且所述处理请求为写入请求,则向所述内存空间内写入新的内存数据,并确定所述 内存空间新的校验和,将所述原始校验和更新为所述新的校验和。a memory data writing submodule, configured to: when the current checksum is the same as the original checksum, and the processing request is a write request, write new memory data into the memory space, and determine Said A new checksum of the memory space, updating the original checksum to the new checksum.
  10. 根据权利要求6所述的驱动模块内存数据监测装置,其特征在于,所述校验和不同处理模块包括:The device for monitoring memory data of a driving module according to claim 6, wherein the different processing modules of the checksum comprise:
    校验和不同处理子模块,用于若所述当前校验和与所述原始校验和不同,将所述内存空间内的内存数据写入文件,并触发出错处理程序执行系统维护操作。 The checksum different processing submodule is configured to write the memory data in the memory space to the file if the current checksum is different from the original checksum, and trigger the error handler to perform a system maintenance operation.
PCT/CN2017/076290 2016-03-24 2017-03-10 Method and device for monitoring memory data of drive module WO2017162049A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610180088.9A CN105869309A (en) 2016-03-24 2016-03-24 Drive module memory data monitoring method and device
CN201610180088.9 2016-03-24

Publications (1)

Publication Number Publication Date
WO2017162049A1 true WO2017162049A1 (en) 2017-09-28

Family

ID=56625804

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/076290 WO2017162049A1 (en) 2016-03-24 2017-03-10 Method and device for monitoring memory data of drive module

Country Status (2)

Country Link
CN (1) CN105869309A (en)
WO (1) WO2017162049A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112948165A (en) * 2021-02-26 2021-06-11 许继集团有限公司 Reliability guarantee method for memory data of relay protection device

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105869309A (en) * 2016-03-24 2016-08-17 广州广电运通信息科技有限公司 Drive module memory data monitoring method and device
CN107644523A (en) * 2017-11-02 2018-01-30 天津纤测道客科技发展有限公司 A kind of test optical fiber data intelligence transmission equipment
CN115129506A (en) * 2021-03-24 2022-09-30 华为技术有限公司 Data transmission system, method and network equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101145129A (en) * 2007-07-18 2008-03-19 中兴通讯股份有限公司 Embedded system memory write-overflow detection method and system
CN102356384A (en) * 2011-08-23 2012-02-15 华为技术有限公司 Method and device for data reliability detection
CN103294606A (en) * 2013-05-08 2013-09-11 天脉聚源(北京)传媒科技有限公司 Methods and devices for allocating memories and detecting overflow thereof
CN104598342A (en) * 2014-12-31 2015-05-06 曙光信息产业(北京)有限公司 Internal storage detection method and device
CN105869309A (en) * 2016-03-24 2016-08-17 广州广电运通信息科技有限公司 Drive module memory data monitoring method and device

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1141644C (en) * 1999-11-20 2004-03-10 深圳市中兴通讯股份有限公司 Test and monitor method for embedded in processor memory
JP4804864B2 (en) * 2005-10-07 2011-11-02 日立オムロンターミナルソリューションズ株式会社 Banknote handling system
US8560888B1 (en) * 2011-02-11 2013-10-15 Bank Of America Corporation Method and apparatus for rebuilding an ATM computer image automatically
CN102508728B (en) * 2011-11-29 2014-10-29 中国航空工业集团公司第六三一研究所 Error detection and read method of goal document solidified on FLASH carrier
CN102855439B (en) * 2012-07-26 2018-05-01 深圳市赛格导航科技股份有限公司 One kind performs file self checking method and device
CN104951708A (en) * 2015-06-11 2015-09-30 浪潮电子信息产业股份有限公司 File measurement and protection method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101145129A (en) * 2007-07-18 2008-03-19 中兴通讯股份有限公司 Embedded system memory write-overflow detection method and system
CN102356384A (en) * 2011-08-23 2012-02-15 华为技术有限公司 Method and device for data reliability detection
CN103294606A (en) * 2013-05-08 2013-09-11 天脉聚源(北京)传媒科技有限公司 Methods and devices for allocating memories and detecting overflow thereof
CN104598342A (en) * 2014-12-31 2015-05-06 曙光信息产业(北京)有限公司 Internal storage detection method and device
CN105869309A (en) * 2016-03-24 2016-08-17 广州广电运通信息科技有限公司 Drive module memory data monitoring method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112948165A (en) * 2021-02-26 2021-06-11 许继集团有限公司 Reliability guarantee method for memory data of relay protection device
CN112948165B (en) * 2021-02-26 2024-02-13 许继集团有限公司 Relay protection device memory data reliability guarantee method

Also Published As

Publication number Publication date
CN105869309A (en) 2016-08-17

Similar Documents

Publication Publication Date Title
WO2017162049A1 (en) Method and device for monitoring memory data of drive module
TWI470420B (en) Dubugging method and computer system using the smae
JP2012198878A (en) Refresh operation start method and system for semiconductor nonvolatile memory device
US20120137167A1 (en) Systematic mitigation of memory errors
WO2019210844A1 (en) Anomaly detection method and apparatus for storage device, and distributed storage system
CN105359114A (en) Memory migration in presence of live memory traffic
US9569303B2 (en) Information processing apparatus
US10942826B2 (en) Method and device for managing storage system
US11314610B2 (en) Auto-recovery for software systems
JP5504604B2 (en) RAM diagnostic device
US20150378799A1 (en) Automatic memory leak detection
KR102299682B1 (en) Operation method of memory contollrer, storage device including the same, and operation method of storage device
JP5447532B2 (en) Information processing device
WO2021038923A1 (en) Control device, execution control method for user program, and system program
US20160210139A1 (en) Managing a code load
US10061667B2 (en) Storage system for a memory control method
US10664402B2 (en) Read operation redirect
CN111124814A (en) SOC memory access monitoring method and device and computer equipment
CN113868023B (en) Snapshot method and device of storage system, electronic equipment and readable storage medium
JP4691355B2 (en) Non-volatile memory
CN110737546B (en) Consistency snapshot checking method, device, equipment and storage medium
CN115359834B (en) Disk arbitration region detection method, device, equipment and readable storage medium
JP2007148570A (en) Diagnostic device and diagnostic method for storage device
KR102020798B1 (en) Method and System for performing automated test
TWI602054B (en) Method of providing error status data for computer device

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17769326

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 17769326

Country of ref document: EP

Kind code of ref document: A1