...
This commit is contained in:
3
src/runtime/.gitignore
vendored
3
src/runtime/.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
*.o
|
*.o
|
||||||
|
out
|
||||||
@@ -1,5 +1,15 @@
|
|||||||
x86_64:
|
CC = gcc
|
||||||
gcc -nostdlib -ffreestanding -c platform/x86_64.s runtime.c
|
CFLAGS = -nostdlib -ffreestanding -Wall -Werror -Wextra
|
||||||
|
|
||||||
|
x64: runtime.o x64.o
|
||||||
|
mkdir -p out
|
||||||
|
ar rcs out/libruntime.a runtime.o x64.o
|
||||||
|
|
||||||
|
runtime.o: runtime/runtime.c
|
||||||
|
$(CC) $(CFLAGS) -c runtime/runtime.c -o runtime.o
|
||||||
|
|
||||||
|
x64.o: runtime.o platform/x64.s
|
||||||
|
$(CC) $(CFLAGS) -c platform/x64.s -o x64.o
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm runtime.o
|
rm -r out runtime.o x64.o
|
||||||
|
|||||||
@@ -4,9 +4,12 @@
|
|||||||
.globl nub_write_string
|
.globl nub_write_string
|
||||||
# void nub_write_string(const char* str)
|
# void nub_write_string(const char* str)
|
||||||
nub_write_string:
|
nub_write_string:
|
||||||
mov rsi, rdi
|
push rdi
|
||||||
mov rdi, 1
|
call nub_cstring_length
|
||||||
|
mov rdx, rax
|
||||||
|
pop rsi
|
||||||
mov rax, 1
|
mov rax, 1
|
||||||
|
mov rdi, 1
|
||||||
syscall
|
syscall
|
||||||
|
|
||||||
.text
|
.text
|
||||||
@@ -45,11 +45,11 @@ void nub_panic_oom()
|
|||||||
nub_exit(NUB_PANIC_ERROR_CODE);
|
nub_exit(NUB_PANIC_ERROR_CODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int main();
|
extern uint64_t main();
|
||||||
|
|
||||||
__attribute__((noreturn)) void _start()
|
__attribute__((noreturn)) void _start()
|
||||||
{
|
{
|
||||||
int exit_code = main();
|
uint64_t exit_code = main();
|
||||||
nub_exit(exit_code);
|
nub_exit(exit_code);
|
||||||
__builtin_unreachable();
|
__builtin_unreachable();
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user