]> mj.ucw.cz Git - minsk.git/commitdiff
Minsk: Initialize memory
authorMartin Mares <mj@ucw.cz>
Sun, 21 Nov 2010 20:42:23 +0000 (21:42 +0100)
committerMartin Mares <mj@ucw.cz>
Mon, 27 Dec 2010 16:13:48 +0000 (17:13 +0100)
minsk.c

diff --git a/minsk.c b/minsk.c
index d9606ef3b424ed857d14cb1b5f448dd47cfd48e1..bc13ae46f0b3bdcf6451ead39320b7497687499c 100644 (file)
--- a/minsk.c
+++ b/minsk.c
@@ -4,11 +4,6 @@
  *     (c) 2010 Martin Mares <mj@ucw.cz>
  */
 
-/*
- * 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);