Amiberry: Exception while adding Z3

Created on 9 May 2020  路  19Comments  路  Source: midwan/amiberry

Describe the bug
Anytime I try to add say 8MB of Z3 then Amiberry generates the below stacktrace. Irrespective of the value of Z3 set emulator will throw an exception.

To Reproduce

  1. Get a uae. Say for Banshee.
  2. Ensure cpu_24bit_addressing=false is set (otherwise I understand it won't allow Z3)
  3. I have set the following (68030 has similar result):
cpu_type=68040
cpu_model=68040
fpu_model=68040
  1. run via ./amiberry -config=conf/Banshee_v3.3_AGA_0633.uae
  2. Amiberry will crash.

Expected behavior
I'd like to add Z3 memory instead of Z2/FASTRAM. Objective would be to run Napalm crisis with Amiberry on a PI (this game comes with a min of 16MB of FAST and 32MB recommended! manual). So far I can't get past the main option screen. The other idea would be to rely on Z3 to prevent some games from flickering during loading screen.

Stacktrace

./amiberry -config=conf/Banshee_v3.3_AGA_0633.uae
INFO: --- New exception ---
INFO: JIT not in use.
INFO: Segmentation Fault
INFO: info.si_signo = 11
INFO: info.si_errno = 0
INFO: info.si_code = 1
INFO: info.si_addr = 836ff000
INFO: r0  = 0x836ff000
INFO: r1  = 0x00000000
INFO: r2  = 0x003ffff0
INFO: r3  = 0x00000000
INFO: r4  = 0x005691bc
INFO: r5  = 0x00000000
INFO: r6  = 0x00000020
INFO: r7  = 0x00000020
INFO: r8  = 0x00000001
INFO: r9  = 0x00000000
INFO: r10 = 0x04007350
INFO: FP  = 0x00573bd4
INFO: IP  = 0x00000000
INFO: SP  = 0x7ed17480
INFO: LR  = 0x00000000
INFO: PC  = 0x76ede114
INFO: CPSR = 0x60000010
INFO: Fault Address = 0x836ff000
INFO: Trap no = 0x0000000e
INFO: Err Code = 0x0000080d
INFO: Old Mask = 0x00000000
INFO: LR - 0x00000000: symbol not found
INFO: Stack trace:
INFO: 0x001b51c8 <(null) + 0x001b51c8> (./amiberry)
INFO: 0x766e86c0 <__default_rt_sa_restorer + 0x00000000> (/lib/arm-linux-gnueabihf/libc.so.6)
INFO: 01: 0x04007350 <(null) + 0x04007350> (./amiberry)
INFO: 02: 0x00573ea4 <(null) + 0x00573ea4> (./amiberry)
INFO: 03: 0x00139fe0 <(null) + 0x00139fe0> (./amiberry)
INFO: IP out of range
INFO: Stack trace (non-dedicated):
INFO: ./amiberry() [0x1b52f8]
INFO: /lib/arm-linux-gnueabihf/libc.so.6(__default_rt_sa_restorer+0) [0x766e86c0]
INFO: End of stack trace.
INFO: --- end exception ---

environment:
Raspberry 3B+
Retropie 4.6
Amiberry v3.1.4 beta (2020-05-02)

cat /proc/sys/kernel/shmmax
4278190079

Additional context
I tried with various cpu, model, chipset, JIT on/off with same outcome. It's really whenever you set a value to z3mem_size= you will end up with a crash.

[snip]
; 
; *** CPU options
; 
finegrain_cpu_speed=1024
cpu_type=68040
cpu_model=68040
fpu_model=68040
cpu_compatible=false
cpu_24bit_addressing=false
fpu_strict=false
compfpu=false
cachesize=0
; 
; *** Memory
; 
chipmem_size=4
z3mapping=uae
fastmem_size=0
a3000mem_size=0
mbresmem_size=0
z3mem_size=8                 // whatever you set here will crash Amiberry!
z3mem_start=0x10000000
bogomem_size=0
gfxcard_hardware_vblank=false
gfxcard_hardware_sprite=false
gfxcard_multithread=false
rtg_modes=0x112
; 
; *** Chipset
; 
chipset=aga
chipset_refreshrate=50.000000
collision_level=playfields
chipset_compatible=A1200
rtc=MSM6242B
ksmirror_a8=true
pcmcia=true
immediate_blits=false
waiting_blits=automatic
fast_copper=false
[snip]
can't recreate

All 19 comments

OK, so you're basically trying to add Z3 memory by editing a config file manually?
Have you tried doing it from the GUI, starting from the Quickstart menu, selecting a model that supports Z3 (e.g. A4000) and then setting some Z3 RAM?

OK, so you're basically trying to add Z3 memory by editing a config file manually?
=> correct :-)

