Browse files

Fix Makefile to use -m64 to compile for 64 bit instead of defaulting …

…to 32 bit on 64 bit machines. However the morph code buffer still doesn't work for some reason on x86_64 as the code exits out without dumping Fischers Inception thought which is the last output in x86 to be seen on the screen. So just updated the exit code to catch 64 bit runs and just dump the warning in the last output as everything else runs fine on 64 bit with the exception of the main display of Fischers inception thought
  • Loading branch information...
1 parent b960842 commit 00e3e099c71e2b0e51d00abf078bbec5a0846318 @karthick18 committed Jul 26, 2010
Showing with 15 additions and 2 deletions.
  1. +10 −1 Makefile
  2. +1 −1 README
  3. +4 −0 inception.c
@@ -1,5 +1,14 @@
+## Build with make ARCH_FLAGS=i686 to get the last inception thought of Fischer till
+## the code buffer that morphs the thought is fixed for x86_64
CC := gcc
-CFLAGS := -g -Wall -m32
+ARCH := $(shell uname -m)
+ifeq ($(ARCH), 'i686')
+ ARCH_FLAGS := -m32
+ ARCH_FLAGS := -m64
+CFLAGS := -g -Wall $(ARCH_FLAGS)
SRC_FILES := $(wildcard *.c)
OBJ_FILES := $(SRC_FILES:%.c=%.o)
LDLIBS := -lpthread -lrt
@@ -1,4 +1,4 @@
Programmatic representation of the Brilliant movie: INCEPTION by the Genius Director THY name is Christopher Nolan!
My tribute to Nolan in "C" Language and a bit of assembly (x86) as the inception is done using x86 code morphing so that Fischer wakes up thinking that the thought was originated from his mind. Running the program would unravel the entire sequence in the movie. Reading the code would explain the movie Programmatically.
--Karthick (
+-Karthick (
@@ -1381,6 +1381,10 @@ static void fischer_dream_level1(void)
output("\n\n[%s] exiting back to reality from level [%d] with the THOUGHT:\n\n", dattr->name, dattr->level);
+ if(sizeof(void *) == 8) /* ifdef __i386__ shud work, but portability paranoia*/
+ {
+ output("In x86_64/64bit machines, the inception thought might not be displayed because of a potential bug with the code buffer used in inception.h.\nSo till thats fixed, try running your code in 32 bit.\nIf you are on x86_64, compile the code for 32 bit with \"make clean;make ARCH_FLAGS=-m32\".\nIf that doesn't compile with -m32 option, then you would have to install: libc6-dev-i386 if running 64 bit Ubuntu with:\nsudo apt-get install libc6-dev-i386 or yum install glibc-devel-*.i686 as root on Fedora/Redhat systems\n\n");
+ }
* This should just exit the INCEPTION PROCESS

0 comments on commit 00e3e09

Please sign in to comment.