aboutsummaryrefslogtreecommitdiff
path: root/libs/libc
diff options
context:
space:
mode:
authorMarvin Borner2021-04-16 23:22:02 +0200
committerMarvin Borner2021-04-16 23:22:02 +0200
commit7485f7e441ca892876d9401380aa77610eb85f76 (patch)
tree065f910effe33f5c9d71cd9619dd25216282a13d /libs/libc
parent4d4e784770b576199b18f22100689125a18bfd9a (diff)
New elegant I/O blocking solution
This is done using an internal scheduler syscall (127). Very nice!
Diffstat (limited to 'libs/libc')
-rw-r--r--libs/libc/inc/sys.h8
-rw-r--r--libs/libc/print.c2
2 files changed, 6 insertions, 4 deletions
diff --git a/libs/libc/inc/sys.h b/libs/libc/inc/sys.h
index ee82946..749888a 100644
--- a/libs/libc/inc/sys.h
+++ b/libs/libc/inc/sys.h
@@ -81,10 +81,12 @@ res read(const char *path, void *buf, u32 offset, u32 count) NONNULL;
res write(const char *path, const void *buf, u32 offset, u32 count) NONNULL;
res stat(const char *path, struct stat *buf) NONNULL;
res exec(const char *path, ...) ATTR((nonnull(1))) SENTINEL;
-res io_poll(u32 *devs);
-res io_read(enum io_type io, void *buf, u32 offset, u32 count);
-res io_write(enum io_type io, void *buf, u32 offset, u32 count);
+
+res io_poll(u32 *devs) NONNULL;
+res io_read(enum io_type io, void *buf, u32 offset, u32 count) NONNULL;
+res io_write(enum io_type io, void *buf, u32 offset, u32 count) NONNULL;
res io_control(enum io_type io, ...);
+
res yield(void);
res boot(u32 cmd);
diff --git a/libs/libc/print.c b/libs/libc/print.c
index 425eb01..27048bd 100644
--- a/libs/libc/print.c
+++ b/libs/libc/print.c
@@ -233,7 +233,7 @@ void print_trace(u32 count)
} * stk;
__asm__ volatile("movl %%ebp, %0;" : "=r"(stk));
print("EBP\tEIP\n");
- for (u32 i = 0; stk && i < count; i++) {
+ for (u32 i = 0; stk && memory_readable(stk) && i < count; i++) {
printf("0x%x\t0x%x\n", stk->ebp, stk->eip);
stk = stk->ebp;
}