Skip to content
Open
4 changes: 2 additions & 2 deletions H/cpumodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

extern ret_code SetCPU( enum cpu_info );
extern void SetModel(void);
static struct asym *sym_CodeSize; /* numeric. requires model */
static struct asym *sym_DataSize; /* numeric. requires model */
extern struct asym *sym_CodeSize; /* numeric. requires model */
extern struct asym *sym_DataSize; /* numeric. requires model */

#endif
2 changes: 1 addition & 1 deletion H/errmsg.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ extern int EmitError( int msgnum );
extern int EmitErr( int msgnum, ... );
extern void EmitWarn( int level, int msgnum, ... );
extern void PrintNote( int msgnum, ... );
extern char *ErrnoStr( void );
extern const char *ErrnoStr( void );
extern int write_logo( void );
extern void PrintUsage( void );
//extern void SeekError( void );
Expand Down
16 changes: 12 additions & 4 deletions H/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

#define _CRT_DISABLE_PERFCRIT_LOCKS

#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -543,14 +544,14 @@ enum opt_queues {
};

enum prologue_epilogue_mode {
PEM_DEFAULT, /* must be value 0 */
PEM_DEFAULT = 0, /* must be value 0 */
PEM_MACRO,
PEM_NONE
};

/* Stack distance */
enum dist_type {
//STACK_NONE,
STACK_NONE,
STACK_NEAR,
STACK_FAR,
};
Expand Down Expand Up @@ -737,7 +738,7 @@ struct module_vars {
struct qdesc LibQueue; /* includelibs */
struct qdesc LinkQueue; /* .pragma comment(linker,"/..") */
struct dll_desc *DllQueue; /* dlls of OPTION DLLIMPORT */
char *imp_prefix;
const char *imp_prefix;
FILE *curr_file[NUM_FILE_TYPES]; /* ASM, ERR, OBJ and LST */
char *curr_fname[NUM_FILE_TYPES];
char * *FNames; /* array of input files */
Expand Down Expand Up @@ -922,6 +923,10 @@ extern uint_8 MacroLevel; /* macro nesting level */
extern bool write_to_file; /* 1=write the object module */
extern bool gmaskflag;

#if defined(__UNIX__)
extern char *strupr(char *);
#endif

/* functions in assemble.c */

struct fixup;
Expand All @@ -946,4 +951,7 @@ extern char *num2hex64(uint_64 value, char *buffer);
extern char *ConvertSectionName( const struct asym *, enum seg_type *pst, char *buffer );
extern void RewindToWin64(void);

#endif
/* empty string (char *)"" in types.c */
extern char STR_EMPTY[1];

#endif /* _GLOBALS_H_INCLUDED */
4 changes: 2 additions & 2 deletions H/instruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -1240,15 +1240,15 @@ insx(SWAPGS, swapgs, OpCls( NONE, NONE, NONE ), F_0F, 0,
insx(SYSCALL_, syscall, OpCls( NONE, NONE, NONE ), F_0F, 0, no_RM, 0x05, 0x00, P_64, 0, RWF_X64)
insx(SYSRET, sysret, OpCls( NONE, NONE, NONE ), F_0F, 0, no_RM, 0x07, 0x00, P_64, 0, RWF_X64)

/* #if 0 /* v2.09: added, inactive ( not supported by ML64 v8,9,10 ) */
//#if 0 /* v2.09: added, inactive ( not supported by ML64 v8,9,10 ) */
insx(FXRSTOR64, fxrstor64, OpCls( M_ANY, NONE, NONE ), F_480F, 0, no_WDS, 0xAE, 0x08, P_64, 0, RWF_X64)
insx(FXSAVE64, fxsave64, OpCls( M_ANY, NONE, NONE ), F_480F, 0, no_WDS, 0xAE, 0x00, P_64, 0, RWF_X64)
#if SSE4SUPP
insx(XRSTOR64, xrstor64, OpCls( M_ANY, NONE, NONE ), F_480F, 0, no_WDS, 0xAE, 0x28, P_64|P_SSE4,0, RWF_X64)
insx(XSAVE64, xsave64, OpCls( M_ANY, NONE, NONE ), F_480F, 0, no_WDS, 0xAE, 0x20, P_64|P_SSE4,0, RWF_X64)
insx(XSAVEOPT64, xsaveopt64, OpCls( M_ANY, NONE, NONE ), F_480F, 0, no_WDS, 0xAE, 0x30, P_64|P_SSE4,0, RWF_X64)
#endif
/*#endif*/
//#endif
#endif

#if SSE4SUPP
Expand Down
2 changes: 2 additions & 0 deletions H/symbols.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ struct asym {
uint_32 max_mbr_size; /* max size members */
/* SYM_STACK, SYM_TYPE (TYPEKIND_TYPEDEF), SYM_EXTERNAL, SYM_INTERNAL (code labels) */
struct asym *target_type; /* set if ptr_memtype is MT_TYPE */
uintptr_t target_type_val;
/* SYM_TMACRO (if it's a register variable for FASTCALL) */
uint_16 regist[2];
};
Expand All @@ -246,6 +247,7 @@ struct asym {
* total number of elements (LENGTHOF)
*/
uint_32 total_length;
uintptr_t altname_val;
struct asym *altname; /* SYM_EXTERNAL (comm==0): alternative name */
struct debug_info *debuginfo;/* SYM_INTERNAL (isproc==1): debug info (COFF) */
internal_func sfunc_ptr; /* SYM_INTERNAL+predefined */
Expand Down
15 changes: 8 additions & 7 deletions Makefile-Linux-GCC-64.mak → Makefile-Linux.mak
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ endif

inc_dirs = -IH

CC = gcc

#cflags stuff

ifeq ($(DEBUG),0)
extra_c_flags = -DNDEBUG -O2 -funsigned-char -Wwrite-strings
extra_c_flags = -DNDEBUG -O2 -funsigned-char -Werror=write-strings
extra_c_flags += -Wunused -Wuninitialized
extra_c_flags += -Wno-switch -Wno-enum-conversion -Wno-enum-compare
OUTD=GccUnixR
else
extra_c_flags = -DDEBUG_OUT -g
Expand All @@ -21,9 +25,6 @@ endif

c_flags =-D __UNIX__ $(extra_c_flags)

#From CLANG 11+, default has changed from allowing global variables to be defined in the headers (-fcommon) to not allowing it (-fno-common)." USE: make CC="clang -fcommon" -f gccLinux64.mak
CC = gcc

.SUFFIXES:
.SUFFIXES: .c .o

Expand Down Expand Up @@ -55,6 +56,6 @@ $(OUTD)/reswords.o: reswords.c H/instruct.h H/special.h H/directve.h H/opndcls.h
######

clean:
rm $(OUTD)/$(TARGET1)
rm $(OUTD)/*.o
rm $(OUTD)/*.map
rm -f $(OUTD)/$(TARGET1)
rm -f $(OUTD)/*.o
rm -f $(OUTD)/*.map
File renamed without changes.
40 changes: 24 additions & 16 deletions assemble.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,15 @@ static const enum seg_type stt[] = {
SEGTYPE_CODE, SEGTYPE_DATA, SEGTYPE_DATA, SEGTYPE_BSS
};

/*
static void CheckBOM(FILE *f)
{
unsigned long bom;
fread(&bom, 3, 1, f);
if ((bom & 0xFFFFFF) != 0xBFBBEF)
rewind(f);
}
*/

extern void RewindToWin64()
{
Expand Down Expand Up @@ -408,7 +410,7 @@ void OutputBytes( const unsigned char *pbytes, int len, struct fixup *fixup )
void OutputInterleavedBytes(const unsigned char *pbytes, int len, struct fixup *fixup)
{
int i = 0;
char *pOut = NULL;
unsigned char *pOut = NULL;

if (write_to_file == TRUE) {
uint_32 idx = CurrSeg->e.seginfo->current_loc - CurrSeg->e.seginfo->start_loc;
Expand Down Expand Up @@ -688,7 +690,7 @@ static void CmdlParamsInit( int pass )
add_cmdline_tmacros();
add_incpaths();
if ( Options.ignore_include == FALSE )
if ( env = getenv( "INCLUDE" ) )
if ( (env = getenv( "INCLUDE" )) != NULL )
AddStringToIncludePath( env );
}
DebugMsg(("CmdlParamsInit exit\n"));
Expand Down Expand Up @@ -1039,7 +1041,7 @@ static void PassOneChecks( void )
*/
#if FASTPASS
/* UASM 2.55 , altname is set to 1 when the type is undefined */
if ( curr->sym.altname > 1 )
if ( curr->sym.altname_val > 1 )
{
if ( curr->sym.altname->state == SYM_INTERNAL )
{
Expand Down Expand Up @@ -1203,10 +1205,11 @@ static int OnePass( void )
DebugMsg1(("OnePass(%u) cur/nxt=%X/%X src=%X.%u mlvl=%u: >%s<\n", Parse_Pass+1, LineStoreCurr, LineStoreCurr->next, LineStoreCurr->srcfile, LineStoreCurr->lineno, MacroLevel, LineStoreCurr->line ));
ModuleInfo.CurrComment = NULL; /* v2.08: added (var is never reset because GetTextLine() isn't called) */
#if USELSLINE
if ( Token_Count = Tokenize( LineStoreCurr->line, 0, ModuleInfo.tokenarray, TOK_DEFAULT ) )
Token_Count = Tokenize( LineStoreCurr->line, 0, ModuleInfo.tokenarray, TOK_DEFAULT );
#else
if ( Token_Count = Tokenize( CurrSource, 0, ModuleInfo.tokenarray, TOK_DEFAULT ) )
Token_Count = Tokenize( CurrSource, 0, ModuleInfo.tokenarray, TOK_DEFAULT );
#endif
if ( Token_Count > 0 )
ParseLine( ModuleInfo.tokenarray );
LineStoreCurr = LineStoreCurr->next;
}
Expand Down Expand Up @@ -1414,24 +1417,29 @@ void close_files( void )

/* get default file extension for error, object and listing files */

static char *GetExt( int type )
#if MZ_SUPPORT || PE_SUPPORT
#if PE_SUPPORT
#define SUB_FORMAT_IS_MZ_OR_PE (Options.sub_format == SFORMAT_MZ || Options.sub_format == SFORMAT_PE)
#else
#define SUB_FORMAT_IS_MZ_OR_PE (Options.sub_format == SFORMAT_MZ)
#endif
#endif

static const char *GetExt( int type )
/*****************************/
{
switch ( type ) {
case OBJ:
#if BIN_SUPPORT
if ( Options.output_format == OFORMAT_BIN )
#if MZ_SUPPORT || PE_SUPPORT
if ( Options.sub_format == SFORMAT_MZ
#if PE_SUPPORT
|| Options.sub_format == SFORMAT_PE
#endif
)
if ( Options.output_format == OFORMAT_BIN ) {
#ifdef SUB_FORMAT_IS_MZ_OR_PE
if ( SUB_FORMAT_IS_MZ_OR_PE ) {
return( EXE_EXT );
else
}
#endif
return( BIN_EXT );
return( BIN_EXT );
#endif
}
return( OBJ_EXT );
case LST:
return( LST_EXT );
Expand Down Expand Up @@ -1798,7 +1806,7 @@ int EXPQUAL AssembleModule( const char *source )
printf("%u errors\n", ModuleInfo.g.error_count);
SetConsoleTextAttribute(hConsole, screenBufferInfo.wAttributes);
#else
printf(FWHT("%s: %lu lines, "), GetFNamePart(GetFName(ModuleInfo.srcfile)->fname), GetLineNumber());
printf(FWHT("%s: %u lines, "), GetFNamePart(GetFName(ModuleInfo.srcfile)->fname), GetLineNumber());
printf(FGRN("%u passes"), Parse_Pass + 1);
printf(", ");
printf(FCYN("%u ms"), endtime - starttime);
Expand Down
3 changes: 2 additions & 1 deletion assume.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,12 @@ void ModelAssumeInit( void )
struct asym *GetStdAssume( int reg )
/**********************************/
{
if ( StdAssumeTable[reg].symbol )
if ( StdAssumeTable[reg].symbol ) {
if ( StdAssumeTable[reg].symbol->mem_type == MT_TYPE )
return( StdAssumeTable[reg].symbol->type );
else
return( StdAssumeTable[reg].symbol->target_type );
}
return ( NULL );
}

Expand Down
Loading