aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2021-04-05 20:50:58 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2021-04-05 20:50:58 +0200
commitfcdc14f939a25189988e21f53dc24d5aed560504 (patch)
treeed14d533f17218f3cd4c50be8e7ab042d18d9b2a
parentba7e57138c9e41cf944afb91c146fea23713c1d1 (diff)
Cleaning Makefile and creating asm macros
-rw-r--r--src/Makefile27
-rw-r--r--src/bringelle.c2
-rw-r--r--src/utils/asm.h11
3 files changed, 21 insertions, 19 deletions
diff --git a/src/Makefile b/src/Makefile
index f5f9c83..08b31d7 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,34 +1,23 @@
EXEC := bringelle
CC := gcc -c -m32 -fno-pie -fno-builtin -fno-stack-protector
-UTILS_SRC := $(wildcard utils/*.c)
+UTILS_OBJ := $(addsuffix .o,$(basename $(wildcard utils/*.c)))
all: $(EXEC)
-$(EXEC): boot.o utils.o bringelle.o
- for obj in $^ ;\
- do \
- objcopy --remove-section .note.gnu.property $${obj} ; \
- done
+$(EXEC): boot/boot.o $(UTILS_OBJ) bringelle.o
ld -Ttext=0x00100000 -melf_i386 -nostdlib --oformat=binary -o bringelle $^
-bringelle.o: bringelle.c
- $(CC) $^
-
-utils.o: $(UTILS_SRC)
- for src in $^ ;\
- do \
- obj=$$(basename $${src} ".c")".o" ;\
- $(CC) $${src} -o utils/$${obj} ;\
- done
- ld -melf_i386 -relocatable utils/*.o -o utils.o
-
-boot.o: ./boot/boot.S
+boot/boot.o: ./boot/boot.S
as --32 -o $@ $^ -mx86-used-note=no
+%.o: %.c
+ $(CC) -o $@ $<
+ objcopy --remove-section .note.gnu.property $@
+
clean:
- find ./ -name "*.o" -delete
- rm $(EXEC)
+ - find ./ -name "*.o" -delete
.PHONY: clean
diff --git a/src/bringelle.c b/src/bringelle.c
index d8bbe82..c13744a 100644
--- a/src/bringelle.c
+++ b/src/bringelle.c
@@ -1,8 +1,10 @@
#include "utils/print.h"
+#include "utils/asm.h"
void bringelle(){
clear();
print("Booting Bringelle...");
+
while(1);
}
diff --git a/src/utils/asm.h b/src/utils/asm.h
new file mode 100644
index 0000000..0929afa
--- /dev/null
+++ b/src/utils/asm.h
@@ -0,0 +1,11 @@
+#ifndef ASM_H
+#define ASM_H
+
+#define outb(port,value) \
+ asm volatile ("outb %%al, %%dx" :: "a"(value), "d" (port) )
+
+#define outbj(port,value) \
+ asm volatile ("outb %%al, %%dx;" :: "a" (value), "d"(port) )
+
+
+#endif \ No newline at end of file