VOGONS


SVN on OS X - core=dynamic causes segfault

Topic actions

Reply 40 of 110, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

step 1. and 2. can be shortcut. We only took the long route because I didn't know you wanted a portable, not fully featured one (and to make sure that this works first before proceeding)
so it would be:
1. Install macports, in terminal run the commands

sudo port install libsdl +universal +no_x11
sudo port install libpng +universal
sudo port install pkgconfig +universal

Step 2. is not necessary anymore (unless you installed libsdl_sound or libsdl_net before)

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 41 of 110, by emendelson

User metadata
Rank Oldbie
Rank
Oldbie

Have edited to make these corrections. Thanks again.

Reply 43 of 110, by emendelson

User metadata
Rank Oldbie
Rank
Oldbie

Urgh - I meant to do that and forgot. Next time I'll read my own post.

Reply 44 of 110, by gulikoza

User metadata
Rank Oldbie
Rank
Oldbie

Dynrec core crashes because data is above 4GB (something that is not true for Windows and Linux). The first dosbox instruction (if I'm still doing this right 😀) is 0xcd which generates something like:

0x11e84c011:	mov    eax,DWORD PTR [rip-0x1e60f0f7]        # 0x10023cf20 <CPU_Cycles>
0x11e84c017: cmp eax,0x0
0x11e84c01a: jle 0x11e84c06d
0x11e84c020: sub DWORD PTR ds:0x23cf20,0x1

The first 3 instructions are the cycle check I think, the last one is the beginning from dyn_interrupt()->dyn_reduce_cycles()->gen_sub_direct_word()->gen_sub_direct_byte() and it's the one that crashes. Notice how it's trying to substract 1 from CPU_Cycles but the address is obviously wrong.
I don't remember exactly, but we had problems with x86_64 addressing. I do think that at the time the documentation said all data would be <2GB but this is obviously not the case anymore. It appears, x86_64 decoder would need to be rewritten to use RIP relative addressing to make it work on OS X.

http://www.si-gamer.net/gulikoza

Reply 45 of 110, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

I'll need to write this all up in the wiki, so we don't need to figure this all out again and again 😉
Thanks guli

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 46 of 110, by gulikoza

User metadata
Rank Oldbie
Rank
Oldbie

Actually, something like gen_memaddr() should be used I guess...let's see how this works 😀

http://www.si-gamer.net/gulikoza

Reply 49 of 110, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Dynrec core crashes because data is above 4GB (something that is not true for Windows and Linux).

I somewhen tried (shortly) to get it working on win64 but the problem was that
memory addressing would have been awkward as the malloc'd memory for the
generated code was at pretty high adresses whereas regular code was <4GB.
So the currently used 32bit-relative addressing did not work, and only [eax] was
additionally available iirc.

Reply 50 of 110, by gulikoza

User metadata
Rank Oldbie
Rank
Oldbie

This seems to fix it...and hopefully not break anything else 😁

edit: Yeah, I guess the only problem remains when data>4GB and rip offset> +- 2GB. But at least dosbox will not segfault anymore but report the error.

Last edited by gulikoza on 2011-01-07, 20:09. Edited 1 time in total.

http://www.si-gamer.net/gulikoza

Reply 52 of 110, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

he he, had time right away to test it.
good news: it doesn't crash when I set core dynamic
bad news: it crashes when I start the PCPbench

When I set the core to dynamic before and then start the benchmark I get a sgmentation fault. When I leave it on auto, I get an "illegal instruction" crash.

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 53 of 110, by gulikoza

User metadata
Rank Oldbie
Rank
Oldbie

There's a small typo in the patch...cache_addb(83) should actually read cache_addb(0x83). File updated 😁

http://www.si-gamer.net/gulikoza

Reply 54 of 110, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

still crashes pcpbench. This time I actually see the starting message of PCPbench before crashing. PCPBench can be downloaded from Benchmark Programs: Some suggestions please?

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 55 of 110, by gulikoza

User metadata
Rank Oldbie
Rank
Oldbie

I have no idea this time why it crashes. Actually it works if you first run it with normal core and then repeat with dynrec 😀

http://www.si-gamer.net/gulikoza

Reply 57 of 110, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Actually it works if you first run it with normal core and then repeat with dynrec

Maybe some strange caching effect, well...

but at less than half the speed the 32bit dyncore does

Of course, it's intended for 64bit only (or non-x86) systems.

Reply 58 of 110, by gulikoza

User metadata
Rank Oldbie
Rank
Oldbie

For me it crashes in FPU_FCOS(), line fpu.regs[TOP].d = cos(fpu.regs[TOP].d);
Seems like something is wrong with math library, code generator correctly constructs the call to FPU_FCOS(), putting a printf at the top of the function works - it crashes at the cos() function.

http://www.si-gamer.net/gulikoza

Reply 59 of 110, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Can you trace at that point? Can you check the real status and control word?