...
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
.intel_syntax noprefix
|
||||
|
||||
.equ SYS_EXIT, 60
|
||||
|
||||
.text
|
||||
.globl _start
|
||||
_start:
|
||||
mov rdi, rsp
|
||||
call main
|
||||
mov rdi, rax
|
||||
mov rax, SYS_EXIT
|
||||
syscall
|
||||
@@ -1,17 +1,49 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <syscall.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define NUB_PANIC_ERROR_CODE 101
|
||||
|
||||
uint64_t nub_cstring_length() { return 0; }
|
||||
uint64_t nub_cstring_length(char* string)
|
||||
{
|
||||
return strlen(string);
|
||||
}
|
||||
|
||||
uint64_t nub_string_length() {}
|
||||
uint64_t nub_string_length()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void nub_memcpy() {}
|
||||
void nub_memcpy(void* source, void* destination, uint64_t length)
|
||||
{
|
||||
memcpy(destination, source, length);
|
||||
}
|
||||
|
||||
void nub_memset() {}
|
||||
void nub_memset(void* destination, int value, uint64_t count)
|
||||
{
|
||||
memset(destination, value, count);
|
||||
}
|
||||
|
||||
void nub_panic() {}
|
||||
void nub_panic_array_oob()
|
||||
{
|
||||
puts("Array out of bounds");
|
||||
exit(NUB_PANIC_ERROR_CODE);
|
||||
}
|
||||
|
||||
void nub_panic_array_oob() {}
|
||||
void nub_panic_oom()
|
||||
{
|
||||
puts("Out of memory");
|
||||
exit(NUB_PANIC_ERROR_CODE);
|
||||
}
|
||||
|
||||
void nub_panic_oom() {}
|
||||
extern int64_t main();
|
||||
|
||||
void _start()
|
||||
{
|
||||
int64_t exit_code = main();
|
||||
exit(exit_code);
|
||||
}
|
||||
Reference in New Issue
Block a user