aboutsummaryrefslogtreecommitdiff
path: root/src/disk.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2009-01-01 18:31:11 -0500
committerKevin O'Connor <kevin@koconnor.net>2009-01-01 18:31:11 -0500
commit7f343097712ebdd1f11953c867e208da899b4ba3 (patch)
treea2bee74e381ce87766c006975eb03b34ee47b213 /src/disk.c
parent964622410105c28c42378440ac3cb6d1a996da49 (diff)
downloadseabios-hppa-7f343097712ebdd1f11953c867e208da899b4ba3.zip
seabios-hppa-7f343097712ebdd1f11953c867e208da899b4ba3.tar.gz
seabios-hppa-7f343097712ebdd1f11953c867e208da899b4ba3.tar.bz2
Switch to new stack when calling ATA function in 16bit mode.
This reduces stack usage (old dos programs don't provide much space).
Diffstat (limited to 'src/disk.c')
-rw-r--r--src/disk.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/disk.c b/src/disk.c
index e72be9d..02997fc 100644
--- a/src/disk.c
+++ b/src/disk.c
@@ -39,28 +39,39 @@ __disk_stub(const char *fname, int lineno, struct bregs *regs)
#define DISK_STUB(regs) \
__disk_stub(__func__, __LINE__, (regs))
-static __always_inline int
-send_disk_op(struct disk_op_s *op)
+static int
+__send_disk_op(struct disk_op_s *op_p, u16 op_s)
{
+ struct disk_op_s dop;
+ memcpy_far(MAKE_FARPTR(GET_SEG(SS), &dop)
+ , MAKE_FARPTR(op_s, op_p)
+ , sizeof(dop));
+
dprintf(DEBUG_HDL_13, "disk_op d=%d lba=%d buf=%p count=%d cmd=%d\n"
- , op->driveid, (u32)op->lba, op->far_buffer
- , op->count, op->command);
+ , dop.driveid, (u32)dop.lba, dop.far_buffer
+ , dop.count, dop.command);
irq_enable();
int status;
- if (op->command == CMD_CDEMU_READ)
- status = cdrom_read_512(op);
- else if (op->command == CMD_CDROM_READ)
- status = cdrom_read(op);
+ if (dop.command == CMD_CDEMU_READ)
+ status = cdrom_read_512(&dop);
+ else if (dop.command == CMD_CDROM_READ)
+ status = cdrom_read(&dop);
else
- status = ata_cmd_data(op);
+ status = ata_cmd_data(&dop);
irq_disable();
return status;
}
+static int
+send_disk_op(struct disk_op_s *op)
+{
+ return stack_hop((u32)op, GET_SEG(SS), 0, __send_disk_op);
+}
+
static void
basic_access(struct bregs *regs, u8 device, u16 command)
{