JPH11265290A - Program loading method - Google Patents

Program loading method

Info

Publication number
JPH11265290A
JPH11265290A JP6649798A JP6649798A JPH11265290A JP H11265290 A JPH11265290 A JP H11265290A JP 6649798 A JP6649798 A JP 6649798A JP 6649798 A JP6649798 A JP 6649798A JP H11265290 A JPH11265290 A JP H11265290A
Authority
JP
Japan
Prior art keywords
file
instruction
record
program
format
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
JP6649798A
Other languages
Japanese (ja)
Inventor
隆裕 ▲廣▼瀬
Takahiro Hirose
Masaru Oki
優 大木
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hitachi Ltd
Original Assignee
Hitachi Ltd
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 Hitachi Ltd filed Critical Hitachi Ltd
Priority to JP6649798A priority Critical patent/JPH11265290A/en
Publication of JPH11265290A publication Critical patent/JPH11265290A/en
Pending legal-status Critical Current

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

PROBLEM TO BE SOLVED: To make a program possible to be loaded and executed even in a system not provided with memory resources enough to develop the file of a relative address form on a memory by selecting and loading a storage medium storing object codes in the order of an address at the time of loading. SOLUTION: A file conversion processing 101 receives the file 100 of the relative address form as input and outputs a successively convertible relative address form file 104. That is, records are prepared first, the prepared records are gathered as the file 104 and outputted. A successive arrangement loader 102 reads the successively convertible relative address form file 104 and outputs the program in an absolute address form. The program 108 in the absolute address form can be directly arranged on the memory and executed. In the case that the plural input files 104 are present, a successive loading processing is performed and they are turned the single program 108 of the absolute address form and outputted.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】計算機の利用において、プロ
グラムをロードする方式に関する。
[0001] 1. Field of the Invention [0002] The present invention relates to a method of loading a program in using a computer.

【0002】[0002]

【従来の技術】プログラムのオブジェクトコード形式に
は絶対アドレス形式と相対アドレス形式がある。絶対ア
ドレス形式とは、メモリ参照や分岐先が絶対アドレスで
指定されている形式である。CPUで直接実行できるのは
絶対アドレス形式のプログラムのみである。
2. Description of the Related Art An object code format of a program includes an absolute address format and a relative address format. The absolute address format is a format in which a memory reference or a branch destination is specified by an absolute address. Only programs in absolute address format can be directly executed by the CPU.

【0003】相対アドレス形式とは、メモリ参照や分岐
先がシンボル等の相対的な方式で指定されている形式で
ある。相対アドレス形式のプログラムは、CPUで直接実
行することができない。ローダーを通して、絶対アドレ
ス形式に変換してから実行する。相対アドレス形式のプ
ログラムは、絶対アドレス形式と異なり、ロードすると
きに配置アドレスを指定することができる。そのため、
メモリ上の配置を自由選べるという利点があり、現在、
の多くの計算機システムで採用されている。
[0003] The relative address format is a format in which a memory reference or a branch destination is specified by a relative method such as a symbol. Relative address format programs cannot be executed directly by the CPU. Convert to absolute address format through loader and execute. Unlike the absolute address format, the relative address format program can specify the location address when loading. for that reason,
The advantage is that you can freely select the location on the memory,
Has been adopted in many computer systems.

【0004】相対アドレス形式のプログラムファイル
は、プログラム本体と再配置情報からなる。再配置情報
は、プログラム本体を絶対アドレス形式に変換するとき
にローダーが参照する情報である。その概要は「日本コ
ンピュータ協会発行 John J.Donovan著 システム・プ
ログラム I 第5章ローダー」にある。プログラムファ
イルの形式のうちでもっとも広く使われているのはCOFF
(Common Object File Format)と呼ばれるファイル形
式である。詳細は「AT&T UNIX SYSTEM V Programmers R
eference Manual Chapter 4(File Formats)」に記述さ
れている。
[0004] A program file in the relative address format includes a program body and relocation information. The relocation information is information referred to by the loader when converting the program body into the absolute address format. An overview is given in "System Program I, Chapter 5 Loader" by John J. Donovan, published by the Japan Computer Association. COFF is the most widely used program file format
(Common Object File Format). See AT & T UNIX SYSTEM V Programmers R for details.
eference Manual Chapter 4 (File Formats) ".

【0005】[0005]

【発明が解決しようとする課題】相対アドレス形式ファ
イルを配置するローダーは、ファイルをすべて読み込ん
で、メモリ上に展開してから、絶対アドレス形式ファイ
ルへの変換する。相対アドレス形式ファイルは再配置情
報を持っているので、絶対アドレス形式ファイルの数倍
のサイズになることが多い。そのため、ローダーが動作
するには、プログラム本体の数倍の作業メモリを確保し
なくてはならない。作業メモリが確保できなければ、プ
ログラムファイルをロードすることができず、プログラ
ムを実行することもできない。
A loader for arranging a relative address format file reads all the files, expands them on a memory, and converts them into an absolute address format file. Since the relative address format file has the relocation information, the size is often several times the size of the absolute address format file. Therefore, in order for the loader to operate, it is necessary to secure a working memory several times as large as the program body. If the working memory cannot be secured, the program file cannot be loaded and the program cannot be executed.

