diff options
author | dzwdz | 2023-01-25 20:56:36 +0100 |
---|---|---|
committer | dzwdz | 2023-01-25 20:56:36 +0100 |
commit | c24a9376b4a048a3f9408df2d47eaad367459bd7 (patch) | |
tree | 74388b8b575719ab94e6f8eed9ad834abe7ba36b /src/kernel/arch/amd64/driver | |
parent | 93194f8645ecd9f280372ec99497ede5f0ce7cee (diff) |
kernel: consolidate some header files
Diffstat (limited to 'src/kernel/arch/amd64/driver')
-rw-r--r-- | src/kernel/arch/amd64/driver/pata.c | 1 | ||||
-rw-r--r-- | src/kernel/arch/amd64/driver/ps2.c | 1 | ||||
-rw-r--r-- | src/kernel/arch/amd64/driver/rtl8139.c | 1 | ||||
-rw-r--r-- | src/kernel/arch/amd64/driver/serial.c | 2 | ||||
-rw-r--r-- | src/kernel/arch/amd64/driver/util.c | 8 | ||||
-rw-r--r-- | src/kernel/arch/amd64/driver/util.h | 2 | ||||
-rw-r--r-- | src/kernel/arch/amd64/driver/video.c | 1 |
7 files changed, 9 insertions, 7 deletions
diff --git a/src/kernel/arch/amd64/driver/pata.c b/src/kernel/arch/amd64/driver/pata.c index b0ed592..3e9fa7a 100644 --- a/src/kernel/arch/amd64/driver/pata.c +++ b/src/kernel/arch/amd64/driver/pata.c @@ -3,7 +3,6 @@ #include <kernel/arch/amd64/ata.h> #include <kernel/arch/amd64/driver/pata.h> #include <kernel/arch/amd64/driver/util.h> -#include <kernel/mem/virt.h> #include <kernel/panic.h> #include <kernel/proc.h> #include <kernel/vfs/request.h> diff --git a/src/kernel/arch/amd64/driver/ps2.c b/src/kernel/arch/amd64/driver/ps2.c index cdcbf19..971d7d1 100644 --- a/src/kernel/arch/amd64/driver/ps2.c +++ b/src/kernel/arch/amd64/driver/ps2.c @@ -5,7 +5,6 @@ #include <kernel/arch/amd64/port_io.h> #include <kernel/panic.h> #include <kernel/proc.h> -#include <kernel/ring.h> #include <kernel/vfs/request.h> #include <shared/mem.h> diff --git a/src/kernel/arch/amd64/driver/rtl8139.c b/src/kernel/arch/amd64/driver/rtl8139.c index dd11102..d0e4d90 100644 --- a/src/kernel/arch/amd64/driver/rtl8139.c +++ b/src/kernel/arch/amd64/driver/rtl8139.c @@ -2,7 +2,6 @@ #include <kernel/arch/amd64/driver/util.h> #include <kernel/arch/amd64/pci.h> #include <kernel/arch/amd64/port_io.h> -#include <kernel/mem/virt.h> #include <kernel/panic.h> #include <kernel/proc.h> #include <kernel/vfs/request.h> diff --git a/src/kernel/arch/amd64/driver/serial.c b/src/kernel/arch/amd64/driver/serial.c index 6fe4500..5004c31 100644 --- a/src/kernel/arch/amd64/driver/serial.c +++ b/src/kernel/arch/amd64/driver/serial.c @@ -2,10 +2,8 @@ #include <kernel/arch/amd64/driver/util.h> #include <kernel/arch/amd64/interrupts/irq.h> #include <kernel/arch/amd64/port_io.h> -#include <kernel/mem/virt.h> #include <kernel/panic.h> #include <kernel/proc.h> -#include <kernel/ring.h> #include <kernel/util.h> #include <stdint.h> diff --git a/src/kernel/arch/amd64/driver/util.c b/src/kernel/arch/amd64/driver/util.c index 957005c..1462258 100644 --- a/src/kernel/arch/amd64/driver/util.c +++ b/src/kernel/arch/amd64/driver/util.c @@ -1,6 +1,5 @@ #include <camellia/fsutil.h> #include <kernel/arch/amd64/driver/util.h> -#include <kernel/mem/virt.h> #include <kernel/panic.h> #include <kernel/proc.h> #include <kernel/vfs/request.h> @@ -53,3 +52,10 @@ void postqueue_ringreadall(VfsReq **queue, ring_t *r) { } *queue = NULL; } + +size_t ring_to_virt(ring_t *r, Proc *proc, void __user *ubuf, size_t max) { + char tmp[32]; + if (max > sizeof tmp) max = sizeof tmp; + max = ring_get(r, tmp, max); + return pcpy_to(proc, ubuf, tmp, max); +} diff --git a/src/kernel/arch/amd64/driver/util.h b/src/kernel/arch/amd64/driver/util.h index 5827fa9..0f7db7a 100644 --- a/src/kernel/arch/amd64/driver/util.h +++ b/src/kernel/arch/amd64/driver/util.h @@ -19,3 +19,5 @@ bool postqueue_pop(VfsReq **queue, void (*accept)(VfsReq *)); /** If there are any pending read requests, and the ring buffer isn't empty, fulfill them * all with a single read. */ void postqueue_ringreadall(VfsReq **queue, ring_t *r); + +size_t ring_to_virt(ring_t *r, Proc *proc, void __user *ubuf, size_t max); diff --git a/src/kernel/arch/amd64/driver/video.c b/src/kernel/arch/amd64/driver/video.c index d7046b4..ecf713f 100644 --- a/src/kernel/arch/amd64/driver/video.c +++ b/src/kernel/arch/amd64/driver/video.c @@ -2,7 +2,6 @@ #include <camellia/fsutil.h> #include <kernel/arch/amd64/driver/util.h> #include <kernel/arch/amd64/driver/video.h> -#include <kernel/mem/virt.h> #include <kernel/panic.h> #include <kernel/proc.h> #include <kernel/vfs/request.h> |