Page 1 of 1

Compiling on Linux - "dyngen: ret or jmp expected..."

Posted: Thu Feb 23, 2012 12:29 pm
by Flamkuch
Hi,

I've been trying to compile SheepShaver on Arch Linux. I've followed the instructions listed on the wiki, but I've had to apply this little patch to be able to run make (as suggested there, most recent comment):

Code: Select all

#Eliminate the broken x86(_64) test as suggested at http://www.emaculation.com/doku.php/compiling_sheepshaver_basilisk#building_basiliskii_in_linux_flavours
sed -i '107,120 s:^:dnl :' configure.ac
#Fix the name conflict between loacal file_handle and /usr/include/bits/fcntl.h file_handle by renaming the local struct mac_file_handle
sed -e 's/\<file_handle\>/mac_file_handle/g' sys_unix.cpp
So then I run make but it fails at:

Code: Select all

./dyngen -o ppc-dyngen-ops.hpp obj/ppc-dyngen-ops.o
dyngen: ret or jmp expected at the end of op_jump_next_A0
make: *** [ppc-dyngen-ops.hpp] Fel 1
So I took a peek at that "ppc-dyngen-ops.hpp" header, and the incriminating function seems to be:

Code: Select all

/**
 *		Generate possible call to next basic block without going
 *		through register state restore & full cache lookup
 **/

void OPPROTO op_jump_next_A0(void)
{
	powerpc_block_info *bi = (powerpc_block_info *)A0;
	uint32 pc = powerpc_dyngen_helper::get_pc();
	if (likely(bi->pc == pc) || likely((bi = powerpc_dyngen_helper::find_block(pc)) != NULL))
		goto *(bi->entry_point);
	dyngen_barrier();
}
I don't know what I can do at this point to fix it.
Thanks for any input!

Re: Compiling on Linux - "dyngen: ret or jmp expected..."

Posted: Sat Feb 25, 2012 11:18 am
by Cat_7
Hi,

Can't help you there. The same happens in 32 bit Ubuntu 11.10 and 64 bit Suse 12.1

Best,
Cat_7

Re: Compiling on Linux - "dyngen: ret or jmp expected..."

Posted: Wed Feb 29, 2012 4:29 am
by Myrd
I guess the question is what the generated assembly for op_jump_next_A0 on your system looks like.

Can you attach the output of running "objdump -d obj/ppc-dyngen-ops.o"?

Re: Compiling on Linux - "dyngen: ret or jmp expected..."

Posted: Wed Feb 29, 2012 6:39 am
by Cat_7
Found this in the command output in Ubuntu 32 bit:
000028ee <_Z15op_jump_next_A0v>:
28ee: 8b 95 ac 03 00 00 mov 0x3ac(%ebp),%edx
28f4: 89 d8 mov %ebx,%eax
28f6: 39 13 cmp %edx,(%ebx)
28f8: 74 1a je 2914 <_Z15op_jump_next_A0v+0x26>
28fa: 89 d0 mov %edx,%eax
28fc: c1 e8 02 shr $0x2,%eax
28ff: 25 ff 7f 00 00 and $0x7fff,%eax
2904: 8b 84 85 f8 07 0c 00 mov 0xc07f8(%ebp,%eax,4),%eax
290b: 85 c0 test %eax,%eax
290d: 74 04 je 2913 <_Z15op_jump_next_A0v+0x25>
290f: 3b 10 cmp (%eax),%edx
2911: 74 01 je 2914 <_Z15op_jump_next_A0v+0x26>
2913: c3 ret
2914: ff 60 40 jmp *0x40(%eax)



Found this on 64 bit Suse:
00000000000026d4 <_Z15op_jump_next_A0v>:
26d4: 8b 95 ac 03 00 00 mov 0x3ac(%rbp),%edx
26da: 48 89 d8 mov %rbx,%rax
26dd: 48 39 13 cmp %rdx,(%rbx)
26e0: 74 1f je 2701 <_Z15op_jump_next_A0v+0x2d>
26e2: 48 89 d0 mov %rdx,%rax
26e5: 48 c1 e8 02 shr $0x2,%rax
26e9: 25 ff 7f 00 00 and $0x7fff,%eax
26ee: 48 8b 84 c5 28 08 0c mov 0xc0828(%rbp,%rax,8),%rax
26f5: 00
26f6: 48 85 c0 test %rax,%rax
26f9: 74 05 je 2700 <_Z15op_jump_next_A0v+0x2c>
26fb: 48 3b 10 cmp (%rax),%rdx
26fe: 74 01 je 2701 <_Z15op_jump_next_A0v+0x2d>
2700: c3 retq
2701: ff 60 70 jmpq *0x70(%rax)

