implemented a bunch of syscalls

This commit is contained in:
Luxferre
2026-06-18 19:54:49 +03:00
parent 7368329c16
commit 172ea779c6
4 changed files with 506 additions and 22 deletions
+14 -4
View File
@@ -5,7 +5,7 @@ EMULATOR = ./amach
ASFLAGS = -march=rv32imac -mabi=ilp32 -nostdlib -s -static -fno-pic -fno-pie -mno-relax
LDFLAGS = -Wl,-Ttext=0x100b0 -Wl,--build-id=none
all: rv32imac_tests.bin
all: rv32imac_tests.bin rv32imac_syscall_tests.bin
rv32imac_tests.elf: rv32imac_tests.s
$(CC) $(ASFLAGS) $(LDFLAGS) rv32imac_tests.s -o rv32imac_tests.elf
@@ -13,15 +13,25 @@ rv32imac_tests.elf: rv32imac_tests.s
rv32imac_tests.bin: rv32imac_tests.elf
$(OBJCOPY) -O binary rv32imac_tests.elf rv32imac_tests.bin
run: rv32imac_tests.bin
rv32imac_syscall_tests.elf: rv32imac_syscall_tests.s
$(CC) $(ASFLAGS) $(LDFLAGS) rv32imac_syscall_tests.s -o rv32imac_syscall_tests.elf
rv32imac_syscall_tests.bin: rv32imac_syscall_tests.elf
$(OBJCOPY) -O binary rv32imac_syscall_tests.elf rv32imac_syscall_tests.bin
run: rv32imac_tests.bin rv32imac_syscall_tests.bin
@echo "Running CPU instruction tests..."
$(EMULATOR) rv32imac_tests.bin
@echo "Running syscall tests..."
ln -sf test_output_new.txt test_link.txt
$(EMULATOR) rv32imac_syscall_tests.bin
@echo "Testing standard ebreak..."
@echo "115 0 16 0" | awk -f amach.awk 2>&1 | grep -q "Fatal: EBREAK"
@echo "Testing compressed c.ebreak..."
@echo "2 144" | awk -f amach.awk 2>&1 | grep -q "Fatal: EBREAK"
@echo "All EBREAK tests PASSED!"
@echo "All tests PASSED!"
clean:
rm -f rv32imac_tests.elf rv32imac_tests.bin
rm -rf rv32imac_tests.elf rv32imac_tests.bin rv32imac_syscall_tests.elf rv32imac_syscall_tests.bin test_dir test_link.txt test_output.txt test_output_new.txt
.PHONY: all run clean