summaryrefslogtreecommitdiff
path: root/user/lib
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-04-08 10:39:48 -0400
committerFreya Murphy <freya@freyacat.org>2025-04-08 10:39:48 -0400
commit8a19547957a86bed3f58c9abc1ac218d04698faf (patch)
treeed7ccc6f3a8902915dfe6c9bf763fc45d752b3c4 /user/lib
parentfmt (diff)
downloadcomus-8a19547957a86bed3f58c9abc1ac218d04698faf.tar.gz
comus-8a19547957a86bed3f58c9abc1ac218d04698faf.tar.bz2
comus-8a19547957a86bed3f58c9abc1ac218d04698faf.zip
break apart c libaray
Diffstat (limited to '')
-rw-r--r--user/lib/alloc.c (renamed from lib/alloc.c)4
-rw-r--r--user/lib/atox.c (renamed from lib/atox.c)0
-rw-r--r--user/lib/bound.c (renamed from lib/bound.c)0
-rw-r--r--user/lib/btoa.c (renamed from lib/btoa.c)0
-rw-r--r--user/lib/ctoi.c (renamed from lib/ctoi.c)0
-rw-r--r--user/lib/delay.c (renamed from lib/delay.c)0
-rw-r--r--user/lib/entry.S (renamed from ulib/entry.S)0
-rw-r--r--user/lib/isdigit.c (renamed from lib/isdigit.c)0
-rw-r--r--user/lib/isspace.c (renamed from lib/isspace.c)0
-rw-r--r--user/lib/itoc.c (renamed from lib/itoc.c)0
-rw-r--r--user/lib/memcmp.c (renamed from lib/memcmp.c)0
-rw-r--r--user/lib/memcpy.c (renamed from lib/memcpy.c)0
-rw-r--r--user/lib/memmove.c (renamed from lib/memmove.c)0
-rw-r--r--user/lib/memset.c (renamed from lib/memset.c)0
-rw-r--r--user/lib/printf.c (renamed from lib/printf.c)0
-rw-r--r--user/lib/spawn.c (renamed from ulib/spawn.c)0
-rw-r--r--user/lib/stpcpy.c (renamed from lib/stpcpy.c)0
-rw-r--r--user/lib/stpncpy.c (renamed from lib/stpncpy.c)0
-rw-r--r--user/lib/strcat.c (renamed from lib/strcat.c)0
-rw-r--r--user/lib/strcpy.c (renamed from lib/strcpy.c)0
-rw-r--r--user/lib/strlen.c (renamed from lib/strlen.c)0
-rw-r--r--user/lib/strncmp.c (renamed from lib/strncmp.c)0
-rw-r--r--user/lib/strncpy.c (renamed from lib/strncpy.c)0
-rw-r--r--user/lib/strtoux.c (renamed from lib/strtoux.c)0
-rw-r--r--user/lib/strtox.c (renamed from lib/strtox.c)0
-rw-r--r--user/lib/syscall.S (renamed from ulib/syscall.S)0
-rw-r--r--user/lib/timetostr.c (renamed from lib/timetostr.c)0
-rw-r--r--user/lib/uxtoa.c (renamed from lib/uxtoa.c)0
-rw-r--r--user/lib/xtoa.c (renamed from lib/xtoa.c)0
29 files changed, 4 insertions, 0 deletions
diff --git a/lib/alloc.c b/user/lib/alloc.c
index dfa2df5..49c762b 100644
--- a/lib/alloc.c
+++ b/user/lib/alloc.c
@@ -1,8 +1,10 @@
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#define MAGIC 0xBEEFCAFE
+#define PAGE_SIZE 4096
struct page_header {
struct page_header *next;
@@ -37,6 +39,7 @@ static void *alloc_new(size_t size)
{
size_t pages = ((size + header_len) / PAGE_SIZE) + 1;
+ // FIXME: use brk/sbrk
void *addr = alloc_pages(pages);
void *mem = (char *)addr + header_len;
@@ -206,6 +209,7 @@ void free(void *ptr)
header->next->prev = header->prev;
if (header->prev)
header->prev->next = header->next;
+ // FIXME: use brk/sbrk
free_pages(header);
}
}
diff --git a/lib/atox.c b/user/lib/atox.c
index c4bef59..c4bef59 100644
--- a/lib/atox.c
+++ b/user/lib/atox.c
diff --git a/lib/bound.c b/user/lib/bound.c
index 072a41a..072a41a 100644
--- a/lib/bound.c
+++ b/user/lib/bound.c
diff --git a/lib/btoa.c b/user/lib/btoa.c
index fe5e275..fe5e275 100644
--- a/lib/btoa.c
+++ b/user/lib/btoa.c
diff --git a/lib/ctoi.c b/user/lib/ctoi.c
index efe4fec..efe4fec 100644
--- a/lib/ctoi.c
+++ b/user/lib/ctoi.c
diff --git a/lib/delay.c b/user/lib/delay.c
index ff5ccc4..ff5ccc4 100644
--- a/lib/delay.c
+++ b/user/lib/delay.c
diff --git a/ulib/entry.S b/user/lib/entry.S
index 87ad9c7..87ad9c7 100644
--- a/ulib/entry.S
+++ b/user/lib/entry.S
diff --git a/lib/isdigit.c b/user/lib/isdigit.c
index aa93ced..aa93ced 100644
--- a/lib/isdigit.c
+++ b/user/lib/isdigit.c
diff --git a/lib/isspace.c b/user/lib/isspace.c
index 9e89d76..9e89d76 100644
--- a/lib/isspace.c
+++ b/user/lib/isspace.c
diff --git a/lib/itoc.c b/user/lib/itoc.c
index c19d814..c19d814 100644
--- a/lib/itoc.c
+++ b/user/lib/itoc.c
diff --git a/lib/memcmp.c b/user/lib/memcmp.c
index 7f3dc01..7f3dc01 100644
--- a/lib/memcmp.c
+++ b/user/lib/memcmp.c
diff --git a/lib/memcpy.c b/user/lib/memcpy.c
index ec56537..ec56537 100644
--- a/lib/memcpy.c
+++ b/user/lib/memcpy.c
diff --git a/lib/memmove.c b/user/lib/memmove.c
index 81f00fe..81f00fe 100644
--- a/lib/memmove.c
+++ b/user/lib/memmove.c
diff --git a/lib/memset.c b/user/lib/memset.c
index ddf42f8..ddf42f8 100644
--- a/lib/memset.c
+++ b/user/lib/memset.c
diff --git a/lib/printf.c b/user/lib/printf.c
index 4a85956..4a85956 100644
--- a/lib/printf.c
+++ b/user/lib/printf.c
diff --git a/ulib/spawn.c b/user/lib/spawn.c
index 78b1a53..78b1a53 100644
--- a/ulib/spawn.c
+++ b/user/lib/spawn.c
diff --git a/lib/stpcpy.c b/user/lib/stpcpy.c
index 1586a37..1586a37 100644
--- a/lib/stpcpy.c
+++ b/user/lib/stpcpy.c
diff --git a/lib/stpncpy.c b/user/lib/stpncpy.c
index 4e0def6..4e0def6 100644
--- a/lib/stpncpy.c
+++ b/user/lib/stpncpy.c
diff --git a/lib/strcat.c b/user/lib/strcat.c
index 33f749b..33f749b 100644
--- a/lib/strcat.c
+++ b/user/lib/strcat.c
diff --git a/lib/strcpy.c b/user/lib/strcpy.c
index 70cd1ca..70cd1ca 100644
--- a/lib/strcpy.c
+++ b/user/lib/strcpy.c
diff --git a/lib/strlen.c b/user/lib/strlen.c
index 6c4cc86..6c4cc86 100644
--- a/lib/strlen.c
+++ b/user/lib/strlen.c
diff --git a/lib/strncmp.c b/user/lib/strncmp.c
index e890517..e890517 100644
--- a/lib/strncmp.c
+++ b/user/lib/strncmp.c
diff --git a/lib/strncpy.c b/user/lib/strncpy.c
index 264fd9d..264fd9d 100644
--- a/lib/strncpy.c
+++ b/user/lib/strncpy.c
diff --git a/lib/strtoux.c b/user/lib/strtoux.c
index 7c2d7ee..7c2d7ee 100644
--- a/lib/strtoux.c
+++ b/user/lib/strtoux.c
diff --git a/lib/strtox.c b/user/lib/strtox.c
index 5f786f1..5f786f1 100644
--- a/lib/strtox.c
+++ b/user/lib/strtox.c
diff --git a/ulib/syscall.S b/user/lib/syscall.S
index 46fcb89..46fcb89 100644
--- a/ulib/syscall.S
+++ b/user/lib/syscall.S
diff --git a/lib/timetostr.c b/user/lib/timetostr.c
index fa77362..fa77362 100644
--- a/lib/timetostr.c
+++ b/user/lib/timetostr.c
diff --git a/lib/uxtoa.c b/user/lib/uxtoa.c
index 8d4e0e1..8d4e0e1 100644
--- a/lib/uxtoa.c
+++ b/user/lib/uxtoa.c
diff --git a/lib/xtoa.c b/user/lib/xtoa.c
index bf02236..bf02236 100644
--- a/lib/xtoa.c
+++ b/user/lib/xtoa.c