diff options
author | dzwdz | 2022-08-07 18:55:59 +0200 |
---|---|---|
committer | dzwdz | 2022-08-07 18:55:59 +0200 |
commit | eb36d836458803b5dcfa668fef487c52e5c45cdc (patch) | |
tree | d3d140e32769c3d3d0a714d44885bd86f5ed3986 /src/kernel/ring.c | |
parent | a52ceb05e49d6d5b5adeaa733037d558187848f7 (diff) |
kernel: ring_to_virt
Diffstat (limited to 'src/kernel/ring.c')
-rw-r--r-- | src/kernel/ring.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/kernel/ring.c b/src/kernel/ring.c new file mode 100644 index 0000000..e25024a --- /dev/null +++ b/src/kernel/ring.c @@ -0,0 +1,11 @@ +#include <kernel/mem/virt.h> +#include <kernel/ring.h> + +size_t ring_to_virt(ring_t *r, struct pagedir *pages, void __user *ubuf, size_t max) { + char tmp[32]; + if (max > sizeof tmp) max = sizeof tmp; + max = ring_get(r, tmp, max); + // TODO decide how write errors should be handled + virt_cpy_to(pages, ubuf, tmp, max); + return max; +} |