[context] Floating Point Exception

Attempting to use the latest Boost.Context implementation on Mac OS X and everything was going fine except for a few small issues: 1) fcontext_x86_64_sysv_macho_gas.S fails to compile because: fcontext_x86_64_sysv_macho_gas.S:50:Unknown pseudo-op: .type fcontext_x86_64_sysv_macho_gas.S:50:Rest of line ignored. 1st junk character valued 95 (_). fcontext_x86_64_sysv_macho_gas.S:51:Alignment too large: 15. assumed. 2) I can fix those errors by commenting out the .type line and changing to .balign 16 or .align 8 3) Compiled with: gcc-4.5.0 -o fcontext_x86_64_sysv_macho_gas.S.o -c fcontext_x86_64_sysv_macho_gas.S 4) protected_stack() cannot map /dev/zero - solutions were to mkfile -n 1m /tmp/zero and then open that - use ::mmap( 0, size__, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); instead of specifying any file. After getting all of those things "working" I attempted to print out a floating point number and it dies deep inside __ntoa(), but I could get it to crash by doing any floating point operations from within the contexts stack. I noticed that none of the examples test for floating point ops. You might want to include that as part of your standard testing. Dan

Am 29.06.2011 20:18, schrieb Daniel Larimer:
could you write a little helloworld-app and compile it with -S and send me the generated assembler?
MAP_ANON is not standard - have think about it (would require to test for addition additional preprocessor macros)
fixed missing fp x87 word initialisation
I noticed that none of the examples test for floating point ops. You might want to include that as part of your standard testing.
thx, added http://ok73.ok.funpic.de/boost.context-0.7.4.zip Oliver

On Jul 1, 2011, at 3:44 PM, Oliver Kowalke wrote:
Your new code still has the invalid Unknown pseudo-op: .type.
Sure. Do you want it to use your context or just want to see int main( ) { printf( "hello world"); return 0; } ?
Seems to have fixed things. Asm version is 2x as fast as ucontext for my use case.
I noticed that none of the examples test for floating point ops. You might want to include that as part of your standard testing.
I saw you added these tests to git... did it work on other platforms, or did you have to change multiple asm files?

Am 02.07.2011 18:17, schrieb Daniel Larimer:
Your new code still has the invalid Unknown pseudo-op: .type.
.type tells the compile which kind of symbol is encountered -> function I need some assembler genereated by gcc to see how the meta infos look like on MacOS X (I've no installation)
yes - at best you generated a shared library with position-independed code (-fPIC) and link the test app. The assembler (gcc -S) file should tell me how functions are addresses in pic on MacOSX/Mach-O. The meta infos (see above -> .type) are provided too.
fixed missing fp x87 word initialisation
Seems to have fixed things. Asm version is 2x as fast as ucontext for my use case.
how do you test it? I get a spped-up factor of 10x on Linux/x86. boost.context contains a subfolder 'performance' with code measuring the CPU cycles
I've modified the asm files for x86 platform (added missing fp-register initialisation) and I've added an example and a test for floating point ops too (which should work on all platforms)

Hello Daniel, could you check the modifications - the lib is available at https://github.com/olk/boost.context. If possible run bjam in the test subdir. thx and best regards, Oliver Am 29.06.2011 20:18, schrieb Daniel Larimer:
participants (2)
-
Daniel Larimer
-
Oliver Kowalke