The send_disk_op() function is only called from the 16bit handlers found in disk.c.
Signed-off-by: Kevin O'Connor kevin@koconnor.net --- src/block.c | 34 +--------------------------------- src/block.h | 1 - src/disk.c | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 34 deletions(-)
diff --git a/src/block.c b/src/block.c index d9de29f..a383574 100644 --- a/src/block.c +++ b/src/block.c @@ -22,7 +22,7 @@ #include "hw/virtio-scsi.h" // virtio_scsi_process_op #include "malloc.h" // malloc_low #include "output.h" // dprintf -#include "stacks.h" // stack_hop +#include "stacks.h" // call32 #include "std/disk.h" // struct dpte_s #include "string.h" // checksum #include "util.h" // process_floppy_op @@ -613,35 +613,3 @@ process_op(struct disk_op_s *op) op->count = 0; return ret; } - -// Execute a "disk_op_s" request - this runs on the extra stack. -static int -__send_disk_op(struct disk_op_s *op_far, u16 op_seg) -{ - struct disk_op_s dop; - memcpy_far(GET_SEG(SS), &dop - , op_seg, op_far - , sizeof(dop)); - - dprintf(DEBUG_HDL_13, "disk_op d=%p lba=%d buf=%p count=%d cmd=%d\n" - , dop.drive_gf, (u32)dop.lba, dop.buf_fl - , dop.count, dop.command); - - int status = process_op(&dop); - - // Update count with total sectors transferred. - SET_FARVAR(op_seg, op_far->count, dop.count); - - return status; -} - -// Execute a "disk_op_s" request by jumping to the extra 16bit stack. -int -send_disk_op(struct disk_op_s *op) -{ - ASSERT16(); - if (! CONFIG_DRIVES) - return -1; - - return stack_hop(__send_disk_op, op, GET_SEG(SS)); -} diff --git a/src/block.h b/src/block.h index a5f38c4..0f15ff9 100644 --- a/src/block.h +++ b/src/block.h @@ -115,7 +115,6 @@ int fill_edd(struct segoff_s edd, struct drive_s *drive_gf); void block_setup(void); int default_process_op(struct disk_op_s *op); int process_op(struct disk_op_s *op); -int send_disk_op(struct disk_op_s *op); int create_bounce_buf(void);
#endif // block.h diff --git a/src/disk.c b/src/disk.c index 3854d00..bcd6a09 100644 --- a/src/disk.c +++ b/src/disk.c @@ -87,6 +87,38 @@ getLCHS(struct drive_s *drive_gf) return res; }
+// Execute a "disk_op_s" request - this runs on the extra stack. +static int +__send_disk_op(struct disk_op_s *op_far, u16 op_seg) +{ + struct disk_op_s dop; + memcpy_far(GET_SEG(SS), &dop + , op_seg, op_far + , sizeof(dop)); + + dprintf(DEBUG_HDL_13, "disk_op d=%p lba=%d buf=%p count=%d cmd=%d\n" + , dop.drive_gf, (u32)dop.lba, dop.buf_fl + , dop.count, dop.command); + + int status = process_op(&dop); + + // Update count with total sectors transferred. + SET_FARVAR(op_seg, op_far->count, dop.count); + + return status; +} + +// Execute a "disk_op_s" request by jumping to the extra 16bit stack. +static int +send_disk_op(struct disk_op_s *op) +{ + ASSERT16(); + if (! CONFIG_DRIVES) + return -1; + + return stack_hop(__send_disk_op, op, GET_SEG(SS)); +} + // Perform read/write/verify using old-style chs accesses static void noinline basic_access(struct bregs *regs, struct drive_s *drive_gf, u16 command)
If CONFIG_ENTRY_EXTRASTACK is set (enabled by default) then the 16bit disk interface code is already running on the extra stack and it is not necessary to support stack switching on each disk request.
Signed-off-by: Kevin O'Connor kevin@koconnor.net --- src/block.c | 4 ++++ src/disk.c | 12 ++++-------- 2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/block.c b/src/block.c index a383574..f7280cf 100644 --- a/src/block.c +++ b/src/block.c @@ -599,6 +599,10 @@ process_op_16(struct disk_op_s *op) int process_op(struct disk_op_s *op) { + dprintf(DEBUG_HDL_13, "disk_op d=%p lba=%d buf=%p count=%d cmd=%d\n" + , op->drive_gf, (u32)op->lba, op->buf_fl + , op->count, op->command); + int ret, origcount = op->count; if (origcount * GET_GLOBALFLAT(op->drive_gf->blksize) > 64*1024) { op->count = 0; diff --git a/src/disk.c b/src/disk.c index bcd6a09..dc0427c 100644 --- a/src/disk.c +++ b/src/disk.c @@ -87,18 +87,12 @@ getLCHS(struct drive_s *drive_gf) return res; }
-// Execute a "disk_op_s" request - this runs on the extra stack. +// Execute a "disk_op_s" request after jumping to the extra stack. static int __send_disk_op(struct disk_op_s *op_far, u16 op_seg) { struct disk_op_s dop; - memcpy_far(GET_SEG(SS), &dop - , op_seg, op_far - , sizeof(dop)); - - dprintf(DEBUG_HDL_13, "disk_op d=%p lba=%d buf=%p count=%d cmd=%d\n" - , dop.drive_gf, (u32)dop.lba, dop.buf_fl - , dop.count, dop.command); + memcpy_far(GET_SEG(SS), &dop, op_seg, op_far, sizeof(dop));
int status = process_op(&dop);
@@ -115,6 +109,8 @@ send_disk_op(struct disk_op_s *op) ASSERT16(); if (! CONFIG_DRIVES) return -1; + if (CONFIG_ENTRY_EXTRASTACK) + return process_op(op);
return stack_hop(__send_disk_op, op, GET_SEG(SS)); }
On Thu, Mar 31, 2016 at 02:50:32PM -0400, Kevin O'Connor wrote:
If CONFIG_ENTRY_EXTRASTACK is set (enabled by default) then the 16bit disk interface code is already running on the extra stack and it is not necessary to support stack switching on each disk request.
FYI, I committed this change.
-Kevin