summaryrefslogtreecommitdiff
path: root/Kernel/Devices/SB16.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/Devices/SB16.cpp')
-rw-r--r--Kernel/Devices/SB16.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/Kernel/Devices/SB16.cpp b/Kernel/Devices/SB16.cpp
index 8d7406f39b..eb6d15b993 100644
--- a/Kernel/Devices/SB16.cpp
+++ b/Kernel/Devices/SB16.cpp
@@ -177,7 +177,7 @@ bool SB16::can_read(const FileDescription&, size_t) const
return false;
}
-KResultOr<size_t> SB16::read(FileDescription&, size_t, u8*, size_t)
+KResultOr<size_t> SB16::read(FileDescription&, size_t, UserOrKernelBuffer&, size_t)
{
return 0;
}
@@ -231,7 +231,7 @@ void SB16::wait_for_irq()
disable_irq();
}
-KResultOr<size_t> SB16::write(FileDescription&, size_t, const u8* data, size_t length)
+KResultOr<size_t> SB16::write(FileDescription&, size_t, const UserOrKernelBuffer& data, size_t length)
{
if (!m_dma_region) {
auto page = MM.allocate_supervisor_physical_page();
@@ -252,7 +252,8 @@ KResultOr<size_t> SB16::write(FileDescription&, size_t, const u8* data, size_t l
const int sample_rate = 44100;
set_sample_rate(sample_rate);
- memcpy(m_dma_region->vaddr().as_ptr(), data, length);
+ if (!data.read(m_dma_region->vaddr().as_ptr(), length))
+ return KResult(-EFAULT);
dma_start(length);
// 16-bit single-cycle output.