[hatari-devel] SIGSEGV error with MMU

Laurent Sallafranque laurent.sallafranque at free.fr
Wed Feb 23 23:40:59 CET 2011


Hi,

1) Is your code really running from m68k_run_mmu040() instead of some
    of the other m68k_run_xxx() functions?

I've found the solution. This was the problem : from bt, I can see that 
code runs from run_2p and not from mmu_040.

(gdb) bt
#0  0x00000000004f4e40 in get_iword ()
     at /home/laurent/Atari/hatari/src/cpu/newcpu.h:326
#1  next_iword () at /home/laurent/Atari/hatari/src/cpu/newcpu.h:327
#2  0x00000000006fe8d4 in op_11b0_31_ff (opcode=5040)
     at /home/laurent/Atari/hatari/build/src/cpu/cpuemu_31.c:7548
#3  0x00000000004ff737 in m68k_run_2p ()
     at /home/laurent/Atari/hatari/src/cpu/newcpu.c:3516
#4  0x00000000004fd243 in m68k_go (may_quit=<value optimized out>)
     at /home/laurent/Atari/hatari/src/cpu/newcpu.c:3723
#5  0x00000000004b2056 in M68000_Start ()
     at /home/laurent/Atari/hatari/src/m68000.c:241
#6  0x00000000004b2916 in main (argc=1, argv=0x7fffffffe308)
     at /home/laurent/Atari/hatari/src/main.c:773

It seems to be because of the following code from newcpu.c (function 
m68k_go)

         set_x_funcs ();
         if (mmu_enabled && !currprefs.cachesize) {
             run_func = m68k_run_mmu;
         } else {
             run_func = currprefs.cpu_cycle_exact && currprefs.cpu_model 
== 68000 ? m68k_run_1_ce :
                 currprefs.cpu_compatible && currprefs.cpu_model == 
68000 ? m68k_run_1 :
#ifdef JIT
                 currprefs.cpu_model >= 68020 && currprefs.cachesize ? 
m68k_run_jit :
#endif
                 (currprefs.cpu_model == 68040 || currprefs.cpu_model == 
68060) && currprefs.mmu_model ? m68k_run_mmu040 :
                 currprefs.cpu_model >= 68020 && 
currprefs.cpu_cycle_exact ? m68k_run_2ce :
                 currprefs.cpu_compatible ? m68k_run_2p : m68k_run_2;
         }
         run_func ();


Currprefs.mmu_model is not filled correctly from inits. So, instead of 
running m68k_run_mmu040, we ran m68k_run_2p (or m68k_run_2 if precise 
cycle was not selected).

I've added the following line before the test (see code below) :

currprefs.mmu_model = 1;

And relaunched hatari with 68040 and MMU.

Hatari boots and displays the desktop.

I'll try to understand better this currprefs.mmu_model and add it to the 
Hatari's GUI.

Thanks for the help.
Regards,

Laurent


Le 23/02/2011 22:45, Thomas Huth a écrit :
> Am Wed, 23 Feb 2011 11:56:31 +0100
> schrieb Laurent Sallafranque<laurent.sallafranque at free.fr>:
>
>> Hi,
>>
>> I've tested quickly the mmu code.
>>
>> I start with my usual 68030 CPU, no MMU.
>>
>> Then, I press "F12" and change the following parameters :
>> CPU = 68040, activate MMU
>>
>> Then I reset Hatari.
>>
>>
>> I get a SIGSEGV error when hatari reset (look at the gdb trace) :
>>
>> Exception 2 (0) at e02ce2 ->  e02ce6!
>> Building CPU, 46224 opcodes (4 1 1)
>> CPU=68040, FPU=68040, MMU=1, JIT=0.
>> MMU: enabled=0 page8k=0
>> MMU: enabled=0 page8k=0
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> 0x00000000004f4e40 in get_iword () at
> I wonder why you got a segfault in get_iword ... shouldn't that be
> uae_mmu_get_iword() instead?
>
> Please check the following:
>
> 1) Is your code really running from m68k_run_mmu040() instead of some
>     of the other m68k_run_xxx() functions?
>
> 2) m68k_run_mmu040() needs the M68000_AddCycles() stuff instead of the
>     do_cycles() call.
>
> 3) You might need to disable the "NoPmmu" TOS patch in tos.c for
>     running with MMU...
>
>   Thomas
> _______________________________________________
> hatari-devel mailing list
> hatari-devel at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/hatari-devel
>
>




More information about the hatari-devel mailing list