summaryrefslogtreecommitdiff
path: root/Source/Kernel/Linker/Binary.proto.cpp
blob: c0345dae36dbe70f775676f4c5f6cdfdd82c66ab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "Binary.proto.h"

#include <Linker/MelonBinary.class.h>
#include <Linker/ElfBinary.class.h>

Binary* (*loaders[])(File& file) = {
	&MelonBinary::load,
	&ElfBinary::load,
0 };

Binary* Binary::load(File& file) {
	Binary* r = 0;
	u32int i = 0;
	while (loaders[i] != 0) {
		file.seek(0, SM_BEGINNING);
		r = loaders[i](file);	//Call loader
		if (r != 0) break;
		i++;
	}
	return r;
}