【0006】発明の目的は、相対アドレス形式のファイ
ルをメモリ上に展開できるだけのメモリ資源を持たない
システムであっても、プログラムをロード及び実行でき
るようにする事である。
An object of the present invention is to enable a program to be loaded and executed even in a system which does not have a memory resource capable of expanding a file of a relative address format in a memory.

【0007】[0007]

【課題を解決するための手段】(1)従来の相対アドレス
形式ファイルを、命令本体と命令再配置情報を要素とし
て含むレコードの集合からなるプログラム形式に変換す
る。
Means for Solving the Problems (1) A conventional relative address format file is converted into a program format including a set of records including an instruction body and instruction relocation information as elements.

【0008】(2)ローダーは、上記(1)のプログラム形式
のファイルから1レコードずつ取り出し、絶対アドレス
形式に変換して、メモリ上に配置する。
(2) The loader takes out one record at a time from the file in the program format of (1), converts it into the absolute address format, and arranges it on the memory.

【0009】(3)上記(1)のプログラム形式のファイルが
単一の媒体に収まらない場合は、ファイルを分割し、複
数の媒体に分けて格納する。
(3) If the file of the program format of (1) cannot be stored in a single medium, the file is divided and stored in a plurality of media.

【0010】(4)ローダーは、上記(3)のように分割され
たファイルを順次ロードし、単一のプログラムに再構成
してメモリ上に配置する。
(4) The loader sequentially loads the files divided as described in (3) above, reconfigures them into a single program, and arranges them on the memory.

【0011】[0011]

【発明の実施の形態】図1に全体の構成を示す。ファイ
ル変換処理101は、相対アドレス形式のファイル100を入
力として受け取り、逐次変換可能相対アドレス形式ファ
イル104を出力する。逐次変換可能相対アドレス形式フ
ァイル104は、ディスク装置に格納することもできる
し、ICカードに格納することもできる。単一の媒体に収
まらない場合は、複数の媒体に分割して格納することも
できる。
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS FIG. 1 shows the overall configuration. The file conversion processing 101 receives a file 100 in a relative address format as an input and outputs a sequentially convertible relative address format file 104. The sequentially convertible relative address format file 104 can be stored in a disk device or an IC card. If the data cannot be stored in a single medium, the data can be divided and stored in a plurality of media.

【0012】相対アドレス形式ファイル100のうち最も
一般的なフォーマットはCOFF形式である。逐次変換可能
相対アドレス形式ファイル104は、命令本体と命令再配
置情報を要素として含むレコードの集合からなる形式の
ファイルである。ファイル変換処理101は、102でまずレ
コードを作成する。レコードの作成方法には、再配置情
報を単位とする方法と、命令を単位とする方法がある。
次に作成したレコードをまとめてファイルに出力する。
ファイルが単一の媒体に収まらない場合は、ファイル分
割処理103で複数のファイルに分割する。ファイルを格
納する媒体にICカードを使う場合は、記憶容量の制限が
厳しいため、ファイルの分割が必要になることが多い。
The most common format of the relative address format file 100 is the COFF format. The successively convertible relative address format file 104 is a file having a format including a set of records including an instruction body and instruction relocation information as elements. The file conversion process 101 first creates a record in 102. There are two methods for creating a record: a method using relocation information as a unit and a method using an instruction as a unit.
Next, the created records are output together to a file.
If the file does not fit on a single medium, the file is divided into a plurality of files by file division processing 103. When an IC card is used as a medium for storing a file, the storage capacity is strictly limited, so that it is often necessary to divide the file.

【0013】逐次配置ローダー102は、逐次変換可能相
対アドレス形式ファイル104を読み取り、絶対アドレス
形式のプログラムを出力する。絶対アドレス形式のプロ
グラムはメモリ上に直接配置して実行することができ
る。メモリに直接書き込んでも良いし、ファイルに落と
すこともできる。入力ファイルが複数ある場合は、順次
ロード処理を行って、単一の絶対アドレス形式プログラ
ムにして出力する。逐次配置ローダー104は、まずファ
イルヘッダを読み取り、命令配置アドレス決定106を行
う。このアドレスに基づいて、レコード配置処理107を
行い、絶対アドレス形式プログラム108を生成する。
The sequential placement loader 102 reads the sequentially convertible relative address format file 104 and outputs an absolute address format program. The program in the absolute address format can be directly arranged on the memory and executed. You can write it directly to memory or save it to a file. If there are a plurality of input files, they are sequentially loaded and output as a single absolute address format program. The sequential placement loader 104 first reads the file header and determines the instruction placement address. Based on this address, record arrangement processing 107 is performed to generate an absolute address format program 108.