I should have mentioned that I'm fiddling with the config file because I couldn't find a stable way to set Z3 mem straight from the GUI too.
=> Apologize for that.

Actually every time I pick a A3000 or A4000 (030 or 040) quick config from the GUI and hit "reset" Amiberry will crash as well. Which is inline with what's being described in the ticket - as soon as there's Z3 there will be crash.
Note: with those configs there are 8MB of Z3 set by default and I can't use the slider to change that amount (same applies to RTG board yet I could "slide" chip/slow/z2/A4000board/A4000proc). I do have the A4000 3.1 KS rom in my "bios" folder.

So far I can't recreate this, but my main testing platform is an RPI4 running Debian Buster Desktop.
I'll have to test it on an RPI3 also, to see there. And if it still works there, then test it on the latest RetroPie also, just in case.

@nemo93
It works normally for me on an RPI3 as well, when I try the following:

  • Set Quickstart to A4000 (the default config has an 030 with 8MB of Z3 RAM)
  • Click Start

And it also works on RetroPie 4.6 for me, if I follow the same steps. :)

Ok, so for the booter, what we are saying is the QuickStart should be A4000.... but the 030 is a bit excessive in many cases I suspect. We donstill need to try and get the lowest setting on each game to save host cpu time :)

What鈥檚 the reason for needing to use that? Is the 020 not Z3 compatible? Or should it maybe be set to the 020EC cpu to work? (Have you tried this @nemo93 ?)

@HoraceAndTheSpider
No, you don't need to set A4000 in Quickstart to get Z3... That was just the quickest test to see if allocating Z3 RAM works or crashes the system (it works).

You can also set Z3 RAM if you start with an A1200 configuration, and disable the 24-bit addresssing. Though I noticed a little glitch, that disabling 24-bit addressing doesn't seem to update the internal check for having the Z3 RAM slider disabled - I'll need to fix that.

So a workaround is to just choose an 030, then switch back to an 020 (with no 24-bit addressing), and then the slider is enabled. :)

I've fixed the GUI issue, where the RAM panel would not get refreshed when the 24-bit addressing option was changed (so the Z3 slider would remain in the previous state it had).

So now, you can set an A1200 config, disable 24-bit addressing, and add Z3 RAM.

related: Tested with Dungeon Master (which should have z3=16meg) WHDload autoboot.

confirmed in the amiberry log;

                PRIMARY_CONTROL=MOUSE
                PORT0=MOUSE
                PORT1=JOY
                SCREEN_HEIGHT=200
                SCREEN_CENTERH=SMART
                SCREEN_CENTERV=SMART
                Z3_RAM=16

However, the z3 is not being applied in this instance.

Code needs to be fixed to;

  • detect that Z3 is in the XML
    -- remove Z2 (maybe not essential?) .
    -- force 24-bit addressing to be OFF
    -- set the Z3 memory

I did try adding CPU_24BITADDRESSING=FALSE to the XML manually, but this didnt work - possibly this is needs to be set in the WHDLoad autoboot code before the memory stuff. (I doubt this has been done), and i can see in the log this fails with Can't use 32-bit memory when using a 24 bit address space.

@HoraceAndTheSpider I was just trying to add some Z3 and read that 030/040 would be fine for good. If it worked I'd have tried with other CPU :-)

