diff --git a/second/head.h b/second/head.h index d87e649..c2ff195 100644 --- a/second/head.h +++ b/second/head.h @@ -45,10 +45,18 @@ struct emile_l2_header { u_int32_t gestaltID; } __attribute__((packed)); +#define EMILE_ID_MASK 0xFFF0 +#define EMILE_VERSION_MASK 0x000F + +#define EMILE_ID(a) ((a) & EMILE_ID_MASK) +#define EMILE_VERSION(a) ((a) & EMILE_VERSION_MASK) + #define EMILE_01_SIGNATURE (('E'<<24)|('M'<<16)|('0'<<8)|'1') #define EMILE_02_SIGNATURE (('E'<<24)|('M'<<16)|('0'<<8)|'2') #define EMILE_03_SIGNATURE (('E'<<24)|('M'<<16)|('0'<<8)|'3') +#define EMILE_COMPAT(a,b) ( ( EMILE_ID(a) == EMILE_ID(b) ) && \ + ( EMILE_VERSION(a) <= EMILE_VERSION(b) ) ) enum { STDOUT_VGA = 0x00000001, STDOUT_SERIAL0 = 0x00000002, diff --git a/second/main.c b/second/main.c index 77df962..954a203 100644 --- a/second/main.c +++ b/second/main.c @@ -58,7 +58,7 @@ int start(emile_l2_header_t* info) printf("EMILE v"VERSION" (c) 2004 Laurent Vivier\n"); printf("This is free software, redistribute it under GPL\n"); - if (info->signature < EMILE_03_SIGNATURE) + if (!EMILE_COMPAT(EMILE_03_SIGNATURE, info->signature)) error("Bad header signature !\n"); arch_init();