Fix ASMCFUNC (FAR) functions for ia16-elf-gcc.

We need to use make the functions vararg (,...) to make them cdecl.
For FAR functions we need wrappers.
This commit is contained in:
Bart Oldeman 2017-12-19 19:39:26 -05:00 committed by Kenneth J Davis
parent 9b5b2e7d60
commit 89d97b18de
12 changed files with 64 additions and 21 deletions

View File

@ -483,14 +483,14 @@ extern request /* I/O Request packets */
ASM CharReqHdr, ASM IoReqHdr, ASM MediaReqHdr;
/* dsk.c */
COUNT ASMCFUNC FAR blk_driver(rqptr rp);
COUNT ASMCFUNC FAR blk_driver(rqptr rp, ...);
ddt * getddt(int dev);
/* error.c */
COUNT char_error(request * rq, struct dhdr FAR * lpDevice);
COUNT block_error(request * rq, COUNT nDrive, struct dhdr FAR * lpDevice, int mode);
/* sysclk.c */
WORD ASMCFUNC FAR clk_driver(rqptr rp);
WORD ASMCFUNC FAR clk_driver(rqptr rp, ...);
/* execrh.asm */
#if defined(__WATCOMC__) && _M_IX86 >= 300

View File

@ -630,7 +630,7 @@ struct memdiskinfo {
};
/* query_memdisk() based on similar subroutine in Eric Auer's public domain getargs.asm which is based on IFMEMDSK */
struct memdiskinfo FAR * ASMCFUNC query_memdisk(UBYTE drive);
struct memdiskinfo FAR * ASMCFUNC query_memdisk(UBYTE drive, ...);
struct memdiskopt {
BYTE * name;

View File

@ -170,7 +170,7 @@ static dsk_proc * const dispatch[NENTRY] =
/* F U N C T I O N S --------------------------------------------------- */
/* ----------------------------------------------------------------------- */
COUNT ASMCFUNC FAR blk_driver(rqptr rp)
COUNT ASMCFUNC FAR blk_driver(rqptr rp, ...)
{
if (rp->r_unit >= blk_dev.dh_name[0] && rp->r_command != C_INIT)
return failure(E_UNIT);

View File

@ -363,7 +363,7 @@ VOID ASMCFUNC FAR cpm_entry(VOID)
/*INRPT FAR handle_break(VOID) */ ;
COUNT ASMCFUNC
CriticalError(COUNT nFlag, COUNT nDrive, COUNT nError,
struct dhdr FAR * lpDevice);
struct dhdr FAR * lpDevice, ...);
VOID ASMCFUNC FAR CharMapSrvc(VOID);
#if 0

View File

@ -198,11 +198,9 @@ void ASMPASCAL set_DTA(void far *dta);
/* irqstack.asm */
VOID ASMCFUNC init_stacks(VOID FAR * stack_base, COUNT nStacks,
WORD stackSize);
WORD stackSize, ...);
/* inthndlr.c */
VOID ASMCFUNC FAR int21_entry(iregs UserRegs);
VOID ASMCFUNC int21_service(iregs far * r);
VOID ASMCFUNC FAR int0_handler(void);
VOID ASMCFUNC FAR int6_handler(void);
VOID ASMCFUNC FAR int19_handler(void);
@ -224,7 +222,11 @@ VOID ASMCFUNC FAR cpm_entry(void);
#define int29_handler DOSTEXT(int29_handler)
/* kernel.asm */
#ifdef __GNUC__
VOID ASMCFUNC init_call_p_0(struct config FAR *Config, ...) asm("init_call_p_0");
#else
VOID ASMCFUNC FAR init_call_p_0(struct config FAR *Config); /* P_0, actually */
#endif
/* main.c */
VOID ASMCFUNC FreeDOSmain(void);

View File

