From 1d2a6f21294f8390b683e4e097cb49210ed832d1 Mon Sep 17 00:00:00 2001 From: johannst Date: Fri, 26 Mar 2021 23:17:46 +0100 Subject: Added dyn allocator + syscall wrappers + minor fixes. --- lib/include/common.h | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'lib/include/common.h') diff --git a/lib/include/common.h b/lib/include/common.h index 5ea6050..631c25f 100644 --- a/lib/include/common.h +++ b/lib/include/common.h @@ -3,14 +3,12 @@ #pragma once #include "io.h" -#include "syscall.h" - -#include - -#define ERROR_ON(cond, ...) \ - do { \ - if ((cond)) { \ - efmt(__VA_ARGS__); \ - syscall1(__NR_exit, 1); \ - } \ +#include "syscalls.h" + +#define ERROR_ON(cond, fmt, ...) \ + do { \ + if ((cond)) { \ + efmt("%s:%d " fmt, __FILE__, __LINE__ __VA_OPT__(, ) __VA_ARGS__); \ + _exit(1); \ + } \ } while (0) -- cgit v1.2.3 From 9b4b10a31954c00813a7cbf9411d30bc84eccea8 Mon Sep 17 00:00:00 2001 From: johannst Date: Sat, 17 Apr 2021 23:38:23 +0200 Subject: add memset --- lib/include/common.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'lib/include/common.h') diff --git a/lib/include/common.h b/lib/include/common.h index 631c25f..1e48097 100644 --- a/lib/include/common.h +++ b/lib/include/common.h @@ -5,10 +5,13 @@ #include "io.h" #include "syscalls.h" -#define ERROR_ON(cond, fmt, ...) \ - do { \ - if ((cond)) { \ - efmt("%s:%d " fmt, __FILE__, __LINE__ __VA_OPT__(, ) __VA_ARGS__); \ - _exit(1); \ - } \ +#define ERROR_ON(cond, fmt, ...) \ + do { \ + if ((cond)) { \ + efmt("%s:%d " fmt "\n", __FILE__, __LINE__, ##__VA_ARGS__); \ + _exit(1); \ + } \ } while (0) + + +void* memset(void* s, int c, size_t n); -- cgit v1.2.3 From 1df4dfdcdbbaef7e5b32c5c0bfadec02b3ccd6f0 Mon Sep 17 00:00:00 2001 From: johannst Date: Tue, 20 Apr 2021 22:05:13 +0200 Subject: added memcpy + tests for memcpy/memset --- lib/include/common.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/include/common.h') diff --git a/lib/include/common.h b/lib/include/common.h index 1e48097..d006d71 100644 --- a/lib/include/common.h +++ b/lib/include/common.h @@ -15,3 +15,5 @@ void* memset(void* s, int c, size_t n); +void* memcpy(void* d, const void* s, size_t n); + -- cgit v1.2.3