An update.

This commit is contained in:
bʰedoh₂ swé 2024-10-20 16:53:40 +05:00
parent e4294e3454
commit 945c04770d
4 changed files with 2053 additions and 6 deletions

View File

@ -1,12 +1,14 @@
SRCS = boot.c
LDFLAGS = -flto -T linker.ld -nostdlib
LDFLAGS = -flto -T linker.ld -nostdlib -Os
CFLAGS = -flto -ffreestanding -fno-builtin -fno-pie -Wall -std=c2x -m16 -nostdlib -Os -nostartfiles -r
%.o: %.c
$(CC) $^ -o $@ $(CFLAGS)
all: $(SRCS:.c=.o)
bin: $(SRCS:.c=.o)
$(CC) $(LDFLAGS) -o bin $^
all: bin
clean:
$(RM) $(SRCS:.c=.o) bin

10
boot.c
View File

@ -1,5 +1,7 @@
static void putchar(char);
static void write(char*);
#include "hedley.h"
HEDLEY_ALWAYS_INLINE void putchar(char);
HEDLEY_ALWAYS_INLINE void write(char*);
void _start(void) {
write("Hello World!\r\n\0");
@ -7,12 +9,12 @@ void _start(void) {
;
}
static void write(char *out) {
HEDLEY_ALWAYS_INLINE void write(char *out) {
for (char *i = out; *i != 0; i++)
putchar(*i);
}
static void putchar(char out) {
HEDLEY_ALWAYS_INLINE void putchar(char out) {
__asm__ volatile (
"movb $0x0e, %%ah;"
"movb %0, %%al;"

2042
hedley.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -23,5 +23,6 @@ SECTIONS
/DISCARD/ : { *(.eh_frame)
*(.comment)
*(.note.GNU-stack)
*(.note.gnu.build-id)
}
}