【0014】図2は、相対アドレス形式のオブジェクト
ファイルの一例を示している。この例は説明のために一
般的なCOFF形式のファイルに比べて簡略化されている。
相対アドレス形式のファイル200は大きく分けて、ファ
イルヘッダー201、コード領域202、再配置情報領域20
7、という3つの部分からなる。ファイルヘッダ201に
は、ファイルの属性や領域の配置等の情報が書かれてい
る。コード領域202には、命令列203,204,205,206が書か
れている。命令の中には、再配置処理の対象になるもの
とならないものがある。204,205は再配置対象外命令で
ある。コード領域に書かれている命令がそのまま絶対ア
ドレス命令になる。203,206は再配置対象命令である。
これらは、再配置情報208,209を元に、ロード時に絶対
アドレス命令に変換される。
FIG. 2 shows an example of an object file in a relative address format. This example is simplified compared to a common COFF format file for explanation.
The relative address format file 200 is roughly divided into a file header 201, a code area 202, and a relocation information area 20.
It consists of three parts, seven. The file header 201 describes information such as file attributes and area arrangement. In the code area 202, instruction strings 203, 204, 205, and 206 are written. Some instructions are not subject to relocation processing. 204 and 205 are instructions not to be relocated. The instruction written in the code area becomes an absolute address instruction as it is. 203 and 206 are instructions to be relocated.
These are converted into absolute address instructions at the time of loading based on the relocation information 208 and 209.

【0015】逐次変換可能相対形式のファイルフォーマ
ットは2種類考えられる。命令単位でレコードを作成す
る方式と、再配置情報単位でレコードを作成する方式で
ある。再配置情報単位でレコードを作成する方式から説
明する。
There are two types of relative format file formats that can be sequentially converted. One is to create a record in units of instructions, and the other is to create a record in units of relocation information. A method for creating a record in units of relocation information will be described.

【0016】図3の300は、再配置情報単位でレコードを
作成する逐次変換可能相対形式ファイルの一例を示して
いる。ファイル300は、ファイルヘッダー301とレコード
リスト302からなる。ファイルヘッダー301には、ファイ
ル識別情報とレコードを配置するオフセットが記述され
ている。レコードリスト302は、303,304等のレコードを
順に多数並べたリストである。
FIG. 3 shows an example of a sequentially convertible relative format file 300 for creating a record in units of relocation information. The file 300 includes a file header 301 and a record list 302. The file header 301 describes the file identification information and the offset at which the record is arranged. The record list 302 is a list in which many records such as 303 and 304 are arranged in order.

【0017】レコードは、再配置情報と対応する再配置
対象命令と再配置対象外命令からなる。再配置情報と再
配置対象命令は常に1つあるが、再配置対象外命令は無
い場合もあるし、複数ある場合もある。レコード303の
場合、再配置情報208と再配置対象命令203があり、再配
置対象外命令は204,205の2つがある。レコード304は、
再配置情報209と再配置対象命令206を持っているが、再
配置対象外命令を持っていない。
The record includes a relocation target instruction corresponding to the relocation information and a non-relocation target instruction. Although there is always one relocation information and one relocation target instruction, there may be no relocation non-relocation target instruction, or there may be more than one. In the case of the record 303, there are relocation information 208 and a relocation target instruction 203, and there are two non-relocation target instructions 204 and 205. Record 304 is
It has the relocation information 209 and the relocation target instruction 206, but has no relocation target instruction.

【0018】各レコードは、再配置情報と再配置対象命
令をレコード内に保持しているので、ローダーは1レコ
ードを読み込むと直ちに命令を配置することができる。
Since each record holds the relocation information and the relocation target instruction in the record, the loader can arrange the instruction as soon as one record is read.

【0019】図4の400,403は、再配置情報単位でレコー
ドを作成する逐次変換可能相対形式ファイルの分割の例
を示している。逐次変換可能相対形式のファイルはレコ
ードを単位として、任意のファイルに分割することがで
きる。レコードリスト302は、レコードリスト402とレコ
ードリスト405に分割され、それぞれファイル400とファ
イル403の要素になっている。
Reference numerals 400 and 403 in FIG. 4 show an example of division of a sequentially convertible relative format file for creating a record in units of relocation information. The sequentially convertible relative format file can be divided into arbitrary files in units of records. The record list 302 is divided into a record list 402 and a record list 405, which are elements of a file 400 and a file 403, respectively.

【0020】ファイルヘッダーには、ファイル識別情報
とコード領域のオフセットが示してある。ファイルヘッ
ダー401には、ファイル識別情報のみが記述されてい
る。ファイル400は先頭ファイルなので、コード領域の
先頭から命令を配置すれば良い。ファイルヘッダー404
には、ファイル識別情報とコードのオフセットが記述さ
れている。ファイル403は2番目のファイルなので、先
頭ファイルの命令入るスペースを空けて配置しなくては
ならない。ヘッダー404から、コード領域先頭から16バ
イトの地点から命令を配置すれば良いことが判る。
The file header shows the file identification information and the offset of the code area. The file header 401 describes only file identification information. Since the file 400 is the first file, instructions may be arranged from the beginning of the code area. File header 404
Describes the file identification information and the code offset. Since the file 403 is the second file, it must be arranged with a space for the instruction of the first file. It can be seen from the header 404 that the instruction should be arranged from the point of 16 bytes from the head of the code area.

