summaryrefslogblamecommitdiff
path: root/Source/Kernel/Linker/Binary.proto.cpp
blob: c0345dae36dbe70f775676f4c5f6cdfdd82c66ab (plain) (tree)
1
2
3
4
5
6
7
8


                                     
                                   


                                    
                         





                                  
                                           





                                                     
#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;
}