diff --git a/BaS_gcc/Makefile b/BaS_gcc/Makefile index bf87f3c..727b9ff 100644 --- a/BaS_gcc/Makefile +++ b/BaS_gcc/Makefile @@ -142,9 +142,6 @@ $(LIBBAS): $(OBJS) # compile init_fpga with -mbitfield for testing purposes #$(OBJDIR)/init_fpga.o: CFLAGS += -mbitfield -# compile xhdi_interface -mshort to make it callable from (-mshort-compiled) EmuTOS -$(OBJDIR)/xhdi_interface.o: CFLAGS += -mshort - # compile printf pc-relative so it can be used as well before and after copy of BaS $(OBJDIR)/bas_printf.o: CFLAGS += -mpcrel # the same for flush_and_invalidate_cache() diff --git a/BaS_gcc/include/xhdi_sd.h b/BaS_gcc/include/xhdi_sd.h index 114a338..973caab 100644 --- a/BaS_gcc/include/xhdi_sd.h +++ b/BaS_gcc/include/xhdi_sd.h @@ -93,16 +93,6 @@ extern unsigned long xhdi_call(struct XHDICALL_args stack); extern xhdi_call_fun xhdi_sd_install(xhdi_call_fun old_vector) __attribute__((__interrupt__)); -/* - * begin of XHDI calls. The following is a little tricky: since those functions can be called by code compiled with -mshort as - * well as from "normal" code, "-mshort"-code needs to be tricked to pass 16-bit values as 32-bit integers. - */ -#if __INT_MAX__ == 32767 -#define uint16_t unsigned long -#define uint32_t unsigned long -#warning -mshort trick activated -#endif /* _MSHORT_ */ - extern uint16_t xhdi_version(void); /* XHDI 0 */ extern uint32_t xhdi_inquire_target(uint16_t major, uint16_t minor, uint32_t *block_size, uint32_t *flags, @@ -149,9 +139,4 @@ extern uint32_t xhdi_last_access(uint16_t major, uint16_t minor, uint32_t *ms); extern uint32_t xhdi_reaccess(uint16_t major, uint16_t minor); /* XHDI 19 */ -/* disarm stack trick */ -#ifdef uint16_t -#undef uint16_t -#undef uint32_t -#endif /* uint16_t */ #endif /* _XHDI_SD_H_ */ diff --git a/BaS_gcc/sources/xhdi_interface.c b/BaS_gcc/sources/xhdi_interface.c index d3e0fc3..a7eed40 100644 --- a/BaS_gcc/sources/xhdi_interface.c +++ b/BaS_gcc/sources/xhdi_interface.c @@ -27,9 +27,9 @@ #include "bas_printf.h" -unsigned long xhdi_call(struct XHDICALL_args stack) +uint32_t xhdi_call(struct XHDICALL_args stack) { - unsigned int opcode = stack.opcode; + uint32_t opcode = stack.opcode; switch (opcode) { @@ -41,12 +41,12 @@ unsigned long xhdi_call(struct XHDICALL_args stack) { struct XHINQTARGET_args { - char *productname; - unsigned long *deviceflags; - unsigned long *blocksize; - unsigned int minor; - unsigned int major; unsigned int opcode; + unsigned int major; + unsigned int minor; + unsigned long *blocksize; + unsigned long *deviceflags; + char *productname; }*args = (struct XHINQTARGET_args *) &stack; return xhdi_inquire_target(args->major, args->minor, args->blocksize, @@ -58,11 +58,11 @@ unsigned long xhdi_call(struct XHDICALL_args stack) { struct XHRESERVE_args { - uint16_t key; - uint16_t do_reserve; - uint16_t minor; - uint16_t major; uint16_t opcode; + uint16_t major; + uint16_t minor; + uint16_t do_reserve; + uint16_t key; } *args = (struct XHRESERVE_args *) &stack; return xhdi_reserve(args->major, args->minor, args->do_reserve, args->key); @@ -119,12 +119,12 @@ unsigned long xhdi_call(struct XHDICALL_args stack) { struct XHINQDEV_args { + uint16_t opcode; + uint16_t drv; + uint16_t *major; + uint16_t *minor; + uint32_t *start; BPB *bpb; - unsigned long *start; - unsigned int *minor; - unsigned int *major; - unsigned int drv; - unsigned int opcode; } *args = (struct XHINQDEV_args *) &stack; return xhdi_inquire_device(args->drv, args->major, args->minor, args->start, @@ -135,13 +135,13 @@ unsigned long xhdi_call(struct XHDICALL_args stack) { struct XHINQDRIVER_args { - uint16_t *maxIPL; - uint16_t *ahdi_version; - char *company; - char *version; - char *name; - uint16_t dev; uint16_t opcode; + uint16_t dev; + char *name; + char *version; + char *company; + uint16_t *ahdi_version; + uint16_t *maxIPL; }*args = (struct XHINQDRIVER_args *) &stack; return xhdi_inquire_driver(args->dev, args->name, args->version, args->company, @@ -152,8 +152,8 @@ unsigned long xhdi_call(struct XHDICALL_args stack) { struct XHNEWCOOKIE_args { - unsigned long newcookie; uint16_t opcode; + uint32_t newcookie; }*args = (struct XHNEWCOOKIE_args *) &stack; return xhdi_new_cookie(args->newcookie); @@ -163,18 +163,18 @@ unsigned long xhdi_call(struct XHDICALL_args stack) { struct XHREADWRITE_args { + uint16_t opcode; + uint16_t major; + uint16_t minor; + uint16_t rw; + uint32_t sector; + uint16_t count; void *buf; - unsigned int count; - unsigned long sector; - unsigned int rw; - unsigned int minor; - unsigned int major; - unsigned int opcode; } *args = (struct XHREADWRITE_args *) &stack; - return xhdi_read_write((unsigned long) args->major, (unsigned long) args->minor, - (unsigned long) args->rw, args->sector, - (unsigned long) args->count, (unsigned long) args->buf); + return xhdi_read_write(args->major, args->minor, + args->rw, args->sector, + args->count, args->buf); } case XHDI_INQUIRE_TARGET2: