mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 05:01:41 +00:00
- Added self-modifying code notifications for Valgrind.
Build with make VALGRIND=1 to turn them on. SVN r1025 (trunk)
This commit is contained in:
parent
000f3e0ef1
commit
e203ccda20
7 changed files with 81 additions and 0 deletions
|
@ -32,6 +32,11 @@ CFLAGS += -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -DNEED_STRUPR
|
|||
LDFLAGS += -lz -ljpeg `sdl-config --libs` `pkg-config gtk+-2.0 --libs` $(FMOD_PREFIX)/lib/libfmodex${X64}.so
|
||||
NASMFLAGS += -f elf -DM_TARGET_LINUX
|
||||
|
||||
ifdef VALGRIND
|
||||
NOSTRIP = 1
|
||||
NASMFLAGS += -DVALGRIND_AWARE
|
||||
endif
|
||||
|
||||
SRCDIRS = src/ $(addprefix src/,g_doom/ g_heretic/ g_hexen/ g_raven/ g_shared/ g_strife/ oplsynth/ sound/ sdl/ textures/ thingdef/ xlat/ timidity/)
|
||||
VPATH = $(SRCDIRS)
|
||||
INCLUDES = $(addprefix -I,$(SRCDIRS))
|
||||
|
@ -71,6 +76,8 @@ else
|
|||
LDFLAGS += -Wl,-Map=$(ZDOOM).map
|
||||
ifndef NOSTRIP
|
||||
LDFLAGS += -s
|
||||
else
|
||||
CFLAGS += -g
|
||||
endif
|
||||
ZDOOMBIN = $(ZDOOM)
|
||||
endif
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
June 7, 2008
|
||||
- Added self-modifying code notifications for Valgrind.
|
||||
Build with make VALGRIND=1 to turn them on.
|
||||
|
||||
June 6, 2008
|
||||
- Fixed: There was still an inventory bar check in FMugShot::GetFace() after
|
||||
separating it from DDoomStatusBar.
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
; See the included license file "BUILDLIC.TXT" for license info.
|
||||
; This file has been modified from Ken Silverman's original release
|
||||
|
||||
%include "src/valgrind.inc"
|
||||
|
||||
SECTION .data
|
||||
|
||||
%ifndef M_TARGET_LINUX
|
||||
|
@ -56,6 +58,7 @@ setvlinebpl_:
|
|||
mov [fixchain1m+2], eax
|
||||
mov [fixchain2ma+2], eax
|
||||
mov [fixchain2mb+2], eax
|
||||
selfmod fixchain1a, fixchain2mb+6
|
||||
ret
|
||||
|
||||
; pass it log2(texheight)
|
||||
|
@ -87,6 +90,7 @@ setupvlineasm:
|
|||
dec eax
|
||||
mov dword [machvsh2+2], eax ;(1<<shy)-1
|
||||
mov dword [machvsh4+2], eax ;(1<<shy)-1
|
||||
selfmod premach3a, machvsh8+6
|
||||
ret
|
||||
|
||||
SECTION .rtext progbits alloc exec write align=64
|
||||
|
@ -250,6 +254,7 @@ machvsh12: rol ebx, 88h ;sh
|
|||
add ebp, ebx
|
||||
|
||||
mov ecx, esi
|
||||
selfmod beginvlineasm4, machvline4end+6
|
||||
jmp short beginvlineasm4
|
||||
ALIGN 16
|
||||
beginvlineasm4:
|
||||
|
@ -323,6 +328,7 @@ setupmvlineasm:
|
|||
mov byte [machmv14+2], cl
|
||||
mov byte [machmv15+2], cl
|
||||
mov byte [machmv16+2], cl
|
||||
selfmod maskmach3a, machmv13+6
|
||||
ret
|
||||
|
||||
ALIGN 16
|
||||
|
@ -405,6 +411,7 @@ mvlineasm4:
|
|||
mov ebp, [vplce+12]
|
||||
fixchain2ma: sub edi, 320
|
||||
|
||||
selfmod beginmvlineasm4, machmv2+6
|
||||
jmp short beginmvlineasm4
|
||||
ALIGN 16
|
||||
beginmvlineasm4:
|
||||
|
@ -529,3 +536,5 @@ mvcase1: mov [edi], bl
|
|||
jmp beginmvlineasm4
|
||||
ALIGN 16
|
||||
mvcase0: jmp beginmvlineasm4
|
||||
|
||||
align 16
|
||||
|
|
15
src/tmap.nas
15
src/tmap.nas
|
@ -33,6 +33,8 @@
|
|||
|
||||
BITS 32
|
||||
|
||||
%include "src/valgrind.inc"
|
||||
|
||||
; Segment/section definition macros.
|
||||
|
||||
SECTION .data
|
||||
|
@ -176,6 +178,8 @@ R_SetSpanSource_ASM:
|
|||
mov [mspreade+2],ecx
|
||||
mov [mspreadf+2],ecx
|
||||
mov [mspreadg+2],ecx
|
||||
|
||||
selfmod spreada, mspreadg+6
|
||||
|
||||
mov [ds_cursource],ecx
|
||||
ret
|
||||
|
@ -202,6 +206,8 @@ R_SetSpanColormap_ASM:
|
|||
mov [mspmape+2],ecx
|
||||
mov [mspmapf+2],ecx
|
||||
mov [mspmapg+2],ecx
|
||||
|
||||
selfmod spmapa, mspmapg+6
|
||||
|
||||
mov [ds_curcolormap],ecx
|
||||
ret
|
||||
|
@ -275,10 +281,14 @@ R_SetSpanSize_ASM:
|
|||
mov [dmsy3+2],dl
|
||||
mov [dmsy4+2],dl
|
||||
|
||||
selfmod dsy1, dmsm7+6
|
||||
|
||||
aret: ret
|
||||
|
||||
SECTION .rtext progbits alloc exec write align=64
|
||||
|
||||
rtext_start:
|
||||
|
||||
GLOBAL @R_DrawSpanP_ASM@0
|
||||
GLOBAL _R_DrawSpanP_ASM
|
||||
GLOBAL R_DrawSpanP_ASM
|
||||
|
@ -1731,6 +1741,7 @@ ac4p: add eax,320 ; pitch
|
|||
ac4nil: pop edi
|
||||
ret
|
||||
|
||||
rtext_end:
|
||||
align 16
|
||||
|
||||
;************************
|
||||
|
@ -1759,6 +1770,7 @@ R_SetupShadedCol:
|
|||
mov [s4fg2+3],eax
|
||||
mov [s4fg3+3],eax
|
||||
mov [s4fg4+3],eax
|
||||
selfmod s4cm1, s4fg4+7
|
||||
.cdone ret
|
||||
|
||||
GLOBAL R_SetupAddCol
|
||||
|
@ -1790,6 +1802,7 @@ R_SetupAddCol:
|
|||
mov [a4bg2+3],eax
|
||||
mov [a4bg3+3],eax
|
||||
mov [a4bg4+3],eax
|
||||
selfmod a4cm1, a4bg4+7
|
||||
.dbdone ret
|
||||
|
||||
GLOBAL R_SetupAddClampCol
|
||||
|
@ -1821,6 +1834,7 @@ R_SetupAddClampCol:
|
|||
mov [ac4bg2+3],eax
|
||||
mov [ac4bg3+3],eax
|
||||
mov [ac4bg4+3],eax
|
||||
selfmod ac4cm1, ac4bg4+7
|
||||
.dbdone ret
|
||||
|
||||
EXTERN setvlinebpl_
|
||||
|
@ -1847,5 +1861,6 @@ _ASM_PatchPitch:
|
|||
mov [s4p2+2],ecx
|
||||
inc ecx
|
||||
mov [s4p3+2],ecx
|
||||
selfmod rtext_start, rtext_end
|
||||
call setpitch3
|
||||
jmp setvlinebpl_
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
|
||||
BITS 32
|
||||
|
||||
%include "src/valgrind.inc"
|
||||
|
||||
%define SPACEFILLER4 (0x44444444)
|
||||
|
||||
%ifndef M_TARGET_LINUX
|
||||
|
@ -160,6 +162,7 @@ R_SetTiltedSpanSource_ASM:
|
|||
mov [fetch9+3],ecx
|
||||
mov [fetch10+3],ecx
|
||||
mov [ds_curtiltedsource],ecx
|
||||
selfmod rtext_start, rtext_end
|
||||
ret
|
||||
|
||||
GLOBAL SetTiltedSpanSize
|
||||
|
@ -209,10 +212,14 @@ SetTiltedSpanSize:
|
|||
mov [m9+2],eax
|
||||
mov [m10+2],eax
|
||||
|
||||
selfmod rtext_start, rtext_end
|
||||
|
||||
ret
|
||||
|
||||
SECTION .rtext progbits alloc exec write align=64
|
||||
|
||||
rtext_start:
|
||||
|
||||
GLOBAL R_DrawTiltedPlane_ASM
|
||||
GLOBAL @R_DrawTiltedPlane_ASM@8
|
||||
|
||||
|
@ -619,3 +626,5 @@ fetch10 mov al,[ebp+esi+SPACEFILLER4]
|
|||
pop esi
|
||||
pop ebx
|
||||
ret
|
||||
|
||||
rtext_end:
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
%include "src/valgrind.inc"
|
||||
|
||||
%ifdef M_TARGET_WATCOM
|
||||
SEGMENT DATA PUBLIC ALIGN=16 CLASS=DATA USE32
|
||||
SEGMENT DATA
|
||||
|
@ -57,6 +59,7 @@ setpitch3:
|
|||
mov [vltpitcha+2],eax
|
||||
mov [vlt1pitch1+2], eax
|
||||
mov [vlt1pitch2+2], eax
|
||||
selfmod vltpitch, vlt1pitch2+6
|
||||
ret
|
||||
|
||||
ALIGN 16
|
||||
|
@ -74,6 +77,7 @@ setupvlinetallasm:
|
|||
mov [preshift+2], cl
|
||||
mov [shift11+2], cl
|
||||
mov [shift12+2], cl
|
||||
selfmod shifter1, shift12+6
|
||||
ret
|
||||
|
||||
SECTION .rtext progbits alloc exec write align=64
|
||||
|
@ -126,6 +130,7 @@ vlinetallasm4:
|
|||
mov ecx, [vplce+4]
|
||||
mov esi, [vplce+8]
|
||||
mov eax, [vplce+12]
|
||||
selfmod loopit, vltpitch
|
||||
jmp loopit
|
||||
|
||||
ALIGN 16
|
||||
|
@ -217,6 +222,7 @@ vlinetallasmathlon4:
|
|||
mov ecx, [vplce+4]
|
||||
mov esi, [vplce+8]
|
||||
mov eax, [vplce+12]
|
||||
selfmod loopita, vltpitcha
|
||||
jmp loopita
|
||||
|
||||
; Unfortunately, this code has not been carefully analyzed to determine
|
||||
|
|
31
src/valgrind.inc
Normal file
31
src/valgrind.inc
Normal file
|
@ -0,0 +1,31 @@
|
|||
%ifdef VALGRIND_AWARE
|
||||
|
||||
%define VG_USERREQ__DISCARD_TRANSLATIONS 0x1002
|
||||
|
||||
%macro selfmod 2
|
||||
pusha
|
||||
sub esp,6*4
|
||||
mov dword [esp], VG_USERREQ__DISCARD_TRANSLATIONS
|
||||
mov dword [esp+4], %1
|
||||
mov dword [esp+8], %2 - %1
|
||||
mov dword [esp+12], 0
|
||||
mov dword [esp+16], 0
|
||||
mov dword [esp+20], 0
|
||||
mov eax, esp
|
||||
; special instruction preamble
|
||||
rol edi, 3
|
||||
rol edi, 13
|
||||
rol edi, 29
|
||||
rol edi, 19
|
||||
xchg ebx, ebx
|
||||
; restore state
|
||||
add esp,6*4
|
||||
popa
|
||||
%endmacro
|
||||
|
||||
%else
|
||||
|
||||
%macro selfmod 2
|
||||
%endmacro
|
||||
|
||||
%endif
|
Loading…
Reference in a new issue