diff options
author | tma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2005-10-13 14:47:00 +0000 |
---|---|---|
committer | tma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2005-10-13 14:47:00 +0000 |
commit | 2409247307a2fdf0266a8bd7cd39526f06bea0d3 (patch) | |
tree | 3db0f1aeac11c230a2cfeca37c911cb2fec92d04 /code/tools | |
parent | 0ef0850cce08475bd990dd1d3e8865e48995b0ee (diff) | |
download | ioquake3-aero-2409247307a2fdf0266a8bd7cd39526f06bea0d3.tar.gz ioquake3-aero-2409247307a2fdf0266a8bd7cd39526f06bea0d3.zip |
* (Non-trivial) fix to the "opStack corrupted in compiled code" bug
git-svn-id: svn://svn.icculus.org/quake3/trunk@156 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/tools')
-rw-r--r-- | code/tools/asm/q3asm.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/code/tools/asm/q3asm.c b/code/tools/asm/q3asm.c index 6c529ab..7d88e73 100644 --- a/code/tools/asm/q3asm.c +++ b/code/tools/asm/q3asm.c @@ -135,6 +135,7 @@ typedef enum { DATASEG, // initialized 32 bit data, will be byte swapped LITSEG, // strings BSSSEG, // 0 filled + JTRGSEG, // psuedo-segment that contains only jump table targets NUM_SEGMENTS } segmentName_t; @@ -989,6 +990,8 @@ STAT("ADDRESS"); /* Addresses are 32 bits wide, and therefore go into data segment. */ HackToSegment( DATASEG ); EmitInt( currentSegment, v ); + if( passNumber == 1 && token[ 0 ] == '$' ) // crude test for labels + EmitInt( &segment[ JTRGSEG ], v ); return 1; } return 0; @@ -1375,7 +1378,7 @@ void WriteVmFile( void ) { return; } - header.vmMagic = VM_MAGIC; + header.vmMagic = VM_MAGIC_VER2; header.instructionCount = instructionCount; header.codeOffset = sizeof( header ); header.codeLength = segment[CODESEG].imageUsed; @@ -1383,6 +1386,7 @@ void WriteVmFile( void ) { header.dataLength = segment[DATASEG].imageUsed; header.litLength = segment[LITSEG].imageUsed; header.bssLength = segment[BSSSEG].imageUsed; + header.jtrgLength = segment[JTRGSEG].imageUsed; report( "Writing to %s\n", imageName ); @@ -1392,6 +1396,7 @@ void WriteVmFile( void ) { SafeWrite( f, &segment[CODESEG].image, segment[CODESEG].imageUsed ); SafeWrite( f, &segment[DATASEG].image, segment[DATASEG].imageUsed ); SafeWrite( f, &segment[LITSEG].image, segment[LITSEG].imageUsed ); + SafeWrite( f, &segment[JTRGSEG].image, segment[JTRGSEG].imageUsed ); fclose( f ); } @@ -1417,6 +1422,7 @@ void Assemble( void ) { for ( passNumber = 0 ; passNumber < 2 ; passNumber++ ) { segment[LITSEG].segmentBase = segment[DATASEG].imageUsed; segment[BSSSEG].segmentBase = segment[LITSEG].segmentBase + segment[LITSEG].imageUsed; + segment[JTRGSEG].segmentBase = segment[BSSSEG].segmentBase + segment[BSSSEG].imageUsed; for ( i = 0 ; i < NUM_SEGMENTS ; i++ ) { segment[i].imageUsed = 0; } |