@ -63,7 +63,7 @@ struct HugeSectorBlock {
/* variables needed for the rest of the handler. */
/* this here works on the users stack !! and only very few functions
are allowed */
VOID ASMCFUNC int21_syscall(iregs FAR * irp)
VOID ASMCFUNC int21_syscall(iregs FAR * irp, ...)
{
Int21AX = irp->AX;
@ -376,7 +376,7 @@ int int21_fat32(lregs *r)
}
#endif
VOID ASMCFUNC int21_service(iregs FAR * r)
VOID ASMCFUNC int21_service(iregs FAR * r, ...)
{
COUNT rc;
long lrc;
@ -1625,7 +1625,7 @@ struct int25regs {
/*
this function is called from an assembler wrapper function
*/
VOID ASMCFUNC int2526_handler(WORD mode, struct int25regs FAR * r)
VOID ASMCFUNC int2526_handler(WORD mode, struct int25regs FAR * r, ...)
{
ULONG blkno;
UWORD nblks;
@ -1734,7 +1734,7 @@ struct int2f12regs {
/* WARNING: modifications in `r' are used outside of int2F_12_handler()
* On input r.AX==0x12xx, 0x4A01 or 0x4A02
*/
VOID ASMCFUNC int2F_12_handler(struct int2f12regs r)
VOID ASMCFUNC int2F_12_handler(struct int2f12regs r, ...)
{
COUNT rc;
long lrc;

View File

@ -276,6 +276,29 @@ cpu_abort:
%endif ; XCPU != 86
%ifdef gcc
global init_call_p_0
init_call_p_0:
pop ax
push cs
push ax
jmp DGROUP:_init_call_p_0
global __EnableA20
__EnableA20:
pop ax
push cs
push ax
jmp DGROUP:_ENABLEA20
global __DisableA20
__DisableA20:
pop ax
push cs
push ax
jmp DGROUP:_DISABLEA20
%endif
segment INIT_TEXT_END
@ -915,6 +938,18 @@ global %1lshrsi3
; reserve space for far jump to cp/m routine
times 5 db 0
%ifdef gcc
blk_driver_wrap:mov ax, _blk_driver
jmp short blkclk
clk_driver_wrap:mov ax, _clk_driver
blkclk: pop si
pop di
call ax
push di
push si
retf
%endif
;End of HMA segment
segment HMA_TEXT_END
global __HMATextEnd
@ -1007,13 +1042,21 @@ _cpm_entry: jmp 0:reloc_call_cpm_entry
global _reloc_call_blk_driver
extern _blk_driver
_reloc_call_blk_driver:
%ifdef gcc
jmp 0:blk_driver_wrap
%else
jmp 0:_blk_driver
%endif
call near forceEnableA20
global _reloc_call_clk_driver
extern _clk_driver
_reloc_call_clk_driver:
%ifdef gcc
jmp 0:clk_driver_wrap
%else
jmp 0:_clk_driver
%endif
call near forceEnableA20
global _CharMapSrvc ; in _DATA (see AARD)

View File

@ -158,8 +158,6 @@ SECTIONS
_set_DTA = SET_DTA;
_DetectXMSDriver = DETECTXMSDRIVER;
_init_call_XMScall = INIT_CALL_XMSCALL;
__EnableA20 = _ENABLEA20;
__DisableA20 = _DISABLEA20;
*(.text)
*(INIT_TEXT_END)
ASSERT(. <= 0x10000,

View File

@ -509,7 +509,7 @@ VOID DosUpMem(VOID FAR * str, unsigned len)
* the HiByte of the first argument must remain unchanged.
* See NLSSUPT.ASM -- 2000/03/30 ska
*/
unsigned char ASMCFUNC DosUpChar(unsigned char ch)
unsigned char ASMCFUNC DosUpChar(unsigned char ch, ...)
/* upcase a single character */
{
log(("NLS: DosUpChar(): in ch=%u (%c)\n", ch, ch > 32 ? ch : ' '));
@ -667,7 +667,7 @@ VOID FAR *DosGetDBCS(void)
Return value: AL register to be returned
if AL == 0, Carry must be cleared, otherwise set
*/
UWORD ASMCFUNC syscall_MUX14(DIRECT_IREGS)
UWORD ASMCFUNC syscall_MUX14(DIRECT_IREGS, ...)
{
struct nlsPackage FAR *nls; /* addressed NLS package */

View File

@ -260,7 +260,7 @@ BYTE DosYesNo(UWORD ch);
#ifndef DosUpMem
VOID DosUpMem(VOID FAR * str, unsigned len);
#endif
unsigned char ASMCFUNC DosUpChar(unsigned char ch);
unsigned char ASMCFUNC DosUpChar(unsigned char ch, ...);
VOID DosUpString(char FAR * str);
VOID DosUpFMem(VOID FAR * str, unsigned len);
unsigned char DosUpFChar(unsigned char ch);
@ -276,7 +276,7 @@ COUNT DosSetCountry(UWORD cntry);
COUNT DosGetCodepage(UWORD * actCP, UWORD * sysCP);
COUNT DosSetCodepage(UWORD actCP, UWORD sysCP);
VOID FAR *DosGetDBCS(void);
UWORD ASMCFUNC syscall_MUX14(DIRECT_IREGS);
UWORD ASMCFUNC syscall_MUX14(DIRECT_IREGS, ...);
/* prf.c */
#ifdef DEBUG
@ -383,7 +383,7 @@ UWORD get_machine_name(BYTE FAR * netname);
VOID set_machine_name(BYTE FAR * netname, UWORD name_num);
/* procsupt.asm */
VOID ASMCFUNC exec_user(iregs FAR * irp, int disable_a20);
VOID ASMCFUNC exec_user(iregs FAR * irp, int disable_a20, ...);
/* new by TE */

View File

@ -58,7 +58,7 @@ STATIC void DayToBcd(BYTE * x, unsigned mon, unsigned day, unsigned yr)
x[2] = ByteToBcd(yr % 100);
}
WORD ASMCFUNC FAR clk_driver(rqptr rp)
WORD ASMCFUNC FAR clk_driver(rqptr rp, ...)
{
BYTE bcd_days[4], bcd_minutes, bcd_hours, bcd_seconds;

View File

@ -800,7 +800,7 @@ COUNT DosExec(COUNT mode, exec_blk FAR * ep, BYTE FAR * lp)
#include "config.h" /* config structure definition */
/* start process 0 (the shell) */
VOID ASMCFUNC P_0(struct config FAR *Config)
VOID ASMCFUNC P_0(struct config FAR *Config, ...)
{
BYTE *tailp, *endp;
exec_blk exb;