TWI221960B - Test method of command cache memory - Google Patents

Test method of command cache memory Download PDF

Info

Publication number
TWI221960B
TWI221960B TW92115096A TW92115096A TWI221960B TW I221960 B TWI221960 B TW I221960B TW 92115096 A TW92115096 A TW 92115096A TW 92115096 A TW92115096 A TW 92115096A TW I221960 B TWI221960 B TW I221960B
Authority
TW
Taiwan
Prior art keywords
test
machine code
memory
memory space
patent application
Prior art date
Application number
TW92115096A
Other languages
Chinese (zh)
Other versions
TW200428202A (en
Inventor
Win-Harn Liu
Jeff Song
Ding-Hao Zhang
Original Assignee
Inventec Corp
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 Inventec Corp filed Critical Inventec Corp
Priority to TW92115096A priority Critical patent/TWI221960B/en
Application granted granted Critical
Publication of TWI221960B publication Critical patent/TWI221960B/en
Publication of TW200428202A publication Critical patent/TW200428202A/en

Links

Landscapes

  • Memory System Of A Hierarchy Structure (AREA)
  • Test And Diagnosis Of Digital Computers (AREA)

Abstract

A test method of command cache memory directly writes executable machine code into the memory to generate test functions. Therefore, while testing, the code quantity of the machine code is variable and controllable. The method comprises the following steps: first allocating a segment of memory space and then writing the executable machine code into the memory space; next treating the executable machine code as test functions to execute the test; evaluating the execution results and finally releasing the memory space.

Description

1221960 五、發明說明(1) 【發明之技術領域】 本發明係為一種指令快取記憶體的測試方法,特別是 一種通過直接向記憶體中寫入可執行機器碼來生成測試函 數,從而使測試時機器的代碼量可變且受控制的指令快取 記憶體測試方法。 【先前技術】1221960 V. Description of the Invention (1) [Technical Field of the Invention] The present invention is a test method for instruction cache memory, and particularly a method for generating a test function by directly writing executable machine code into the memory, so that Testing method of variable code and controlled instruction cache memory of machine during test. [Prior art]

快取記憶體(Cache)是當前中央處理器(CPU)中必 不可少的組成部分,因為電腦系統中,記憶體(Memory) 的處理速度遠低於CPU,為了彌補兩者的速度差異,就必 須在C P U中增加C a c h e。增加C a c h e功能的依據是局部性原 理,即程式的位址訪問流有很強的時序相關性,CPU要訪 問的下一個記憶體單元大部分情況在上一次訪問的位址附 近。Cache is an indispensable part of the current central processing unit (CPU), because the processing speed of memory in computer systems is much lower than that of CPU. In order to compensate for the speed difference between the two, Cache must be added to the CPU. The basis for adding the C a c h e function is based on the principle of locality, that is, the program's address access stream has a strong timing correlation, and the next memory unit to be accessed by the CPU is mostly near the address of the last access.

Cache功能主要包括正媒的進行讀寫,是完全由硬體 來完成的。一般CPU對記憶體的訪問分為兩種,一種是需 要得到下一條指令(機器碼),另一種是需要得到資料。 在CPU中的Cache分?兩級,在一級Cache中,又分為指令快 取記憶體(Code Cache)和資料快取記憶體(Data C a c h e ),分別對應於上述兩種需要。當在一級C a c h e中沒 有得到·所要的内容時(稱為沒有命中),會在二級Cache 中尋找。二級Cache通常不區分Code和Data,仍未命中, 則真正到記憶體中尋找。對於虛擬記憶體系統,還有可能 最終在磁片中尋找。 CPU在出廠時一般都要經過基於硬體的Cache測試,但The cache function mainly includes reading and writing by the media, which is completely completed by hardware. Generally, the CPU's access to the memory is divided into two types, one is to obtain the next instruction (machine code), and the other is to obtain data. Cache points in the CPU? Two levels, in the first level cache, are divided into instruction cache (Data Cache) and data cache (Data C a c h), respectively corresponding to the above two needs. When you do not get the content you want in the first level C a c h e (referred to as no hit), it will look in the second level cache. The secondary cache usually does not distinguish between Code and Data. If it still misses, it actually looks in the memory. For virtual memory systems, it is also possible to end up looking on magnetic disks. The CPU is generally tested by hardware-based cache when it leaves the factory, but

第4頁 1221960Page 4 1221960

1221960 五、發明說明(3) 代碼不能完全控制。 此時,就需要一種測試時機器的代碼量可變且受控制 的指令快取記憶體測試方法解決上述問題。 【發明内容】 有鑒於此,本發明為解決上述問題而提出了一種指令 快取記憶體的測試方法,通過直接向記憶體中寫入可執行 機器碼來生成測試函數,使測試時機器碼的代碼量可變且 受控制,從而使測試結果更加可靠。1221960 V. Description of the invention (3) The code cannot be completely controlled. At this time, a method for testing the instruction cache memory with a variable amount of machine code and a controlled method for testing the above problems is needed. [Summary of the Invention] In view of this, the present invention proposes a test method of instruction cache memory to solve the above problem. The test function is generated by directly writing executable machine code into the memory to make the machine code Variable and controlled code makes test results more reliable.

本發明提出了 一種指令快取.記憶體的測試方法,該方^ 法包括如下步驟:首先為測試分配一段記憶體空間,然後 向該記憶體空間内寫入可執行機器碼,再把該可執行機器 碼當作測試函數來執行測試,接下來,驗證該測試函數的 執行結果,最後釋放該段記憶體空間。The present invention provides a method for testing instruction cache and memory. The method includes the following steps: first allocate a memory space for the test, then write executable machine code into the memory space, and then save the memory The execution machine code is used as a test function to execute the test. Next, the execution result of the test function is verified, and the memory space is finally released.

與現有的方法相比,.本發明提供的方法通過直接向記 ’憶體中寫入可執行機器碼來生成測試函數,使測試時機器 碼的代碼量可變且受控制,避免了因為測試的軟硬體環境 不同而可能造成的測試結果的偏差,同時也解決了測試機 器碼代碼量不能靈活變化以及測試過程不受控制的問題, 從而能更好的類比實際操作環境,提高了測試的效率和質 量 ° 有關本發明之詳細内容及方法.,茲就配合圖示說明如 下: 【實施方式】 下面結合附圖對本發明進行詳細說明:Compared with the existing methods, the method provided by the present invention generates test functions by directly writing executable machine code into the memory, so that the code amount of the machine code is variable and controlled during the test, which avoids testing The difference in test results caused by different hardware and software environments also solves the problems that the amount of test machine code cannot be flexibly changed and the test process is not controlled. This can better simulate the actual operating environment and improve the test performance. Efficiency and quality ° The detailed content and method of the present invention are described below with reference to the drawings: [Embodiment] The present invention will be described in detail with reference to the drawings:

第6頁 1221960 五、發明說明(4) — ▲透過、『第1圖』來說明,該圖係為本發明之 纪憶體的測試方法之總體流程圖,說明如下:s π 、 首先為測試分配一段記憶體空間(步驟丨1 铁 ;Ϊ Ϊ憶f空間内寫入可執行機器碼(步驟1 2°);:把 :條機器碼當作測試函數來執行測 驟:把 2下來’驗證該測試函數的執行結果(步驟14:13。、 釋放該段記憶體空間(步驟150)。- ),取後 τ袖本!ί明所提供的測試方〉去,通過直接向記情俨中寫入 ;量可;且受控制。該測試函數為-動態函 :!"式分配-段記憶體空間;然後直接寫入:Ke:中 為代碼自修改測試(⑽Self_M〇di=如錢器 益碼代碼’或者為其他指令快取記憶體 ng)的機 碼;=把=機器碼當做測試函數來執行測代 ^ ^中,向5己憶體中寫入機器碼時,所對庫的 :=根,測試的需求進行變…括固;::試函數 5兩種:、在固定模式下將生成固定大小·和隨機 I5,機模式下將生成任意變化大 二砰益瑪;而 2函數要改寫的寄存器也可以根據需求同時’ 不同的寄存器。 為相同或者 測試之完畢後,需要對測試結果進行 其是通過Page 6 1221960 V. Explanation of the invention (4) — ▲ Through “picture 1”, this figure is the overall flow chart of the test method of the memory of the present invention, which is explained as follows: s π, first is the test Allocate a piece of memory space (step 丨 1 iron; Ϊ Ϊ memory f write executable machine code (step 1 2 °) ;: use: bar code as a test function to perform the test: 2 down 'verify The execution result of the test function (step 14:13., Release the memory space (step 150) .-), take the test version of τ sleeve book! 明 Ming directly to the memory card Write; the amount can be controlled; the test function is-dynamic function:! &Quot; type allocation-segment memory space; then directly write: Ke: in the code for self-modification test (⑽Self_M〇di = 如 钱 器"Benefit code code" or machine code of other instruction cache memory ng); = = machine code is used as a test function to perform test generation ^ ^, when the machine code is written to the memory of the 5th memory, the library : = Root, test requirements are changed ... enclosed; :: test function 5 two kinds :, will be generated in fixed mode With fixed size and random I5, the random sophomore will be generated in machine mode. The register to be rewritten by function 2 can also be different at the same time according to requirements. For the same or after the test, the test results need to be performed. Which is through

1221960 五、發明說明(5) 核對暫存器中的内容是否正確,從而確定Cache是否工作 正常。 下面,進一步說明本發明的流程。 請參見『第2圖』,該圖係為本發明所提之向該記憶 體空間内寫入可執行機器碼之流程圖,說明如下: 首先寫入保護現場及寄存器初始化機器碼(步驟 2 1 0);然後重復寫入測試函數主體機器碼(步驟2 2 0); 再寫入將寄存器值存入棧中的機器碼(步驟2 3 0);寫入 恢復現場機器碼(步驟2 4 0);最後寫入返回指令(步驟 2 5 0)。 該測試函數的初始化機器碼中,含有壓棧指令,其用 來保護現場,將當前寄存器中内容壓棧。 在記憶體空間内重復寫入測試機器碼的次數與對測試 機器碼長度的要求有關,當要求該機器碼較長時,寫入和 執行的次數相應較多,反之則次數較少。若該測試機器碼 為固定長度的代碼時,則該次數是一定的;若該測試機器 碼的長度隨機變化時,則該次數也不斷隨機變化。 之後,寫入一段把函數執行完成之後的寄存器值保留 在棧中的機器碼,以便將來把他們存入指定記憶體中,再 進行驗證 ° 最後,寫入一段將寄存器恢復為該測試函數執行前值 的機器瑪及返回指令,從而恢復現場,退出函數。 請參見『第3圖』,該圖係為本發明所提之把該可執 行機器碼當作測試函數來執行測試之流程圖,說明如下:1221960 V. Description of the invention (5) Check whether the content in the temporary register is correct to determine whether the cache is working normally. The process of the present invention is further described below. Please refer to "Figure 2", which is a flowchart of writing executable machine code into the memory space according to the present invention, which is explained as follows: First write the protection site and register initialization machine code (step 2 1 0); then repeatedly write the test function main machine code (step 2 2 0); then write the machine code that stores the register value in the stack (step 2 3 0); write the recovery field machine code (step 2 4 0 ); Finally write the return instruction (step 2 5 0). The initialization machine code of this test function contains a stack push instruction, which is used to protect the scene and push the contents of the current register onto the stack. The number of times the test machine code is repeatedly written in the memory space is related to the requirement for the length of the test machine code. When the machine code is required to be longer, the number of writes and executions is correspondingly larger, and vice versa. If the test machine code is a fixed-length code, the number of times is constant; if the length of the test machine code is randomly changed, the number of times is also continuously changed randomly. After that, write a piece of machine code that keeps the register values after the function execution is completed in the stack, so that they can be stored in the specified memory in the future, and then verified. Finally, write a piece to restore the registers before the test function is executed. The value is returned to the machine and the instruction is restored, and the function is exited. Please refer to "Figure 3", which is a flowchart of executing the test using the executable machine code as a test function according to the present invention, which is described as follows:

1221960 五、發明說明(6) 首先將指定的記憶體地址壓棧(步驟3 1 0);然後執 行這段機器碼來完成測試函數的執行(步驟3 2 0);最後 將寄存器值出棧,存入指定記憶體内(步驟3 3 0)。 步驟3 1 0和步驟3 3 0是為了將函數執行結束時的寄存器 中值存入記憶體中。首先把指定的記憶體地址壓入棧中, 待步驟3 2 0執行完畢後,由於步驟2 3 0的執行,寄存器中的 值已經被保存在機中,最後步驟3 3 0將棧中寄存器的值存 到了指定的記憶體中。1221960 V. Description of the invention (6) First push the specified memory address on the stack (step 3 1 0); then execute this machine code to complete the execution of the test function (step 3 2 0); finally, pop the register value out of the stack. Store in the specified memory (step 3 3 0). Steps 3 0 and 3 3 0 are to store the value in the register at the end of the function execution into memory. First push the specified memory address into the stack. After the execution of step 3 2 0, the value in the register has been saved in the machine due to the execution of step 2 3 0. In the last step 3 3 0, the value of the register in the stack is saved. The value is stored in the specified memory.

請參見『第4圖』,該圖係為本發明所提之釋放該段 記憶體空間之流程圖,說明如下: 如果測試尚未完成,則返回為測試分配一段記憶體空 間之步驟,繼續執行其他測試函數之步驟(步驟4 1 0); 如果測試全部完成,則結束測試之步驟(步驟4 2 0)。 當一段測試完成後,測試函數將會對測試情況進行確 認,當所有測試都已經測試完畢後,將結束本次測試;否 則將重新為尚未進行的測試分配一段記憶體空間,繼續進 行測試,直到測試全部完成為止。 下面用一種較佳的實例來說明本發明的流程。Please refer to "Figure 4", which is a flowchart of releasing the memory space in the present invention, which is explained as follows: If the test has not been completed, return to the step of allocating a memory space for the test, and continue to perform other Steps to test the function (step 4 1 0); If the test is all completed, then end the step of the test (step 4 2 0). When a test is completed, the test function will confirm the test situation. When all tests have been completed, the test will end; otherwise, a section of memory space will be allocated for the tests that have not yet been performed, and the test will continue until Testing is complete. The following uses a preferred example to illustrate the process of the present invention.

對指令快取記憶體測試的方法通常有代碼重定測試 (C 〇 d e R e ρ 1 a c e m e n t T e s 1:),代碼自修改測試(C 〇 d e S e 1 f - Μ o d i f y i n g T e s t)及代碼 #、測測試(C o d e S n 〇〇 p Test)等方法。下面以 Code Self-Modifying Tes t作?實 施例來說明本發明的過程。’ 請參見『第5圖』,該圖係為本發明所提實例之在先The methods for testing the instruction cache memory usually include code re-setting test (C o de R e ρ 1 acement T es 1 :), code self-modifying test (C o de S e 1 f-M odifying T est) and code # , Test test (C ode Sn 〇p Test) and other methods. Let ’s use Code Self-Modifying Tes t? An example is provided to illustrate the process of the present invention. "Please refer to" Figure 5 ", which is the previous example of the present invention

第9頁 1221960 五、發明說明(7) 前技術下執行C 〇 d e S e 1 f - Μ 〇 d i f y i n g測試之流程圖,說明 如下: 在先前技術下,傳統測試方法流程是執行不同的Code Self - Modifying程式,這些程式是事先用彙編寫好並編 譯的大小不同的執行體,不能根據實際的測試情況來改變 大小,即時的生成大小不同的執行體,其執行過程如下: 執行C 〇 d e S e 1 f - Μ 〇 d i f y i n g的測試程式1 (步驟5 1 0);執 行C o d e S e 1 f - Μ o d i f y i n g的測試程式2 (步驟5 2 0);執行 Code Self-Modifyin g的測試程式3 (步驟5 3 0)。直到所 有的C 〇 d e S e 1 f - Μ 〇 d i f y i n g的測試程式執行完畢為止。 同時,C o d e S e 1 f - Μ o d i f y i n g的測試程式與程式主體 比較接近,程式運行時,程式只需從主體中跳到該函數中 運行即可,二者在記憶體中的位址有可能很近,從而指令 快取記憶體中的内容可能並不刷新。 請參見『第6圖』,該圖係為本發明所提之實例之使 用本發明之方法執行Self Modifyin g測試之流程圖,說明 如下j : 本發明所提供的方法,其執行過程如下: 首先為測試分配一段記憶體空間(步驟6 1 0);然後向 記憶體内寫入C 〇 d e S e 1 f - Μ 〇 d i f y i n g測試的代碼(機器 碼)(步,驟6 2 0);再執行C o d e S e 1 f - Μ o d i f y i n g的測試程 式(步驟6 3 Q);接來下,驗證測試的執行結果(步驟 6 4 0);最後釋放該段記憶體空間(步驟6 5 0)。 其中,執行C 〇 d e S e 1 f - Μ 〇 d i f y i n g的測試程式更包括Page 9 1221960 V. Description of the invention (7) The flow chart of performing C ode Se 1 f-M odifying test under the previous technology is explained as follows: Under the prior art, the traditional test method flow is to execute different Code Self- Modifying programs. These programs are executables of different sizes written and compiled in advance. You cannot change the size according to the actual test situation. Real-time generation of executables with different sizes is performed as follows: Execute C ode Se 1 f-Μ 〇difying test program 1 (step 5 1 0); running Code S e 1 f-Μ odifying test program 2 (step 5 2 0); running Code Self-Modifying test program 3 (step 5 3 0). Until all C o d e Se f-M d i f y i n g test program is completed. At the same time, the test program of Code S e 1 f-Μ ifying is relatively close to the main body of the program. When the program runs, the program only needs to jump from the main body to the function to run. The addresses of the two in the memory may be possible. Close enough that the contents of the instruction cache may not be refreshed. Please refer to "Figure 6", which is a flow chart of an example of the present invention using the method of the present invention to perform a Self Modifyin g test, which is described as follows: The method provided by the present invention, its execution process is as follows: First Allocate a piece of memory space for the test (step 6 1 0); then write the code (machine code) of the C ode Se 1 f-M odifying test into the memory (step, step 6 2 0); then execute Co ode Se f-odifying test program (step 6 3 Q); Next, verify the execution result of the test (step 6 4 0); finally release the memory space (step 6 50). Among them, the test program for executing C o d e S e 1 f-Μ o d i f y i n g further includes

第10頁 1、發明說明(8) 〜〜 了 Ϊ:重ΐ ΐ:ΐ函數初始化的機器碼’如壓棧等指 次數二、搶 ”’ elf-M〇difying Code機器碼,里 θ 棧::據所要求代瑪長度來決定;再寫入將寄存:丨入 函的機益碼以及恢復現場和返回的機器碼 =入 行校驗等其他處理出棧存入指定記憶體^最後進 咖edx,och…、代碼如下: and nop *dec nop dword ptr Γ . 1 侍到*指令的位址 e X] ’ ebx改變*指令.,自減1變自加丄 eax 編乍 寄存器eax自減1 如上述代喝所示空操# ^ 的eax寄存器自 /、、弟一句代碼將更改第四句,把原來 内容是否正°確,改,自加1,最後通過校驗eax寄存器的 不斷重復執彳干=確疋Cache功能是否正常。上述代碼將 當需其執行測試由代碼長度決定。 用別的代碼^ ^ ^ Cach_.能不同方面的測試時,可以改 制反復次數來* Μ 0 d i f y i n g c 〇 d e ’同樣可以通過控 當測整體代碼長度。 . 中分配’再向^ =二日守,1先分配記憶體,在系統的堆疊 到Heap中執行?二寫二,要執行的機器碼,然後程式跳轉 再次執行該槿纟7兀畢後回到跳轉處執行後邊的指令, .、 或者釋放所分配的記憶體並結束程式。Page 10 1. Description of the invention (8) ~~ Ϊ: heavy ΐ ΐ: ΐ machine code for function initialization 'such as pushing the stack number of times, grabbing' 'elf-M〇difying Code machine code, θ stack :: Determined according to the required length of Dema; then write and store: 丨 the machine benefit code of the incoming letter and the machine code of the recovery site and the return = check-in and other processing. edx, och…, the code is as follows: and nop * dec nop dword ptr Γ. 1 The address of the * instruction e X] 'ebx change * instruction., decrement 1 to increment 丄 eax edit register eax decrement 1 As shown in the above code, the code of the eax register of the empty operation # ^ will be changed from the fourth sentence, the original content is correct, changed, incremented by 1, and finally repeatedly verified by checking the eax register彳 dry = confirm whether the cache function is normal. The above code will be determined by the length of the code when it is required to perform the test. Use other codes ^ ^ ^ Cach_. When testing in different aspects, you can modify the number of iterations to repeat * Μ 0 difyingc 〇de 'It is also possible to measure the overall code length through control.. 'Redirect to ^ = two days guard, 1 allocate memory first, execute in the stack of the system in Heap? Second write two, the machine code to be executed, and then the program jumps to the execution again and returns to the jump position. Execute the following instructions, or release the allocated memory and end the program.

1221960 五、發明說明(9) 這樣每次跳轉會到不同的記憶體位置,指令快取記憶體中 的内容會被刷新,從而更有效進行測試.。 以上所述者,僅為本發明其中的較佳實施例而已,並 非用來限定本發明的實施範圍;即凡依本創作申請專利·範 圍所作的均等變化與修飾,皆為本創作專利範圍所涵蓋。1221960 V. Description of the invention (9) In this way, each jump will go to a different memory location, and the contents of the instruction cache memory will be refreshed, so that the test can be performed more efficiently. The above are only the preferred embodiments of the present invention, and are not intended to limit the scope of implementation of the present invention; that is, all equivalent changes and modifications made in accordance with the patents and scope of this creative application are within the scope of this creative patent. Covered.

第12頁 1221960 圖式簡單說明 第1圖係為本發明之指令快取記憶體的測試 程圖; 第2圖係為本發明所提之向該記憶體空間内 器碼之流程圖; 第3圖係為本發明所提之把該可執行機器碼 來執行測試之流程圖; 第4圖係為本發明所提之釋放該段記憶體空 第5圖係為本發明所提實例之在先前技術下 Seli-Modifying測試之流程圖;及 方法之總體流 寫入可執行機 當作測試函數 間之流程圖; 執行Code 第6圖係為本發明所提之實例之使 Self Modifying測試之流程圖。 【圖式符號說明】 步驟1 1 0 為測試分配一段記憶 步驟1 2 0 向該記憶體空間内寫 步驟1 3 0 把該可執行機器碼當 步驟1 4 0 驗證該測試函數的執 步驟1 5 0 釋放該段記憶體空間 步驟2 1 0 寫入保護現場及寄存 步驟2 2 0 重復寫入測試函數主 步驟2 3 0 寫入將寄存器值存入 步驟2 4 0 寫入恢復現場機器碼 步驟250 寫入返回指令 步驟3 1 0 將指定的記憶體地址 步驟3 2 0 執行這段機器碼來完 用本發明之方法執行 體空間 入可執行 作測試函 行結果 器初始化 體機器碼 棧中的機 機器碼 數來執行測試 機器碼 器碼 壓棧 成測試函數的執行Page 1212960 Brief description of the diagram. The first diagram is a test process diagram of the instruction cache memory of the present invention. The second diagram is a flowchart of the code in the memory space provided by the present invention. Figure 4 is a flowchart of testing the executable machine code according to the present invention; Figure 4 is a flowchart of releasing the memory space according to the present invention; Figure 5 is a previous example of the present invention; Flow chart of the Seli-Modifying test under the technology; and the overall flow of the method written into the executable machine as a flow chart between test functions; Execution Code Figure 6 is a flow chart of the Self Modifying test of the example mentioned in the present invention . [Illustration of symbolic symbols] Step 1 1 0 Assign a piece of memory to the test. Step 1 2 0 Write step 1 3 to the memory space. Use the executable machine code as step 1 4 0. Step 1 5 to verify the test function 0 Free up this section of memory step 2 1 0 Write protected field and register step 2 2 0 Repeat write test function main step 2 3 0 Write to save register value in step 2 4 0 Write to restore field machine code step 250 Write return instruction Step 3 1 0 Assign the specified memory address Step 3 2 0 Execute this machine code to use the method of the present invention to execute the body space into the executable machine as a test function result initializer to initialize the machine in the machine code stack Machine code count to execute test machine code push stack into test function execution

第13頁 1221960 圖式簡單說明 步驟3 3 0 步驟4 1 0 記憶體空間 步驟4 2 0 步驟5 1 0 步驟5 2 0 步驟5 3 0 步驟6 1 0 步驟6 2 0 代碼(機器 步驟6 3 0 步驟6 4 0 步驟6 5 0 將寄存器值出棧,存入指定記憶體内 如果測試尚未完成,則返回為測試分配一段 之步驟,繼續執行其他測試函數 如果測試全部完成,則結束測試 執行C 〇 d e S e 1 f - Μ 〇 d i f y i n g的測試程式1 執行C o d e S e 1 f - Μ o d i f y i n g的測試程式2 執行C o d e S e 1 f - Μ o d i f y i n g的測試程式3 為測試分配一段記憶體空間 向記憶體内寫入C 〇 d e S e 1 f - Μ 〇 d i f y i n g測試的 碼) 執行Code Self-Modifying的測試程式 驗證測試的執行結果 釋放該段記憶體空間Page 13 1221960 Simple illustration of step 3 3 0 step 4 1 0 memory space step 4 2 0 step 5 1 0 step 5 2 0 step 5 3 0 step 6 1 0 step 6 2 0 code (machine step 6 3 0 Step 6 4 0 Step 6 5 0 Remove the register value from the stack and store it in the specified memory. If the test has not been completed, return to the step of assigning a segment to the test and continue executing other test functions. If the test is all completed, end the test execution C. 〇 de S e 1 f-Μ difying test program 1 Run Co ode S e 1 f-Μ odifying test program 2 Run Co ode S e 1 f-Μ odifying test program 3 Allocate a memory space to the test for memory Code written in the body 〇 de S e 1 f-Μ difying test) Run the Code Self-Modifying test program to verify the execution result of the test to free up this memory space

第14頁Page 14

Claims (1)

1221960 六、申請專利範圍 1、 一種指令快取記憶體的測試方法,該方.法至少包括以 下步驟: 為測試分配一段記憶體空間; 向該記憶體空間内寫入可執行機器碼; 把該可執行機器碼當作測試函數來執行測試; 驗證該測試函數的執行結果;及 釋放該段記憶體空間。1221960 VI. Application Patent Scope 1. A test method for instruction cache memory. The method includes at least the following steps: Allocating a piece of memory space for testing; writing executable machine code into the memory space; The executable machine code is used as a test function to execute the test; verify the execution result of the test function; and free the memory space. 2、 如專利申請範圍第1項所述之指令快取記憶體的測試方 法,其中為測試分配一段記憶體空間係為在系統的堆疊中 為該測試分配一段記憶體空間。 3、 如專利申請範圍第1項所述之指令快取記憶體的測試方 法,其中該可執行機器碼係為符合函數的規範,能執行相 應功能測試的機器碼。 4、 如專利申請範圍第1項所述之指令快取記憶體的測試方 法,其中向該記憶體空間内寫入可執行機器碼之步驟更包 括以下步驟: 寫入保護現場及寄存器初始化機器碼; 重.復寫入測試函數主體機器碼; 寫入將寄存器值存入棧中的機器碼;2. The instruction cache test method described in item 1 of the patent application scope, wherein allocating a memory space for the test is allocating a memory space for the test in the system stack. 3. The test cache memory test method described in item 1 of the patent application scope, wherein the executable machine code is a machine code that conforms to the specification of a function and can perform a corresponding functional test. 4. The method for testing instruction cache memory as described in item 1 of the scope of patent application, wherein the step of writing executable machine code into the memory space further includes the following steps: writing the protection site and register initialization machine code Repeatedly write the machine code of the test function body; Write the machine code that stores the register value in the stack; 寫入恢復現場機器碼;及 寫入返回指令。 、 5、 如專利申請範圍.第4項所述之指令快取記憶體的測試方 法,其中該初始化機器‘碼中含有壓棧指令。 6、 如專利申請範圍第4項所述之指令快取記憶體的測試方Write recovery field machine code; and write return instruction. 5. The method for testing the instruction cache memory as described in the scope of patent application. Item 4, wherein the initialization machine's code includes a stack push instruction. 6. The test party of the instruction cache memory as described in item 4 of the scope of patent application 第15頁 1221960 六、申請專利範圍 法,其中向該記憶體空間内重復寫入測試機器碼並執行係 為根據所需測試機器碼的長度來決定重復寫入及執行的次 數。 7、 如專利申請範圍第4項所述之指令快取記憶體的測試方 法,其中返回執行其他該測試函數指令係為返回執行驗證 該測試函數的執行結果之步驟。 8、 如專利申請範圍第1項所述之指令快取記憶體的測試方 法,其中把該可執行機器碼當作測試函數來執行測試之步 驟更包括以下步驟: 將指定的記憶體地址壓棧; 執行這段機器碼來完成測試函數的執行;及 將寄存器值出棧,存入指定記憶體内。 9、 如專利申請範圍第1項所述之指令快取記憶體的測試方 法,其中驗證該測試函數的執行結果係為通過驗證寄存器 中的内容來確定Cache的工作情況。 1 0、如專利申請範圍第1項所述之指令快取記憶體的測試 方法,其中釋放該段記憶體空間之步驟後更包括如果測試 尚未完成,則返回為測試分配一段記憶體空間之步驟,繼 續執行其他測試函數之步驟。 1 1、如專利申請範圍第1項所述之指令快取記憶體的測試 方法,其中釋放該段記憶體空間之步驟後更包括如果測試 全部完成,則結束測試之步驟。Page 15 1221960 VI. Patent Application Law, in which the test machine code is repeatedly written into the memory space and the execution is based on the length of the required test machine code to determine the number of repeated writes and execution times. 7. The test method for instruction cache memory as described in item 4 of the scope of patent application, wherein returning to execute other test function instructions is a step of returning the execution verification result of the test function. 8. The method for testing instruction cache memory as described in item 1 of the scope of patent application, wherein the step of executing the test by using the executable machine code as a test function further includes the following steps: pushing the specified memory address on the stack ; Execute this machine code to complete the execution of the test function; and pop the register value out of the stack and store it in the specified memory. 9. The test method for instruction cache memory as described in item 1 of the scope of patent application, wherein verifying the execution result of the test function is to determine the working condition of the cache by verifying the content in the register. 10. The method for testing the instruction cache memory as described in item 1 of the scope of patent application, wherein the step of releasing the memory space further includes a step of allocating a memory space for the test if the test has not been completed , Continue with the steps of other test functions. 1 1. The method for testing the instruction cache memory as described in item 1 of the scope of patent application, wherein the step of releasing the memory space further includes a step of ending the test if the test is all completed. 第16頁Page 16
TW92115096A 2003-06-03 2003-06-03 Test method of command cache memory TWI221960B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW92115096A TWI221960B (en) 2003-06-03 2003-06-03 Test method of command cache memory

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW92115096A TWI221960B (en) 2003-06-03 2003-06-03 Test method of command cache memory

Publications (2)

Publication Number Publication Date
TWI221960B true TWI221960B (en) 2004-10-11
TW200428202A TW200428202A (en) 2004-12-16

Family

ID=34432973

Family Applications (1)

Application Number Title Priority Date Filing Date
TW92115096A TWI221960B (en) 2003-06-03 2003-06-03 Test method of command cache memory

Country Status (1)

Country Link
TW (1) TWI221960B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108241559A (en) * 2016-12-26 2018-07-03 迈普通信技术股份有限公司 Internal storage testing method and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108241559A (en) * 2016-12-26 2018-07-03 迈普通信技术股份有限公司 Internal storage testing method and device

Also Published As

Publication number Publication date
TW200428202A (en) 2004-12-16

Similar Documents

Publication Publication Date Title
Akritidis et al. Preventing memory error exploits with WIT
US5911073A (en) Method and apparatus for dynamic process monitoring through an ancillary control code system
US8434064B2 (en) Detecting memory errors using write integrity testing
KR100712767B1 (en) Techniques for reducing the cost of dynamic class initialization checks in compiled code
US8364461B2 (en) Reusing invalidated traces in a system emulator
US7805717B1 (en) Pre-computed dynamic instrumentation
US10761970B2 (en) Computerized method and systems for performing deferred safety check operations
US20120011491A1 (en) Efficient recording and replaying of the execution path of a computer program
CN101782868A (en) Method and device for performance testing for local method call
CN101425020A (en) Method and device for accelerating MMU emulation and total system emulator
US20060277371A1 (en) System and method to instrument references to shared memory
TWI237759B (en) Method for data accessing in a computer and the computer thereof
CN106055481B (en) Method and device for testing computer program
EP3438814B1 (en) Storing memory profile data of an application in non-volatile memory
TW201351274A (en) Method and apparatus for substituting compiler built-in helper functions with machine instructions
US8484620B2 (en) Implementing performance impact reduction of watched variables
CN111433742A (en) Multiple protection tag set instruction
TWI221960B (en) Test method of command cache memory
EP3953820A1 (en) Cross-thread memory indexing in time-travel debugging traces
Zhu et al. Lightweight transparent java thread migration for distributed jvm
CN111694580A (en) Method and device for upgrading and initializing storage device and electronic device
US10229070B2 (en) Computer-implemented method and a system for encoding a heap application memory state using shadow memory
Blackburn et al. Rave: A Modular and Extensible Framework for Program State Re-Randomization
CN101593257B (en) System and method for protecting software based on.Net virtual machine
Fu et al. C++ memory detection tool based on dynamic instrumentation

Legal Events

Date Code Title Description
MM4A Annulment or lapse of patent due to non-payment of fees