Git Product home page Git Product logo

Comments (25)

m4xw avatar m4xw commented on July 1, 2024 1

@fr500 @realnc confirmed working for switch.

from dosbox-svn.

realnc avatar realnc commented on July 1, 2024 1

Thank you very much for the help, @m4xw!

from dosbox-svn.

andres-asm avatar andres-asm commented on July 1, 2024

Switch

The libco implementation we had was by @webgeek1234, this one is new and seems it relies on mman.
@m4xw, do you think it can be fixed or should we go back to the old implementation for aarch64?

from dosbox-svn.

andres-asm avatar andres-asm commented on July 1, 2024

Android

Had it crash a couple times

11-24 16:45:56.633  3963  3997 F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x8 in tid 3997 (Thread-2)
11-24 16:45:56.633   235   235 W         : debuggerd: handling request: pid=3963 uid=10083 gid=10083 tid=3997
11-24 16:45:56.671   318   454 W nvaudio_hw: UNDERRUN DETECTED for music-playback ret -1 avail 0
11-24 16:45:56.635  4004  4004 W debuggerd: type=1400 audit(0.0:1055): avc: denied { search } for name="com.retroarch.ra32" dev="mmcblk0p29" ino=631879 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
11-24 16:45:56.697  4004  4004 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
11-24 16:45:56.698  4004  4004 F DEBUG   : LineageOS Version: '14.1-20180328-NIGHTLY-foster'
11-24 16:45:56.698  4004  4004 F DEBUG   : Build fingerprint: 'NVIDIA/loki_e_wifi/foster:7.0/NRD90M/2427173_1038.2788:user/release-keys'
11-24 16:45:56.698  4004  4004 F DEBUG   : Revision: '0'
11-24 16:45:56.698  4004  4004 F DEBUG   : ABI: 'arm'
11-24 16:45:56.698  4004  4004 F DEBUG   : pid: 3963, tid: 3997, name: Thread-2  >>> com.retroarch.ra32 <<<
11-24 16:45:56.698  4004  4004 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x8
11-24 16:45:56.698  4004  4004 F DEBUG   :     r0 00000000  r1 6cf9afc0  r2 6cf9afe8  r3 6c6bee3c
11-24 16:45:56.698  4004  4004 F DEBUG   :     r4 6e7ff000  r5 6e7ed000  r6 6e7ff36c  r7 6c96b788
11-24 16:45:56.698  4004  4004 F DEBUG   :     r8 57dfd3b8  r9 6e7ff168  sl 50bc9490  fp 57dfcc60
11-24 16:45:56.698  4004  4004 F DEBUG   :     ip 6cf32ffc  sp 57dfc510  lr 6c88c4dc  pc 6c88e59c  cpsr 600d0010
11-24 16:45:56.700  4004  4004 F DEBUG   :
11-24 16:45:56.700  4004  4004 F DEBUG   : backtrace:
11-24 16:45:56.700  4004  4004 F DEBUG   :     #00 pc 0038259c  /data/app/com.retroarch.ra32-1/lib/arm/libretroarch-activity.so (menu_widgets_frame+8668)
11-24 16:45:56.700  4004  4004 F DEBUG   :     #01 pc 001a557c  /data/app/com.retroarch.ra32-1/lib/arm/libretroarch-activity.so
11-24 16:45:56.700  4004  4004 F DEBUG   :     #02 pc 00460948  /data/app/com.retroarch.ra32-1/lib/arm/libretroarch-activity.so
11-24 16:45:56.701  4004  4004 F DEBUG   :     #03 pc 00324150  /data/app/com.retroarch.ra32-1/lib/arm/libretroarch-activity.so
11-24 16:45:56.701  4004  4004 F DEBUG   :     #04 pc 00047bf3  /system/lib/libc.so (_ZL15__pthread_startPv+22)
11-24 16:45:56.701  4004  4004 F DEBUG   :     #05 pc 00019f1d  /system/lib/libc.so (__start_thread+6)```

When it doesn't crash it's jerky and sound is messed up with external.
The crash seems to be entirely in retroarch side though. Also happened pre-libco update so it's probably irrelevant.

This issue only happens with external too (notification gets screwed up and sound gets locked):
https://photos.app.goo.gl/viqZLYyqnXueQ6t58

Changing from external locks up RA, changing between the two internal methods is fine.

from dosbox-svn.

m4xw avatar m4xw commented on July 1, 2024

@fr500 Dont define LIBCO_MPROTECT if u have and wrap the sys/mman.h include in LIBCO_MPROTECT, the author seems to forgot that.

