KR100884926B1 - Method for utilizing legacy shared libraries on VM-less embedded systems - Google Patents

Method for utilizing legacy shared libraries on VM-less embedded systems Download PDF

Info

Publication number
KR100884926B1
KR100884926B1 KR1020070058648A KR20070058648A KR100884926B1 KR 100884926 B1 KR100884926 B1 KR 100884926B1 KR 1020070058648 A KR1020070058648 A KR 1020070058648A KR 20070058648 A KR20070058648 A KR 20070058648A KR 100884926 B1 KR100884926 B1 KR 100884926B1
Authority
KR
South Korea
Prior art keywords
shared library
memory
virtual memory
shared
code
Prior art date
Application number
KR1020070058648A
Other languages
Korean (ko)
Other versions
KR20080110199A (en
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 한국과학기술원
Priority to KR1020070058648A priority Critical patent/KR100884926B1/en
Publication of KR20080110199A publication Critical patent/KR20080110199A/en
Application granted granted Critical
Publication of KR100884926B1 publication Critical patent/KR100884926B1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45545Guest-host, i.e. hypervisor is an application program itself, e.g. VirtualBox

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Devices For Executing Special Programs (AREA)
  • Stored Programmes (AREA)

Abstract

본 발명은 가상 메모리가 없는 임베디드 시스템에서의 기존 공유 라이브러리 사용방법에 관한 것으로서, 가상 메모리를 지원하지 않는 컴퓨팅 환경에서도 공유 라이브러리를 사용하는 형태의 응용프로그램 코드 생성 시, 가상 메모리를 지원하는 컴퓨팅 환경을 가정하고 개발된 종래의 코드 생성 도구들을 수정 없이 활용할 수 있도록 하는, 기존 공유 라이브러리 사용방법을 제공함에 그 특징적인 목적이 있다. The present invention relates to a method of using an existing shared library in an embedded system without virtual memory, and to a computing environment that supports virtual memory when generating application code in the form of using a shared library even in a computing environment that does not support virtual memory. Its characteristic purpose is to provide a method of using an existing shared library that can be used without modification to the conventional code generation tools that have been assumed and developed.

이러한 특징적인 목적을 달성하기 위한 본 발명은, (a) 공유 라이브러리 전역 오프셋 테이블을 위한 하나의 메모리 영역을 할당하는 과정; (b) 상기 공유 라이브러리를 사용하는 각각의 프로세스가 상기 메모리 영역을 공유할 수 있도록, 상기 공유 라이브러리의 GOT를 공유 라이브러리 코드가 적재된 영역으로부터 고정된 위치에 배치하는 과정; 및 (c) 상기 공유 라이브러리 GOT의 전역 변수 항목이 항상 유효한 물리 메모리 주소를 갖도록, 각각의 프로세스 사이의 문맥 전환 시점에 상기 공유 라이브러리 GOT의 전역 변수 항목 값을 수정하는 과정; 을 포함한다. The present invention for achieving this characteristic object comprises the steps of: (a) allocating one memory area for a shared library global offset table; (b) placing the GOT of the shared library at a fixed location from the area where the shared library code is loaded so that each process using the shared library can share the memory area; And (c) modifying the global variable item value of the shared library GOT at the time of context switching between each process such that the global variable item of the shared library GOT always has a valid physical memory address; It includes.

임베디드 시스템, 가상 메모리, 공유 라이브러리 Embedded Systems, Virtual Memory, Shared Libraries

Description

가상 메모리가 없는 임베디드 시스템에서의 기존 공유 라이브러리 사용방법{Method for utilizing legacy shared libraries on VM-less embedded systems}How to use existing shared libraries on embedded systems without virtual memory {Method for utilizing legacy shared libraries on VM-less embedded systems}

도 1 은 공유 라이브러리 코드에서 전역 변수를 읽거나 쓰기 위해 GOT(Global Offset Table)를 통해 데이터 영역에 접근하는 방법을 보여주는 일예시도.1 is an illustration showing how to access a data region via a Global Offset Table (GOT) to read or write global variables in shared library code.

도 2 는 공유 라이브러리 코드에서 외부 함수를 호출하기 위해 GOT(Global Offset Table) 및 PLT(Procedure Linkage Table)를 사용하는 방식을 보여주는 일예시도.2 illustrates an example of using a global offset table (GOT) and a procedure linkage table (PLT) to call external functions in shared library code.

도 3 은 같은 공유 라이브러리를 사용하는 두 개의 응용프로그램 프로세스가 메모리에 적재되어 있는 상황을 물리 메모리 주소의 관점과 가상 메모리 주소의 관점에서 보여주는 일예시도.Figure 3 is an example showing the situation in which two application processes using the same shared library are loaded in memory in terms of physical memory addresses and virtual memory addresses.

도 4 는 본 발명에 따른 가상 메모리가 없는 임베디드 시스템에서의 기존 공유 라이브러리 사용방법에 관한 전체 흐름도.4 is an overall flowchart of a method of using an existing shared library in an embedded system without a virtual memory according to the present invention.

도 5 는 본 발명에 따른 응용프로그램 프로세스들 사이의 문맥 전환 시점에 전역 변수와 관련된 GOT 항목의 값을 수정해 주는 제 3 과정(S30)의 세부 흐름도.FIG. 5 is a detailed flowchart of a third process S30 for modifying a value of a GOT item associated with a global variable at the time of context switching between application program processes. FIG.

본 발명은 임베디드 시스템에서의 기존 공유 라이브러리 사용방법에 관한 것으로서, 더욱 상세하게는 가상 메모리를 지원하지 않는 컴퓨팅 환경에서 공유 라이브러리를 사용하는 형태의 응용프로그램 코드 생성 시, 가상 메모리를 지원하는 컴퓨팅 환경을 가정하고 개발된 종래의 코드 생성 도구들(컴파일러, 링커 등)을 수정 없이 활용할 수 있도록 하는, 가상 메모리가 없는 임베디드 시스템에서의 기존 공유 라이브러리 사용방법에 관한 것이다. The present invention relates to a method of using an existing shared library in an embedded system, and more particularly, to a computing environment that supports virtual memory when generating application code in a form of using a shared library in a computing environment that does not support virtual memory. The present invention relates to a method of using an existing shared library in an embedded system without virtual memory, so that conventional code generation tools (compilers, linkers, etc.) that are assumed and developed can be utilized without modification.

주지된 바와 같이, 공유 라이브러리 기술은 두 개 이상의 응용프로그램을 동시에 메모리에 적재하여 수행할 수 있는 컴퓨팅 환경에서, 중복되는 코드의 사본을 하나만 두고 응용프로그램들이 공유하도록 하여 메모리를 절약하기 위한 기술이다.As is well known, shared library technology is a technique for saving memory by allowing applications to share only one copy of redundant code in a computing environment in which two or more applications can be loaded and executed in memory at the same time.

기존의 운영체제들, 예를 들어 윈도우즈나 리눅스에서는 공유 라이브러리의 사용이 일상적이며, 최근에는 휴대전화를 비롯한 소형 휴대 기기들의 성능이 향상되면서 이러한 컴퓨팅 환경에서도 여러 개의 응용프로그램을 동시에 메모리에 적재하면서 수행할 수 있게 되었는데, 이처럼 메모리가 제한된 컴퓨팅 환경에서는 공유 라이브러리 기술의 중요성이 더욱 회자되고 있는 추세이다. In existing operating systems, such as Windows or Linux, the use of shared libraries is commonplace, and in recent years, the performance of small mobile devices, including mobile phones, has increased, allowing multiple applications to be loaded into memory simultaneously in these computing environments. In such a memory-limited computing environment, shared library technology is becoming increasingly important.

가상 메모리 장치를 지원하지 않는 임베디드 시스템에서 공유 라이브러리를 지원하기 위한 별도의 방법을 사용하기도 한다. 일예로서, Program Counter(이하, 'PC'라고 함)에 일정한 오프셋 값을 더하여 전역 오프셋 테이블(Global Offset Table: 이하, 'GOT'라고 함)에 접근하는 기존의 방식 대신에 항상 현재 프로세스의 데이터 영역을 가리키는 특별한 레지스터(DSBR: Data Section Base Register)를 두고, DSBR을 통해 GOT에 접근하는 방식의 코드를 사용하고, 운영체제가 문맥 전환(context switch) 시점에 DSBR이 전환하려는 프로세스의 데이터 영역을 가리키도록 설정해 주는 방법을 사용하고 있으나, 이는 이러한 방식의 코드를 생성하는 특별한 컴파일러를 사용해야만 하는 한계를 가지고 있다. Other methods may be used to support shared libraries in embedded systems that do not support virtual memory devices. As an example, instead of the traditional way of accessing the Global Offset Table (GOT) by adding a constant offset value to the Program Counter (hereinafter referred to as 'PC'), the data area of the current process is always present. A special section (DSBR) is used to access the GOT through DSBR, and the operating system switches to the data area of the process that DSBR is about to switch to at the context switch. Although this method is used, it has the limitation of using a special compiler to generate this type of code.

그리고, 기존의 공유 라이브러리 코드는 GOT에 접근할 때에 PC에 일정한 오프셋 값을 더하여 GOT 항목의 주소를 찾아내는데, 가상 메모리를 지원하지 않는 환경에서는 공유 라이브러리 코드 영역과 각 응용프로그램 프로세스마다 할당하는 공유 라이브러리 GOT 영역의 주소 차이가 고정되어 있지 않으므로 이러한 방식의 기존 코드가 올바로 동작하지 않는 문제점이 있었다. In addition, the existing shared library code finds the address of the GOT item by adding a certain offset value to the PC when accessing the GOT.In an environment that does not support virtual memory, the shared library code area and the shared library allocated to each application process are allocated. Since the address difference of the GOT area is not fixed, there is a problem that the existing code of this method does not work correctly.

본 발명은, 상기와 같은 문제점을 해결하기 위해 창안된 것으로서, 가상 메모리를 지원하지 않는 컴퓨팅 환경에서도 공유 라이브러리를 사용하는 형태의 응용프로그램 코드 생성 시, 가상 메모리를 지원하는 컴퓨팅 환경을 가정하고 개발된 종래의 코드 생성 도구들(컴파일러, 링커 등)을 수정 없이 활용할 수 있도록 하는, 기존 공유 라이브러리 사용방법을 제공하는 것으로서, The present invention was devised to solve the above problems, and was developed assuming a computing environment that supports virtual memory when generating application code in the form of using a shared library even in a computing environment that does not support virtual memory. It provides a method of using an existing shared library, which can use existing code generation tools (compiler, linker, etc.) without modification.

본 발명의 제 1 목적은, 공유 라이브러리 코드 영역으로부터 고정된 위치에 단 하나의 GOT 영역(메모리 영역)만을 할당함으로써, 공유 라이브러리를 사용하는 모든 응용프로그램 프로세스가 공유하도록 하는 방법을 제공함에 있으며, The first object of the present invention is that only one in a fixed position from the shared library code area By allocating only the GOT area (memory area), it provides a way for all application processes using the shared library to share.

본 발명의 제 2 목적은, 할당된 하나의 GOT가 응용프로그램 프로세스들 사이의 문맥 전환 이후에도 유효한 물리 메모리 주소 값을 갖도록, 응용프로그램 프로세스 사이의 문맥 전환 시점에서 GOT 항목의 물리 메모리 주소 값 즉, 공유 라이브러리 GOT의 전역 변수 항목 값을 수정하는 방법을 제공함에 있다. The second object of the present invention is to share the physical memory address value of a GOT item, i.e., at the point of context switch between application processes, so that one assigned GOT has a valid physical memory address value even after the context switch between application processes. Provides a way to modify the global variable entry value of the library GOT.

본 발명은 가상 메모리가 없는 임베디드 시스템에서의 기존 공유 라이브러리 사용방법에 관한 것으로서, 가상 메모리가 없는 임베디드 시스템에서의 기존 공유 라이브러리 사용방법에 있어서, (a) 공유 라이브러리 전역 오프셋 테이블을 위한 하나의 메모리 영역을 할당하는 과정; (b) 상기 공유 라이브러리를 사용하는 각각의 프로세스가 상기 메모리 영역을 공유할 수 있도록, 상기 공유 라이브러리의 GOT를 공유 라이브러리 코드가 적재된 영역으로부터 고정된 위치에 배치하는 과정; 및 (c) 상기 공유 라이브러리 GOT의 전역 변수 항목이 항상 유효한 물리 메모리 주소를 갖도록, 각각의 프로세스 사이의 문맥 전환 시점에 상기 공유 라이브러리 GOT의 전역 변수 항목 값을 수정하는 과정; 을 포함한다. The present invention relates to a method of using an existing shared library in an embedded system without a virtual memory, and to a method of using an existing shared library in an embedded system without a virtual memory, the method comprising: (a) one memory region for a shared library global offset table; Assigning a process; (b) placing the GOT of the shared library at a fixed location from the area where the shared library code is loaded so that each process using the shared library can share the memory area; And (c) modifying the global variable item value of the shared library GOT at the time of context switching between each process such that the global variable item of the shared library GOT always has a valid physical memory address; It includes.

또한 바람직하게 상기 (c) 과정은, (c-1) 상기 공유 라이브러리 GOT에서 전역 변수를 가리키는 항목의 목록을 저장하는 단계; (c-2) 상기 공유 라이브러리를 사용하는 각 프로세스의 메모리 영역에 할당한 공유 라이브러리 데이터 영역의 시작 주소를 저장하는 단계; 및 (c-3) 상기 공유 라이브러리를 사용하는 각각의 프로세스를 위해 할당한 공유 라이브러리 데이터 영역의 시작주소의 오차 값을 이용하 여 상기 공유 라이브러리 GOT의 전역 변수 항목을 수정하는 단계; 를 포함하는 것을 특징으로 한다. Also preferably, the step (c) may include: (c-1) storing a list of items indicating global variables in the shared library GOT; (c-2) storing a start address of a shared library data area allocated to a memory area of each process using the shared library; (C-3) modifying a global variable item of the shared library GOT using an error value of a start address of a shared library data area allocated for each process using the shared library; Characterized in that it comprises a.

그리고 바람직하게 상기 오차 값은, 다음 프로세스의 공유 라이브러리 데이터 영역의 시작 주소와, 현재 프로세스의 공유 라이브러리 데이터 영역의 시작주소의 차로서 산출되는 것을 특징으로 한다. Preferably, the error value is calculated as a difference between the start address of the shared library data area of the next process and the start address of the shared library data area of the current process.

본 발명의 특징 및 이점들은 첨부도면에 의거한 다음의 상세한 설명으로 더욱 명백해질 것이다. 이에 앞서, 본 명세서 및 청구범위에 사용된 용어나 단어는 발명자가 그 자신의 발명을 가장 최선의 방법으로 설명하기 위해 용어의 개념을 적절하게 정의할 수 있다는 원칙에 입각하여 본 발명의 기술적 사상에 부합하는 의미와 개념으로 해석되어야 할 것이다. 또한, 본 발명에 관련된 공지 기능 및 그 구성에 대한 구체적인 설명이 본 발명의 요지를 불필요하게 흐릴 수 있다고 판단되는 경우에는, 그 구체적인 설명을 생략하였음에 유의해야 할 것이다.The features and advantages of the present invention will become more apparent from the following detailed description based on the accompanying drawings. Prior to this, the terms or words used in the present specification and claims are defined in the technical spirit of the present invention on the basis of the principle that the inventor can appropriately define the concept of the term in order to explain his invention in the best way. It should be interpreted to mean meanings and concepts. In addition, when it is determined that the detailed description of the known function and its configuration related to the present invention may unnecessarily obscure the subject matter of the present invention, it should be noted that the detailed description is omitted.

이하, 첨부된 도면을 참조하여 본 발명을 상세하게 설명한다. Hereinafter, with reference to the accompanying drawings will be described in detail the present invention.

이에 앞서, 이하에서는 그 언급을 생략하겠으나, 모든 처리과정은 운영체제 수준의 공유 라이브러리 및 응용프로그램 프로세스 관리모듈을 통해 실행되는 것으로 이해하는 것이 바람직하다. Prior to this, the following description will be omitted, but it is preferable to understand that all processing is performed through an operating system-level shared library and an application process management module.

도 1, 도 2 및 도 3 은 기존의 공유 라이브러리가 동작하는 원리를 설명하기 위한 것으로서, 먼저 도 1 은 공유 라이브러리 코드에서 전역 변수를 읽거나 쓰기 위해 GOT를 통해 데이터 영역에 접근하는 방법을 보여주는 일예시도이다.1, 2 and 3 are for explaining the principle of the operation of the existing shared library, first Figure 1 shows how to access the data area through the GOT to read or write global variables in the shared library code It is an illustration.

공유 라이브러리 코드는 메모리의 임의의 위치에 적재할 것을 가정하고 PIC(Position Independent Code) 형식으로 생성된다. PIC는 항상 PC에 상대적인 주소를 사용하여 분기를 수행하고, 전역 변수에 접근할 때에는 GOT 항목을 통해 접근한다. GOT를 통해 전역 변수에 접근하는 방식으로 코드를 생성하면 로더 혹은 동적 링커에 의한 재배치(relocation) 과정에서 작업을 최소화할 수 있다. GOT 항목을 적절히 설정해 주는 것만으로 코드가 올바르게 동작하므로 코드 영역을 수정할 필요가 없다. 전역 변수를 가리키는 GOT 항목은 각 응용프로그램 프로세스마다 할당된 공유 라이브러리 데이터 영역을 가리키므로, 응용프로그램 프로세스마다 서로 다른 물리 메모리 주소를 가리킨다.The shared library code is generated in the Position Independent Code (PIC) format, assuming that it is loaded at an arbitrary location in memory. PIC always branches using a PC-relative address and accesses GOT entries when accessing global variables. Generating code in a way that accesses global variables through the GOT minimizes the need for relocation by the loader or dynamic linker. By setting the GOT items properly, the code works correctly, so there is no need to modify the code area. The GOT entry pointing to the global variable points to a shared library data area allocated for each application process, so it points to a different physical memory address for each application process.

도 2 는 공유 라이브러리에서 외부 함수 호출 시, GOT(Global Offset Table) 및 PLT(Procedure Linkage Table)를 사용하는 방식을 보여주는 일예시도이다. 2 is a diagram illustrating a method of using a global offset table (GOT) and a procedure linkage table (PLT) when calling an external function from a shared library.

공유 라이브러리에서 외부 함수(다른 공유 라이브러리의 함수)를 호출하는 과정 역시 GOT를 통해 이루어지는데 특정한 GOT 항목에 저장된 주소를 읽어 그 주소로 분기하는 것이다. 해당하는 GOT 항목을 적절히 설정해 주는 것은 동적 링커의 역할이다. PLT를 사용하지 않고도 외부 함수를 호출하는 코드를 생성할 수 있는데, PLT를 사용하는 목적은 외부 함수로의 연결을 실제 호출 시점까지 지연시키는 것이다. GOT 항목 중에서 PLT를 가리키는 항목은 공유 라이브러리를 사용하는 모든 응용프로그램 프로세스에서 동일한 물리 메모리 주소를 가리킨다.The process of calling an external function (a function in another shared library) from a shared library is also done through the GOT, which reads an address stored in a specific GOT item and branches to that address. It is the dynamic linker's job to set the appropriate GOT entry appropriately. You can generate code to call external functions without using PLT. The purpose of using PLT is to delay the connection to the external function until the actual call. Among the GOT entries, the PLT entry points to the same physical memory address in all application processes that use the shared library.

도 3 은 같은 공유 라이브러리를 사용하는 두 개의 응용프로그램 프로세스가 메모리에 적재되어 있는 상황을 물리 메모리 주소의 관점과 가상 메모리 주소의 관 점에서 보여주는 일예시도이다. FIG. 3 is an exemplary view illustrating the situation in which two application processes using the same shared library are loaded in memory in terms of physical memory addresses and virtual memory addresses.

물리 메모리 주소의 관점에서 응용프로그램 2를 위해 할당된 GOT 영역은 응용프로그램 1을 위해 할당된 GOT 영역보다 공유 라이브러리 코드 영역으로부터 더 멀리 떨어져 있지만, 가상 메모리 주소의 관점에서는 두 GOT 영역이 공유 라이브러리 코드 영역으로부터 일정한 거리에 위치하도록 가상 메모리 주소를 할당해 줄 수 있다. 따라서 수행 중에 PC에 일정한 오프셋 값을 더하여 GOT 항목에 접근하는 방식의 코드가 문제없이 동작할 수 있다. 하지만 가상 메모리를 지원하지 않는 환경에서는 이러한 방식으로 메모리를 구성하면 기존 코드가 올바로 동작하지 않는다.The GOT area allocated for application 2 in terms of physical memory addresses is farther from the shared library code area than the GOT area allocated for application 1, but in terms of virtual memory addresses, the two GOT areas are shared library code areas. You can assign a virtual memory address so that it is located at a certain distance from it. Therefore, the code that accesses the GOT item by adding a certain offset value to the PC during execution can operate without any problem. In an environment that does not support virtual memory, however, configuring memory in this way will prevent existing code from working correctly.

도 4 는 본 발명의 특징적인 일 양상에 따른 가상 메모리가 없는 임베디드 시스템에서의 기존 공유 라이브러리 사용방법에 관한 전체 흐름도로서, 도시된 바와 같이 공유 라이브러리 GOT를 위한 하나의 메모리 영역을 할당하는 제 1 과정(S10)과, 공유 라이브러리를 사용하는 각각의 프로세스가 상기 메모리 영역을 공유할 수 있도록, 공유 라이브러리의 GOT를 공유 라이브러리 코드가 적재된 영역으로부터 고정된 위치에 배치하는 제 2 과정(S20) 및 공유 라이브러리 GOT의 전역 변수 항목이 항상 유효한 물리 메모리 주소를 갖도록, 각각의 프로세스 사이의 문맥 전환 시점에 상기 공유 라이브러리 GOT의 전역 변수 항목 값을 수정하는 제 3 과정(S30)을 포함한다.FIG. 4 is a flowchart illustrating a method of using an existing shared library in an embedded system without a virtual memory according to an aspect of the present invention. The first process of allocating one memory area for a shared library GOT as shown in FIG. (S10) and a second process (S20) of placing the GOT of the shared library at a fixed position from the area where the shared library code is loaded, so that each process using the shared library can share the memory area and sharing. And a third step S30 of modifying the global variable item value of the shared library GOT at the time of context switching between each process so that the global variable item of the library GOT always has a valid physical memory address.

상기 제 1 과정(S10) 및 제 2 과정(S20)과 같은 메모리 구성을 통해, 가상 메모리를 지원하지 않는 컴퓨팅 환경에서도 수행 중에 PC에 일정한 오프셋 값을 더하여 GOT를 찾아내는 것이 가능하게 된다. 다만, 응용프로그램 프로세스들은 공유 라이브러리의 코드는 공유하지만 공유 라이브러리의 데이터(전역 변수 등)는 공유하지 않는다. Through memory configurations such as the first process S10 and the second process S20, it is possible to find a GOT by adding a constant offset value to a PC during execution in a computing environment that does not support virtual memory. Application processes, however, share code in a shared library but do not share data (such as global variables) in the shared library.

각 응용프로그램 프로세스들은 공유 라이브러리 데이터를 저장하기 위한 공간을 별도로 할당한다. 응용프로그램1 수행 중에 GOT의 전역 변수 관련 항목은 응용프로그램1 프로세스를 위해 할당한 공유 라이브러리 데이터 영역을 가리키고 있어야 하고, 응용프로그램2 수행 중에는 응용프로그램2 프로세스를 위해 할당한 공유 라이브러리 데이터 영역을 가리키고 있어야 한다. Each application process allocates separate space for storing shared library data. The GOT global variable related items should point to the shared library data area allocated for the Application1 process while running Application1, and the shared library data area allocated for the Application2 process should be pointing to the Application2 process. .

본 발명에서는 응용프로그램 프로세스들 사이의 문맥 전환 시점에 전역 변수와 관련된 GOT 항목의 값을 수정해 주는 제 3 과정(S30)의 방법을 통해 문제를 해결한다.In the present invention, the problem is solved through the method of the third step S30 of modifying a value of a GOT item related to a global variable at the time of context switching between application program processes.

문맥 전환 시점에 GOT 항목의 값을 수정하는 방법은 공유 라이브러리 및 프로세스 관리 모듈을 통해 다양한 방법으로 구현할 수 있으나 그 일 예로서, 제 3 과정(S30)의 세부 흐름을 도 5 를 참조하여 살피면 다음과 같다. The method of modifying the value of the GOT item at the time of context switching can be implemented in various ways through the shared library and the process management module. However, as an example, the detailed flow of the third process S30 will be described with reference to FIG. same.

공유 라이브러리 GOT에서 전역 변수를 가리키는 항목의 목록을 비트맵 등의 자료 구조를 이용하여 저장하고(S32), 공유 라이브러리를 사용하는 각 프로세스의 메모리 영역에 할당한 공유 라이브러리 데이터 영역의 시작 주소를 저장한다(S34).Store a list of items pointing to global variables in the shared library GOT using a data structure such as a bitmap (S32), and store the start address of the shared library data area allocated to the memory area of each process using the shared library. (S34).

같은 공유 라이브러리를 사용하는 프로세스1에서 프로세스2로 문맥 전환을 수행하는 경우, 프로세스2를 위해 할당된 공유 라이브러리 데이터 영역의 시작 주소와 프로세스1을 위해 할당한 공유 라이브러리 데이터 영역의 시작 주소의 차를 계산하여, 그 차를 공유 라이브러리 GOT의 전역 변수 관련 항목들에 일괄적으로 더 해준다(S36).When performing a context switch from process 1 to process 2 using the same shared library, calculate the difference between the start address of the shared library data area allocated for process 2 and the start address of the shared library data area allocated for process 1 In step S36, the difference is added to global variable related items of the shared library GOT.

이를 유사코드로 기술하면 다음과 같다. 만일 프로세스2가 프로세스1 이 사용하고 있는 공유 라이브러리를 사용하지 않는 프로세스라면 프로세스2를 위해 할당된 공유 라이브러리 데이터 영역이 존재하지 않으나, 특정한 기본값(예를 들어 0)을 사용하여 동일한 작업을 수행하면 이후에 공유 라이브러리를 사용하는 다른 프로세스로 문맥 전환이 이루어진 시점에 문제가 발생하지 않는다.If this is described as pseudo code, it is as follows. If process2 does not use the shared library used by process1, then there is no shared library data area allocated for process2, but if you do the same with a specific default value (for example 0), then The problem does not occur when the context switch is made to another process that uses the shared library.

오차 = (다음 프로세스의 공유 라이브러리 데이터 영역의 시작 주소) - (현재 프로세스의 공유 라이브러리 데이터 영역의 시작 주소);Error = (start address of shared library data area of next process)-(start address of shared library data area of current process);

for (i = 0; i < (GOT 항목의 개수); i++)for (i = 0; i <(number of GOT entries); i ++)

{{

if (i가 전역 변수 항목의 인덱스) GOT[i] += 오차;    if (i is the index of the global variable entry) GOT [i] + = error;

}}

지금까지 상술한 바와 같은 본 발명은, 가상 메모리 장치를 탑재하지 않아 가상 메모리를 지원하지 않는 컴퓨팅 환경에서도 기존 구조의 공유 라이브러리 코드를 수정 없이 수행할 수 있도록 함으로써, 휴대전화, PDA(Portable Digital Assistant), 소형 멀티미디어 기기 등 일반적으로는 가상 메모리 장치를 탑재하지 않은 각종 임베디드 시스템에 적용할 수 있고, 이러한 환경에서 공유 라이브러리를 사용하는 형태의 응용프로그램을 개발하려 할 때에도 다양한 기존 코드 생성 도구들을 큰 수정 없이 활용할 수 있다.As described above, the present invention enables a mobile phone and a portable digital assistant (PDA) to be executed without modification by using a shared library code of an existing structure even in a computing environment that does not support a virtual memory because it is not equipped with a virtual memory device. It can be applied to a variety of embedded systems that do not have virtual memory devices, such as small and multimedia devices, and various existing code generation tools can be used without significant modifications when developing applications using a shared library in such an environment. It can be utilized.

또한, 가상 메모리를 지원하지 않는 컴퓨팅 환경에서 공유 라이브러리를 사용하기 위해 개발된 종래의 방법들과 비교하여도 메모리 사용량을 보다 절약할 수 있다는 특징적인 장점을 갖는다. In addition, compared to conventional methods developed for using a shared library in a computing environment that does not support virtual memory, there is a characteristic advantage that the memory usage can be further saved.

이상으로 본 발명의 기술적 사상을 예시하기 위한 바람직한 실시예와 관련하여 설명하고 도시하였지만, 본 발명은 이와 같이 도시되고 설명된 그대로의 구성 및 작용에만 국한되는 것이 아니며, 기술적 사상의 범주를 일탈함이 없이 본 발명에 대해 다수의 변경 및 수정이 가능함을 당업자들은 잘 이해할 수 있을 것이다. 따라서, 그러한 모든 적절한 변경 및 수정과 균등물들도 본 발명의 범위에 속하는 것으로 간주되어야 할 것이다. As described above and described with reference to a preferred embodiment for illustrating the technical idea of the present invention, the present invention is not limited to the configuration and operation as shown and described as described above, it is a deviation from the scope of the technical idea It will be understood by those skilled in the art that many modifications and variations can be made to the invention without departing from the scope of the invention. Accordingly, all such suitable changes and modifications and equivalents should be considered to be within the scope of the present invention.

상기와 같은 본 발명에 따르면, 공유 라이브러리의 GOT를 공유 라이브러리 코드 영역으로부터 물리 메모리 구조상으로 고정된 위치에 단 하나만 유지하면서, 응용프로그램 프로세스 사이의 문맥 전환 시점에 GOT 항목의 값을 수정함으로써, 모든 GOT 항목이 항상 유효한 물리 메모리 주소를 가지도록 하고, 이러한 방식으로 기존의 공유 라이브러리 코드가 올바르게 동작하도록 할 수 있는 효과가 있다. According to the present invention as described above, all GOTs are modified by modifying the value of the GOT item at the time of context switching between application processes, while maintaining only one GOT of the shared library at a fixed position on the physical memory structure from the shared library code area. This has the effect of ensuring that items always have a valid physical memory address, and that existing shared library code will work correctly in this way.

그리고 본 발명에 따르면 기존의 코드 생성 도구들을 그대로 활용하여 공유 라이브러리 기술이 적용된 소프트웨어를 개발할 수 있는 효과도 있다.In addition, according to the present invention, it is possible to develop software to which a shared library technology is applied by utilizing existing code generation tools.

Claims (3)

가상 메모리가 없는 임베디드 시스템에서의 기존 공유 라이브러리 사용방법에 있어서, In using existing shared library in embedded system without virtual memory, (a) 공유 라이브러리 GOT(Global Offset Table, 전역 오프셋 테이블)을 위한 하나의 메모리 영역을 운영체제의 메인 메모리에 할당하는 과정; (a) allocating one memory area for a shared library GOT (Global Offset Table) to main memory of an operating system; (b) 공유 라이브러리를 사용하는 각각의 프로세스가 상기 메모리 영역을 공유할 수 있도록, 상기 공유 라이브러리 GOT와 공유 라이브러리 코드가 적재된 영역이 일정한 주소 차이를 갖도록 배치하는 과정; 및 (b) arranging the shared library GOT and the region in which the shared library code is loaded to have a predetermined address difference so that each process using the shared library can share the memory region; And (c) 상기 공유 라이브러리 GOT의 전역 변수 항목이 항상 유효한 물리 메모리 주소를 갖도록, 다른 프로세스로의 전환 시점에 상기 공유 라이브러리 GOT의 전역 변수 항목 값을 수정하는 과정; 을 포함하는 가상 메모리가 없는 임베디드 시스템에서의 기존 공유 라이브러리 사용방법.(c) modifying a global variable item value of the shared library GOT at the time of switching to another process such that the global variable item of the shared library GOT always has a valid physical memory address; How to use an existing shared library in an embedded system without a virtual memory. 제 1 항에 있어서,The method of claim 1, 상기 (c) 과정은,Step (c) is, (c-1) 상기 공유 라이브러리 GOT에서 전역 변수를 가리키는 항목의 목록을 저장하는 단계;(c-1) storing a list of items indicating global variables in the shared library GOT; (c-2) 상기 공유 라이브러리를 사용하는 각 프로세스의 메모리 영역에 할당한 공유 라이브러리 데이터 영역의 시작 주소를 운영체제 내부에 저장하는 단계; 및 (c-2) storing a start address of a shared library data area allocated to a memory area of each process using the shared library in an operating system; And (c-3) 상기 공유 라이브러리를 사용하는 각 프로세스가 할당한 공유 라이브러리 데이터 영역들의 시작 주소를 이용하여, 상기 공유 라이브러리 GOT의 전역 변수 항목에 저장된 주소의 오차를 수정하는 단계; 를 포함하는 것을 특징으로 하는 가상 메모리가 없는 임베디드 시스템에서의 기존 공유 라이브러리 사용방법.(c-3) correcting an error of an address stored in a global variable item of the shared library GOT by using a start address of shared library data areas allocated by each process using the shared library; Method of using an existing shared library in an embedded system without a virtual memory, characterized in that it comprises a. 제 2 항에 있어서,The method of claim 2, 상기 공유 라이브러리 GOT의 전역 변수 항목에 저장된 주소의 오차는,The error of the address stored in the global variable item of the shared library GOT is 다음 프로세스의 공유 라이브러리 데이터 영역의 시작 주소와, 현재 프로세스의 공유 라이브러리 데이터 영역의 시작주소의 차로서 산출되는 것을 특징으로 하는 가상 메모리가 없는 임베디드 시스템에서의 기존 공유 라이브러리 사용방법.A method of using an existing shared library in an embedded system without virtual memory, characterized in that it is calculated as a difference between a start address of a shared library data area of a next process and a start address of a shared library data area of a current process.
KR1020070058648A 2007-06-15 2007-06-15 Method for utilizing legacy shared libraries on VM-less embedded systems KR100884926B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020070058648A KR100884926B1 (en) 2007-06-15 2007-06-15 Method for utilizing legacy shared libraries on VM-less embedded systems

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020070058648A KR100884926B1 (en) 2007-06-15 2007-06-15 Method for utilizing legacy shared libraries on VM-less embedded systems

Publications (2)

Publication Number Publication Date
KR20080110199A KR20080110199A (en) 2008-12-18
KR100884926B1 true KR100884926B1 (en) 2009-02-20

Family

ID=40369137

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020070058648A KR100884926B1 (en) 2007-06-15 2007-06-15 Method for utilizing legacy shared libraries on VM-less embedded systems

Country Status (1)

Country Link
KR (1) KR100884926B1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101256149B1 (en) * 2010-07-12 2013-04-19 홍익대학교 산학협력단 Method and apparatus for securing indirect function calls by using program counter encoding

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6260075B1 (en) 1995-06-19 2001-07-10 International Business Machines Corporation System and method for providing shared global offset table for common shared library in a computer system
KR20050007906A (en) * 2003-07-12 2005-01-21 삼성전자주식회사 Shared library system and method for constructing the system
KR20060062240A (en) * 2004-12-03 2006-06-12 한국전자통신연구원 Method for creating lightweight shared library for plural application programs

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6260075B1 (en) 1995-06-19 2001-07-10 International Business Machines Corporation System and method for providing shared global offset table for common shared library in a computer system
KR20050007906A (en) * 2003-07-12 2005-01-21 삼성전자주식회사 Shared library system and method for constructing the system
KR20060062240A (en) * 2004-12-03 2006-06-12 한국전자통신연구원 Method for creating lightweight shared library for plural application programs

Also Published As

Publication number Publication date
KR20080110199A (en) 2008-12-18

Similar Documents

Publication Publication Date Title
KR100518584B1 (en) Shared library system and method for constructing the system
US8028148B2 (en) Safe and efficient allocation of memory
US7412710B2 (en) System, method, and medium for efficiently obtaining the addresses of thread-local variables
US20100228936A1 (en) Accessing memory locations for paged memory objects in an object-addressed memory system
KR101213275B1 (en) System and method for providing monolithic image for use in a wireless device
KR101059633B1 (en) Heap configuration for multitasking virtual machines
EP2341441A2 (en) Methods and apparatus to perform adaptive pre-fetch operations in managed runtime environments
JP5678133B2 (en) Sharing multiple operating system subprocesses across multiple tasks
US8769498B2 (en) Warning of register and storage area assignment errors
EP2047364A1 (en) A method to use global variables for pre-efi initialization modules in efi-based firmware
KR100809293B1 (en) Apparatus and method for managing stacks in virtual machine
CN107391190B (en) Dynamic loading method for program module
KR100884926B1 (en) Method for utilizing legacy shared libraries on VM-less embedded systems
US20050132160A1 (en) Platform independent method for establishing a run-time data area
CN115994348A (en) Control method for program pipeline, processing device and storage medium
KR101140522B1 (en) System and Method for Managing Object
CN107391191B (en) Dynamic loading method for program module
CN117056031B (en) Cross-container dynamic library sharing method based on virtual process
CN112488293B (en) Method and device for operating deep learning network
CN115952017B (en) Memory processing method, device, equipment and medium
KR20170139547A (en) Fine memory protection to prevent memory overrun attacks
US20110107339A1 (en) Inner Process
CN116107919A (en) Cross-architecture multi-address space virtualized memory domain isolation method
JP2004151822A (en) Method and program for binding common library
JP2007065891A (en) Task assignment method in multiprocessor system

Legal Events

Date Code Title Description
A201 Request for examination
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: 20120201

Year of fee payment: 4

FPAY Annual fee payment

Payment date: 20130130

Year of fee payment: 5

LAPS Lapse due to unpaid annual fee