Re: Compiling on Linux - "dyngen: ret or jmp expected..."

Posted: Wed Feb 29, 2012 11:46 am
by Flamkuch
64 bit Arch Linux here, I get the same output as what Cat_7 posted for his 64 bit Suse system.

Re: Compiling on Linux - "dyngen: ret or jmp expected..."

Posted: Thu Mar 01, 2012 3:56 am
by Myrd
Strange. Both of those do have a "ret" - i.e 0xc3 as their second-to-last instructions.

Can someone post the equivalent output from an earlier Linux version that doesn't exhibit this problem?

Edit: I've committed a change that may help. Can you try again with that version?

Re: Compiling on Linux - "dyngen: ret or jmp expected..."

Posted: Thu Mar 01, 2012 7:34 am
by Cat_7
Hi,

SheepShaver builds again!
Perhaps due to my virtual box install of OpenSUSE 64, I only get a black screen when running it. In Fedora 64, I get a segmentation fault.
Lets see what Flamkuch has to say.

The Basilisk errors remain the same, as described here: http://www.emaculation.com/forum/viewto ... =20&t=7490

btw: would you have any idea on how to get rid of not being able to run without setting: vm.mmap_min_addr = 0 in etc/sysctl.conf on linux systems?

Thanks!

Cat_7

Re: Compiling on Linux - "dyngen: ret or jmp expected..."

Posted: Thu Mar 01, 2012 1:28 pm
by Flamkuch
Good to hear this fixes the compilation issue! I'm on a restricted network on weekdays so I can't checkout from CVS, but I'll give it a go when I get home this weekend.

Re: Compiling on Linux - "dyngen: ret or jmp expected..."

Posted: Fri Mar 02, 2012 9:58 am
by Flamkuch
I managed to checkout. Sheepshaver builds fine here too!

Trying to allocate a fairly large amount of memory (512M) results in an "ERROR: Cannot map area for RAM and ROM" error. (even though I have 4G on this system)
With a lower amount of memory (128M), SheepShaver segfaults when JIT is enabled.
Mac OS starts up when JIT is disabled and illegal memory access is ignored, but it eventually crashes shortly after Mac OS is fully booted up.

Code: Select all

SheepShaver: Fatal IO error 11 (Resursen tillfälligt otillgänglig) on X server :0.0.
SIGSEGV
  pc 0x452443
  ea 0x1e10000
 r0 00006004   r1 68ffe000   r2 41ef3c0c   r3 000000ff
 r4 00003ab0   r5 00000005   r6 00000000   r7 00000000
 r8 4971abb0   r9 4a26dcf0  r10 41efdbac  r11 0002f072
r12 41efdbac  r13 82000048  r14 00000001  r15 302f0004
IIRC I use OS 9.0.4 and a new world ROM. This setup works fine in Windows with the precompiled executables.

If you need any more info I'll be glad to help :)

Re: Compiling on Linux - "dyngen: ret or jmp expected..."

Posted: Fri Mar 02, 2012 11:49 am
by Cat_7
Resursen tillfälligt otillgänglig
You're from Sweden?. Seeing that makes me pine for the north. I've only been to the north on 8 holidays. Need more ;-) Perhaps a relocation from the Netherlands might help.

Best,
Cat_7

Re: Compiling on Linux - "dyngen: ret or jmp expected..."

Posted: Fri Mar 02, 2012 2:20 pm
by Flamkuch
Cat_7 wrote:
Resursen tillfälligt otillgänglig
You're from Sweden?
Hehe, nice find. Nope, I'm French, but I've lived in Sweden. As you might imagine I never get to speak Swedish in France, so setting my computer to Swedish is a little way to keep my Swedish from getting rusty :)

It's a very nice place indeed, wish I could go back soon. Never been to the NL yet, but I want to!

Re: Compiling on Linux - "dyngen: ret or jmp expected..."

Posted: Sat Mar 31, 2012 2:38 pm
by Tux
It's building on 64-bit Fedora 16 as well. My CVS is of March 30th, for your information. Of course, I set the sysctl parameter and disabled SELinux and BAM! SheepShaver. I might build an RPM later.

Re: Compiling on Linux - "dyngen: ret or jmp expected..."

Posted: Sat Mar 31, 2012 3:25 pm
by Flamkuch
Hmm. I've tried building it again with today's CVS checkout. It does compile fine, but it doesn't really work. It still segfaults if JIT is on, and it's very slow (and eventually stalls or segfaults anyway) without JIT.

I'm still getting that "Fatal IO error 11" all the time.

What configure options did you use when compiling?

I am interested in your binary if you plan on building an RPM, so that I can see if something's wrong with the way I compiled it.

EDIT: I'm opening a new topic as the issue I brought up in the first post has been solved