Author Topic: Help new_dynarec  (Read 12092 times)

Offline bsmiles32

  • byte
  • *
  • Posts: 15
    • View Profile
Help new_dynarec
« on: December 03, 2014, 02:23:35 PM »
Hi everyone,

I've been trying to refactor the memory module recently, but in doing so I broke the new_dynarec.
More precisely, I changed the way memory handlers are written and I removed some global variables.
Te problem is that the new_dynarec relied on those...
That's why I'm looking for some help.

Please take a look at the original pull request:
https://github.com/mupen64plus/mupen64plus-core/pull/47
and my WIP which try to fix the new_dynarec:
https://groups.google.com/d/msg/mupen64plus/vlyjzT2Lk5k/RnbyCWqvBl4J

As stated in the email to the mailing list, I don't have an ARM device to play with, so I cannot test what I've proposed... which is why external help is required.

Feel free to ask for more informations.

Offline littleguy

  • Moderator
  • double
  • *****
  • Posts: 1945
    • View Profile
Re: Help new_dynarec
« Reply #1 on: December 03, 2014, 02:44:17 PM »
Wow there's been a crazy flurry of activity here in the last month.  I'd love to help but I'm stretched pretty thin at the moment so I'd hate to make promises I couldn't keep.  Also, I personally know nothing about the dynarec so I might not be much help anyhow.

If you wanted to pick up a cheap Android phone or tablet off Ebay/Amazon/Newegg, I'd be happy to get you up and running with the build process for mupen64plus-ae.  You really wouldn't need to know anything about Android to be able to build and test your changes to the native C code.

BTW: Nice to see you here on the forum :D
« Last Edit: December 03, 2014, 02:48:20 PM by littleguy »
2012 Nexus 7, rooted stock Lollipop
Samsung Galaxy Victory, rooted stock Jelly Bean
Xperia PLAY, stock Gingerbread
OUYA, retail version

Offline Narann

  • byte
  • *
  • Posts: 18
  • mupen64plus Rice dev
    • View Profile
    • My Blog
Re: Help new_dynarec
« Reply #2 on: December 03, 2014, 11:17:15 PM »
Haha! I just see this thread! Too bad I've called for Gillou here.

Anyway, cool to see you here! :)

Offline bsmiles32

  • byte
  • *
  • Posts: 15
    • View Profile
Re: Help new_dynarec
« Reply #3 on: December 04, 2014, 04:42:59 AM »
Thanks for your help and nice welcome :)

Judging by recent activity here, I guess Gillou and Ari64 are the people that know best the new_dynarec.
Maybe if they can look and comment my WIP patch, we can work a solution.

I'll try to get a 32 bit environment in order to at least work on the x86 new_dynarec backend.
Hopefully this will put me in the right direction for the ARM backend.

Offline Gillou68310

  • Developer
  • long
  • *****
  • Posts: 112
    • View Profile
Re: Help new_dynarec
« Reply #4 on: December 04, 2014, 04:46:38 AM »
Hi bobby, that's a lot of changes to the new dynarec, has you said I think we should try to make it work on x86 first and focus on ARM after that. Are you working on linux or windows?

Offline bsmiles32

  • byte
  • *
  • Posts: 15
    • View Profile
Re: Help new_dynarec
« Reply #5 on: December 04, 2014, 04:51:47 AM »
I develop on a x86_64 archlinux machine.
I will try to setup there a 32 bit environment so that I can compile and run the x86 backend.

Offline Gillou68310

  • Developer
  • long
  • *****
  • Posts: 112
    • View Profile
Re: Help new_dynarec
« Reply #6 on: December 04, 2014, 05:01:49 AM »
Ok Personally I'm working on windows (buiding and debugging on VS2010) so in the meantime I will try to integrate your changes and see if it builds/runs. I'm a bit busy these days so it might not be today ;)

Offline bsmiles32

  • byte
  • *
  • Posts: 15
    • View Profile
