17.01.2015 Views

Relocatable Object Module Format (OMF) Specification

Relocatable Object Module Format (OMF) Specification

Relocatable Object Module Format (OMF) Specification

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Relocatable</strong> <strong>Object</strong> <strong>Module</strong> <strong>Format</strong><br />

<strong>Module</strong> table, indexed by module number, with N + 1 fixed-length entries:<br />

WORD module page number<br />

WORD offset from start of extended dictionary to list of required modules<br />

Last entry is null.<br />

Dictionary Hashing Algorithm<br />

Pseudocode for creating a library and inserting names into a dictionary is listed below.<br />

typedef unsigned short hash_value;<br />

typedef struct {<br />

hash_value block_x, block_d, bucket_x, bucket_d;<br />

} hash;<br />

typedef unsigned char block[512];<br />

unsigned short nblocks = choose some prime number such that it is<br />

likely that all the names will fit in those blocks (the value must be<br />

greater than 1 and less than 255);<br />

const int nbuckets = 37;<br />

const int freespace = nbuckets+1;<br />

MORE_BLOCKS: ;<br />

// Allocate storage for the dictionary:<br />

block *blocks = malloc(nblocks*sizeof(block));<br />

// Zero out each block.<br />

memset(blocks,0,nblocks*sizeof(block));<br />

// Initialize freespace pointers.<br />

for (int i = 0; i < nblocks; i++)<br />

blocks[i][freespace] = freespace/2;<br />

for N

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!