【0021】図5は、再配置情報単位でレコードを作成
する逐次変換可能相対形式ファイルを生成するファイル
変換の処理手順を示している。まず、500で相対アドレ
ス形式のファイルを読み込み、メモリ上に展開する。次
に、501で再配置情報領域を調べ、登録されている再配
置情報のエントリ数を調べる。そのエントリの数だけ逐
次変換可能相対形式のレコードを作成する。502で再配
置情報領域のエントリを走査し、再配置情報を逐次変換
可能相対形式のレコードに書き込む。次にコード領域の
命令をレコードに書き込む。このとき、再配置対象命令
と再配置対象外の命令では扱いが異なる。再配置対象命
令は、503で各レコードに1命令ずつ書き込まれる。再配
置対象外命令は、504で直前の再配置対象命令と同じレ
コードに組み込まれる。従って、再配置対象外命令が複
数書かれることもあれば、全く書かれないこともある。
最終的に全ての命令がレコードに書き込まれる。
FIG. 5 shows a file conversion processing procedure for generating a sequentially convertible relative format file for creating a record in units of relocation information. First, a file in a relative address format is read at 500 and expanded in a memory. Next, at 501, the relocation information area is checked, and the number of registered relocation information entries is checked. Create a record in the relative format that can be sequentially converted by the number of the entries. In 502, the entry in the relocation information area is scanned, and the relocation information is written into a record in a sequentially convertible relative format. Next, the instruction in the code area is written in the record. At this time, the instruction to be relocated and the instruction not to be relocated are handled differently. The instruction to be relocated is written 503 in each record one instruction at a time. The instruction not to be relocated is incorporated in 504 in the same record as the immediately preceding instruction to be relocated. Therefore, a plurality of instructions not to be relocated may be written, or they may not be written at all.
Eventually all instructions are written to the record.

【0022】505で、逐次変換可能相対形式ファイルの
大きさを見積もる。ヘッダーの大きさは固定なので、レ
コードの占めるメモリでファイル全体の大きさを見積も
ることができる。ファイルの大きさが書き込む媒体の記
憶サイズに以内であれば、そのまま単一ファイルとして
扱う。媒体に収まりきらない場合は、506でレコードリ
ストを適当なところで分けて、複数ファイルに分割す
る。507で各ファイルの命令オフセット値を計算して、
ヘッダーを作成する。最後に508でレコードをファイル
に書き込む。
At 505, the size of the sequentially convertible relative format file is estimated. Since the size of the header is fixed, the size of the entire file can be estimated from the memory occupied by the record. If the file size is within the storage size of the medium to be written, it is treated as a single file as it is. If the record list does not fit in the medium, the record list is divided at an appropriate place in 506 and divided into a plurality of files. 507 calculates the instruction offset value of each file,
Create a header. Finally, at 508, the record is written to the file.

【0023】機密性のあるプログラムの場合は、処理50
7でヘッダーに許可条件を記述しておく。さらに処理508
でレコードを暗号化してからファイルに書き込む。レコ
ード単位で暗号化しても良いし、レコードリスト全体で
暗号化しても良い。
In the case of a confidential program, the process 50
7 describes the permission conditions in the header. Further processing 508
Encrypts the record with and writes it to the file. Encryption may be performed on a record basis or on the entire record list.

【0024】図6は、再配置情報単位でレコードを作成
する逐次変換可能相対形式ファイルを配置する逐次配置
ローダーの処理手順を示している。600で逐次配置可能
相対形式のファイルヘッダーを読む。601でその中のフ
ァイル属性を参照する。ヘッダーに許可情報が付いてい
る場合は、条件を調べ、条件に合致したら処理を続け
る。次にファイルが分割されているかどうか調べる。単
一ファイルであればそのまま処理を続ける。複数ファイ
ルに分割されている場合は、命令オフセットを調べる。
以後の処理107では、コード領域中のオフセット分だけ
ずらした位置から命令を配置していく。
FIG. 6 shows a processing procedure of a sequential placement loader for arranging a sequentially convertible relative format file for creating a record in units of relocation information. At 600, read the file header in the sequential layout relative format. At 601, the file attributes in the file are referenced. If the header has permission information, the condition is checked, and if the condition is met, the processing is continued. Then check if the file is split. If it is a single file, the process is continued. If the file is divided into multiple files, check the instruction offset.
In the subsequent processing 107, instructions are arranged from a position shifted by an offset in the code area.

【0025】602でレコードを順番に走査していく。レ
コードが暗号化されている場合はここで復号化する。全
てのレコードを走査したら完了である。まず603でレコ
ードの再配置情報を取り出す。次に、604で再配置対象
命令を取り出し、先に読んだ再配置情報と合わせて、絶
対アドレス命令を生成する。605で生成した命令はメモ
リのコード領域に配置する。次に606で再配置対象外命
令を調べる。再配置対象外命令がなければ、次のレコー
ドに処理を移す。再配置対象外命令があれば、607,608
でそのままメモリのコード領域に配置する。命令を書い
たら次のレコードに処理を移す。
In step 602, records are sequentially scanned. If the record is encrypted, it is decrypted here. When all records have been scanned, the process is completed. First, at 603, record relocation information is extracted. Next, in step 604, the instruction to be relocated is extracted, and an absolute address instruction is generated together with the relocation information read earlier. The instruction generated in 605 is arranged in the code area of the memory. Next, an instruction not to be relocated is checked at 606. If there is no instruction to be relocated, the process moves to the next record. 607,608 if there are non-relocation instructions
And place it in the code area of the memory as it is. After writing the command, the process moves to the next record.

