From f7de862e6544499a7483dfcee091de5e816474d6 Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Fri, 28 Jan 2022 00:49:04 +0500 Subject: [PATCH] Add main module --- build.sh | 3 ++- src/x86/main.c | 7 +++++++ src/x86/stage2.S | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 src/x86/main.c diff --git a/build.sh b/build.sh index 5efb949..b5f3768 100755 --- a/build.sh +++ b/build.sh @@ -10,13 +10,14 @@ STAGE1_LDFLAGS='--defsym=program_start=0x7c00' STAGE2_LDFLAGS='--defsym=program_start=0x7e00' STAGE1_OBJS="$SRC/common.o $SRC/stage1.o" -STAGE2_OBJS="$SRC/common.o $SRC/stage2.o" +STAGE2_OBJS="$SRC/common.o $SRC/stage2.o $SRC/main.o" ./clean.sh ${CROSS}gcc -c $SRC/common.S -o $SRC/common.o ${CROSS}gcc -c $SRC/stage1.S -o $SRC/stage1.o ${CROSS}gcc -c $SRC/stage2.S -o $SRC/stage2.o +${CROSS}gcc -c $SRC/main.c -o $SRC/main.o ${CROSS}ld -T$SRC/linker.ld -o $SRC/stage1.bin $STAGE1_LDFLAGS $STAGE1_OBJS ${CROSS}ld -T$SRC/linker.ld -o $SRC/stage2.bin $STAGE2_LDFLAGS $STAGE2_OBJS diff --git a/src/x86/main.c b/src/x86/main.c new file mode 100644 index 0000000..f1226da --- /dev/null +++ b/src/x86/main.c @@ -0,0 +1,7 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +int main() +{ +} diff --git a/src/x86/stage2.S b/src/x86/stage2.S index be03570..d594b82 100644 --- a/src/x86/stage2.S +++ b/src/x86/stage2.S @@ -21,4 +21,6 @@ _start: mov $newline, %si call print_str + call main + ljmp $0, $hang