diff --git a/include/xhdi_sd.h b/include/xhdi_sd.h index b7dc772..d05190d 100644 --- a/include/xhdi_sd.h +++ b/include/xhdi_sd.h @@ -87,9 +87,9 @@ typedef void* (*xhdi_call_fun)(int xhdi_fun, ...); struct XHDICALL_args { uint16_t opcode; -} __attribute__((packed)); +}; -extern uint32_t xhdi_call(struct XHDICALL_args *stack); +extern unsigned long xhdi_call(struct XHDICALL_args stack); extern xhdi_call_fun xhdi_sd_install(xhdi_call_fun old_vector) __attribute__((__interrupt__)); diff --git a/sources/xhdi_interface.c b/sources/xhdi_interface.c index 4d19b33..bc1d3ff 100644 --- a/sources/xhdi_interface.c +++ b/sources/xhdi_interface.c @@ -27,9 +27,9 @@ #include "bas_printf.h" -uint32_t xhdi_call(uint16_t *stack) +unsigned long xhdi_call(struct XHDICALL_args stack) { - uint16_t opcode = *stack; + uint16_t opcode = stack.opcode; xprintf("xhdi_call(): opcode %d\r\n", opcode); @@ -49,7 +49,7 @@ uint32_t xhdi_call(uint16_t *stack) uint32_t *blocksize; uint32_t *deviceflags; char *productname; - }*args = (struct XHINQTARGET_args *) stack; + }*args = (struct XHINQTARGET_args *) &stack; return xhdi_inquire_target(args->major, args->minor, args->blocksize, args->deviceflags, args->productname); @@ -65,7 +65,7 @@ uint32_t xhdi_call(uint16_t *stack) uint16_t minor; uint16_t do_reserve; uint16_t key; - }*args = (struct XHRESERVE_args *) stack; + }*args = (struct XHRESERVE_args *) &stack; return xhdi_reserve(args->major, args->minor, args->do_reserve, args->key); } @@ -79,7 +79,7 @@ uint32_t xhdi_call(uint16_t *stack) uint16_t minor; uint16_t do_lock; uint16_t key; - }*args = (struct XHLOCK_args *) stack; + }*args = (struct XHLOCK_args *) &stack; return xhdi_lock(args->major, args->minor, args->do_lock, args->key); } @@ -93,7 +93,7 @@ uint32_t xhdi_call(uint16_t *stack) uint16_t minor; uint16_t do_stop; uint16_t key; - }*args = (struct XHSTOP_args *) stack; + }*args = (struct XHSTOP_args *) &stack; return xhdi_stop(args->major, args->minor, args->do_stop, args->key); } @@ -107,7 +107,7 @@ uint32_t xhdi_call(uint16_t *stack) uint16_t minor; uint16_t do_eject; uint16_t key; - }*args = (struct XHEJECT_args *) stack; + }*args = (struct XHEJECT_args *) &stack; return xhdi_eject(args->major, args->minor, args->do_eject, args->key); } @@ -127,7 +127,7 @@ uint32_t xhdi_call(uint16_t *stack) uint16_t *minor; uint32_t *start; BPB *bpb; - }*args = (struct XHINQDEV_args *) stack; + }*args = (struct XHINQDEV_args *) &stack; return xhdi_inquire_device(args->drv, args->major, args->minor, args->start, args->bpb); @@ -144,7 +144,7 @@ uint32_t xhdi_call(uint16_t *stack) char *company; uint16_t *ahdi_version; uint16_t *maxIPL; - }*args = (struct XHINQDRIVER_args *) stack; + }*args = (struct XHINQDRIVER_args *) &stack; return xhdi_inquire_driver(args->dev, args->name, args->version, args->company, args->ahdi_version, args->maxIPL); @@ -156,7 +156,7 @@ uint32_t xhdi_call(uint16_t *stack) { uint16_t opcode; uint32_t newcookie; - }*args = (struct XHNEWCOOKIE_args *) stack; + }*args = (struct XHNEWCOOKIE_args *) &stack; return xhdi_new_cookie(args->newcookie); } @@ -172,7 +172,7 @@ uint32_t xhdi_call(uint16_t *stack) uint32_t sector; uint16_t count; void *buf; - }*args = (struct XHREADWRITE_args *) stack; + }*args = (struct XHREADWRITE_args *) &stack; return xhdi_read_write(args->major, args->minor, args->rw, args->sector, args->count, args->buf); @@ -189,7 +189,7 @@ uint32_t xhdi_call(uint16_t *stack) uint32_t *deviceflags; char *productname; uint16_t stringlen; - }*args = (struct XHINQTARGET2_args *) stack; + }*args = (struct XHINQTARGET2_args *) &stack; return xhdi_inquire_target2(args->major, args->minor, args->blocksize, args->deviceflags, args->productname, args->stringlen); @@ -207,7 +207,7 @@ uint32_t xhdi_call(uint16_t *stack) BPB *bpb; uint32_t *blocks; char *partid; - }*args = (struct XHINQDEV2_args *) stack; + }*args = (struct XHINQDEV2_args *) &stack; return xhdi_inquire_device2(args->drv, args->major, args->minor, args->start, args->bpb, args->blocks, args->partid); @@ -222,7 +222,7 @@ uint32_t xhdi_call(uint16_t *stack) uint32_t key2; uint16_t subopcode; void *data; - }*args = (struct XHDRIVERSPECIAL_args *) stack; + }*args = (struct XHDRIVERSPECIAL_args *) &stack; return xhdi_driver_special(args->key1, args->key2, args->subopcode, args->data); @@ -237,7 +237,7 @@ uint32_t xhdi_call(uint16_t *stack) uint16_t minor; uint32_t *blocks; uint32_t *blocksize; - }*args = (struct XHGETCAPACITY_args *) stack; + }*args = (struct XHGETCAPACITY_args *) &stack; return xhdi_get_capacity(args->major, args->minor, args->blocks, args->blocksize); @@ -250,7 +250,7 @@ uint32_t xhdi_call(uint16_t *stack) uint16_t opcode; uint16_t major; uint16_t minor; - }*args = (struct XHMEDIUMCHANGED_args *) stack; + }*args = (struct XHMEDIUMCHANGED_args *) &stack; return xhdi_medium_changed(args->major, args->minor); } @@ -262,7 +262,7 @@ uint32_t xhdi_call(uint16_t *stack) uint16_t opcode; uint16_t subopcode; void *data; - }*args = (struct XHMINTINFO_args *) stack; + }*args = (struct XHMINTINFO_args *) &stack; return xhdi_mint_info(args->subopcode, args->data); } @@ -274,7 +274,7 @@ uint32_t xhdi_call(uint16_t *stack) uint16_t opcode; uint16_t which; uint32_t limit; - }*args = (struct XHDOSLIMITS_args *) stack; + }*args = (struct XHDOSLIMITS_args *) &stack; return xhdi_dos_limits(args->which, args->limit); } @@ -287,7 +287,7 @@ uint32_t xhdi_call(uint16_t *stack) uint16_t major; uint16_t minor; uint32_t *ms; - }*args = (struct XHLASTACCESS_args *) stack; + }*args = (struct XHLASTACCESS_args *) &stack; return xhdi_last_access(args->major, args->minor, args->ms); } @@ -299,7 +299,7 @@ uint32_t xhdi_call(uint16_t *stack) uint16_t opcode; uint16_t major; uint16_t minor; - }*args = (struct XHREACCESS_args *) stack; + }*args = (struct XHREACCESS_args *) &stack; return xhdi_reaccess(args->major, args->minor); }