Skip to content

Commit

Permalink
allow gcc build to succeed with -DWIN31SUPPORT
Browse files Browse the repository at this point in the history
  • Loading branch information
ecm-pushbx committed Aug 5, 2023
1 parent 29ccb6e commit a9e5865
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
6 changes: 6 additions & 0 deletions hdr/win.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ struct WinStartupInfo
ULONG optInstanceTable; /* used only if winver set to 0x400 (w95)*/
};
extern struct WinStartupInfo winStartupInfo;
#if defined __GNUC__
extern UWORD winseg1, winseg2, winseg3;
extern UBYTE markEndInstanceData;
extern struct lol ASM FAR DATASTART;
#endif


/* contains a list of offsets relative to DOS data segment of
various internal variables.
Expand Down
5 changes: 5 additions & 0 deletions kernel/inthndlr.c
Original file line number Diff line number Diff line change
Expand Up @@ -2001,6 +2001,11 @@ VOID ASMCFUNC int2F_12_handler(struct int2f12regs FAR *pr)
r.es = FP_SEG(&winStartupInfo);
r.BX = FP_OFF(&winStartupInfo);
winStartupInfo.winver = r.di; /* match what caller says it is */
#if defined __GNUC__
winseg1 = FP_SEG(&winStartupInfo);
winseg2 = FP_SEG(&DATASTART);
winseg3 = FP_OFF(&markEndInstanceData);
#endif
winInstanced = 1; /* internal flag marking Windows is active */
DebugPrintf(("Win startup\n"));
break;
Expand Down
19 changes: 17 additions & 2 deletions kernel/kernel.asm
Original file line number Diff line number Diff line change
Expand Up @@ -607,11 +607,25 @@ _winStartupInfo:
dd 0 ; next startup info structure, 0:0h marks end
dd 0 ; far pointer to name virtual device file or 0:0h
dd 0 ; far pointer, reference data for virtual device driver
%ifnidni __OUTPUT_FORMAT__, elf
dw instance_table,seg instance_table ; array of instance data
%else
dw instance_table ; array of instance data
global _winseg1
_winseg1: dw 0
%endif
instance_table: ; should include stacks, Win may auto determine SDA region
; we simply include whole DOS data segment
%ifnidni __OUTPUT_FORMAT__, elf
dw seg _DATASTART, 0 ; [SEG:OFF] address of region's base
dw markEndInstanceData wrt seg _DATASTART ; size in bytes
dw _markEndInstanceData wrt seg _DATASTART ; size in bytes
%else
global _winseg2
_winseg2: dw 0
dw 0 ; [SEG:OFF] address of region's base
global _winseg3
_winseg3: dw 0 ; size in bytes
%endif
dd 0 ; 0 marks end of table
dw 0 ; and 0 length for end of instance_table entry
global _winPatchTable
Expand Down Expand Up @@ -975,7 +989,8 @@ segment DYN_DATA
_Dyn:
DynAllocated dw 0

markEndInstanceData: ; mark end of DOS data seg we say needs instancing
global _markEndInstanceData
_markEndInstanceData: ; mark end of DOS data seg we say needs instancing

segment ID_B
Expand Down

0 comments on commit a9e5865

Please sign in to comment.