【0026】処理が終わったら、メモリコード領域の配
置情報を調べる。単一ファイルの場合は全てのコード領
域が配置済みになっているはずである。プログラムが実
行可能になったことをシステムに通知する。複数ファイ
ルに分割されている場合は、全てのコード領域が配置済
みになっているとは限らない。全ての命令が配置された
ことが確認できたら、プログラムが実行可能になったこ
とをシステムに通知する。
When the processing is completed, the arrangement information of the memory code area is checked. In the case of a single file, all the code areas should have already been placed. Notify the system that the program is ready to run. If the file is divided into a plurality of files, not all of the code areas are already arranged. When it is confirmed that all the instructions have been arranged, the system is notified that the program can be executed.

【0027】図7の700は、命令単位でレコードを作成す
る逐次変換可能相対形式ファイルの一例を示している。
ファイル700は、ファイルヘッダー701とレコードリスト
702からなる。ファイルヘッダー701には、ファイル識別
情報とレコードを配置するオフセットが記述されてい
る。レコードリスト702は、703,704,705,706等のレコー
ドを順に多数並べたリストである。
Reference numeral 700 in FIG. 7 shows an example of a sequentially convertible relative format file for creating a record in instruction units.
File 700 has file header 701 and record list
Consists of 702. The file header 701 describes the file identification information and the offset at which the record is arranged. The record list 702 is a list in which many records such as 703, 704, 705, and 706 are arranged in order.

【0028】レコードは、再配置情報と命令からなる。
命令が再配置対象命令の場合は再配置情報と命令を持つ
が、命令が再配置対象外命令は再配置が空になる。レコ
ード703,706の場合は、命令203,206が再配置対象命令な
ので、それぞれ再配置情報208,209を持っている。レコ
ード704,705は、命令204,205が再配置対象外命令なの
で、再配置情報は空である。
A record is composed of relocation information and an instruction.
When the instruction is the instruction to be relocated, the instruction has the relocation information and the instruction. However, the instruction that is not the instruction to be relocated has empty relocation. The records 703 and 706 have relocation information 208 and 209, respectively, because the instructions 203 and 206 are relocation target instructions. In the records 704 and 705, the relocation information is empty because the instructions 204 and 205 are non-relocation instructions.

【0029】各レコードは、配置に必要な情報をレコー
ド内に保持しているので、ローダーは1レコードを読み
込むと直ちに命令を配置することができる。
Since each record holds information necessary for arrangement in the record, the loader can arrange an instruction as soon as one record is read.

【0030】図8の800,803は、命令単位でレコードを作
成する逐次変換可能相対形式ファイルを分割した例を示
している。逐次変換可能相対形式のファイルはレコード
を単位として、任意のファイルに分割することができ
る。レコードリスト702は、レコードリスト802とレコー
ドリスト805に分割され、それぞれファイル801とファイ
ル803の要素になっている。
Reference numerals 800 and 803 in FIG. 8 show examples in which a sequentially convertible relative format file for creating a record for each instruction is divided. The sequentially convertible relative format file can be divided into arbitrary files in units of records. The record list 702 is divided into a record list 802 and a record list 805, which are elements of a file 801 and a file 803, respectively.

【0031】ファイルヘッダーには、ファイル識別情報
とコード領域のオフセットが示してある。ファイルヘッ
ダー801には、ファイル識別情報のみが記述されてい
る。ファイル800は先頭ファイルなので、コード領域の
先頭から命令を配置すれば良い。ファイルヘッダー804
には、ファイル識別情報とコードのオフセットが記述さ
れている。ファイル803は2番目のファイルなので、先
頭ファイルの命令入るスペースを空けて配置しなくては
ならない。ヘッダー804から、コード領域先頭から16バ
イトの地点から命令を配置すれば良いことが判る。
The file header shows the file identification information and the offset of the code area. The file header 801 describes only file identification information. Since the file 800 is the first file, the instructions may be arranged from the beginning of the code area. File header 804
Describes the file identification information and the code offset. Since the file 803 is the second file, it must be arranged with a space for the instruction of the first file. It can be seen from the header 804 that the instruction should be arranged from the point of 16 bytes from the head of the code area.

【0032】図9は、命令単位でレコードを作成する逐
次変換可能相対形式ファイルを生成するファイル変換の
処理手順を示している。まず、900で相対アドレス形式
のファイルを読み込み、メモリ上に展開する。次に、90
1でコード領域を調べ、登録されている命令数を調べ、
そのエントリの数だけレコードを作成する。902で生成
したレコードに命令を登録する。903で再配置情報領域
のエントリを走査し、命令に対応した再配置情報がある
かどうか調べる。情報がなければ、その命令は再配置対
象外命令である。再配置情報の欄は空のままにしてお
く。情報があれば、再配置対象命令である。904でレコ
ードに再配置情報を登録する。
FIG. 9 shows a processing procedure of file conversion for generating a sequentially convertible relative format file for creating a record for each instruction. First, a file in a relative address format is read at 900 and expanded in a memory. Then, 90
Check the code area with 1, check the number of registered instructions,
Create as many records as there are entries. Register the command in the record generated in step 902. In 903, the entry in the relocation information area is scanned to check whether there is relocation information corresponding to the instruction. If there is no information, the instruction is a non-relocation target instruction. Leave the relocation information column empty. If there is information, it is a relocation target instruction. In step 904, the relocation information is registered in the record.

