libdebug.so
and stack tracing from userland is working.
Debugger
app can’t be compiled because libedit
external dependency is missing.
libdebug.so
and stack tracing from userland is working.
Debugger
app can’t be compiled because libedit
external dependency is missing.
Same board is at Aliexpress:
Technically Radeon HD cards should work on the SiFive unmatched under Haiku. Our mode setting driver for Radeon HD doesn’t need to rely on x86 bios services. (it might need some work though for locating the VGA bios, etc… but nothing major.)
Of course drm + 3d acceleration is the gold standard… but it might not be too much work to use AMD cards on RISC-V.
@X512, start getting some of these patches into https://review.haiku-os.org ! I don’t think anyone has issues accepting a raw risc-v platform loader into our repos. We designed our boot loader to support lots of options. Even if the raw risc-v loader isn’t the default for risc-v in the future, having it is a great option.
Some patch splitting and debug code cleanup is needed. Currently most code is inside one big commit.
Speaking of…
SiFive HiFive Unmatched RISC-V Developer Boards Begin Shipping
https://www.phoronix.com/scan.php?page=news_item&px=SiFive-HiFive-Unmatched-Ships
Hm… I have a mini-itx chassi that I don’t know what to do with… Perhaps I do soon
This is great progress!
In case you want to test this in tinyemu on a recent macOS, the emulator is unable to display the graphics window due to an incompatibility of SDL1.2 with recent macOS versions.
Replacing the sdl.c source file in tinyemu with this one using SDL2 and changing the library to -lSDL2 in the Makefile fixes the problem.
Other changes are needed: utime
CSR should be implemented (currently hardcoded to microseconds) and VirtIO queue may be need to be increased. Also keyboard scancodes may be different.
Try this fork with SDL2 support - GitHub - fernandotcl/TinyEMU: Tweaks to Fabrice Bellard's TinyEMU
Thanks @3dEyes - this version was the one I adapted the SDL2 code from. However, that doesn’t include X512’s patches and (at least for me) crashes into the kernel debugger when trying to boot Haiku.
I hacked together a quick tinyemu version with SDL2 support, (mostly correct, I think) keyboard mapping, POSIX microsecond timer support, and X512’s patches, see my github repository. Beware - only tested on macOS 11 so far.
No free descs?
Nope, it’s an illegal instruction exception in system_time (see the attached screenshot) but I haven’t tried figuring out why this occurs in the fernandoctl version.
utime CSR register is not implemented in that fork: https://github.com/fernandotcl/TinyEMU/blob/master/riscv_cpu.c#L731. It is used for system_time()
. Without that register the only way to get time will be mtime MMIO register of CLINT that can’t be efficiently provided for user mode.
I published current source code to GitHub - X547/haiku at riscv. History is currently a mess.
Done after bootstrapping on OpenSUSE:
Thank you, great job!
I can compile programs inside Haiku on RISC-V. riscv64
platform is displayed as unknown
for some unknown reason.
Would be nice to see how fast it are on real hardware
After recompiling libstdc++.so
and libgcc_s.so.1
with built-in -fno-omit-frame-pointer
I managed to get correct stack trace for crash caused by exception:
debug_server: Thread 863 entered the debugger: Debugger call: `abort() called'
stack trace, current PC 0xfffffff3fd8d9218 _kern_debugger + 0x8 (closest symbol):
(0xfffffffdad039aa0) 0xffffffc4dbbcf454 uw_update_context + 0
(0xfffffffdad039f80) 0xffffffc4dbbcfb36 _Unwind_RaiseException + 0x9c
(0xfffffffdad03aa50) 0xffffffc4dbb31186 __cxa_throw + 0x42
(0xfffffffdad03aa80) 0xfffffff45ef83b92 _ZN11BPackageKit8BManager8BPrivate18BRepositoryBuilder11AddPackagesENS_28BPackageInstallationLocationEPKc + 0x66
(0xfffffffdad03aab0) 0xfffffff45ef805f0 _ZN11BPackageKit8BManager8BPrivate15BPackageManager27ClientInstallationInterface23InitInstalledRepositoryERNS2_19InstalledRepositoryE + 0x4a
(0xfffffffdad03ab20) 0xfffffff45ef80bf0 _ZN11BPackageKit8BManager8BPrivate15BPackageManager23_AddInstalledRepositoryEPNS2_19InstalledRepositoryE + 0x1e
(0xfffffffdad03ab70) 0xfffffff45ef82030 _ZN11BPackageKit8BManager8BPrivate15BPackageManager4InitEj + 0xfe
(0xfffffffdad03ac30) 0xfffffff45ef6c956 _ZN11BPathFinder5SetToERKN11BPackageKit28BPackageResolvableExpressionEPKc + 0x78
(0xfffffffdad03ae50) 0xffffffd976ef1dd0 main + 0x280
(0xfffffffdad03afa0) 0xffffffd976ef20de _start + 0x38
(0xfffffffdad03afd0) 0xfffffff5e13ac6d4 runtime_loader + 0xd6
(0xfffffffdad03b000) 0x803a1a94
uw_update_context
seems not implemented in libgcc
for riscv64:
uw_update_context:
0000CCAE 80E7 0260 JALR RA, abort (* !!! *)
0000CCB2 1101 ADDI SP, SP, -32
0000CCB4 E822 SD FP, 16(SP)
0000CCB6 E426 SD S1, 8(SP)
0000CCB8 E04A SD S2, 0(SP)
0000CCBA EC06 SD RA, 24(SP)
0000CCBC 1000 ADDI FP, SP, 32
0000CCBE 84AE MV S1, A1
0000CCC0 892A MV S2, A0
0000CCC2 0097 0000 AUIPC RA, $00000000
0000CCC6 80E7 9680 JALR RA, $0000C62A
0000CCCA B783 4784 LD A5, 1144(S1)
0000CCCE 4719 LI A4, 6
0000CCD0 9693 0047 SLLI A3, A5, 4
0000CCD4 94B6 ADD S1, A3
0000CCD6 4494 LW A3, 8(S1)
0000CCD8 9A63 00E6 BNE A3, A4, $0000CCEC
0000CCDC 60E2 LD RA, 24(SP)
0000CCDE 6442 LD FP, 16(SP)
0000CCE0 3023 2209 SD 0, 544(S2)
0000CCE4 64A2 LD S1, 8(SP)
0000CCE6 6902 LD S2, 0(SP)
0000CCE8 6105 ADDI SP, SP, 32
0000CCEA 8082 RET
Fullstack trace of iostream related crash:
vm_page_fault: vm_soft_fault returned error 'Bad address' on fault at 0x0, ip 0xfffffffdb874b12e, write 0, user 1, thread 0x1c9
STrap(exception loadPageFault)
sstatus: (ie: {u, s}, pie: {s}, spp: u, sum: 1)
sie: {sTimer, sExtern}
sip: {}
stval: 0x0
tp: 0xcddab080(TrackerTaskLoop)
arch_thread_init_kthread_stack(0x00000000cdda7400(team 454 debug task))
arch_thread_init_kthread_stack(0x00000000cdda6e80(team 454 handler))
arch_thread_enter_uspace()
debug_server: Thread 457 entered the debugger: Segment violation
stack trace, current PC 0xfffffffdb874b12e _ZN9__gnu_cxx18__exchange_and_addEPVii + 0x4a:
(0xfffffff276242590) 0xfffffffdb874175c _ZNSt6localeaSERKS_ + 0x40
(0xfffffff2762425c0) 0xfffffffdb8740c90 _ZNSt8ios_base7_M_initEv + 0x38
(0xfffffff2762425f0) 0xfffffffdb87902fe _ZNSt9basic_iosIcSt11char_traitsIcEE4initEPSt15basic_streambufIcS1_E + 0x18
(0xfffffff276242610) 0xffffffc8823cc890 _ZN8BPrivate16PlainTextCatalog12ReadFromFileEPKc + 0xbe
(0xfffffff276243740) 0xffffffc8823cd95e _ZN8BPrivate16PlainTextCatalogC2ERK9entry_refPKcj + 0x19c
(0xfffffff276243990) 0xffffffc8823cdc6a instantiate_catalog.localalias.23 + 0x3c
(0xfffffff2762439c0) 0xffffffe34aaf9c56 _ZNK8BPrivate19MutableLocaleRoster11LoadCatalogERK9entry_refPKci + 0xee
(0xfffffff276243b00) 0xffffffe34aaefeb6 _ZN8BCatalog5SetToERK9entry_refPKcj + 0x5c
(0xfffffff276243b50) 0xffffffe34aaf0170 _ZN8BCatalogC2ERK9entry_refPKcj + 0x50
(0xfffffff276243b90) 0xffffffe34aaf7a00 _ZN13BLocaleRoster20GetLocalizedFileNameER7BStringRK9entry_refb + 0xf2
(0xfffffff276243c90) 0xffffffe33c96ce9a _ZN8BPrivate5Model18CacheLocalizedNameEv + 0x34
(0xfffffff276243cb0) 0xffffffe33c96d7b8 _ZN8BPrivate5Model14OpenNodeCommonEb + 0xf8
(0xfffffff276243d20) 0xffffffe33c96d8fc _ZN8BPrivate5Model8OpenNodeEb + 0x34
(0xfffffff276243d40) 0xffffffe33c96dae8 _ZN8BPrivate5Model5SetToEPK6BEntrybb + 0x8c
(0xfffffff276243d70) 0xffffffe33c96deca _ZN8BPrivate5ModelC2EPK9entry_refbbb + 0x8e
(0xfffffff276243e00) 0xffffffe33c97320e _ZN8BPrivate13NodePreloader10PreloadOneEPKc + 0xec
(0xfffffff276243f40) 0xffffffe33c97340c _ZN8BPrivate13NodePreloader7PreloadEv + 0xd0
(0xfffffff276243fb0) 0xffffffe33c9c1e3e _ZN8BPrivate6Thread3RunEv + 0x14
(0xfffffff276243fd0) 0xffffffe33c9c1e20 _ZN8BPrivate12SimpleThread9RunBinderEPv + 0xe
(0xfffffff276243fe0) 0xffffffcc2770cfb6 thread_entry + 0x1e
(0xfffffff276244000) 0x803a1aa4