diff options
author | iximeow <me@iximeow.net> | 2014-09-26 22:15:27 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2014-09-26 22:15:27 -0700 |
commit | b5b9bbb79304e9e9c24b88f2dedbd32cea1d5acf (patch) | |
tree | 734963547213528e7613c770b1850ce3928351f5 | |
parent | 88a8caca6781365eeb427d5c6e660b2d7576485d (diff) |
various tweaks
-rwxr-xr-x | build/compile.sh | 12 | ||||
-rwxr-xr-x | build/splicetobootsect.sh | 2 | ||||
-rw-r--r-- | src/kernel/main.c | 14 |
3 files changed, 18 insertions, 10 deletions
diff --git a/build/compile.sh b/build/compile.sh index efd8962..50b5771 100755 --- a/build/compile.sh +++ b/build/compile.sh @@ -1,7 +1,9 @@ #! /bin/sh -IN=$1 -FILE=$(basename $1) -gcc -masm=intel -nostartfiles -nostdlib -ffreestanding "$IN".c -o "tmp/$FILE".o -objcopy -S -R .note.gnu.build-id -R .comment -O binary "tmp/$FILE".o "bim/$FILE".bin -rm "$IN".o +INPATH=$1 +INFILE=$(basename $1) +INFILENAME="${INFILE%.*}" +INEXT="${INFILE##*.}" +gcc -m32 -nostartfiles -nostdlib -ffreestanding "$INPATH" -o "tmp/$INFILENAME".o +objcopy -S -R .note.gnu.build-id -R .comment -O binary "tmp/$INFILENAME".o "bin/$INFILENAME".bin +rm "tmp/$INFILENAME".o diff --git a/build/splicetobootsect.sh b/build/splicetobootsect.sh index 6a2c353..7418c9b 100755 --- a/build/splicetobootsect.sh +++ b/build/splicetobootsect.sh @@ -15,4 +15,4 @@ echo "Initializing output file" dd if=bin/dummy.bin of="$OUTFILE" >/dev/null 2>&1 echo "Splicing binary" dd if="$1" of="$OUTFILE" conv=notrunc >/dev/null 2>&1 -echo "Done" +echo "Done. Generated file: $OUTFILE" diff --git a/src/kernel/main.c b/src/kernel/main.c index 90f82f4..f8e6c6a 100644 --- a/src/kernel/main.c +++ b/src/kernel/main.c @@ -1,8 +1,14 @@ +__asm__(".code16gcc\n"); + int func() { - asm( - ".intel_syntax noprefix \n" - "mov eax, 42 \n" - "ret \n" + __asm__( + "mov $0x10, %%cx \n" + "mov $0x0A, %%ah \n" + "mov $0x74, %%al \n" + "int $0x10 \n" + "mov $42, %%eax \n" + "ret \n" + : : ); } |