From d07301a9201a28e4146b85da3ffce71a2639291b Mon Sep 17 00:00:00 2001 From: David Given Date: Tue, 24 Apr 2018 21:01:27 +0200 Subject: [PATCH] Actually read data into user memory, rather than scribbling randomly across the address space (which never works). --- Kernel/platform-amstradnc/devfd.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Kernel/platform-amstradnc/devfd.c b/Kernel/platform-amstradnc/devfd.c index 4360bae3..1b89a87a 100644 --- a/Kernel/platform-amstradnc/devfd.c +++ b/Kernel/platform-amstradnc/devfd.c @@ -92,17 +92,20 @@ static int devfd_transfer(bool is_read, uint8_t is_raw) { int ct = 0; int tries; - int blocks = udata.u_nblock; - uint16_t lba = udata.u_block; + int blocks; + uint16_t lba; + + /* This must happen first, as it updates the udata variables. */ + if (is_raw && d_blkoff(BLKSHIFT)) + return -1; + blocks = udata.u_nblock; + lba = udata.u_block; // kprintf("[%s %d @ %x : %d:%x]\n", is_read ? "read" : "write", // blocks, lba, is_raw, udata.u_dptr); // if (!is_read) // return blocks << BLKSHIFT; - if (is_raw && d_blkoff(BLKSHIFT)) - return -1; - fd_select(0); fd765_is_user = is_raw; fd765_buffer = udata.u_dptr; -- 2.34.1