The basic element of FreeLDR is a pre-loader. The full pre-loader version is preldr0.mdl. It is intended to be a main low-level module exporting a common interface for different loaders. It exports the following functions to its client:

Code:

unsigned int __cdecl

u_open (char *name, unsigned int *size);

int __cdecl

u_dir  (char *dirname);

unsigned int __cdecl

u_read (char *buf, unsigned int count);

unsigned int __cdecl

u_seek (int loffseek);

void __cdecl

u_close (void);

void __cdecl

u_terminate (void);

int __cdecl

u_diskctl (int func, int drive, struct geometry *geometry, int sector, int nsec, int addr);

int __cdecl

u_vbectl(int func, int mode_number, void *info);

struct term_entry * __cdecl

u_termctl(int termno);

int __cdecl

u_boot (int type);

int __cdecl

u_load (char *image, unsigned int size, char *load_addr, struct exe_params *p);

int __cdecl

u_parm (int parm, int action, unsigned int *val);

void __cdecl

u_msg (char *s);

void __cdecl

u_setlip (lip2_t *l);

The 1st 6 functions are for filesystem access; u_diskctl is for low level access to disk sectors; u_vbectl is for VESA VBE access; u_termctl is for textmode terminal access; etc…

So, pre-loader is the basic building element for different loaders. For multiboot loader, it simply loads freeldr.mdl – if it specified in preldr.ini file. Also instead of a freeldr.mdl, there can be an os2ldr specified (in preldr.ini). So, pre-loader, together with filesystem access backends (in /boot/loader/fsd/) can serve as ordinary 16-bit microfsd for OS/2 kernel.