VOGONS


First post, by kjliew

User metadata
Rank Oldbie
Rank
Oldbie

The game is Heavy Gear 2 under Win98SE, DOSBox SVN r3858 with voodoo1 patch. I also confirm that similar deadlock is also present in the game downloadable demo.
Here's the code snippet where it deadlocked.

000A1063: 8BF9                           mov       edi,ecx
000A1065: D1FF sar (d) edi,1
000A1067: 8BC7 mov eax,edi
000A1069: C1E004 shl (d) eax,04
000A106C: DD0418 fld (q) st(0),[ebx+eax]
000A106F: DC5DD8 fcomp (q) st(0),[ebp-28]
000A1072: 8D3418 lea esi,[ebx+eax]
000A1075: DFE0 fstsw ax
000A1077: F6C441 test (b) ah,41
000A107A: 741F je file:000A109B
000A107C: 8B06 mov eax,[esi]
000A107E: C1E104 shl (d) ecx,04
000A1081: 03CB add ecx,ebx
000A1083: 8901 mov [ecx],eax
000A1085: 8B4604 mov eax,[esi+04]
000A1088: 894104 mov [ecx+04],eax
000A108B: 8B4608 mov eax,[esi+08]
000A108E: 894108 mov [ecx+08],eax
000A1091: 8B460C mov eax,[esi+0C]
000A1094: 89410C mov [ecx+0C],eax
000A1097: 8BCF mov ecx,edi
000A1099: EBC8 jmps file:000A1063

1st CacheBlock [A1063 - A1077]
2nd CacheBlock [A107C - A1097]
The jump instruction at A107A is never taken, so the code spins indefinitely. This jump closes the 1st CacheBlock as if it is taken, then it will link to another CacheBlock beyond A109B.
The deadlock is resolved when using "dynamic_nodhfpu" as CPU core, but FPU performance takes a significant hit. The slowdown is obviously noticeable in game.