From: David Given Date: Tue, 24 Apr 2018 19:01:27 +0000 (+0200) Subject: Actually read data into user memory, rather than scribbling randomly across the X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=d07301a9201a28e4146b85da3ffce71a2639291b;p=FUZIX.git Actually read data into user memory, rather than scribbling randomly across the address space (which never works). --- 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;