Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ CC = $(ARCH)-gcc
LD = $(ARCH)-ld
OBJCOPY = $(ARCH)-objcopy

CFLAGS = -g -O0 -nostdlib -ffreestanding -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -Wall -Wextra -mcpu=cortex-a72 -I. -I../shared -I../user
CFLAGS = -g -O0 -std=c17 -nostdlib -ffreestanding -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -Wall -Wextra -mcpu=cortex-a72 -I. -I../shared -I../user
LDFLAGS = -T $(shell ls *.ld)

C_SRC = $(shell find . -name '*.c')
Expand Down
4 changes: 4 additions & 0 deletions kernel/exceptions/exception_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
#include "theme/theme.h"
#include "std/string.h"

#ifndef asm
#define asm __asm__
#endif

static bool panic_triggered = false;

void set_exception_vectors(){
Expand Down
1 change: 1 addition & 0 deletions kernel/fw/fw_cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#define FW_LIST_DIRECTORY 0x19


static bool checked = false;

struct fw_cfg_dma_access {
Expand Down
46 changes: 30 additions & 16 deletions run
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#/!bin/sh
#!/bin/sh

echo "Running emulator"

Expand All @@ -15,19 +15,33 @@ if echo "$XHCI_CAPABILITIES" | grep -q "msi "; then
MSI_CAPABILITIES="msi=on,msix=off,"
fi

OS_TYPE="$(uname)"

if [[ "$OS_TYPE" == "Darwin" ]]; then
NETARG="vmnet-bridged,id=net0,ifname=en0"

elif [[ "$OS_TYPE" == "Linux" ]]; then
NETARG="user,id=net0"

else
echo "Unknown OS: $OS_TYPE" >&2
exit 1
fi


qemu-system-aarch64 \
-M virt \
-cpu cortex-a72 \
-m 512M \
-kernel kernel.elf \
-device virtio-gpu-pci \
-display sdl \
-netdev vmnet-bridged,id=net0,ifname=en0 \
-device virtio-net-pci,netdev=net0 \
-serial mon:stdio \
-drive file=disk.img,if=none,format=raw,id=hd0 \
-device virtio-blk-pci,drive=hd0 \
-device qemu-xhci,${MSI_CAPABILITIES}id=usb \
-device usb-kbd,bus=usb.0 \
-d guest_errors \
$ARGS
-M virt \
-cpu cortex-a72 \
-m 512M \
-kernel kernel.elf \
-device virtio-gpu-pci \
-display sdl \
-netdev ${NETARG} \
-device virtio-net-pci,netdev=net0 \
-serial mon:stdio \
-drive file=disk.img,if=none,format=raw,id=hd0 \
-device virtio-blk-pci,drive=hd0 \
-device qemu-xhci,${MSI_CAPABILITIES}id=usb \
-device usb-kbd,bus=usb.0 \
-d guest_errors \
$ARGS
2 changes: 1 addition & 1 deletion shared/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ CC = $(ARCH)-gcc
AR = $(ARCH)-ar
OBJCOPY = $(ARCH)-objcopy

CFLAGS = -g -O0 -nostdlib -nolibc -ffreestanding -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -Wall -Wextra -mcpu=cortex-a72 -I. -I../kernel -Wno-unused-parameter
CFLAGS = -g -O0 -std=c17 -nostdlib -nolibc -ffreestanding -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -Wall -Wextra -mcpu=cortex-a72 -I. -I../kernel -Wno-unused-parameter

C_SRC = $(shell find . -name '*.c')
CPP_SRC = $(shell find . -name '*.cpp')
Expand Down
6 changes: 6 additions & 0 deletions shared/types.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
#pragma once

#ifndef asm
#define asm __asm__
#endif

#ifdef __cplusplus
extern "C" {
#endif



typedef unsigned int uint32_t;
typedef long unsigned int size_t;
typedef unsigned long uint64_t;
Expand Down
2 changes: 1 addition & 1 deletion user/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ CC = $(ARCH)-gcc
LD = $(ARCH)-ld
OBJCOPY = $(ARCH)-objcopy

CFLAGS = -g -O0 -nostdlib -ffreestanding -Wall -Wextra -mcpu=cortex-a72 -I. -I../shared -Wno-unused-parameter
CFLAGS = -g -O0 -std=c17 -nostdlib -ffreestanding -Wall -Wextra -mcpu=cortex-a72 -I. -I../shared -Wno-unused-parameter
LDFLAGS = -T $(shell ls *.ld)

C_SRC = $(shell find . -name '*.c')
Expand Down