@midwan thank you very much. Apologize also for the time waste. I tried again after upgrading to Buster and compiling Amiberry with with your latest fix. Unfortunately I keep on having the same exception on my 3B+ (kernel 4.19.97-v7+). I still can't add Z3 and the slider doesn't work either despite me following closely your steps above (either going 4000 or 1200+disabling 24bit).

@nemo93 no worries - it was more a point to @midwan about why we would be unlikely to just skip to the A4000 qucikstart - which is probably the easiest solution, but not the 'most correct' one

the good news about all this is that we have revealled a bug in the whd booter for the handling of the z3 memory / cpu addressing :)

@nemo93
Are you testing with the latest binary that RetroPie provides?
If so, please try compiling the latest from source, as the fix in the GUI just went in a few hours ago. ;)

Even with the latest binary release however, it doesn't crash here.
The steps I've followed are:

  • Start Amiberry GUI
  • Select A1200 Quickstart option
  • Go to CPU panel, disable 24-bit addressing (if you're running the older binary, switch to 030 and back to 020 instead, to refresh the RAM panel)
  • Go to RAM panel, add some Z3 memory. I've tried it with 8MB and all the way up to 512MB.
  • Click start

I'm also testing this on an RPI3B+, running the latest RetroPie 4.6 (freshly installed and updated today).

thanks again Guys for your patience. I'm still stuck here I really don't undestand why. I don't want to waste more of your time hence you could close this issue anytime. I'll reopen it if I find anything. Don't worry!

I recompiled yesterday thanks to Retropie "setup" and got myself a fresh Amiberry binary (before you committed the "smart centering" PR :-)). I then launched Amiberry from the command-line directly (./amiberry). At this stage I'll go straight to Amiberry GUI. So far so good. Then I followed your guidance:

  • I go to Quickstart
  • I pick the A1200 item and click on "Set configuration" at the bottom
  • I move on to CPU panel.
  • I disable/untick the 24-bit addressing box
  • I then go to RAM and ... I can point to the Z3 slider but it won't move. It remains at "0" no matter what.

About the exception raised and reported above. For the sake of completeness let me share what I have done exactly (also with a freshly compiled binary).

  • I don't have a way to launch Amiberry GUI straight from Pegasus (EmulationStation-like frontend).
  • Therefore I just run a game and enter the GUI from there.
  • At this stage I follow the same guidance (go to Quickstart/get the A1200/Set configuration)
  • I ensure 020 is set and 24-bit addressing disabled.
  • I move on to RAM and this time I can't even access the Z3 slider!
  • if I pick A4000 quickstart which comes with Z3, click on Set configuration and hit "Reset" this time the emulator will crash.
  • it may be related to the fact Retropie launch Amiberry via a bash script. I need to have a look there as it may interfere in some ways. That's the only lead/suspect I got.

I don't know what I'm doing wrong here on my setup...

@nemo93
Are you sure you recompiled from RetroPie, and not just installed the latest binary release they provide?
What's the version string say in the About panel? If it's not 3.1.4 beta (2020-05-10) then you don't have the latest version installed.

