Ich hab mich ebenfalls für die Intel-Syntax entschieden:
section multiboot
MB_MODULEALIGN equ 0x0 ;not used
MB_MEMINFO equ 0x0 ;not used
MB_FLAGS equ MB_MODULEALIGN | MB_MEMINFO
MB_MAGIC equ 0x1BADB002
MB_CHECKSUM equ -(MB_MAGIC + MB_FLAGS)
align 4
dd MB_MAGIC
dd MB_FLAGS
dd MB_CHECKSUM
section .text
extern init
global _start
_start:
mov esp, kernel_stack
call init
_stop:
cli
hlt
jmp _stop
section .bss
resb 8192 ; 8kB stack
kernel_stack:
Und das dafür vorgesehene Makefile entsprechend geändert:
# Main Makefile
SRCS = $(shell find -name '*.[cS]')
OBJS = $(addsuffix .o,$(basename $(SRCS)))
CC = gcc
AS = nasm
LD = ld
ASFLAGS = -f elf
CFLAGS = -m32 -Wall -g -fno-stack-protector -nostdinc
LDFLAGS = -melf_i386 -Ttext=0x100000
nnOS: $(OBJS)
$(LD) $(LDFLAGS) -o $@ $^
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $^
%.o: %.S
$(AS) $^ $(ASFLAGS) -f elf -o $@
clean:
rm $(OBJS)
qemu:
qemu -kernel nnOS
.PHONY: clean