【0033】最終的に全ての命令がレコードに書き込ま
れたら、905で逐次変換可能相対形式ファイルの大きさ
を見積もる。ヘッダーの大きさは固定なので、レコード
の占めるメモリでファイル全体の大きさを見積もること
ができる。ファイルの大きさが書き込む媒体の記憶サイ
ズに以内であれば、そのまま単一ファイルとして扱う。
媒体に収まりきらない場合は、906でレコードリストを
適当なところで分けて、複数ファイルに分割する。907
で各ファイルの命令オフセット値を計算して、ヘッダー
を作成する。最後に908でレコードをファイルに書き込
む。
When all the instructions are finally written in the record, the size of the sequentially convertible relative format file is estimated at 905. Since the size of the header is fixed, the size of the entire file can be estimated from the memory occupied by the record. If the file size is within the storage size of the medium to be written, it is treated as a single file as it is.
If the record list does not fit in the medium, the record list is divided at an appropriate place in 906 and divided into a plurality of files. 907
Calculates the instruction offset value for each file and creates a header. Finally, at 908, the record is written to the file.

【0034】機密性のあるプログラムの場合は、処理90
7でヘッダーに許可条件を記述しておく。さらに処理908
でレコードを暗号化してからファイルに書き込む。レコ
ード単位で暗号化しても良いし、レコードリスト全体で
暗号化しても良い。
In the case of a confidential program, the process 90
7 describes the permission conditions in the header. Further processing 908
Encrypts the record with and writes it to the file. Encryption may be performed on a record basis or on the entire record list.

【0035】図10は、命令単位でレコードを作成する逐
次変換可能相対形式ファイルを配置する逐次配置ローダ
ーの処理手順を示している。1000でファイルヘッダーを
読む。1001でファイル属性を参照を参照する。ヘッダー
に許可情報が付いている場合は、条件を調べ、条件に合
致したら処理を続ける。次にファイルが分割されている
かどうか調べる。単一ファイルであればそのまま処理を
続ける。複数ファイルに分割されている場合は、命令オ
フセットを調べる。以後の処理107では、コード領域中
のオフセット分だけずらした位置から命令を配置してい
く。
FIG. 10 shows a processing procedure of a sequential placement loader for arranging a sequentially convertible relative format file for creating a record for each instruction. Read file header at 1000. Refer to the file attribute reference in 1001. If the header has permission information, the condition is checked, and if the condition is met, the processing is continued. Then check if the file is split. If it is a single file, the process is continued. If the file is divided into multiple files, check the instruction offset. In the subsequent processing 107, instructions are arranged from a position shifted by an offset in the code area.

【0036】次に1002でレコードを順番に走査してい
く。レコードが暗号化されている場合はここで復号化す
る。全てのレコードを走査したら完了である。まず1003
でレコードの再配置情報を見て、情報が書かれているか
どうか調べる。情報が空ならば、1004で命令をそのまま
メモリのコード領域に書き込む。再配置情報があった
ら、1005で再配置情報を読み、1006で再配置対象命令を
読む。再配置情報と命令を合わせて、絶対アドレス命令
を生成する。生成した命令は1007でメモリのコード領域
に書き込む。
Next, in step 1002, records are sequentially scanned. If the record is encrypted, it is decrypted here. When all records have been scanned, the process is completed. First 1003
Check the record relocation information to see if the information is written. If the information is empty, the instruction is directly written into the code area of the memory at 1004. If there is relocation information, the relocation information is read at 1005, and the relocation target instruction is read at 1006. An absolute address instruction is generated by combining the relocation information and the instruction. The generated instruction is written in the code area of the memory at 1007.

【0037】全てのレコードの処理が終わったら、メモ
リ中のコード領域の配置情報を調べる。単一ファイルの
場合は全てのコード領域が配置済みになっているはずで
ある。プログラムが実行可能になったことをシステムに
通知する。複数ファイルに分割されている場合は、全て
のコード領域が配置済みになっているとは限らない。全
てのファイルをロードして、全ての命令が配置されたこ
とが確認できたら、プログラムが実行可能になったこと
をシステムに通知する。
When all records have been processed, the arrangement information of the code area in the memory is checked. In the case of a single file, all the code areas should have already been placed. Notify the system that the program is ready to run. If the file is divided into a plurality of files, not all of the code areas are already arranged. When all the files are loaded and it is confirmed that all the instructions are arranged, the system is notified that the program is executable.

【0038】図11は、再配置情報付き実行メモリイメー
ジを示している。プログラムはすべて実行可能な絶対ア
ドレス形式に変換されてメモリ上に配置される。一度、
絶対アドレス形式に変換されてしまうと、再配置情報が
失われてしまうので、もはや再配置を行うことはできな
い。絶対アドレス形式のコードを再配置するには、再配
置情報を別に格納しておかなくてはならない。
FIG. 11 shows an execution memory image with relocation information. All programs are converted to an executable absolute address format and placed in memory. one time,
When the data is converted into the absolute address format, the relocation information is lost, so that the relocation can no longer be performed. To relocate code in absolute address format, the relocation information must be stored separately.

