13
0

windows 32bit asm/fpu support.

This still leaves cache_aligned_malloc() in
libs/pbd/malign.cc pending _aligned_free (windows crashes when using
free() on memory allocated with _aligned_malloc()).

So far however there seems to be no issue with default malloc
for audio+midi buffers on win32…
This commit is contained in:
Robin Gareus 2015-04-24 02:43:52 +02:00
parent 63b3d06fd7
commit 6cb742c289
2 changed files with 15 additions and 11 deletions

View File

@ -49,17 +49,12 @@ FPU::FPU ()
#ifdef PLATFORM_WINDOWS
#ifndef USE_X86_64_ASM
/* no 32 bit version of assembler for windows */
return;
#else
// Get CPU flags using Microsoft function
// It works for both 64 and 32 bit systems
// no need to use assembler for getting info from register, this function does this for us
int cpuInfo[4];
__cpuid (cpuInfo, 1);
cpuflags = cpuInfo[3];
#endif
#else
@ -98,7 +93,7 @@ FPU::FPU ()
: "%rax", "%rbx", "%rcx", "%rdx"
);
#endif /* USE_X86_64_ASM */
#endif /* _LP64 */
#endif /* PLATFORM_WINDOWS */
if (cpuflags & (1<<25)) {
@ -124,10 +119,18 @@ FPU::FPU ()
*/
#ifndef HAVE_POSIX_MEMALIGN
# ifdef PLATFORM_WINDOWS
fxbuf = (char **) _aligned_malloc (sizeof (char *), 16);
assert (fxbuf);
*fxbuf = (char *) _aligned_malloc (512, 16);
assert (*fxbuf);
# else
# warning using default malloc for aligned memory
fxbuf = (char **) malloc (sizeof (char *));
assert (fxbuf);
*fxbuf = (char *) malloc (512);
assert (*fxbuf);
# endif
#else
(void) posix_memalign ((void **) &fxbuf, 16, sizeof (char *));
assert (fxbuf);
@ -163,8 +166,13 @@ FPU::FPU ()
_flags = Flags (_flags | HasDenormalsAreZero);
}
#if !defined HAVE_POSIX_MEMALIGN && defined PLATFORM_WINDOWS
_aligned_free (*fxbuf);
_aligned_free (fxbuf);
#else
free (*fxbuf);
free (fxbuf);
#endif
}
#endif
}

View File

@ -4,7 +4,6 @@ from waflib import Options
from waflib import TaskGen
import os
import sys
import re
# Version of this package (even if built as a child)
MAJOR = '4'
@ -146,9 +145,6 @@ def build(bld):
if bld.env['build_target'] == 'x86_64':
obj.defines += [ 'USE_X86_64_ASM' ]
if bld.env['build_target'] == 'mingw':
if re.search ('/^x86_64/', str(bld.env['CC'])):
obj.defines += [ 'USE_X86_64_ASM' ]
obj.defines += ['NO_POSIX_MEMALIGN' ]
obj.source += [ 'windows_special_dirs.cc' ]
obj.uselib += ' OLE'