diff options
author | Sergei Trofimovich <slyfox@gentoo.org> | 2018-07-06 23:32:25 +0100 |
---|---|---|
committer | Sergei Trofimovich <slyfox@gentoo.org> | 2018-07-06 23:33:09 +0100 |
commit | c068f68557e6a0d7d2f5232221900205076429aa (patch) | |
tree | e7d93e7c22896d33e4e41fe0f3958c3913fe5eab /games-emulation/zsnes/files | |
parent | sys-apps/guix: bump up to 0.15.0 (diff) | |
download | gentoo-c068f68557e6a0d7d2f5232221900205076429aa.tar.gz gentoo-c068f68557e6a0d7d2f5232221900205076429aa.tar.bz2 gentoo-c068f68557e6a0d7d2f5232221900205076429aa.zip |
games-emulation/zsnes: apply stack realignment to more functions
Expand existing stack realignment hack to more C functions
that get called from early init assembly. Fixes zsnes startup
for me.
Bug: https://bugs.gentoo.org/503138
Package-Manager: Portage-2.3.41, Repoman-2.3.9
Diffstat (limited to 'games-emulation/zsnes/files')
-rw-r--r-- | games-emulation/zsnes/files/zsnes-1.51-stack-align-v2.patch | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/games-emulation/zsnes/files/zsnes-1.51-stack-align-v2.patch b/games-emulation/zsnes/files/zsnes-1.51-stack-align-v2.patch new file mode 100644 index 000000000000..35613a953596 --- /dev/null +++ b/games-emulation/zsnes/files/zsnes-1.51-stack-align-v2.patch @@ -0,0 +1,56 @@ +zsnes call C initialization code from assembler. + +Example backtrace: + + Thread 1 "zsnes" received signal SIGSEGV, Segmentation fault. + => 0xf7550275 <+37>: vmovdqa (%esp),%xmm1 + ... + #13 0x5699ef82 in InitSound () at linux/audio.c:336 + #14 0x569a25af in initwinvideo () at linux/sdllink.c:1080 + #15 0x5699fc13 in initvideo () at linux/sdllink.c:1298 + #16 0x56f9d5bc in regptwa () + #17 0x56a34b50 in SA1tableG () + #18 0x56f84788 in selcB800 () + ... + +Call to 'initwinvideo' (first C function) looks like that: + NEWSYM InitPreGame ; Executes before starting/continuing a game + mov byte[pressed+1],2 + pushad + call Start60HZ + %ifdef __OPENGL__ + call drawscreenwin + %endif + call initwinvideo + +Note: pushad / call does not 16-byte maintain stack alignment +and breaks i386 ABI. + +We apply realignment attribute to all functions noticed by users. +Bug: https://bugs.gentoo.org/503138 +--- src/linux/sdllink.c.old ++++ src/linux/sdllink.c +@@ -773,11 +773,11 @@ BOOL InitInput() + { + InitJoystickInput(); + return TRUE; + } + +-int startgame() ++int __attribute__((force_align_arg_pointer)) startgame() + { + static bool ranonce = false; + int status; + + if (!ranonce) +--- a/linux/sdllink.c ++++ b/linux/sdllink.c +@@ -897,7 +897,7 @@ bool OGLModeCheck() + return(cvidmode > 4); + } + +-void initwinvideo(void) ++void __attribute__((force_align_arg_pointer)) initwinvideo(void) + { + DWORD newmode = 0; + |