【0039】1101はシステム上のメモリイメージを表し
ている。1103は、実行可能なアプリケーションのコード
領域である。1104,1105,1106,1107はコード領域中の命
令である。いずれの命令も配置済みの実行可能な命令で
ある。1109は命令の再配置情報を格納しているメモリ領
域である。208と209は再配置情報である。1110は、再配
置情報以外の付加的な情報を格納しておく領域である。
1109と1110はプログラムの実行には必要ない。コード領
域中のプログラムを再配置して、別のシステムにロード
するときに使用する。
Reference numeral 1101 denotes a memory image on the system. 1103 is a code area of an executable application. 1104, 1105, 1106, 1107 are instructions in the code area. Each instruction is a placed executable instruction. A memory area 1109 stores instruction relocation information. 208 and 209 are relocation information. An area 1110 stores additional information other than the relocation information.
1109 and 1110 are not required for running the program. Used to relocate a program in a code area and load it on another system.

【0040】1102はシステム領域、1111は別のアプリケ
ーションの領域である。
Reference numeral 1102 denotes a system area, and 1111 denotes an area for another application.

【0041】図12は、再配置情報付き実行メモリイメー
ジから別の端末にロードするときの手順を示している。
1201で、元の端末のメモリのコード領域を調べる。命令
がなければ終了である。1202でコード領域から命令を取
り出し、1203で対応する再配置情報があるかどうか調べ
る。再配置情報がなければ、1205でロード先の端末に命
令を転送する。再配置情報があれば、1204で命令の再配
置を実行し、処理が終わったら命令をロード先の端末に
転送する。
FIG. 12 shows a procedure for loading from an execution memory image with relocation information to another terminal.
At 1201, the code area of the memory of the original terminal is examined. If there is no command, the process ends. At 1202, an instruction is taken out of the code area, and at 1203, it is checked whether or not there is corresponding relocation information. If there is no relocation information, in step 1205, the instruction is transferred to the load destination terminal. If there is the rearrangement information, the instruction is rearranged in step 1204, and when the processing is completed, the instruction is transferred to the load destination terminal.

【0042】命令の処理が終わったら1207に移る。新し
い端末にロードしたプログラムを再び別の端末にロード
するつもりがあるかどうか考える。別の端末にロードす
るつもりがないなら、このまま処理を終了して良い。ロ
ードするつもりならば、再配置情報を付けておかないと
別の端末にロードすることが出来ない。1007で、再配置
情報をロード先の端末に転送する。
When the processing of the instruction is completed, the process proceeds to 1207. Consider whether you intend to load the program loaded on the new terminal again on another terminal. If there is no intention to load the data to another terminal, the processing may be ended as it is. If you intend to load it, you cannot load it to another terminal without relocation information. At 1007, the relocation information is transferred to the terminal to be loaded.

【0043】図13は、再配置済みプログラムファイルの
例を示している。ファイルは、プログラムの属性情報を
記述したファイルヘッダー1302と、複数のプログラム本
体1305から構成されている。プログラム本体1305は、ロ
ードアドレスフィールド1304と再配置済みオブジェ
クトフィールド1306を持っている。再配置済みオブ
ジェクトは、特定のアドレスを指定してオブジェクトを
再配置したもので、そのままメモリに書き込んで実行す
ることができる。ロードアドレス1304は、そのアドレス
を記述したフィールドである。
FIG. 13 shows an example of a relocated program file. The file is composed of a file header 1302 describing attribute information of the program, and a plurality of program bodies 1305. The program main body 1305 has a load address field 1304 and a rearranged object field 1306. A relocated object is one in which an object is relocated by designating a specific address, and can be directly written to a memory and executed. The load address 1304 is a field describing the address.

【0044】再配置済みプログラムをロードする手順は
簡単である。まず、システムからプログラムのロードア
ドレスを取得する。次に、ファイル内のロードアドレス
フィールドを検索し、システムから得たアドレスと一致
するものを探す。一致するものがなければロードできな
い。一致するものがあれば、再配置済みオブジェクトを
取り出し、ロード先のメモリにそのまま書き込めば良
い。作業メモリはほとんど必要としない。
The procedure for loading the relocated program is simple. First, the load address of the program is obtained from the system. Next, the load address field in the file is searched for a match with the address obtained from the system. If there is no match, you cannot load. If there is a match, the relocated object may be extracted and written to the load destination memory as it is. Requires little working memory.

【0045】ロードアドレスは予め用意しておいたもの
に限られてしまうが、一般に、計算機システムはメモリ
をある一定の大きさのブロックに区切って管理するの
で、その区画に合わせて再配置済みオブジェクトを用意
しておけば良い。フラッシュメモリ等のディバイスの場
合は、チップの仕様としブロックの区切りが決まってい
るので、用意すべきアドレスはさらに限られる。
Although the load address is limited to the one prepared in advance, the computer system generally manages the memory by dividing the memory into blocks of a certain size. Should be prepared. In the case of a device such as a flash memory, the address to be prepared is further limited because the specification of the chip and the delimitation of the block are determined.

【0046】[0046]

【発明の効果】相対アドレス形式のファイルをメモリ上
に展開できるだけのメモリ資源を持たないシステムであ
っても、プログラムをロード及び実行することができ
る。
According to the present invention, a program can be loaded and executed even in a system having no memory resources capable of expanding a file of a relative address format on a memory.

【図面の簡単な説明】[Brief description of the drawings]

【図1】プログラムロード方法の全体構成。FIG. 1 is an overall configuration of a program loading method.

【図2】相対アドレス形式ファイルの例。FIG. 2 is an example of a relative address format file.