from dosbox-svn.

realnc avatar realnc commented on July 1, 2024

Updated the bundled libco to not include mman.h when not using mprotect: 6c40864

If this builds now on Switch, I'll submit the change to upstream as well.

from dosbox-svn.

m4xw avatar m4xw commented on July 1, 2024

@realnc @fr500
Job succeeded, however can't test if it actually works rn.
https://git.m4xw.net/libretro/cores/dosbox-svn/-/jobs/6147

from dosbox-svn.

m4xw avatar m4xw commented on July 1, 2024

@realnc apparently it crashes

from dosbox-svn.

realnc avatar realnc commented on July 1, 2024

It was using armeabi.c before, right? Should we keep using that for ARM in general?

from dosbox-svn.

m4xw avatar m4xw commented on July 1, 2024

No it uses aarch64 (switch)

from dosbox-svn.

m4xw avatar m4xw commented on July 1, 2024

Also i cant tell u rn where it crashes to begin with, am at work myself.
Could be somewhere other than libco

from dosbox-svn.

realnc avatar realnc commented on July 1, 2024

Do you know whether or not __arm__ is defined as well as __aarch64__?

from dosbox-svn.

m4xw avatar m4xw commented on July 1, 2024

@realnc __aarch64__ is defined as well as __SWITCH__, don't think __arm__ is defined, if so then the aarch64 needs to take precedence.

from dosbox-svn.

realnc avatar realnc commented on July 1, 2024

OK, I just pushed a throw-away commit to test if arm.c is being picked. It will #error if that's the case.

from dosbox-svn.

m4xw avatar m4xw commented on July 1, 2024

@realnc seems to build https://git.m4xw.net/libretro/cores/dosbox-svn/-/jobs/6152
try adding __attribute__((used)) here https://github.com/libretro/dosbox-svn/blob/libretro/libretro/deps/libco/aarch64.c#L24
you also might still want to pagealign it to 0x1000

from dosbox-svn.

realnc avatar realnc commented on July 1, 2024

OK. did both. e9dd94e

from dosbox-svn.

m4xw avatar m4xw commented on July 1, 2024

Still crash, will need to ask a tester for the log and check the debug elf

from dosbox-svn.

m4xw avatar m4xw commented on July 1, 2024

LR is https://github.com/libretro/dosbox-svn/blob/libretro/libretro/libretro.cpp#L1441 so yea, seems its libcro, error is Instruction Abort, its basically executing a NO_X segment.
Seems it creates a 2nd .text section according to IDA, lmao
image

from dosbox-svn.

m4xw avatar m4xw commented on July 1, 2024

@realnc that should be correct __attribute__((section(".text")));
This should be changed for everything that uses gcc

from dosbox-svn.

realnc avatar realnc commented on July 1, 2024

@m4xw section is a macro from settings.h. However, it appends a #?

from dosbox-svn.

m4xw avatar m4xw commented on July 1, 2024
#elif defined(__linux__) || defined(__HAIKU__) || \
      defined(__FreeBSD__) || defined(__DragonFly__) || \
	  defined(HAVE_LIBNX)
	__attribute__((section(".text")));
#elif defined(__MACH__)
	__attribute__((section("__TEXT,.text")));
#else

Taken from flycast and known working, for MACH it doesnt add the "." too, the section name must match, otherwise its a new section and you would have to explicitly tell it to be executable.
# becomes _ in practice here so its never added in .text
So no idea why that even works for some platforms

from dosbox-svn.

realnc avatar realnc commented on July 1, 2024

On Linux, without the #:

Warning: ignoring changed section attributes for .text

No such warning with #.

from dosbox-svn.

m4xw avatar m4xw commented on July 1, 2024

yea because it creates a new section, otherwise that will also flag the .text as data (so read write execute), some AV's might trigger on that.
Theres no other way, or u have to use __attribute__(section(".text#", "rx"))
Also at that point, call it .libco or smth

from dosbox-svn.

m4xw avatar m4xw commented on July 1, 2024

But i guess on the platforms where it works, it creates already a RWX section.
I mean linux should never even use that codepath tho, because it has mman

from dosbox-svn.

realnc avatar realnc commented on July 1, 2024

Aha. The core didn't actually define LIBCO_MPROTECT. It was always using the .text codepath.

I changed that so that macOS and Linux use mprotect, and removed the # from the section tag. Rolled back the previous commit. As well.

7245874
e4512a2

from dosbox-svn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.