From 61d9c4724161c2a0c13b5195b4f38e3baa4e3b88 Mon Sep 17 00:00:00 2001 From: Stas Sergeev Date: Wed, 6 Mar 2024 16:34:39 +0300 Subject: [PATCH] avoid thunk_gen --- build/fdpp/plt_asmc.h | 10 ++ build/fdpp/plt_asmp.h | 38 ++++++ build/fdpp/thunk_asms.h | 242 +++++++++++++++++++++++++++++++++++++ build/fdpp/thunk_asms.tmp | 48 ++++++++ build/fdpp/thunk_calls.h | 42 +++++++ build/fdpp/thunk_calls.tmp | 14 +++ fdpp/makefile | 4 +- 7 files changed, 396 insertions(+), 2 deletions(-) create mode 100644 build/fdpp/plt_asmc.h create mode 100644 build/fdpp/plt_asmp.h create mode 100644 build/fdpp/thunk_asms.h create mode 100644 build/fdpp/thunk_asms.tmp create mode 100644 build/fdpp/thunk_calls.h create mode 100644 build/fdpp/thunk_calls.tmp diff --git a/build/fdpp/plt_asmc.h b/build/fdpp/plt_asmc.h new file mode 100644 index 00000000..51e6df81 --- /dev/null +++ b/build/fdpp/plt_asmc.h @@ -0,0 +1,10 @@ +ASMCSYM(DosIdle_int, 0) +ASMCSYM(DosIdle_hlt, 1) +ASMCSYM(exec_user, 3) +ASMCSYM(ret_user, 4) +ASMCSYM(share_criterr, 16) +ASMCSYM(CriticalError, 21) +ASMCSYM(CharMapSrvc, 22) +ASMCSYM(init_stacks, 45) +ASMCSYM(spawn_int23, 46) +ASMCSYM(call_p_0, 47) diff --git a/build/fdpp/plt_asmp.h b/build/fdpp/plt_asmp.h new file mode 100644 index 00000000..6e15952f --- /dev/null +++ b/build/fdpp/plt_asmp.h @@ -0,0 +1,38 @@ +ASMPSYM(NETWORK_REDIRECTOR_MX, 2) +ASMPSYM(FL_RESET, 5) +ASMPSYM(FL_DISKCHANGED, 6) +ASMPSYM(FL_FORMAT, 7) +ASMPSYM(FL_READ, 8) +ASMPSYM(FL_WRITE, 9) +ASMPSYM(FL_VERIFY, 10) +ASMPSYM(FL_SETDISKTYPE, 11) +ASMPSYM(FL_SETMEDIATYPE, 12) +ASMPSYM(FL_READKEY, 13) +ASMPSYM(FL_LBA_READWRITE, 14) +ASMPSYM(FLOPPY_CHANGE, 15) +ASMPSYM(CALL_NLS, 17) +ASMPSYM(READPCCLOCK, 18) +ASMPSYM(WRITEATCLOCK, 19) +ASMPSYM(WRITEPCCLOCK, 20) +ASMPSYM(INIT_CALL_INTR, 23) +ASMPSYM(CALL_INTR, 24) +ASMPSYM(CALL_INTR_FUNC, 25) +ASMPSYM(INIT_DOSREAD, 26) +ASMPSYM(INIT_DOSOPEN, 27) +ASMPSYM(INIT_EXISTS, 28) +ASMPSYM(_CLOSE, 29) +ASMPSYM(_DUP2, 30) +ASMPSYM(_LSEEK, 31) +ASMPSYM(ALLOCMEM, 32) +ASMPSYM(KEYCHECK, 33) +ASMPSYM(SET_DTA, 34) +ASMPSYM(EXECRH, 35) +ASMPSYM(_ENABLEA20, 36) +ASMPSYM(_DISABLEA20, 37) +ASMPSYM(DETECTXMSDRIVER, 38) +ASMPSYM(CALL_XMSCALL, 39) +ASMPSYM(INIT_PSPSET, 40) +ASMPSYM(INIT_DOSEXEC, 41) +ASMPSYM(INIT_SETDRIVE, 42) +ASMPSYM(INIT_SWITCHAR, 43) +ASMPSYM(UMB_GET_LARGEST, 44) diff --git a/build/fdpp/thunk_asms.h b/build/fdpp/thunk_asms.h new file mode 100644 index 00000000..dfdadd28 --- /dev/null +++ b/build/fdpp/thunk_asms.h @@ -0,0 +1,242 @@ +#define _THUNK_P_0(n, r, s, f, z) \ +r f(void) \ +{ \ + const uint32_t _flags = z; \ + uint32_t _ret; \ + _ret = __CALL(n, NULL, 0, _flags); \ + return s(r, _ret); \ +} +#define _THUNK0_v(n, f, z) \ +void f(void) \ +{ \ + const uint32_t _flags = z; \ + __CALL(n, NULL, 0, _flags); \ +} +#define _THUNK_P_0_v(n, f, z) \ +void f(void) \ +{ \ + const uint32_t _flags = z; \ + __CALL(n, NULL, 0, _flags); \ +} +#define _THUNK_P_1(n, r, s, f, t1, q1, at1, aat1, c1, l1, z) \ +r f(t1 a1 q1) \ +{ \ + const uint32_t _flags = z; \ + uint32_t _ret; \ + _CNV(c1, t1, at1, l1, 1); \ + struct { \ + aat1 a1; \ + } PACKED _args = { _a1 }; \ + _ret = __CALL(n, (UBYTE *)&_args, sizeof(_args), _flags); \ + _UCNV(c1, l1, 1); \ + return s(r, _ret); \ +} +#define _THUNK1_v(n, f, t1, q1, at1, aat1, c1, l1, z) \ +void f(t1 a1 q1) \ +{ \ + const uint32_t _flags = z; \ + _CNV(c1, t1, at1, l1, 1); \ + struct { \ + aat1 a1; \ + } PACKED _args = { _a1 }; \ + __CALL(n, (UBYTE *)&_args, sizeof(_args), _flags); \ + _UCNV(c1, l1, 1); \ + __CSTK(sizeof(_args)); \ +} +#define _THUNK_P_1_v(n, f, t1, q1, at1, aat1, c1, l1, z) \ +void f(t1 a1 q1) \ +{ \ + const uint32_t _flags = z; \ + _CNV(c1, t1, at1, l1, 1); \ + struct { \ + aat1 a1; \ + } PACKED _args = { _a1 }; \ + __CALL(n, (UBYTE *)&_args, sizeof(_args), _flags); \ + _UCNV(c1, l1, 1); \ +} +#define _THUNK_P_2(n, r, s, f, t1, q1, at1, aat1, c1, l1, t2, q2, at2, aat2, c2, l2, z) \ +r f(t1 a1 q1, t2 a2 q2) \ +{ \ + const uint32_t _flags = z; \ + uint32_t _ret; \ + _CNV(c1, t1, at1, l1, 1); \ + _CNV(c2, t2, at2, l2, 2); \ + struct { \ + aat2 a2; \ + aat1 a1; \ + } PACKED _args = { _a2, _a1 }; \ + _ret = __CALL(n, (UBYTE *)&_args, sizeof(_args), _flags); \ + _UCNV(c1, l1, 1); \ + _UCNV(c2, l2, 2); \ + return s(r, _ret); \ +} +#define _THUNK_P_2_v(n, f, t1, q1, at1, aat1, c1, l1, t2, q2, at2, aat2, c2, l2, z) \ +void f(t1 a1 q1, t2 a2 q2) \ +{ \ + const uint32_t _flags = z; \ + _CNV(c1, t1, at1, l1, 1); \ + _CNV(c2, t2, at2, l2, 2); \ + struct { \ + aat2 a2; \ + aat1 a1; \ + } PACKED _args = { _a2, _a1 }; \ + __CALL(n, (UBYTE *)&_args, sizeof(_args), _flags); \ + _UCNV(c1, l1, 1); \ + _UCNV(c2, l2, 2); \ +} +#define _THUNK_P_3(n, r, s, f, t1, q1, at1, aat1, c1, l1, t2, q2, at2, aat2, c2, l2, t3, q3, at3, aat3, c3, l3, z) \ +r f(t1 a1 q1, t2 a2 q2, t3 a3 q3) \ +{ \ + const uint32_t _flags = z; \ + uint32_t _ret; \ + _CNV(c1, t1, at1, l1, 1); \ + _CNV(c2, t2, at2, l2, 2); \ + _CNV(c3, t3, at3, l3, 3); \ + struct { \ + aat3 a3; \ + aat2 a2; \ + aat1 a1; \ + } PACKED _args = { _a3, _a2, _a1 }; \ + _ret = __CALL(n, (UBYTE *)&_args, sizeof(_args), _flags); \ + _UCNV(c1, l1, 1); \ + _UCNV(c2, l2, 2); \ + _UCNV(c3, l3, 3); \ + return s(r, _ret); \ +} +#define _THUNK3_v(n, f, t1, q1, at1, aat1, c1, l1, t2, q2, at2, aat2, c2, l2, t3, q3, at3, aat3, c3, l3, z) \ +void f(t1 a1 q1, t2 a2 q2, t3 a3 q3) \ +{ \ + const uint32_t _flags = z; \ + _CNV(c1, t1, at1, l1, 1); \ + _CNV(c2, t2, at2, l2, 2); \ + _CNV(c3, t3, at3, l3, 3); \ + struct { \ + aat1 a1; \ + aat2 a2; \ + aat3 a3; \ + } PACKED _args = { _a1, _a2, _a3 }; \ + __CALL(n, (UBYTE *)&_args, sizeof(_args), _flags); \ + _UCNV(c1, l1, 1); \ + _UCNV(c2, l2, 2); \ + _UCNV(c3, l3, 3); \ + __CSTK(sizeof(_args)); \ +} +#define _THUNK4(n, r, s, f, t1, q1, at1, aat1, c1, l1, t2, q2, at2, aat2, c2, l2, t3, q3, at3, aat3, c3, l3, t4, q4, at4, aat4, c4, l4, z) \ +r f(t1 a1 q1, t2 a2 q2, t3 a3 q3, t4 a4 q4) \ +{ \ + const uint32_t _flags = z; \ + uint32_t _ret; \ + _CNV(c1, t1, at1, l1, 1); \ + _CNV(c2, t2, at2, l2, 2); \ + _CNV(c3, t3, at3, l3, 3); \ + _CNV(c4, t4, at4, l4, 4); \ + struct { \ + aat1 a1; \ + aat2 a2; \ + aat3 a3; \ + aat4 a4; \ + } PACKED _args = { _a1, _a2, _a3, _a4 }; \ + _ret = __CALL(n, (UBYTE *)&_args, sizeof(_args), _flags); \ + _UCNV(c1, l1, 1); \ + _UCNV(c2, l2, 2); \ + _UCNV(c3, l3, 3); \ + _UCNV(c4, l4, 4); \ + __CSTK(sizeof(_args)); \ + return s(r, _ret); \ +} +#define _THUNK_P_4_v(n, f, t1, q1, at1, aat1, c1, l1, t2, q2, at2, aat2, c2, l2, t3, q3, at3, aat3, c3, l3, t4, q4, at4, aat4, c4, l4, z) \ +void f(t1 a1 q1, t2 a2 q2, t3 a3 q3, t4 a4 q4) \ +{ \ + const uint32_t _flags = z; \ + _CNV(c1, t1, at1, l1, 1); \ + _CNV(c2, t2, at2, l2, 2); \ + _CNV(c3, t3, at3, l3, 3); \ + _CNV(c4, t4, at4, l4, 4); \ + struct { \ + aat4 a4; \ + aat3 a3; \ + aat2 a2; \ + aat1 a1; \ + } PACKED _args = { _a4, _a3, _a2, _a1 }; \ + __CALL(n, (UBYTE *)&_args, sizeof(_args), _flags); \ + _UCNV(c1, l1, 1); \ + _UCNV(c2, l2, 2); \ + _UCNV(c3, l3, 3); \ + _UCNV(c4, l4, 4); \ +} +#define _THUNK_P_6(n, r, s, f, t1, q1, at1, aat1, c1, l1, t2, q2, at2, aat2, c2, l2, t3, q3, at3, aat3, c3, l3, t4, q4, at4, aat4, c4, l4, t5, q5, at5, aat5, c5, l5, t6, q6, at6, aat6, c6, l6, z) \ +r f(t1 a1 q1, t2 a2 q2, t3 a3 q3, t4 a4 q4, t5 a5 q5, t6 a6 q6) \ +{ \ + const uint32_t _flags = z; \ + uint32_t _ret; \ + _CNV(c1, t1, at1, l1, 1); \ + _CNV(c2, t2, at2, l2, 2); \ + _CNV(c3, t3, at3, l3, 3); \ + _CNV(c4, t4, at4, l4, 4); \ + _CNV(c5, t5, at5, l5, 5); \ + _CNV(c6, t6, at6, l6, 6); \ + struct { \ + aat6 a6; \ + aat5 a5; \ + aat4 a4; \ + aat3 a3; \ + aat2 a2; \ + aat1 a1; \ + } PACKED _args = { _a6, _a5, _a4, _a3, _a2, _a1 }; \ + _ret = __CALL(n, (UBYTE *)&_args, sizeof(_args), _flags); \ + _UCNV(c1, l1, 1); \ + _UCNV(c2, l2, 2); \ + _UCNV(c3, l3, 3); \ + _UCNV(c4, l4, 4); \ + _UCNV(c5, l5, 5); \ + _UCNV(c6, l6, 6); \ + return s(r, _ret); \ +} +_THUNK0_v(0, DosIdle_int, _TFLG_NONE) +_THUNK0_v(1, DosIdle_hlt, _TFLG_NONE) +_THUNK_P_3(2, __ARG(DWORD), __RET, network_redirector_mx, __ARG(UWORD), , __ARG_A(UWORD), __ARG_A(UWORD), __CNV_SIMPLE, _L_NONE, __ARG_PTR_FAR(VOID), , __ARG_PTR_FAR_A(VOID), __ARG_PTR_FAR_A(VOID), __CNV_PTR_FAR, _L_NONE, __ARG(UWORD), , __ARG_A(UWORD), __ARG_A(UWORD), __CNV_SIMPLE, _L_NONE, _TFLG_NONE) +_THUNK1_v(3, exec_user, __ARG_PTR_FAR(const exec_regs), , __ARG_PTR_FAR_A(const exec_regs), __ARG_PTR_FAR_A(const exec_regs), __CNV_PTR_FAR, _L_NONE, _TFLG_NORET) +_THUNK1_v(4, ret_user, __ARG_PTR_FAR(const iregs), , __ARG_PTR_FAR_A(const iregs), __ARG_PTR_FAR_A(const iregs), __CNV_PTR_FAR, _L_NONE, _TFLG_NORET) +_THUNK_P_1(5, __ARG(WORD), __RET, fl_reset, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, _TFLG_NONE) +_THUNK_P_1(6, __ARG(WORD), __RET, fl_diskchanged, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, _TFLG_NONE) +_THUNK_P_6(7, __ARG(WORD), __RET, fl_format, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG_PTR_FAR(UBYTE), , __ARG_PTR_FAR_A(UBYTE), __ARG_PTR_FAR_A(UBYTE), __CNV_PTR_FAR, _L_NONE, _TFLG_NONE) +_THUNK_P_6(8, __ARG(WORD), __RET, fl_read, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG_PTR_FAR(UBYTE), , __ARG_PTR_FAR_A(UBYTE), __ARG_PTR_FAR_A(UBYTE), __CNV_PTR_FAR, _L_NONE, _TFLG_NONE) +_THUNK_P_6(9, __ARG(WORD), __RET, fl_write, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG_PTR_FAR(UBYTE), , __ARG_PTR_FAR_A(UBYTE), __ARG_PTR_FAR_A(UBYTE), __CNV_PTR_FAR, _L_NONE, _TFLG_NONE) +_THUNK_P_6(10, __ARG(WORD), __RET, fl_verify, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG_PTR_FAR(UBYTE), , __ARG_PTR_FAR_A(UBYTE), __ARG_PTR_FAR_A(UBYTE), __CNV_PTR_FAR, _L_NONE, _TFLG_NONE) +_THUNK_P_2(11, __ARG(WORD), __RET, fl_setdisktype, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, _TFLG_NONE) +_THUNK_P_3(12, __ARG(WORD), __RET, fl_setmediatype, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, _TFLG_NONE) +_THUNK_P_0_v(13, fl_readkey, _TFLG_NONE) +_THUNK_P_3(14, __ARG(WORD), __RET, fl_lba_ReadWrite, __ARG(BYTE), , __ARG_A(BYTE), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG_PTR_FAR(struct _bios_LBA_address_packet), , __ARG_PTR_FAR_A(struct _bios_LBA_address_packet), __ARG_PTR_FAR_A(struct _bios_LBA_address_packet), __CNV_PTR_FAR, _L_NONE, _TFLG_NONE) +_THUNK_P_1(15, __ARG(UWORD), __RET, floppy_change, __ARG(UWORD), , __ARG_A(UWORD), __ARG_A(UWORD), __CNV_SIMPLE, _L_NONE, _TFLG_NONE) +_THUNK4(16, __ARG(WORD), __RET, share_criterr, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG_PTR_FAR(struct dhdr), , __ARG_PTR_FAR_A(struct dhdr), __ARG_PTR_FAR_A(struct dhdr), __CNV_PTR_FAR, _L_NONE, __ARG(UWORD), , __ARG_A(UWORD), __ARG_A(UWORD), __CNV_SIMPLE, _L_NONE, _TFLG_NONE) +_THUNK_P_6(17, __ARG(DWORD), __RET, call_nls, __ARG(UWORD), , __ARG_A(UWORD), __ARG_A(UWORD), __CNV_SIMPLE, _L_NONE, __ARG_PTR_FAR(VOID), , __ARG_PTR_FAR_A(VOID), __ARG_PTR_FAR_A(VOID), __CNV_PTR_FAR, _L_NONE, __ARG(UWORD), , __ARG_A(UWORD), __ARG_A(UWORD), __CNV_SIMPLE, _L_NONE, __ARG(UWORD), , __ARG_A(UWORD), __ARG_A(UWORD), __CNV_SIMPLE, _L_NONE, __ARG(UWORD), , __ARG_A(UWORD), __ARG_A(UWORD), __CNV_SIMPLE, _L_NONE, __ARG(UWORD), , __ARG_A(UWORD), __ARG_A(UWORD), __CNV_SIMPLE, _L_NONE, _TFLG_NONE) +_THUNK_P_0(18, __ARG(UDWORD), __RET, ReadPCClock, _TFLG_NONE) +_THUNK_P_4_v(19, WriteATClock, __ARG_PTR_FAR(BYTE), , __ARG_PTR_FAR_A(BYTE), __ARG_PTR_FAR_A(BYTE), __CNV_PTR_FAR, _L_NONE, __ARG(BYTE), , __ARG_A(BYTE), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG(BYTE), , __ARG_A(BYTE), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG(BYTE), , __ARG_A(BYTE), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, _TFLG_NONE) +_THUNK_P_1_v(20, WritePCClock, __ARG(UDWORD), , __ARG_A(UDWORD), __ARG_A(UDWORD), __CNV_SIMPLE, _L_NONE, _TFLG_NONE) +_THUNK4(21, __ARG(WORD), __RET, CriticalError, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG_PTR_FAR(struct dhdr), , __ARG_PTR_FAR_A(struct dhdr), __ARG_PTR_FAR_A(struct dhdr), __CNV_PTR_FAR, _L_NONE, _TFLG_NONE) +_THUNK0_v(22, CharMapSrvc, _TFLG_FAR) +_THUNK_P_2(23, __ARG(UWORD), __RET, init_call_intr, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG_PTR(iregs), , __ARG_PTR_A(iregs), __ARG_PTR_A(iregs), __CNV_PTR, _L_SZ(2), _TFLG_INIT) +_THUNK_P_2(24, __ARG(UWORD), __RET, call_intr, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG_PTR_FAR(iregs), , __ARG_PTR_FAR_A(iregs), __ARG_PTR_FAR_A(iregs), __CNV_PTR_FAR, _L_NONE, _TFLG_NONE) +_THUNK_P_2_v(25, call_intr_func, __ARG_PTR_FAR(VOID), , __ARG_PTR_FAR_A(VOID), __ARG_PTR_FAR_A(VOID), __CNV_PTR_FAR, _L_NONE, __ARG_PTR_FAR(iregs), , __ARG_PTR_FAR_A(iregs), __ARG_PTR_FAR_A(iregs), __CNV_PTR_FAR, _L_NONE, _TFLG_NONE) +_THUNK_P_3(26, __ARG(DWORD), __RET, init_DosRead, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG_PTR(VOID), , __ARG_PTR_A(VOID), __ARG_PTR_A(VOID), __CNV_PTR_VOID, _L_REF(3, 1), __ARG(UWORD), , __ARG_A(UWORD), __ARG_A(UWORD), __CNV_SIMPLE, _L_NONE, _TFLG_INIT) +_THUNK_P_2(27, __ARG(WORD), __RET, init_DosOpen, __ARG_PTR(const char), , __ARG_PTR_A(const char), __ARG_PTR_A(const char), __CNV_PTR_CCHAR, _L_NONE, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, _TFLG_INIT) +_THUNK_P_1(28, __ARG(WORD), __RET, init_exists, __ARG_PTR(const char), , __ARG_PTR_A(const char), __ARG_PTR_A(const char), __CNV_PTR_CCHAR, _L_NONE, _TFLG_INIT) +_THUNK_P_1(29, __ARG(WORD), __RET, _close, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, _TFLG_INIT) +_THUNK_P_2(30, __ARG(WORD), __RET, _dup2, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, _TFLG_INIT) +_THUNK_P_2(31, __ARG(UDWORD), __RET, _lseek, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG(DWORD), , __ARG_A(DWORD), __ARG_A(DWORD), __CNV_SIMPLE, _L_NONE, _TFLG_INIT) +_THUNK_P_1(32, __ARG(UWORD), __RET, allocmem, __ARG(UWORD), , __ARG_A(UWORD), __ARG_A(UWORD), __CNV_SIMPLE, _L_NONE, _TFLG_INIT) +_THUNK_P_0_v(33, keycheck, _TFLG_INIT) +_THUNK_P_1_v(34, set_DTA, __ARG_PTR_FAR(VOID), , __ARG_PTR_FAR_A(VOID), __ARG_PTR_FAR_A(VOID), __CNV_PTR_FAR, _L_NONE, _TFLG_INIT) +_THUNK_P_2(35, __ARG(WORD), __RET, execrh, __ARG_PTR_FAR(request), , __ARG_PTR_FAR_A(request), __ARG_PTR_FAR_A(request), __CNV_PTR_FAR, _L_NONE, __ARG_PTR_FAR(struct dhdr), , __ARG_PTR_FAR_A(struct dhdr), __ARG_PTR_FAR_A(struct dhdr), __CNV_PTR_FAR, _L_NONE, _TFLG_NONE) +_THUNK_P_0_v(36, _EnableA20, _TFLG_FAR) +_THUNK_P_0_v(37, _DisableA20, _TFLG_FAR) +_THUNK_P_0(38, __ARG_PTR_FAR(void), __RET_PTR_FAR, DetectXMSDriver, _TFLG_FAR) +_THUNK_P_3(39, __ARG(WORD), __RET, call_XMScall, __ARG_PTR_FAR(VOID), , __ARG_PTR_FAR_A(VOID), __ARG_PTR_FAR_A(VOID), __CNV_PTR_FAR, _L_NONE, __ARG(UWORD), , __ARG_A(UWORD), __ARG_A(UWORD), __CNV_SIMPLE, _L_NONE, __ARG(UWORD), , __ARG_A(UWORD), __ARG_A(UWORD), __CNV_SIMPLE, _L_NONE, _TFLG_FAR) +_THUNK_P_1_v(40, init_PSPSet, __ARG(UWORD), , __ARG_A(UWORD), __ARG_A(UWORD), __CNV_SIMPLE, _L_NONE, _TFLG_INIT) +_THUNK_P_3(41, __ARG(WORD), __RET, init_DosExec, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG_PTR(exec_blk), , __ARG_PTR_A(exec_blk), __ARG_PTR_A(exec_blk), __CNV_PTR, _L_SZ(2), __ARG_PTR(const char), , __ARG_PTR_A(const char), __ARG_PTR_A(const char), __CNV_PTR_CCHAR, _L_NONE, _TFLG_INIT) +_THUNK_P_1(42, __ARG(WORD), __RET, init_setdrive, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, _TFLG_INIT) +_THUNK_P_1(43, __ARG(WORD), __RET, init_switchar, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, _TFLG_INIT) +_THUNK_P_3(44, __ARG(WORD), __RET, UMB_get_largest, __ARG_PTR_FAR(VOID), , __ARG_PTR_FAR_A(VOID), __ARG_PTR_FAR_A(VOID), __CNV_PTR_FAR, _L_NONE, __ARG_PTR(UDWORD), , __ARG_PTR_A(UDWORD), __ARG_PTR_A(UDWORD), __CNV_PTR, _L_SZ(2), __ARG_PTR(UWORD), , __ARG_PTR_A(UWORD), __ARG_PTR_A(UWORD), __CNV_PTR, _L_SZ(3), _TFLG_INIT) +_THUNK3_v(45, init_stacks, __ARG_PTR_FAR(VOID), , __ARG_PTR_FAR_A(VOID), __ARG_PTR_FAR_A(VOID), __CNV_PTR_FAR, _L_NONE, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, __ARG(WORD), , __ARG_A(WORD), __ARG_A(WORD), __CNV_SIMPLE, _L_NONE, _TFLG_INIT) +_THUNK0_v(46, spawn_int23, _TFLG_NORET) +_THUNK1_v(47, call_p_0, __ARG_PTR_FAR(const struct config), , __ARG_PTR_FAR_A(const struct config), __ARG_PTR_FAR_A(const struct config), __CNV_PTR_FAR, _L_NONE, _TFLG_FAR | _TFLG_NORET) diff --git a/build/fdpp/thunk_asms.tmp b/build/fdpp/thunk_asms.tmp new file mode 100644 index 00000000..cfa582d2 --- /dev/null +++ b/build/fdpp/thunk_asms.tmp @@ -0,0 +1,48 @@ +0 VOID ASMFUNC DosIdle_int(void); +1 VOID ASMFUNC DosIdle_hlt(void); +2 DWORD ASMPASCAL network_redirector_mx(UWORD cmd, void FAR *s, UWORD arg); +3 VOID ASMFUNC NORETURN exec_user(const exec_regs FAR * erp); +4 VOID ASMFUNC NORETURN ret_user(const iregs FAR * irp); +5 BOOL ASMPASCAL fl_reset(WORD); +6 COUNT ASMPASCAL fl_diskchanged(WORD); +7 COUNT ASMPASCAL fl_format(WORD, WORD, WORD, WORD, WORD,UBYTE FAR *); +8 COUNT ASMPASCAL fl_read(WORD, WORD, WORD, WORD, WORD,UBYTE FAR *); +9 COUNT ASMPASCAL fl_write(WORD, WORD, WORD, WORD, WORD,UBYTE FAR *); +10 COUNT ASMPASCAL fl_verify(WORD, WORD, WORD, WORD, WORD,UBYTE FAR *); +11 COUNT ASMPASCAL fl_setdisktype(WORD, WORD); +12 COUNT ASMPASCAL fl_setmediatype(WORD, WORD, WORD); +13 VOID ASMPASCAL fl_readkey(VOID); +14 COUNT ASMPASCAL fl_lba_ReadWrite(BYTE drive, WORD mode,struct _bios_LBA_address_packet FAR * dap_p); +15 UWORD ASMPASCAL floppy_change(UWORD); +16 WORD ASMFUNC share_criterr(WORD flags, WORD err, struct dhdr FAR * lpDevice, UWORD ax); +17 DWORD ASMPASCAL call_nls(UWORD,VOID FAR *, UWORD, UWORD, UWORD, UWORD); +18 ULONG ASMPASCAL ReadPCClock(VOID); +19 VOID ASMPASCAL WriteATClock(BYTE FAR *, BYTE, BYTE, BYTE); +20 VOID ASMPASCAL WritePCClock(ULONG); +21 COUNT ASMFUNC CriticalError(COUNT nFlag, COUNT nDrive, COUNT nError,struct dhdr FAR * lpDevice); +22 VOID ASMFUNC FAR CharMapSrvc(VOID); +23 UWORD ASMPASCAL INITTEXT init_call_intr(WORD nr, iregs * rp); +24 UWORD ASMPASCAL call_intr(WORD nr, iregs FAR * rp); +25 VOID ASMPASCAL call_intr_func(VOID FAR * ptr, iregs FAR * rp); +26 DWORD ASMPASCAL INITTEXT init_DosRead(WORD fd, void _V_FW(1) *buf, UWORD count); +27 WORD ASMPASCAL INITTEXT init_DosOpen(const char *pathname, WORD flags); +28 WORD ASMPASCAL INITTEXT init_exists(const char *pathname); +29 WORD ASMPASCAL INITTEXT _close(WORD fd); +30 WORD ASMPASCAL INITTEXT _dup2(WORD oldfd, WORD newfd); +31 ULONG ASMPASCAL INITTEXT _lseek(WORD fd, DWORD position); +32 UWORD ASMPASCAL INITTEXT allocmem(UWORD size); +33 void ASMPASCAL INITTEXT keycheck(void); +34 void ASMPASCAL INITTEXT set_DTA(void FAR *_dta); +35 WORD ASMPASCAL execrh(request FAR *, struct dhdr FAR *); +36 VOID ASMPASCAL FAR _EnableA20(VOID); +37 VOID ASMPASCAL FAR _DisableA20(VOID); +38 void FAR * ASMPASCAL FAR DetectXMSDriver(VOID); +39 WORD ASMPASCAL FAR call_XMScall(void FAR * driverAddress, UWORD ax, UWORD dx); +40 void ASMPASCAL INITTEXT init_PSPSet(UWORD psp_seg); +41 WORD ASMPASCAL INITTEXT init_DosExec(WORD mode, exec_blk * ep, const char * lp); +42 WORD ASMPASCAL INITTEXT init_setdrive(WORD drive); +43 WORD ASMPASCAL INITTEXT init_switchar(WORD chr); +44 COUNT ASMPASCAL INITTEXT UMB_get_largest(void FAR * driverAddress, UDWORD * __seg, UCOUNT * size); +45 VOID ASMFUNC INITTEXT init_stacks(VOID FAR * stack_base, COUNT nStacks, WORD stackSize); +46 void ASMFUNC NORETURN spawn_int23(void); +47 VOID ASMFUNC FAR NORETURN call_p_0(const struct config FAR *Config); diff --git a/build/fdpp/thunk_calls.h b/build/fdpp/thunk_calls.h new file mode 100644 index 00000000..e7104799 --- /dev/null +++ b/build/fdpp/thunk_calls.h @@ -0,0 +1,42 @@ + case 0: + _DISPATCH(1, _ARG_R(UBYTE), _RET, DosUpChar, _ARG(0, UBYTE, _SP)); + break; + case 1: + _DISPATCH(2, _ARG_R(UWORD), _RET, syscall_MUX14, _ARG_PTR_FAR(0, iregs, _SP)); + break; + case 2: + _DISPATCH(2, _ARG_R(WORD), _RET, clk_driver, _ARG_PTR_FAR(0, request, _SP)); + break; + case 3: + _DISPATCH(2, _ARG_R(WORD), _RET, blk_driver, _ARG_PTR_FAR(0, request, _SP)); + break; + case 4: + _DISPATCH_v(FreeDOSmain); + break; + case 5: + _DISPATCH_v(int21_syscall, _ARG_PTR_FAR(0, iregs, _SP)); + break; + case 6: + _DISPATCH_v(int21_service, _ARG_PTR_FAR(0, iregs, _SP)); + break; + case 7: + _DISPATCH_v(int2526_handler, _ARG(0, WORD, _SP), _ARG_PTR_FAR(2, struct int25regs, _SP)); + break; + case 8: + _DISPATCH_v(P_0, _ARG_PTR_FAR(0, const struct config, _SP)); + break; + case 9: + _DISPATCH_v(P_0_exit); + break; + case 10: + _DISPATCH_v(P_0_bad); + break; + case 11: + _DISPATCH_v(int2F_12_handler, _ARG_PTR_FAR(0, struct int2f12regs, _SP)); + break; + case 12: + _DISPATCH_v(int2F_08_handler, _ARG_PTR_FAR(0, iregs, _SP)); + break; + case 13: + _DISPATCH_v(int2F_10_handler, _ARG_PTR_FAR(0, iregs, _SP)); + break; diff --git a/build/fdpp/thunk_calls.tmp b/build/fdpp/thunk_calls.tmp new file mode 100644 index 00000000..84d2c4e5 --- /dev/null +++ b/build/fdpp/thunk_calls.tmp @@ -0,0 +1,14 @@ +0 unsigned char ASMCFUNC SEGM(HMA_TEXT) DosUpChar(unsigned char ch); +1 UWORD ASMCFUNC SEGM(HMA_TEXT) syscall_MUX14(iregs FAR * regs); +2 WORD ASMCFUNC SEGM(HMA_TEXT) FAR clk_driver(request FAR * rp); +3 COUNT ASMCFUNC SEGM(HMA_TEXT) FAR blk_driver(request FAR * rp); +4 VOID ASMCFUNC SEGM(INIT_TEXT) FreeDOSmain(void); +5 VOID ASMCFUNC SEGM(HMA_TEXT) int21_syscall(iregs FAR * irp); +6 VOID ASMCFUNC SEGM(HMA_TEXT) int21_service(iregs FAR * r); +7 VOID ASMCFUNC SEGM(HMA_TEXT) int2526_handler(WORD mode,struct int25regs FAR * r); +8 VOID ASMCFUNC SEGM(HMA_TEXT) P_0(const struct config FAR *Config); +9 VOID ASMCFUNC SEGM(HMA_TEXT) P_0_exit(void); +10 VOID ASMCFUNC SEGM(HMA_TEXT) P_0_bad(void); +11 VOID ASMCFUNC SEGM(HMA_TEXT) int2F_12_handler(struct int2f12regs FAR * r); +12 VOID ASMCFUNC SEGM(HMA_TEXT) int2F_08_handler(iregs FAR * regs); +13 VOID ASMCFUNC SEGM(HMA_TEXT) int2F_10_handler(iregs FAR * regs); diff --git a/fdpp/makefile b/fdpp/makefile index ef901b0d..5b6592c2 100644 --- a/fdpp/makefile +++ b/fdpp/makefile @@ -35,7 +35,7 @@ GEN_EXT = fdpp.pc TG = $(shell pkg-config --variable=binary thunk_gen) ifeq ($(TG),) ifeq ($(filter clean,$(MAKECMDGOALS)),) -$(error thunk_gen not installed) +$(warning thunk_gen not installed) endif endif TGS = $(shell pkg-config --variable=tgscript thunk_gen) @@ -76,7 +76,7 @@ clean: $(MAKE) -C kernel clean $(MAKE) -C loader clean -$(RM) .tstamp *.map $(TARGET).elf *.inc \ - *.o $(GEN_CC) $(FDPPDEVL) $(FDPPLIB) *.tmp $(GEN_HEADERS) \ + *.o $(GEN_CC) $(FDPPDEVL) $(FDPPLIB) \ $(LDRDEVL) $(LDRLIB) $(GEN_HEADERS_FD) \ *.pc *.so *.elf