But even with an older version, you can still use the slider:

  • Select A1200 from the Quickstart (no need to click on Set Configuration, unless you've changed something and you want it to reset to this Quickstart option)
  • Go to CPU panel
  • Select 030, then switch back to 020 (this will clear the 24-bit addressing part and refresh the RAM panel)
  • Go to RAM Panel
  • Change the Z3 slider
  • Click Start.

@midwan thanks again. I do confirm I'm updating/compiling "from source" all the time. My current version according to the About panel is indeed 3.1.4 beta (2020-05-10). I still can't access the Z3 slider :-( In the RAM panel, it starts from the top/chip then if I press down I'll go slow, Z2 and then it jumps to A4000 motherboard/proc (those I could change).

If that matters I'm doing all this config via controller (xbox one wireless if that matters). I never had any issue to navigate the GUI via such controller.

@nemo93 when you are re-compiling are you doing make clean beforehand?

i'll see if i can reproduce this on my Pi3 when i update it

definitely doing a proper make clean. Really I don't see what's wrong on my setup. I'll get a Pi4 and test again with a fresh image etc. Apologize for time wasting. I'll reopen if I find something useful.

Thanks for the help!

Just in case (compiled from Retropie Setup):

pi@retropie /opt/retropie/emulators/amiberry $ ldd amiberry
        linux-vdso.so.1 (0x7efe9000)
        /usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so => /usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so (0x76f98000)
        libbcm_host.so => /opt/vc/lib/libbcm_host.so (0x76f6e000)
        libvchiq_arm.so => /opt/vc/lib/libvchiq_arm.so (0x76f58000)
        libSDL2-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libSDL2-2.0.so.0 (0x76e2f000)
        libSDL2_image-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libSDL2_image-2.0.so.0 (0x76df3000)
        libSDL2_ttf-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libSDL2_ttf-2.0.so.0 (0x76ddc000)
        libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0x76db2000)
        libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0x76d87000)
        libpng16.so.16 => /usr/lib/arm-linux-gnueabihf/libpng16.so.16 (0x76d4b000)
        librt.so.1 => /lib/arm-linux-gnueabihf/librt.so.1 (0x76d34000)
        libxml2.so.2 => /usr/lib/arm-linux-gnueabihf/libxml2.so.2 (0x76bb7000)
        libFLAC.so.8 => /usr/lib/arm-linux-gnueabihf/libFLAC.so.8 (0x76b57000)
        libmpg123.so.0 => /usr/lib/arm-linux-gnueabihf/libmpg123.so.0 (0x76afa000)
        libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0x76ae7000)
        libmpeg2convert.so.0 => /usr/lib/arm-linux-gnueabihf/libmpeg2convert.so.0 (0x76ad1000)
        libmpeg2.so.0 => /usr/lib/arm-linux-gnueabihf/libmpeg2.so.0 (0x76aa8000)
        libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0x76961000)
        libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0x768df000)
        libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0x768b2000)
        libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0x76764000)
        libvcos.so => /opt/vc/lib/libvcos.so (0x7674b000)
        libjpeg.so.62 => /usr/lib/arm-linux-gnueabihf/libjpeg.so.62 (0x76706000)
        libtiff.so.5 => /usr/lib/arm-linux-gnueabihf/libtiff.so.5 (0x76686000)
        libwebp.so.6 => /usr/lib/arm-linux-gnueabihf/libwebp.so.6 (0x76622000)
        /lib/ld-linux-armhf.so.3 (0x76fad000)
        libfreetype.so.6 => /usr/lib/arm-linux-gnueabihf/libfreetype.so.6 (0x7657f000)
        libicui18n.so.63 => /usr/lib/arm-linux-gnueabihf/libicui18n.so.63 (0x76331000)
        libicuuc.so.63 => /usr/lib/arm-linux-gnueabihf/libicuuc.so.63 (0x761ab000)
        libicudata.so.63 => /usr/lib/arm-linux-gnueabihf/libicudata.so.63 (0x747ad000)
        liblzma.so.5 => /lib/arm-linux-gnueabihf/liblzma.so.5 (0x7477c000)
        libogg.so.0 => /usr/lib/arm-linux-gnueabihf/libogg.so.0 (0x74767000)
        libzstd.so.1 => /usr/lib/arm-linux-gnueabihf/libzstd.so.1 (0x746ce000)
        libjbig.so.0 => /usr/lib/arm-linux-gnueabihf/libjbig.so.0 (0x746b1000)

Seems related to Pegasus Frontend as Amiberry is working as expected under Raspbian or from Retropie/console/terminal (no frontend running in background).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

phalkon13 picture phalkon13  路  3Comments

Gerbinist picture Gerbinist  路  8Comments

midwan picture midwan  路  10Comments

ransom1122 picture ransom1122  路  5Comments

Babbonz picture Babbonz  路  3Comments