From ccd37a8886999b9a7cd199d1c10fe347418b4f72 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sun, 21 Nov 2010 21:42:23 +0100 Subject: [PATCH] Minsk: Initialize memory --- minsk.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) 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); -- 2.39.2