【図3】再配置情報単位でレコードを作成した逐次変換
可能相対形式ファイルの例。
FIG. 3 is an example of a sequentially convertible relative format file in which records are created in units of relocation information.

【図4】再配置情報単位でレコードを作成した逐次変換
可能相対形式ファイルの分割の例。
FIG. 4 is an example of division of a sequentially convertible relative format file in which records are created in units of relocation information.

【図5】再配置情報単位でレコードを作成する逐次変換
可能相対形式ファイルを生成するファイル変換の処理手
順。
FIG. 5 shows a file conversion processing procedure for generating a sequentially convertible relative format file for creating a record in units of relocation information.

【図6】再配置情報単位でレコードを作成する逐次変換
可能相対形式ファイルを配置するローダーの処理手順。
FIG. 6 is a processing procedure of a loader that arranges a sequentially convertible relative format file that creates a record in units of relocation information.

【図7】命令単位でレコードを作成する逐次変換可能相
対形式ファイルの例。
FIG. 7 is an example of a sequentially convertible relative format file for creating a record in instruction units.

【図8】命令単位でレコードを作成する逐次変換可能相
対形式ファイルの分割の例。
FIG. 8 is an example of division of a sequentially convertible relative format file that creates a record for each instruction.

【図9】命令単位でレコードを作成する逐次変換可能相
対形式ファイルを生成するファイル変換の処理手順。
FIG. 9 is a file conversion processing procedure for generating a sequentially convertible relative format file for creating a record for each instruction.

【図10】命令単位でレコードを作成する逐次変換可能
相対形式ファイルを配置するローダーの処理手順。
FIG. 10 shows a processing procedure of a loader for arranging a sequentially convertible relative format file for creating a record in instruction units.

【図11】システム上の再配置情報付き実行メモリイメ
ージを表した図。
FIG. 11 is a diagram showing an execution memory image with relocation information on the system.

【図12】再配置情報付き実行メモリイメージから別の
システムにプログラムをロードする処理手順。
FIG. 12 is a processing procedure for loading a program from an execution memory image with relocation information to another system.

【図13】再配置済みプログラムファイルの例。FIG. 13 shows an example of a relocated program file.

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】プログラムロード方法において、予めロー
ドアドレスを指定してリンクしておいたオブジェクトコ
ードを複数の記憶媒体に分割して記憶しておいて、ロー
ド時にその中からアドレスの順にオブジェクトコードを
格納した記憶媒体を選択し、プログラムをロードするこ
とを特徴とするプログラムロード方法。
In a program loading method, an object code linked in advance by designating a load address is divided and stored in a plurality of storage media. A program loading method comprising selecting a stored storage medium and loading a program.
【請求項2】請求項1のプログラムロード方法におい
て、目的機械のフラッシュブロック境界やページ境界を
リンクアドレスとして、プログラムファイルを作成する
ことを特徴とするプログラムロード方法。
2. The program loading method according to claim 1, wherein a program file is created using a flash block boundary or a page boundary of a target machine as a link address.
JP6649798A 1998-03-17 1998-03-17 Program loading method Pending JPH11265290A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP6649798A JPH11265290A (en) 1998-03-17 1998-03-17 Program loading method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP6649798A JPH11265290A (en) 1998-03-17 1998-03-17 Program loading method

Publications (1)

Publication Number Publication Date
JPH11265290A true JPH11265290A (en) 1999-09-28

Family

ID=13317522

Family Applications (1)

Application Number Title Priority Date Filing Date
JP6649798A Pending JPH11265290A (en) 1998-03-17 1998-03-17 Program loading method

Country Status (1)

Country Link
JP (1) JPH11265290A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005182809A (en) * 2003-12-16 2005-07-07 Microsoft Corp Creating file system within file in storage technology-abstracted manner

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005182809A (en) * 2003-12-16 2005-07-07 Microsoft Corp Creating file system within file in storage technology-abstracted manner

Similar Documents

Publication Publication Date Title
JPH1185526A (en) Program loading method
US20050144608A1 (en) Operating system allowing running of real-time application programs, control method therefor, and method of loading dynamic link libraries
JP2007535241A5 (en)
US6175935B1 (en) Software debugging method and recording medium to which debugging program has been recorded
JPH11265290A (en) Program loading method
CN114328747A (en) Data synchronization method, data synchronization device, computer equipment and medium
US6205546B1 (en) Computer system having a multi-pointer branch instruction and method
JPS6058487B2 (en) data processing equipment
JPH06214803A (en) Virtual space block arranging system
JP2729795B2 (en) Parallel computer and control method thereof
JP3489673B2 (en) Integrated process RTL description generation method
JP2611490B2 (en) System operating environment setting device
JP3008483B2 (en) Link processing device
EP1709533B1 (en) Method and device for use in decoding executable code
JP2001356916A (en) Memory blocking compiler and program executing method
JP2721377B2 (en) BASIC program compression method
JPH05119924A (en) File access system
JP2000200202A (en) Method and system for link processing in debugging of application program and information recording medium
JPS5854450A (en) Multiprocessing system for text incorporation
JPH0776935B2 (en) Record storage method
JPH01286053A (en) Data control system over plural types of computers
JPS62143150A (en) Program execution control system
JPH04141758A (en) Data transferring method
JP2007520811A5 (en)
JPS63211423A (en) Data input/output method