Re: Help new_dynarec
« Reply #7 on: December 04, 2014, 05:18:16 AM »
Thanks for your offer !

Don't worry, I'm not rushed. I do that in my spare time too :)


Edit: I've setup a 32 bit environment and tested my patch.
The thing compiles and start but crash instantaneously with a corrupted stack.
So I can't use gdb to get a meaningfull backtrace :(
« Last Edit: December 05, 2014, 03:02:58 AM by bsmiles32 »

Offline Gillou68310

  • Developer
  • long
  • *****
  • Posts: 112
    • View Profile
Re: Help new_dynarec
« Reply #8 on: December 08, 2014, 11:07:03 AM »
Ok I managed to make this work with the new dynarec on x86 with the following changes:

This should be replaced:
Code: [Select]
emit_readword(readfn,addr);
emit_readword(writefn,addr);

by:
Code: [Select]
emit_movimm(readfn,addr);
emit_movimm(writefn,addr);


The following hack was necessary to read the correct value, but this seems wrong:
Code: [Select]
if ((signed int)ptr >= 0)
{
    *value = *(uint32_t*)((u_int)(address-(address&3) + (ptr<<2)));
}

Maybe write is incorrect too, I haven't checked.

And the last one ;):
Code: [Select]
fake_pc.f.r.rs=(long long int *)&g_mem_value;
fake_pc.f.r.rt=(long long int *)&g_mem_value;
fake_pc.f.r.rd=(long long int *)&g_mem_value;
« Last Edit: December 09, 2014, 04:47:59 AM by Gillou68310 »

Offline retroben

  • float
  • ****
  • Posts: 432
    • View Profile
Re: Help new_dynarec
« Reply #9 on: December 08, 2014, 11:08:49 AM »
Thanks Gillou,when can I grab it for my Intel x86 tablet so I can test it as well?

Offline Gillou68310

  • Developer
  • long
  • *****
  • Posts: 112
    • View Profile
Re: Help new_dynarec
« Reply #10 on: December 08, 2014, 11:11:27 AM »
I'll need to test it first ;)

Offline retroben

  • float
  • ****
  • Posts: 432
    • View Profile
Re: Help new_dynarec
« Reply #11 on: December 11, 2014, 02:17:06 AM »
When are you going to test it?  ???
I've been waiting a while,and I am just aching to test out Banjo-Tooie and DK64 with it. :)

I have yet to see the performance of either game on my Intel x86 tablet. :(

Offline bsmiles32

  • byte
  • *
  • Posts: 15
    • View Profile
Re: Help new_dynarec
« Reply #12 on: December 12, 2014, 08:59:09 PM »
Thanks a lot for your help Gillou :)

I've posted on the mailing list [1] the second version of the patch which fixes many things : I can now run perfect dark, zelda, ... but it's for x86 only.
Furthermore, I haven't implemented TLB exception and Super Mario doesn't go past the first screen...

If you have any idea why it doesn't work for Super Mario, I'm all ears :)

Thanks again.

[1] https://groups.google.com/d/msg/mupen64plus/vlyjzT2Lk5k/bKL9fQ2WWnoJ

Offline retroben

  • float
  • ****
  • Posts: 432
    • View Profile
Re: Help new_dynarec
« Reply #13 on: December 12, 2014, 11:29:25 PM »
Standing by with my Intel x86 tablet whenever you decide to post the apk so I can be an extra tester.

Edit:I am now more than ready for testing since I have access to a keyboard on my tablet for generally easier controls.
« Last Edit: December 13, 2014, 08:08:41 PM by retroben »

Offline bsmiles32

  • byte
  • *
  • Posts: 15
    • View Profile
Re: Help new_dynarec
« Reply #14 on: December 17, 2014, 09:40:03 AM »
Third version of the patch posted on the mailing list :)

I still need to reimplement the TLB exception handler, but I don't know which game rely on that.
Does anyone know ?

After that, I'm gonna do the same for the arm backend, and we should be good :)
« Last Edit: December 17, 2014, 09:43:37 AM by littleguy »