KR20040005050A - Method managing for memory access violation and computer system therefor - Google Patents
Method managing for memory access violation and computer system therefor Download PDFInfo
- Publication number
- KR20040005050A KR20040005050A KR1020020039334A KR20020039334A KR20040005050A KR 20040005050 A KR20040005050 A KR 20040005050A KR 1020020039334 A KR1020020039334 A KR 1020020039334A KR 20020039334 A KR20020039334 A KR 20020039334A KR 20040005050 A KR20040005050 A KR 20040005050A
- Authority
- KR
- South Korea
- Prior art keywords
- address
- interrupt
- memory access
- service routine
- routine
- Prior art date
Links
Classifications
-
- E—FIXED CONSTRUCTIONS
- E04—BUILDING
- E04F—FINISHING WORK ON BUILDINGS, e.g. STAIRS, FLOORS
- E04F13/00—Coverings or linings, e.g. for walls or ceilings
- E04F13/07—Coverings or linings, e.g. for walls or ceilings composed of covering or lining elements; Sub-structures therefor; Fastening means therefor
- E04F13/08—Coverings or linings, e.g. for walls or ceilings composed of covering or lining elements; Sub-structures therefor; Fastening means therefor composed of a plurality of similar covering or lining elements
- E04F13/12—Coverings or linings, e.g. for walls or ceilings composed of covering or lining elements; Sub-structures therefor; Fastening means therefor composed of a plurality of similar covering or lining elements of metal or with an outer layer of metal or enameled metal
-
- E—FIXED CONSTRUCTIONS
- E04—BUILDING
- E04F—FINISHING WORK ON BUILDINGS, e.g. STAIRS, FLOORS
- E04F13/00—Coverings or linings, e.g. for walls or ceilings
- E04F13/07—Coverings or linings, e.g. for walls or ceilings composed of covering or lining elements; Sub-structures therefor; Fastening means therefor
- E04F13/08—Coverings or linings, e.g. for walls or ceilings composed of covering or lining elements; Sub-structures therefor; Fastening means therefor composed of a plurality of similar covering or lining elements
- E04F13/0871—Coverings or linings, e.g. for walls or ceilings composed of covering or lining elements; Sub-structures therefor; Fastening means therefor composed of a plurality of similar covering or lining elements having an ornamental or specially shaped visible surface
-
- E—FIXED CONSTRUCTIONS
- E04—BUILDING
- E04F—FINISHING WORK ON BUILDINGS, e.g. STAIRS, FLOORS
- E04F2201/00—Joining sheets or plates or panels
- E04F2201/04—Other details of tongues or grooves
- E04F2201/043—Other details of tongues or grooves with tongues and grooves being formed by projecting or recessed parts of the panel layers
Landscapes
- Engineering & Computer Science (AREA)
- Architecture (AREA)
- Civil Engineering (AREA)
- Structural Engineering (AREA)
- Debugging And Monitoring (AREA)
- Storage Device Security (AREA)
Abstract
Description
본 발명은 프로그램의 부적절한 메모리 접근으로 인해 발생하는 접근 위반(access violation)을 처리하는 방법에 관한 것이다.The present invention is directed to a method of handling access violations that result from improper memory access of a program.
접근 위반(access violation)은 응용 프로그램이 접근하지 말아야 할 메모리 영역에 접근하는 경우에 발생한다. 예를 들어 NULL 포인터를 참조하는 경우와 같이 실제 메모리가 할당되어 있지 않은 경우 또는 접근이 금지되어 있는 메모리 영역을 참조하는 경우에 접근 위반이 발생한다. 접근 위반이 발생하는 경우에 메모리의 잘못된 사용으로 인해 다른 프로그램에 영향을 주거나 시스템 전체에 영향을 주어 오동작이 발생할 수 있다. 따라서 접근 위반이 발생하는 경우에는 일반적으로 접근 위반이 발생한 프로그램을 종료시키고 미리 정해진 예외 처리를 하여 시스템을 안정화시킨다.An access violation occurs when an application accesses an area of memory that should not be accessed. An access violation occurs when real memory is not allocated, for example when referring to a NULL pointer, or when a memory area for which access is prohibited is referenced. In case of access violation, incorrect use of memory may affect other programs or affect the whole system, causing malfunction. Therefore, in case of an access violation, the system usually stabilizes by terminating the program that caused the access violation and making a predetermined exception.
일반적으로 메모리 관리 장치(memory management unit, 이하 MMU라 함)를 내장하고 있는 CPU(central processing unit)를 사용하는 시스템에서는 MMU에서 이러한 접근 위반에 대한 처리를 한다. MMU는 프로그램이 요청한 가상 메모리(virtual memory)를 실제 메모리로 매핑시키는 역할을 한다.In general, a system using a central processing unit (CPU) that incorporates a memory management unit (hereinafter referred to as MMU) handles this access violation in the MMU. The MMU is responsible for mapping virtual memory requested by the program to real memory.
프로그램에서 NULL 포인터로 초기화된 상태로 남아 있는 변수는 가상 메모리 상의 특정 주소(미리 정의된 주소 값으로 일반적으로 0을 사용함)로 치환되고, 이 주소 값은 MMU에 의해 실제 메모리로 변환되는 과정에서 실제 메모리 상에서 접근불가능한 영역에 속하도록 변환된다. 다시 말해 가상 메모리 상의 NULL 포인터에 대한 접근은 MMU에 의한 실제 메모리 주소로의 변환과정에서 메모리 접근 제한에 저촉되는 결과가 생기게 되는데 이런 상황이 발생하면 MMU는 데이터 중지 인터럽트(data abort interrupt)를 발생시키고 문제가 된 프로그램이 종료하거나 별도의 예외 처리 규정에 따라 처리되게 된다.Variables that remain initialized with NULL pointers in the program are replaced by specific addresses in virtual memory (typically using zeros for predefined address values), which are then converted to physical memory by the MMU. Is converted to belong to an inaccessible region on memory. In other words, access to a NULL pointer in virtual memory results in a violation of memory access restrictions during the MMU's translation to a physical memory address. When this occurs, the MMU generates a data abort interrupt. The offending program is terminated or handled according to a separate exception handling policy.
그러나 MMU를 내장하고 있지 않은 CPU를 사용하는 시스템에서는 이러한 방법을 이용할 수 없으므로 접근 위반을 소프트웨어적으로 처리하여야 한다. 소프트웨어적으로 처리하기 위해서는 객체를 참조하기 전에 항상 그 객체가 NULL 포인터로 초기화되어 있는지를 검증하는 검증 루틴을 수행하여야 한다. 이와 같이 소프트웨어적으로 접근 위반을 처리하기 위해서는, 프로그램 코드에서 객체를 참조하는 루틴 앞에서 검증 루틴을 추가시켜야 하므로, 프로그램의 크기가 커지며 검증에 따른 오버헤드가 커진다는 문제점이 있다.However, this method is not available on systems using CPUs that do not have a built-in MMU, so access violations must be handled in software. For software processing, you should always run a verification routine to verify that an object is initialized with a NULL pointer before referencing it. As described above, in order to handle an access violation in software, a verification routine must be added in front of a routine referencing an object in a program code, thereby increasing the program size and increasing the overhead of verification.
본 발명이 이루고자 하는 기술적 과제는 MMU가 내장되지 않은 CPU를 사용하는 시스템에서 접근 위반을 하드웨어적으로 처리하는 방법을 제공하는 것이다.An object of the present invention is to provide a method for hardware-handling an access violation in a system using a CPU that does not have an MMU.
도 1은 본 발명의 실시예에 따른 메모리에 대한 접근 위반 처리를 하는 컴퓨터 시스템을 나타내는 도면이다.1 is a diagram illustrating a computer system for performing access violation processing on a memory according to an embodiment of the present invention.
도 2는 오정렬 메모리 접근을 나타내는 도면이다.2 is a diagram illustrating misaligned memory access.
도 3은 메모리에 저장된 인터럽트 벡터 테이블을 ARM CPU의 경우를 예로 들어 나타내는 도면이다.3 is a diagram illustrating an interrupt vector table stored in a memory as an example of an ARM CPU.
도 4는 본 발명의 실시예에 따른 접근 위반 처리 방법을 나타내는 흐름도이다.4 is a flowchart illustrating an access violation processing method according to an embodiment of the present invention.
도 5는 본 발명의 실시예에 따라 NULL 포인터를 정의하는 모의(pseudo) 프로그램 코드이다.5 is a pseudo program code defining a NULL pointer according to an embodiment of the present invention.
도 6은 본 발명의 실시예에 따라 접근 위반이 발생하는 모의 프로그램 코드이다.6 is a simulated program code in which an access violation occurs according to an embodiment of the present invention.
도 7은 본 발명의 실시예에 따른 데이터 중지 인터럽트 서비스 루틴의 처리 방법을 나타내는 흐름도이다.7 is a flowchart illustrating a method of processing a data stop interrupt service routine according to an embodiment of the present invention.
도 8은 본 발명의 실시예에 따른 데이터 중지 인터럽트 서비스 루틴의 모의 프로그램 코드이다.8 is a simulated program code of a data stop interrupt service routine according to an embodiment of the present invention.
이러한 과제를 달성하기 위하여 본 발명은 오정렬 메모리 접근을 이용하여 접근 위반을 처리한다.To achieve this task, the present invention uses misaligned memory access to handle access violations.
본 발명에 따르면 오정렬 메모리 접근(misaligned memory access)에 따라 인터럽트를 발생시키는 컴퓨터 시스템에서 메모리 접근 위반(access violation)을 처리하는 방법이 제공된다. 이 방법에 의하면, 먼저 NULL 포인터의 주소를 오정렬 메모리 접근을 발생시킬 수 있는 주소로 정의한다. 그리고 응용 프로그램의 NULL 포인터 참조로 인해 오정렬 메모리 접근이 발생한 경우에 소정의 인터럽트 서비스 루틴을 실행하여 접근 위반 처리를 한다.According to the present invention there is provided a method for dealing with a memory access violation in a computer system that generates an interrupt in accordance with a misaligned memory access. According to this method, the address of the NULL pointer is first defined as an address that can cause misaligned memory access. When misaligned memory access occurs due to the NULL pointer reference of an application program, an access violation is handled by executing a predetermined interrupt service routine.
이때, NULL 포인터의 주소는 홀수 번지로 정의하는 것이 바람직하다.In this case, it is preferable to define the address of the NULL pointer as an odd address.
본 발명의 메모리 접근 위반 처리 방법에서, 오정렬 메모리 접근에 의해 인터럽트가 발생한 경우에 다음에 실행될 인스트럭션의 주소를 저장한다. 그리고 프로그램 카운터를 인터럽트 서비스 루틴의 위치로 이동시켜, 인터럽트 서비스 루틴을 실행하여 접근 위반 처리를 한다.In the memory access violation processing method of the present invention, an address of an instruction to be executed next when an interrupt occurs due to a misaligned memory access is stored. The program counter is moved to the location of the interrupt service routine, and the interrupt service routine is executed to handle the access violation.
본 발명의 메모리 접근 위반 처리 방법에서 인터럽트 서비스 루틴이 실행되면, 먼저 레지스터에 저장되어 있는 현재 실행 중인 프로그램의 스택 정보 및 상태 정보가 복사된다. 다음에 인터럽트 서비스 루틴에서는 지정된 접근 위반 처리 루틴의 주소를 인터럽트 서비스 루틴의 복귀 주소로 지정한다. 그리고 복사된 스택 정보 및 상태 정보를 복구하고 프로그램 카운터를 지정된 접근 위반 처리 루틴으로 이동시킨다.When the interrupt service routine is executed in the memory access violation processing method of the present invention, first, stack information and state information of a currently executing program stored in a register are copied. Next, the interrupt service routine designates the address of the specified access violation processing routine as the return address of the interrupt service routine. It recovers the copied stack and state information and moves the program counter to the specified access violation handling routine.
본 발명에 따른 컴퓨터 프로그램 제품에는 이러한 방법이 기록되어 있다.Such a method is recorded in a computer program product according to the invention.
본 발명에 따른 컴퓨터 시스템은, 인터럽트가 발생한 경우에 처리할 인터럽트 서비스 루틴의 주소가 지정된 인터럽트 벡터 테이블을 저장하고 있는 메모리와, 오정렬 메모리 접근이 발생한 경우에 인터럽트를 발생시키고, 인터럽트 벡터 테이블에 저장된 주소에 따라 인터럽트 서비스 루틴을 실행시키는 컨트롤러를 포함한다. 그리고 이 컴퓨터 시스템에는 운영 체제가 설치되어, NULL 포인터의 주소를 참조할 경우에 오정렬 메모리 접근이 발생하는 주소로 정의하고, 인터럽트 서비스 루틴의 복귀 주소를 NULL 포인터 접근에 따른 접근 위반 처리를 하는 루틴으로 정의한다.The computer system according to the present invention includes a memory storing an interrupt vector table in which an address of an interrupt service routine to be processed when an interrupt occurs, and an interrupt generated when an misaligned memory access occurs and an address stored in the interrupt vector table. And a controller for executing the interrupt service routine. In addition, the operating system is installed in this computer system and defines as the address where misaligned memory access occurs when referring to the address of NULL pointer, and the return address of the interrupt service routine is an access violation handling according to NULL pointer access. define.
이때 인터럽트 서비스 루틴은, 레지스터에 저장되어 있는 현재 실행 중인 프로그램의 스택 정보 및 상태 정보를 복사하는 루틴, 접근 위반 처리를 하는 루틴의 주소를 인터럽트 서비스 루틴의 복귀 주소로 저장하는 루틴, 그리고 복사된 스택 정보 및 상태 정보를 복구하는 루틴을 포함하는 것이 바람직하다.At this time, the interrupt service routine may include a routine for copying stack information and status information of a currently executing program stored in a register, a routine for storing an address of an access violation handling routine as a return address of an interrupt service routine, and a copied stack. It is desirable to include a routine for recovering information and status information.
아래에서는 첨부한 도면을 참고로 하여 본 발명의 실시예에 대하여 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자가 용이하게 실시할 수 있도록 상세히 설명한다. 그러나 본 발명은 여러 가지 상이한 형태로 구현될 수 있으며 여기에서 설명하는 실시예에 한정되지 않는다.DETAILED DESCRIPTION Hereinafter, exemplary embodiments of the present invention will be described in detail with reference to the accompanying drawings so that those skilled in the art may easily implement the present invention. As those skilled in the art would realize, the described embodiments may be modified in various different ways, all without departing from the spirit or scope of the present invention.
이제 본 발명의 실시예에 따른 메모리 접근 위반 처리 방법 및 이를 위한 컴퓨터 시스템에 대하여 도면을 참고로 하여 상세하게 설명한다.A method of processing a memory access violation and a computer system therefor according to an embodiment of the present invention will now be described in detail with reference to the accompanying drawings.
도 1은 본 발명의 실시예에 따른 메모리 접근 위반 처리를 하는 컴퓨터 시스템을 나타내는 도면이며, 도 2는 정렬되지 않은 메모리 접근을 나타내는 도면이고, 도 3은 메모리에 저장된 인터럽트 벡터 테이블을 ARM CPU의 경우를 예로 들어 나타내는 도면이다.1 is a diagram illustrating a computer system for processing a memory access violation according to an embodiment of the present invention, FIG. 2 is a diagram illustrating an unaligned memory access, and FIG. 3 is an interrupt vector table stored in a memory in the case of an ARM CPU. It is a figure which shows, for example.
도 1에 나타낸 바와 같이, 본 발명의 실시예에 따른 컴퓨터 시스템은 메모리(100), CPU(200) 및 운영 체제(OS, operating system)(300)를 포함한다.As shown in FIG. 1, a computer system according to an embodiment of the present invention includes a memory 100, a CPU 200, and an operating system (OS) 300.
메모리(100)는 데이터나 명령어가 저장되는 영역(110)과 인터럽트 벡터 테이블이 저장되는 영역(120)을 포함한다. 일반적으로 대다수의 컴퓨터 시스템에서는 메모리 접근의 효율성을 위해 하드웨어에서 지원하는 자료형(character, integer, long integer 등)의 길이의 배수에 해당하는 메모리 번지부터 시작되는 메모리 영역에 데이터나 명령어를 저장한다.The memory 100 includes an area 110 in which data or instructions are stored and an area 120 in which an interrupt vector table is stored. In general, most computer systems store data or instructions in memory areas starting at the memory address that is a multiple of the length of the data type supported by the hardware (character, integer, long integer, etc.) for efficient memory access.
그리고 예를 들어 RISC(reduced instruction set computer) 계열의 컴퓨터 시스템에서는 메모리로부터 데이터를 읽어들일 때 그 자료형에 따라 4바이트 또는 8바이트 단위의 덩어리(chunk)로 읽어들인다. 이 때 읽어들이고자 하는 메모리의 주소는 도 2에서 (A)로 표시한 것처럼 덩어리 길이의 배수로부터 시작되어야 하며, 그렇지 못한 메모리 접근을 오정렬 메모리 접근(misaligned memory access)라 한다.For example, in a reduced instruction set computer (RISC) -based computer system, when data is read from memory, it is read in chunks of 4 bytes or 8 bytes according to the data type. At this time, the address of the memory to be read must start from a multiple of the chunk length as indicated by (A) in FIG. 2, and the memory access that is not read is referred to as misaligned memory access.
자세하게 설명하면, 도 2에서 (B)로 표시한 것처럼 덩어리 단위로 나누어진 경계선에 걸리도록 메모리 접근을 하는 경우에 오정렬 메모리 접근이 발생한다. 이러한 오정렬 메모리 접근이 발생한 경우에 CPU(200)는 원래 프로그램의 수행을 멈추고 데이터 중지 인터럽트(data abort interrupt)를 발생시킨다. 데이터 중지 인터럽트가 발생하면 CPU(200)는 도 3에 나타낸 바와 같이 메모리(120)에 저장된 인터럽트 벡터 테이블의 데이터 중지 항목의 내용에 따라 인터럽트 처리를 한다.In detail, a misaligned memory access occurs when the memory access is performed such that the boundary line is divided into chunks as indicated by (B) in FIG. 2. When such misaligned memory access occurs, the CPU 200 stops executing the original program and generates a data abort interrupt. When a data stop interrupt occurs, the CPU 200 performs an interrupt process according to the contents of the data stop item of the interrupt vector table stored in the memory 120 as shown in FIG.
인터럽트 벡터 테이블에는 각 인터럽트 유형별로 미리 지정된 32비트 길이의 벡터를 하나씩 가지고 있으며, 이 벡터에는 분기(branch) 명령 또는 프로그램 카운터(PC, program counter) 로드 명령이 기록되어 있다. CPU(200)는 인터럽트가 발생한 경우에 해당하는 벡터에 기록된 내용에 따라 적절한 인터럽트 서비스 루틴을 실행한다.In the interrupt vector table, there is one 32-bit vector, which is predetermined for each interrupt type, and a branch instruction or a program counter (PC) load instruction is recorded in the vector. The CPU 200 executes an appropriate interrupt service routine according to the contents recorded in the vector corresponding to the interrupt occurrence.
아래에서는 도 4 내지 도 6을 참조하여 본 발명의 실시예에 따른 접근 위반 처리 방법을 자세하게 설명한다.Hereinafter, the access violation processing method according to the embodiment of the present invention will be described in detail with reference to FIGS. 4 to 6.
도 4는 본 발명의 실시예에 따라 접근 위반 처리를 하는 방법을 나타내는 흐름도이며, 도 5는 본 발명의 실시예에 따라 NULL 포인터를 정의하는 모의(pseudo) 프로그램 코드를 나타내는 도면이다. 도 6은 접근 위반이 발생하는 모의 프로그램 코드를 나타내는 도면이다.FIG. 4 is a flowchart illustrating a method of performing an access violation according to an embodiment of the present invention, and FIG. 5 is a diagram illustrating pseudo program code defining a NULL pointer according to an embodiment of the present invention. 6 is a diagram illustrating a mock program code in which an access violation occurs.
먼저 NULL 포인터를 참조하는 경우에 발생하는 접근 위반을 검출하기 위해서, NULL 포인터를 참조하는 경우에 오정렬 메모리 접근이 발생하도록 한다. 이를 위해서 NULL 포인터의 주소를 이를 참조하는 경우에 오정렬 메모리 접근이 발생하는 주소로 정의한다(S401). 예를 들어 메모리(110)에서 데이터를 읽어들일 때 2바이트 또는 4바이트의 덩어리로 읽어들이는 경우에는, 운영 체제(300)에서 도 5에 나타낸 바와 같이 NULL 포인터의 주소를 홀수 번지(도 5의 예에서는 0x1231번지)로 정의한다. 이러한 NULL 포인터의 주소는 홀수 번지뿐만 아니라 그 주소를 참조하는 오정렬 메모리 접근을 발생할 수 있는 번지라면 모든 번지가 가능하다. NULL 포인터의 주소는 NULL 매크로를 사용하는 프로그램을 컴파일하는 경우에 지정된 번지로 치환된다.To detect an access violation that occurs when a NULL pointer is referenced first, misaligned memory access occurs when a NULL pointer is referenced. To this end, the address of the NULL pointer is defined as an address where misaligned memory access occurs when referencing the address (S401). For example, when reading data from the memory 110 in chunks of 2 bytes or 4 bytes, the operating system 300 reads the address of the NULL pointer as an odd address (as shown in FIG. 5). In this example, 0x1231). The address of such a NULL pointer can be any address as long as it can cause an odd address as well as a misaligned memory access that refers to the address. The address of the NULL pointer is replaced with the specified address when compiling a program that uses the NULL macro.
도 6에 나타낸 바와 같은 프로그램에서 pBookCover의 메소드(method)인 getWidth()를 참조하는 경우에는 pBookCover가 NULL 포인터(0x1231번지)로 초기화되어 있으므로 오정렬 메모리 접근이 발생한다(S402). 이와 같이 오정렬 메모리 접근이 발생하면 CPU(200)는 데이터 중지 인터럽트를 발생시킨다(S403). 데이터 중지 인터럽트가 발생하면 CPU(200)는 메모리(120)에 저장된 인터럽트 벡터 테이블의 데이터 중지 영역에 기록된 내용에 따라 데이터 중지 인터럽트 서비스 루틴(data abort interrupt service routine)을 실행시킨다(S404). 이러한 데이터 중지 인터럽트 서비스 루틴의 복귀 주소는 접근 위반을 처리하는 루틴의 주소값으로 한다. 이에 따라 데이터 중지 인터럽트 서비스 루틴이 실행을 마치고 리턴되면 접근 위반에 대한 처리가 실행되고 미리 기록된 내용에 따라 접근 위반을 발생시킨 프로그램이 종료되거나 다른 처리 루틴이 실행된다(S405).In the case of referring to getWidth (), which is a method of pBookCover, in a program as shown in FIG. 6, since misaligned memory access occurs because pBookCover is initialized with a NULL pointer (address 0x1231) (S402). As such, when the misalignment memory access occurs, the CPU 200 generates a data stop interrupt (S403). When a data stop interrupt occurs, the CPU 200 executes a data abort interrupt service routine according to the contents recorded in the data stop area of the interrupt vector table stored in the memory 120 (S404). The return address of this data stop interrupt service routine is the address of the routine that handles the access violation. Accordingly, when the data stop interrupt service routine finishes execution and returns, processing for the access violation is executed, and the program causing the access violation is terminated or another processing routine is executed according to the previously recorded contents (S405).
아래에서는 CPU(200)로서 ARM 프로세서를 사용하는 경우를 예로 들어서 데이터 중지 인터럽트 서비스 루틴에 대하여 도 7 및 도 8을 참조하여 자세하게 설명한다.Hereinafter, a data stop interrupt service routine will be described in detail with reference to FIGS. 7 and 8, taking an example of using an ARM processor as the CPU 200.
도 7은 본 발명의 실시예에 따른 데이터 중지 인터럽트 서비스 루틴의 처리 방법을 나타내는 흐름도이며, 도 8은 본 발명의 실시예에 따른 데이터 중지 인터럽트 서비스 루틴의 모의 프로그램 코드이다.7 is a flowchart illustrating a method of processing a data stop interrupt service routine according to an embodiment of the present invention, and FIG. 8 is a simulation program code of a data stop interrupt service routine according to an embodiment of the present invention.
본 발명의 실시예에서는 오정렬 메모리 접근(접근 위반)이 발생한 경우에 데이터 중지 인터럽트 서비스 루틴을 실행시키기 위해서 벡터 테이블의 데이터 중지 영역에 아래와 같이 기록하여 둔다.In the embodiment of the present invention, in order to execute the data stop interrupt service routine in case of misaligned memory access (access violation), the data stop area of the vector table is recorded as follows.
LDR pc,[pc,#offset]LDR pc, [pc, # offset]
여기서 pc는 프로그램 카운터를 나타내며 #offset은 원래 처리 루틴의 주소와 새롭게 설치할 처리 루틴의 주소 사이의 차이다.Where pc represents the program counter and #offset is the difference between the address of the original processing routine and the address of the new processing routine to be installed.
그러면 데이터 중지 인터럽트가 발생하면 원래 실행되어야 처리 루틴이 실행되지 않고 #offset만큼 떨어진 주소에 새로 설치된 데이터 중지 인터럽트 서비스 루틴이 실행된다. 이러한 데이터 중지 인터럽트 서비스 루틴의 예로서 도 8에 나타낸 바와 같은 알고리즘을 사용할 수 있다.Then, when a data stop interrupt occurs, the processing routine does not run until it is originally executed, but the newly installed data stop interrupt service routine runs at an address that is #offset away. As an example of such a data stop interrupt service routine, an algorithm as shown in FIG. 8 may be used.
데이터 중지 인터럽트가 발생한 경우의 처리 방법에 대해서 자세히 설명하면, 먼저 오정렬 메모리 접근에 의해 데이터 중지 인터럽트가 발생하면 CPU(200)는 이를 발생시킨 인스트럭션(instruction)의 2스텝 다음의 인스트럭션의 주소를 저장한다(S701). 다음에 CPU(200)는 프로그램 카운터(PC)를 인터럽트 벡터 테이블에 지정한 위치로 이동하여 데이터 중지 인터럽트 서비스 루틴이 수행된다(S702).A detailed description will be given of a processing method when a data stop interrupt occurs. First, when a data stop interrupt occurs due to a misalignment memory access, the CPU 200 stores the address of the instruction following two steps of the instruction that caused this. (S701). Next, the CPU 200 moves the program counter PC to the position specified in the interrupt vector table, and a data stop interrupt service routine is performed (S702).
데이터 중지 인터럽트 서비스 루틴은 도 8에 나타낸 바와 같이 레지스터에 저장되어 있는 현재 프로그램의 스택(stack) 정보와 상태 정보를 별도의 위치(스택)에 복사하고(S703), 프로그램 실행 모드를 인터럽트 처리 모드로 변경하여 다른 인터럽트 발생을 막는다(S704). 단계 S703에 복사하는 정보에는 링크 레지스터(link register, LR)도 포함되어 있다.As shown in FIG. 8, the data stop interrupt service routine copies the stack information and the state information of the current program stored in the register to a separate location (stack) (S703), and changes the program execution mode to the interrupt processing mode. The change is prevented to generate another interrupt (S704). The information copied in step S703 also includes a link register (LR).
그리고 데이터 중지 인터럽트 서비스 루틴은 지정된 인터럽트를 수행하는 데, 도 8에 나타낸 바와 같이 링크 레지스터에 인터럽트 서비스 루틴이 리턴할 raiseAV의 주소를 저장한다(S705). raiseAV는 실제로 접근 위반에 대한 처리를 하는 루틴이며, 이러한 raiseAV로는 접근 위반을 발생시킨 프로그램을 종료시키는 처리 루틴 또는 다른 처리 루틴 등이 될 수 있다. 다음에 복사해 둔 스택 정보와 상태 정보 등을 원래의 위치로 복구시키고 프로그램 카운터(PC)를 단계 S701에서 저장한 인스트럭션의 주소로 이동시킨다(S706).The data stop interrupt service routine performs the designated interrupt, and stores the address of the raiseAV to be returned by the interrupt service routine as shown in FIG. 8 (S705). raiseAV is a routine that actually handles access violations. With raiseAV, this can be a routine or other processing routine that terminates the program that caused the access violation. Next, the copied stack information, state information, and the like are restored to their original positions, and the program counter PC is moved to the address of the instruction stored in step S701 (S706).
이와 같이 함으로써 NULL 포인터 참조로 인해서 접근 위반이 발생한 경우에 적절한 처리를 할 수 있다.In this way, proper handling can be taken in the case of an access violation caused by a NULL pointer reference.
이러한 방법은 컴퓨터 프로그램으로 기록되어 적절한 시스템에 탑재될 수 있으며, 특히 ARM 프로세서를 사용하는 이동 통신 단말기의 프로그램으로 기록되어 사용될 수 있다.Such a method can be recorded as a computer program and mounted on an appropriate system, and in particular, can be recorded and used as a program of a mobile communication terminal using an ARM processor.
이상에서 본 발명의 바람직한 실시예에 대하여 상세하게 설명하였지만 본 발명의 권리범위는 이에 한정되는 것은 아니고 다음의 청구범위에서 정의하고 있는 본 발명의 기본 개념을 이용한 당업자의 여러 변형 및 개량 형태 또한 본 발명의 권리범위에 속하는 것이다.Although the preferred embodiments of the present invention have been described in detail above, the scope of the present invention is not limited thereto, and various modifications and improvements of those skilled in the art using the basic concepts of the present invention defined in the following claims are also provided. It belongs to the scope of rights.
이와 같이 본 발명에 의하면, 하드웨어적으로 접근 위반 처리를 지원하지 않는 시스템에서 응용 프로그램의 잘못된 메모리 참조로 접근 위반이 발생한 경우에 적절한 처리를 할 수 있다.As described above, according to the present invention, when an access violation occurs due to an incorrect memory reference of an application in a system that does not support access violation processing in hardware, appropriate processing can be performed.
Claims (8)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR10-2002-0039334A KR100497671B1 (en) | 2002-07-08 | 2002-07-08 | Method managing for memory access violation and computer system therefor |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR10-2002-0039334A KR100497671B1 (en) | 2002-07-08 | 2002-07-08 | Method managing for memory access violation and computer system therefor |
Publications (2)
Publication Number | Publication Date |
---|---|
KR20040005050A true KR20040005050A (en) | 2004-01-16 |
KR100497671B1 KR100497671B1 (en) | 2005-07-25 |
Family
ID=37315423
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
KR10-2002-0039334A KR100497671B1 (en) | 2002-07-08 | 2002-07-08 | Method managing for memory access violation and computer system therefor |
Country Status (1)
Country | Link |
---|---|
KR (1) | KR100497671B1 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10618013B2 (en) | 2005-03-09 | 2020-04-14 | The Regents Of The University Of California | Nanocomposite membranes and methods of making and using same |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP0772819B1 (en) * | 1995-05-26 | 2001-11-07 | National Semiconductor Corporation | Apparatus and method for efficiently determining addresses for misaligned data stored in memory |
WO1997027544A1 (en) * | 1996-01-24 | 1997-07-31 | Sun Microsystems, Inc. | Processor with accelerated array access bounds checking |
US6233667B1 (en) * | 1999-03-05 | 2001-05-15 | Sun Microsystems, Inc. | Method and apparatus for a high-performance embedded memory management unit |
-
2002
- 2002-07-08 KR KR10-2002-0039334A patent/KR100497671B1/en not_active IP Right Cessation
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10618013B2 (en) | 2005-03-09 | 2020-04-14 | The Regents Of The University Of California | Nanocomposite membranes and methods of making and using same |
Also Published As
Publication number | Publication date |
---|---|
KR100497671B1 (en) | 2005-07-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN1147775C (en) | Guared memory system and method | |
US8799879B2 (en) | Method and apparatus for protecting translated code in a virtual machine | |
AU2004218704B2 (en) | Lazy flushing of translation lookaside buffers | |
US5303378A (en) | Reentrant protected mode kernel using virtual 8086 mode interrupt service routines | |
Aiken et al. | Deconstructing process isolation | |
US7472253B1 (en) | System and method for managing table lookaside buffer performance | |
CN112015491B (en) | Method, device and computer storage medium for realizing function jump | |
US7506096B1 (en) | Memory segment emulation model for virtual machine | |
US20070094648A1 (en) | Caching dynamically compiled code to storage | |
JPH07160483A (en) | Method for dynamic linkage of designated program image and related library program to executable application program image | |
GB2394086A (en) | Handling asynchronous interrupts in emulated systems | |
US20020038437A1 (en) | Systems and methods for replicating virtual memory on a host computer and debugging using the replicated memory | |
US7558724B2 (en) | Operation region describing a virtual device | |
US20020042868A1 (en) | Apparatus and method for providing simultaneous local and global addressing with hardware address translation | |
WO2019237866A1 (en) | Method for controlling access at runtime and computing device | |
US11907301B2 (en) | Binary search procedure for control table stored in memory system | |
US6871173B1 (en) | Method and apparatus for handling masked exceptions in an instruction interpreter | |
US7549035B1 (en) | System and method for reference and modification tracking | |
JP2004501407A (en) | Secure software SMI dispatching using caller addresses | |
CN117063165A (en) | Migrating memory pages accessible by an input-output device | |
Chen et al. | Runtime detection of memory errors with smart status | |
US8336039B2 (en) | Program, apparatus, and method of optimizing a Java object | |
WO2021225896A1 (en) | Memory page markings as logging cues for processor-based execution tracing | |
JP4342392B2 (en) | Software verification model generation method | |
KR100497671B1 (en) | Method managing for memory access violation and computer system therefor |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A201 | Request for examination | ||
N231 | Notification of change of applicant | ||
N231 | Notification of change of applicant | ||
E902 | Notification of reason for refusal | ||
E701 | Decision to grant or registration of patent right | ||
GRNT | Written decision to grant | ||
FPAY | Annual fee payment |
Payment date: 20130611 Year of fee payment: 9 |
|
FPAY | Annual fee payment |
Payment date: 20140613 Year of fee payment: 10 |
|
FPAY | Annual fee payment |
Payment date: 20150712 Year of fee payment: 11 |
|
FPAY | Annual fee payment |
Payment date: 20160618 Year of fee payment: 12 |
|
LAPS | Lapse due to unpaid annual fee |