68000 Exceptions on 68030 Emu & Emu Style?

WinSTon, Nostalgia, MSA Converter, FloImg, Makedisk and all the others.

Moderators: Mug UK, Moderator Team

DavidS
Retro freak
Retro freak
Posts: 12
Joined: Thu Sep 15, 2016 11:35 pm

68000 Exceptions on 68030 Emu & Emu Style?

Postby DavidS » Sun Sep 18, 2016 1:04 am

Background First:

I am attempting to get a port of EmuTOS with some extras to run almost native on the Raspberry Pi 2/3. I say almost native as it is running on a emulated 68030 (mostly, no MMU yet), though the drivers are GEM, BIOS, XBIOS and TSR on the 68030 side. The exception being that the core USB driver is on the ARM side and loaded before the 68030 emulation (at least for now), as the Keyboard and Mouse are USB.

The 68030 core I am implementing is going to allow the multi core usage (one per ARM core, so 4 68030 cores).

The trouble 1 Exceptions:
I seem to be having some trouble with the 68030/68020 exception stack, not sure which portion is the trouble maker, though it is there.

I have no trouble at all if I just compile for 68000 and use the 68000 style exception stack.

As such I am wondering if there would be any problem if I implement the CPU emulator using a 68000 style exception stack while supporting the 68030 instruction set and full 32 bit addressing?

Trouble 2 Emulation Model:
Using a lazy JIT emulation I am thus far getting slower results than using a simple hand optimized ARM Assembly software emulation.

Is it worth it to keep on attempting to get the lazy JIT up to speed, or should I just focus on the software emulation?

Thank you in advance:
I thank anyone for there input in advance.

AtariZoll
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2978
Joined: Mon Feb 20, 2012 4:42 pm
Contact:

Re: 68000 Exceptions on 68030 Emu & Emu Style?

Postby AtariZoll » Sun Sep 18, 2016 7:13 am

By interrupts only difference in stackframe is additional 16-bit Vector offset saved in case of 68010-30 . Addresses are full 32-bit at every 68000 CPU in stackframe. I don't think that problem is stackframe. Unless there is case of incorrectly set stackframe flag/system variable in EmuTOS.

I don't know much about EmuTOS. As see, you did some port of it. Maybe there are some important parts missing, or not used properly in code ?

In TOS 2.06 there is test for stackframe system variable (set according to detected CPU at boot) at every trap, and then using proper code section. Probably something similar is in EmuTOS.

May I ask what you making - what can do with 4 emulated 68030 "cores" ?
Famous Schrodinger's cat hypothetical experiment says that cat is dead or alive until we open box and see condition of poor animal, which deserved better logic. Cat is always in some certain state - regardless from is observer able or not to see what the state is.

SteveBagley
Captain Atari
Captain Atari
Posts: 154
Joined: Mon Jan 21, 2013 9:31 am

Re: 68000 Exceptions on 68030 Emu & Emu Style?

Postby SteveBagley » Sun Sep 18, 2016 8:11 am

DavidS wrote:
Trouble 2 Emulation Model:
Using a lazy JIT emulation I am thus far getting slower results than using a simple hand optimized ARM Assembly software emulation.

Is it worth it to keep on attempting to get the lazy JIT up to speed, or should I just focus on the software emulation?


It's a good question actually -- Darek Mihock, author of Gemulator (and then writing emulators at Microsoft and Intel), wrote some fascinating blog posts on this very issue, see:

http://emulators.com/nx_toc.htm

There's a lot of stuff, but there seems to be a short-ish summary in this:

http://emulators.com/docs/VirtNoJit_Paper.pdf

He definitely favors the trad. emulation approach over JITting… It's also worth bearing in mind that JIT will only benefit when you can amortize the cost of compilation by running the code many times.

Steve

BlankVector
Captain Atari
Captain Atari
Posts: 409
Joined: Wed Oct 24, 2007 7:52 pm
Location: France
Contact:

Re: 68000 Exceptions on 68030 Emu & Emu Style?

Postby BlankVector » Sun Sep 18, 2016 7:13 pm

DavidS wrote:I am attempting to get a port of EmuTOS with some extras to run almost native on the Raspberry Pi 2/3. I say almost native as it is running on a emulated 68030 (mostly, no MMU yet), though the drivers are GEM, BIOS, XBIOS and TSR on the 68030 side.

Very good, this is the thing to do.
Then you could later move the some parts to native ARM, it that makes sense.

DavidS wrote:I seem to be having some trouble with the 68030/68020 exception stack, not sure which portion is the trouble maker, though it is there.

The first question is to determine which kind of trouble. And use a debugger or some traces to see what happens.

Regarding to EmuTOS, at startup it autodetects the actual CPU. Then it uses the proper stack frame where appropriate. The first thing to check is to verify which CPU is detected.

DavidS wrote:Is it worth it to keep on attempting to get the lazy JIT up to speed, or should I just focus on the software emulation?

JIT or multi-core support are nice speed-ups, but if the whole thing does not work at all, that's useless.

DavidS
Retro freak
Retro freak
Posts: 12
Joined: Thu Sep 15, 2016 11:35 pm

Re: 68000 Exceptions on 68030 Emu & Emu Style?

Postby DavidS » Mon Sep 19, 2016 2:41 am

SteveBagley wrote:
DavidS wrote:
Trouble 2 Emulation Model:
Using a lazy JIT emulation I am thus far getting slower results than using a simple hand optimized ARM Assembly software emulation.

Is it worth it to keep on attempting to get the lazy JIT up to speed, or should I just focus on the software emulation?


It's a good question actually -- Darek Mihock, author of Gemulator (and then writing emulators at Microsoft and Intel), wrote some fascinating blog posts on this very issue, see:

http://emulators.com/nx_toc.htm

There's a lot of stuff, but there seems to be a short-ish summary in this:

http://emulators.com/docs/VirtNoJit_Paper.pdf

He definitely favors the trad. emulation approach over JITting… It's also worth bearing in mind that JIT will only benefit when you can amortize the cost of compilation by running the code many times.

Steve


Thank you for that. I would say it is quite worth going with a simple translation emulator.

DavidS
Retro freak
Retro freak
Posts: 12
Joined: Thu Sep 15, 2016 11:35 pm

Re: 68000 Exceptions on 68030 Emu & Emu Style?

Postby DavidS » Mon Sep 19, 2016 2:43 am

I figured out the stack frame trouble. I was doing an extra bytswap that was unneeded (as oposite endianes between the 680x0 and the ARM in the Raspberry Pi's).

Kind of a brain fart on my part.

DavidS
Retro freak
Retro freak
Posts: 12
Joined: Thu Sep 15, 2016 11:35 pm

Re: 68000 Exceptions on 68030 Emu & Emu Style?

Postby DavidS » Sat Oct 29, 2016 8:53 pm

I know I have not said anything in a bit, though I am still working on this. It is interesting on the RPi 3B.

I am making heavy use of Aranym on Raspbian Linux in the mean time.


Social Media

     

Return to “Other emulators & tools”

Who is online

Users browsing this forum: No registered users and 1 guest