summaryrefslogtreecommitdiff
path: root/kernel/loader_test.c
blob: 1241a397e75ae63caa87ae505ced262b33fa2682 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#include <stdio.h>
#include <stdlib.h>
#include "loader.c"          /* берём aout_parse из настоящего загрузчика */
int main(int c, char**v){
	FILE*f=fopen(v[1],"rb"); fseek(f,0,SEEK_END); long n=ftell(f); rewind(f);
	u8*b=malloc(n); fread(b,1,n,f); fclose(f);
	Exec e; int r=aout_parse(b,&e);
	printf("aout_parse: %s\n", r==0?"OK (I_MAGIC 386)":"НЕ наш формат");
	printf("  magic=0x%X text=%u data=%u bss=%u entry=0x%X\n",e.magic,e.text,e.data,e.bss,e.entry);
	printf("  сегменты @ file+%d, грузятся -> 0x%X\n",HDRSZ,e.entry);
	return r;
}