An update.
This commit is contained in:
parent
e4294e3454
commit
945c04770d
6
Makefile
6
Makefile
@ -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
10
boot.c
@ -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;"
|
||||
|
Loading…
Reference in New Issue
Block a user