/* the genome: the image a core boots, embedded into the core when it is compiled. an image is a file of little-endian 64-bit words placed at GORG, as written by zc0 or by src/tools/build.zc and checked by mkgenome. the build keeps every image in build/, never in the tree. GENOME_FILE names the image. it defaults to "genome.bin" (or "lsp_genome.bin" with USE_LSP_GENOME) and is found next to this header, then in the directories given with --embed-dir, so that option selects which image a core carries. the file needs a compiler with c23 #embed (clang 19 or gcc 15 and later). no libc here: the microcore includes this on bare metal. */ #ifndef GENOME_H_INCLUDED #define GENOME_H_INCLUDED #include #ifndef GENOME_FILE #ifdef USE_LSP_GENOME #define GENOME_FILE "lsp_genome.bin" #else #define GENOME_FILE "genome.bin" #endif #endif static const unsigned char genome_image[] = { #embed GENOME_FILE }; /* the image's length in words */ #define GLEN ((int)(sizeof genome_image / 8)) /* word i of the image, independent of the host's byte order */ static int64_t genome_word(int i) { const unsigned char *b = genome_image + (long)i * 8; return (int64_t)((uint64_t)b[0] | (uint64_t)b[1] << 8 | (uint64_t)b[2] << 16 | (uint64_t)b[3] << 24 | (uint64_t)b[4] << 32 | (uint64_t)b[5] << 40 | (uint64_t)b[6] << 48 | (uint64_t)b[7] << 56); } #endif