mirror of
https://github.com/FDOS/kernel.git
synced 2025-07-23 13:54:30 +02:00
commit
0954613e2a
@ -37,10 +37,11 @@ You can now also cross compile with T.K. Chia's fork of ia16-elf-gcc,
|
|||||||
which is available at https://github.com/tkchia/gcc-ia16, using
|
which is available at https://github.com/tkchia/gcc-ia16, using
|
||||||
make all COMPILER=gcc
|
make all COMPILER=gcc
|
||||||
or by setting COMPILER=gcc in config.mak. If you are using Ubuntu
|
or by setting COMPILER=gcc in config.mak. If you are using Ubuntu
|
||||||
Linux 16.04 LTS (Xenial Xerus), there are precompiled ia16-elf-gcc
|
Linux 16.04 LTS (Xenial Xerus) or Ubuntu Linux 14.04 LTS (Trusty
|
||||||
packages at https://launchpad.net/~tkchia/+archive/ubuntu/build-ia16/.
|
Tahr), there are precompiled ia16-elf-gcc packages at
|
||||||
|
https://launchpad.net/~tkchia/+archive/ubuntu/build-ia16/.
|
||||||
Otherwise, for now ia16-elf-gcc needs to be compiled from source.
|
Otherwise, for now ia16-elf-gcc needs to be compiled from source.
|
||||||
Only releases 20171210 and later are supported.
|
Only releases 20180708 and later are supported.
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
======
|
======
|
||||||
|
@ -337,7 +337,11 @@ typedef signed long LONG;
|
|||||||
#define FP_SEG(fp) ((unsigned)((ULONG)(VOID FAR *)(fp)>>16))
|
#define FP_SEG(fp) ((unsigned)((ULONG)(VOID FAR *)(fp)>>16))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__GNUC__) && defined(__BUILTIN_IA16_FP_OFF)
|
||||||
|
#define FP_OFF(fp) __builtin_ia16_FP_OFF(fp)
|
||||||
|
#else
|
||||||
#define FP_OFF(fp) ((unsigned)(fp))
|
#define FP_OFF(fp) ((unsigned)(fp))
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,9 +28,8 @@ extern __segment DosTextSeg;
|
|||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
|
|
||||||
#define DosTextSeg 0x70
|
#define DosTextSeg 0x70
|
||||||
/* XXX not supported yet */
|
#define DOSFAR FAR
|
||||||
#define DOSFAR
|
#define DOSTEXTFAR FAR
|
||||||
#define DOSTEXTFAR
|
|
||||||
#undef DOSDATA
|
#undef DOSDATA
|
||||||
#undef DOSTEXT
|
#undef DOSTEXT
|
||||||
#define DOSDATA(x) (*(typeof(x) FAR *)MK_FP(DosDataSeg, (size_t)&(x)))
|
#define DOSDATA(x) (*(typeof(x) FAR *)MK_FP(DosDataSeg, (size_t)&(x)))
|
||||||
|
@ -265,38 +265,21 @@ extern char master_env[128];
|
|||||||
extern struct lol FAR *LoL;
|
extern struct lol FAR *LoL;
|
||||||
|
|
||||||
extern struct dhdr DOSTEXTFAR ASM blk_dev; /* Block device (Disk) driver */
|
extern struct dhdr DOSTEXTFAR ASM blk_dev; /* Block device (Disk) driver */
|
||||||
#define blk_dev DOSTEXT(blk_dev)
|
|
||||||
|
|
||||||
extern struct buffer FAR *DOSFAR firstAvailableBuf; /* first 'available' buffer */
|
extern struct buffer FAR *DOSFAR firstAvailableBuf; /* first 'available' buffer */
|
||||||
#define firstAvailableBuf DOSDATA(firstAvailableBuf)
|
|
||||||
#ifdef __GNUC__
|
|
||||||
extern struct lol ASM DATASTART;
|
|
||||||
#else
|
|
||||||
extern struct lol ASM FAR DATASTART;
|
extern struct lol ASM FAR DATASTART;
|
||||||
#endif
|
|
||||||
#define DATASTART DOSDATA(DATASTART)
|
|
||||||
|
|
||||||
extern BYTE DOSFAR ASM _HMATextAvailable; /* first byte of available CODE area */
|
extern BYTE DOSFAR ASM _HMATextAvailable; /* first byte of available CODE area */
|
||||||
#ifdef __GNUC__
|
|
||||||
extern BYTE ASM _HMATextStart[]; /* first byte of HMAable CODE area */
|
|
||||||
extern BYTE ASM _HMATextEnd[];
|
|
||||||
#else
|
|
||||||
extern BYTE FAR ASM _HMATextStart[]; /* first byte of HMAable CODE area */
|
extern BYTE FAR ASM _HMATextStart[]; /* first byte of HMAable CODE area */
|
||||||
extern BYTE FAR ASM _HMATextEnd[];
|
extern BYTE FAR ASM _HMATextEnd[];
|
||||||
#endif
|
|
||||||
extern BYTE DOSFAR ASM break_ena; /* break enabled flag */
|
extern BYTE DOSFAR ASM break_ena; /* break enabled flag */
|
||||||
#define break_ena DOSDATA(break_ena)
|
extern BYTE DOSFAR ASM _InitTextStart[]; /* first available byte of ram */
|
||||||
extern BYTE DOSFAR ASM _InitTextStart[], /* first available byte of ram */
|
extern BYTE DOSFAR ASM _InitTextEnd[];
|
||||||
DOSFAR ASM _InitTextEnd[],
|
extern BYTE DOSFAR ASM ReturnAnyDosVersionExpected;
|
||||||
DOSFAR ASM ReturnAnyDosVersionExpected,
|
extern BYTE DOSFAR ASM HaltCpuWhileIdle;
|
||||||
DOSFAR ASM HaltCpuWhileIdle;
|
|
||||||
#define ReturnAnyDosVersionExpected DOSDATA(ReturnAnyDosVersionExpected)
|
|
||||||
#define HaltCpuWhileIdle DOSDATA(HaltCpuWhileIdle)
|
|
||||||
|
|
||||||
extern BYTE DOSFAR ASM internal_data[];
|
extern BYTE DOSFAR ASM internal_data[];
|
||||||
#define internal_data DOSDATA(internal_data)
|
|
||||||
extern unsigned char DOSTEXTFAR ASM kbdType;
|
extern unsigned char DOSTEXTFAR ASM kbdType;
|
||||||
#define kbdType DOSTEXT(kbdType)
|
|
||||||
|
|
||||||
extern struct {
|
extern struct {
|
||||||
char ThisIsAConstantOne;
|
char ThisIsAConstantOne;
|
||||||
@ -305,29 +288,23 @@ extern struct {
|
|||||||
struct CountrySpecificInfo C;
|
struct CountrySpecificInfo C;
|
||||||
|
|
||||||
} DOSFAR ASM nlsCountryInfoHardcoded;
|
} DOSFAR ASM nlsCountryInfoHardcoded;
|
||||||
#define nlsCountryInfoHardcoded DOSDATA(nlsCountryInfoHardcoded)
|
|
||||||
#define nlsPackageHardcoded DOSDATA(nlsPackageHardcoded)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
data shared between DSK.C and INITDISK.C
|
data shared between DSK.C and INITDISK.C
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern UWORD DOSFAR LBA_WRITE_VERIFY;
|
extern UWORD DOSFAR LBA_WRITE_VERIFY;
|
||||||
#define LBA_WRITE_VERIFY DOSDATA(LBA_WRITE_VERIFY)
|
|
||||||
|
|
||||||
/* original interrupt vectors, at 70:xxxx */
|
/* original interrupt vectors, at 70:xxxx */
|
||||||
extern struct lowvec {
|
extern struct lowvec {
|
||||||
unsigned char intno;
|
unsigned char intno;
|
||||||
intvec isv;
|
intvec isv;
|
||||||
} DOSTEXTFAR ASM intvec_table[5];
|
} DOSTEXTFAR ASM intvec_table[5];
|
||||||
#define intvec_table DOSTEXT(intvec_table)
|
|
||||||
|
|
||||||
/* floppy parameter table, at 70:xxxx */
|
/* floppy parameter table, at 70:xxxx */
|
||||||
extern unsigned char DOSTEXTFAR ASM int1e_table[0xe];
|
extern unsigned char DOSTEXTFAR ASM int1e_table[0xe];
|
||||||
#define int1e_table DOSTEXT(int1e_table)
|
|
||||||
|
|
||||||
extern char DOSFAR DiskTransferBuffer[/*MAX_SEC_SIZE*/]; /* in dsk.c */
|
extern char DOSFAR DiskTransferBuffer[/*MAX_SEC_SIZE*/]; /* in dsk.c */
|
||||||
#define DiskTransferBuffer DOSDATA(DiskTransferBuffer)
|
|
||||||
|
|
||||||
struct RelocationTable {
|
struct RelocationTable {
|
||||||
UBYTE jmpFar;
|
UBYTE jmpFar;
|
||||||
@ -345,14 +322,10 @@ struct RelocatedEntry {
|
|||||||
UWORD jmpSegment;
|
UWORD jmpSegment;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct RelocationTable
|
extern struct RelocationTable DOSFAR ASM _HMARelocationTableStart[];
|
||||||
DOSFAR ASM _HMARelocationTableStart[],
|
extern struct RelocationTable DOSFAR ASM _HMARelocationTableEnd[];
|
||||||
DOSFAR ASM _HMARelocationTableEnd[];
|
|
||||||
#define _HMARelocationTableStart DOSDATA(_HMARelocationTableStart)
|
|
||||||
#define _HMARelocationTableEnd DOSDATA(_HMARelocationTableEnd)
|
|
||||||
|
|
||||||
extern void FAR *DOSFAR ASM XMSDriverAddress;
|
extern void FAR *DOSFAR ASM XMSDriverAddress;
|
||||||
#define XMSDriverAddress DOSDATA(XMSDriverAddress)
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
extern VOID _EnableA20(VOID);
|
extern VOID _EnableA20(VOID);
|
||||||
extern VOID _DisableA20(VOID);
|
extern VOID _DisableA20(VOID);
|
||||||
|
@ -938,18 +938,6 @@ global %1lshrsi3
|
|||||||
; reserve space for far jump to cp/m routine
|
; reserve space for far jump to cp/m routine
|
||||||
times 5 db 0
|
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
|
;End of HMA segment
|
||||||
segment HMA_TEXT_END
|
segment HMA_TEXT_END
|
||||||
global __HMATextEnd
|
global __HMATextEnd
|
||||||
@ -1042,21 +1030,13 @@ _cpm_entry: jmp 0:reloc_call_cpm_entry
|
|||||||
global _reloc_call_blk_driver
|
global _reloc_call_blk_driver
|
||||||
extern _blk_driver
|
extern _blk_driver
|
||||||
_reloc_call_blk_driver:
|
_reloc_call_blk_driver:
|
||||||
%ifdef gcc
|
|
||||||
jmp 0:blk_driver_wrap
|
|
||||||
%else
|
|
||||||
jmp 0:_blk_driver
|
jmp 0:_blk_driver
|
||||||
%endif
|
|
||||||
call near forceEnableA20
|
call near forceEnableA20
|
||||||
|
|
||||||
global _reloc_call_clk_driver
|
global _reloc_call_clk_driver
|
||||||
extern _clk_driver
|
extern _clk_driver
|
||||||
_reloc_call_clk_driver:
|
_reloc_call_clk_driver:
|
||||||
%ifdef gcc
|
|
||||||
jmp 0:clk_driver_wrap
|
|
||||||
%else
|
|
||||||
jmp 0:_clk_driver
|
jmp 0:_clk_driver
|
||||||
%endif
|
|
||||||
call near forceEnableA20
|
call near forceEnableA20
|
||||||
|
|
||||||
global _CharMapSrvc ; in _DATA (see AARD)
|
global _CharMapSrvc ; in _DATA (see AARD)
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
OUTPUT_FORMAT(binary)
|
OUTPUT_FORMAT(binary)
|
||||||
|
|
||||||
DOS_PSP = 0x60;
|
DOS_PSP = 0x60;
|
||||||
MEMOFS = DOS_PSP * 16 - SIZEOF(.hdr);
|
MEMOFS = DOS_PSP * 16 - SIZEOF(.msdos_mz_hdr);
|
||||||
|
|
||||||
/* these GROUPs play the same role as GROUPS (segments) in OMF */
|
/* these GROUPs play the same role as GROUPS (segments) in OMF */
|
||||||
PGROUP = (MEMOFS + LOADADDR(.ptext)) / 16;
|
PGROUP = (MEMOFS + LOADADDR(.ptext)) / 16;
|
||||||
@ -22,7 +22,7 @@ SECTIONS
|
|||||||
/* Fabricate a .exe header here. Although libbfd does have an
|
/* Fabricate a .exe header here. Although libbfd does have an
|
||||||
"i386msdos" back-end which produces an "MZ" exe header, it cannot do
|
"i386msdos" back-end which produces an "MZ" exe header, it cannot do
|
||||||
certain things (yet). */
|
certain things (yet). */
|
||||||
.hdr : {
|
.msdos_mz_hdr : {
|
||||||
/* Signature. */
|
/* Signature. */
|
||||||
SHORT (0x5a4d)
|
SHORT (0x5a4d)
|
||||||
/* Bytes in last 512-byte page. */
|
/* Bytes in last 512-byte page. */
|
||||||
@ -30,9 +30,9 @@ SECTIONS
|
|||||||
/* Total number of 512-byte pages. */
|
/* Total number of 512-byte pages. */
|
||||||
SHORT (ALIGN(LOADADDR (.ibss), 512) / 512)
|
SHORT (ALIGN(LOADADDR (.ibss), 512) / 512)
|
||||||
/* Relocation entries. */
|
/* Relocation entries. */
|
||||||
SHORT (0)
|
SHORT ((__msdos_mz_rel_end - __msdos_mz_rel_start) / 4)
|
||||||
/* Header size in paragraphs. */
|
/* Header size in paragraphs. */
|
||||||
SHORT (SIZEOF(.hdr) / 16)
|
SHORT (SIZEOF(.msdos_mz_hdr) / 16)
|
||||||
/* Minimum extra paragraphs. */
|
/* Minimum extra paragraphs. */
|
||||||
SHORT (ALIGN(SIZEOF (.ibss) + SIZEOF(.istack), 16) / 16)
|
SHORT (ALIGN(SIZEOF (.ibss) + SIZEOF(.istack), 16) / 16)
|
||||||
/* Maximum extra paragraphs. */
|
/* Maximum extra paragraphs. */
|
||||||
@ -45,12 +45,18 @@ SECTIONS
|
|||||||
. = 0x18;
|
. = 0x18;
|
||||||
/* Relocation table offset. */
|
/* Relocation table offset. */
|
||||||
SHORT (. + 4)
|
SHORT (. + 4)
|
||||||
/* Overlay number + padding */
|
/* Overlay number */
|
||||||
. = ALIGN (32);
|
SHORT (0)
|
||||||
|
/* Relocations */
|
||||||
|
HIDDEN (__msdos_mz_rel_start = .);
|
||||||
|
*(.msdos_mz_reloc .msdos_mz_reloc.*)
|
||||||
|
HIDDEN (__msdos_mz_rel_end = .);
|
||||||
|
/* Padding */
|
||||||
|
. = ALIGN (16);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Target PSP section. */
|
/* Target PSP section. */
|
||||||
.ptext 0 : AT (SIZEOF(.hdr)) {
|
.ptext 0 : AT (SIZEOF(.msdos_mz_hdr)) {
|
||||||
*(PSP)
|
*(PSP)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,12 +68,7 @@ __segment DosTextSeg = 0;
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct lol FAR *LoL
|
struct lol FAR *LoL = &DATASTART;
|
||||||
#ifndef __GNUC__
|
|
||||||
/* cannot initialize from far data with GCC */
|
|
||||||
= &DATASTART;
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
|
|
||||||
VOID ASMCFUNC FreeDOSmain(void)
|
VOID ASMCFUNC FreeDOSmain(void)
|
||||||
{
|
{
|
||||||
@ -95,9 +90,6 @@ VOID ASMCFUNC FreeDOSmain(void)
|
|||||||
at 50:e0
|
at 50:e0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
LoL = &DATASTART;
|
|
||||||
#endif
|
|
||||||
drv = LoL->BootDrive + 1;
|
drv = LoL->BootDrive + 1;
|
||||||
p = MK_FP(0, 0x5e0);
|
p = MK_FP(0, 0x5e0);
|
||||||
if (fmemcmp(p+2,"CONFIG",6) == 0) /* UPX */
|
if (fmemcmp(p+2,"CONFIG",6) == 0) /* UPX */
|
||||||
|
@ -54,8 +54,9 @@ CFLAGSC=
|
|||||||
# -Wno-pointer-to-int-cast do not warn about FP_OFF
|
# -Wno-pointer-to-int-cast do not warn about FP_OFF
|
||||||
# -Wno-pragmas do not warn about #pragma pack
|
# -Wno-pragmas do not warn about #pragma pack
|
||||||
# -Werror treat all warnings as errors
|
# -Werror treat all warnings as errors
|
||||||
|
# -mfar-function-if-far-return-type treat `int __far f ();' as a far function
|
||||||
|
|
||||||
ALLCFLAGS+=-I../hdr $(TARGETOPT) -mcmodel=small -fleading-underscore -fno-common -fpack-struct -ffreestanding -fcall-used-es -mrtd -Wno-pointer-to-int-cast -Wno-pragmas -Werror -Os -fno-strict-aliasing
|
ALLCFLAGS+=-I../hdr $(TARGETOPT) -mcmodel=small -fleading-underscore -fno-common -fpack-struct -ffreestanding -fcall-used-es -mrtd -Wno-pointer-to-int-cast -Wno-pragmas -Werror -Os -fno-strict-aliasing -mfar-function-if-far-return-type
|
||||||
INITCFLAGS=$(ALLCFLAGS) -o $@
|
INITCFLAGS=$(ALLCFLAGS) -o $@
|
||||||
CFLAGS=$(ALLCFLAGS) -o $@
|
CFLAGS=$(ALLCFLAGS) -o $@
|
||||||
|
|
||||||
@ -67,7 +68,7 @@ ifeq ($(LOADSEG)0, 0)
|
|||||||
LOADSEG=0x60
|
LOADSEG=0x60
|
||||||
endif
|
endif
|
||||||
|
|
||||||
INITPATCH=objcopy --redefine-sym ___umodsi3=_init_umodsi3 --redefine-sym ___udivsi3=_init_udivsi3 --redefine-sym ___ashlsi3=_init_ashlsi3 --redefine-sym ___lshrsi3=_init_lshrsi3
|
INITPATCH=ia16-elf-objcopy --redefine-sym ___umodsi3=_init_umodsi3 --redefine-sym ___udivsi3=_init_udivsi3 --redefine-sym ___ashlsi3=_init_ashlsi3 --redefine-sym ___lshrsi3=_init_lshrsi3
|
||||||
CLDEF=1
|
CLDEF=1
|
||||||
CLT=gcc -DDOSC_TIME_H -I../hdr -o $@
|
CLT=gcc -DDOSC_TIME_H -I../hdr -o $@
|
||||||
CLC=$(CLT)
|
CLC=$(CLT)
|
||||||
|
@ -125,8 +125,8 @@ static int exeflat(const char *srcfile, const char *dstfile,
|
|||||||
((DWORD) (header->exPages - 1) << 9) + header->exExtraBytes -
|
((DWORD) (header->exPages - 1) << 9) + header->exExtraBytes -
|
||||||
header->exHeaderSize * 16UL;
|
header->exHeaderSize * 16UL;
|
||||||
printf("image size (less header) = %lu = 0x%lx\n", size, size);
|
printf("image size (less header) = %lu = 0x%lx\n", size, size);
|
||||||
printf("first relocation offset = %u = 0x%u\n", header->exOverlay,
|
printf("first relocation offset = %u = 0x%x\n", header->exRelocTable,
|
||||||
header->exOverlay);
|
header->exRelocTable);
|
||||||
|
|
||||||
/* first read file into memory chunks */
|
/* first read file into memory chunks */
|
||||||
fseek(src, header->exHeaderSize * 16UL, SEEK_SET);
|
fseek(src, header->exHeaderSize * 16UL, SEEK_SET);
|
||||||
@ -150,7 +150,7 @@ static int exeflat(const char *srcfile, const char *dstfile,
|
|||||||
}
|
}
|
||||||
if (fread(*curbuf, sizeof(char), bufsize, src) != bufsize)
|
if (fread(*curbuf, sizeof(char), bufsize, src) != bufsize)
|
||||||
{
|
{
|
||||||
printf("Source file read error %ld %d\n", to_xfer, bufsize);
|
printf("Source file read error %ld %d\n", to_xfer, (int)bufsize);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -381,7 +381,7 @@ int main(int argc, char **argv)
|
|||||||
if (silentcount >= LENGTH(silentSegments))
|
if (silentcount >= LENGTH(silentSegments))
|
||||||
{
|
{
|
||||||
printf("can't handle more then %d silent's\n",
|
printf("can't handle more then %d silent's\n",
|
||||||
LENGTH(silentSegments));
|
(int)LENGTH(silentSegments));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user