From: Martin Mares Date: Sun, 21 Nov 2010 20:42:23 +0000 (+0100) Subject: Minsk: Initialize memory X-Git-Tag: v1.0~23 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=ccd37a8886999b9a7cd199d1c10fe347418b4f72;p=minsk.git Minsk: Initialize memory --- diff --git a/minsk.c b/minsk.c index d9606ef..bc13ae4 100644 --- a/minsk.c +++ b/minsk.c @@ -4,11 +4,6 @@ * (c) 2010 Martin Mares */ -/* - * TODO: - * - we probably have to disable NOP - */ - /* * Things that are not implemented: * @@ -1232,8 +1227,25 @@ static void run_as_daemon(int do_fork) } } +static void init_memory(void) +{ + // For the contest, we fill the whole memory with -00 00 0000 0000 (HALT), + // not +00 00 0000 0000 (NOP). Otherwise, an empty program would reveal + // the location of the password :) + for (int i=0; i<4096; i++) + mem[i] = 01000000000000ULL; + + // Store the password + int pos = 02655; + mem[pos++] = 0574060565373; + mem[pos++] = 0371741405340; + mem[pos++] = 0534051524017; +} + int main(int argc, char **argv) { + init_memory(); + if (argc > 1) { setproctitle_init(argc, argv);