Page MenuHomeFreeBSD

powerpc: Add first Linuxulator support (ELFv1, BE, powerpc64)
Needs ReviewPublic

Authored by jhibbits on Dec 9 2023, 2:57 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Feb 19, 12:26 AM
Unknown Object (File)
Jan 18 2024, 1:23 PM
Unknown Object (File)
Jan 5 2024, 10:40 PM
Unknown Object (File)
Jan 1 2024, 2:20 PM
Unknown Object (File)
Dec 23 2023, 6:05 AM
Unknown Object (File)
Dec 16 2023, 3:48 AM
Subscribers

Details

Reviewers
dchagin
brooks
Group Reviewers
Linux Emulation
PowerPC
Summary

Introduce the first cut of the Linuxulator for powerpc64. This was a
GSoC project for 2022, and consists of the following:

  • Big-endian powerpc64
  • ELFv1
  • Limited shared page (no timekeep)
  • Most, if not all, syscalls are implemented, all common ones, no arch-specific ones.

At completion of the GSoC period this was able to run through the LTP
test suite, with a very high pass rate. More work remains, as always,
and will be done as needed.

Further work is still necessary, but this lays the groundwork. Expected
future work includes:

  • ELFv2
  • powerpc64le
  • 32-bit support (running legacy Linux applications)

Sponsored by: Google Summer of Code
MFC after: 2 months

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 54879
Build 51768: arc lint + arc unit

Event Timeline

sys/compat/linux/linux_file.c
319

should this change apply to COMPAT_LINUX32 only, as with amd64?

sys/compat/linux/linux_ioctl.h
38

curious why this is needed now

335

curious about why these are excluded from __powerpc64__, perhaps a comment in the src

410

this should probably be a separate commit with a stated rationale

sys/conf/files.powerpc
380

undo this

sys/modules/linux64/Makefile
73–74

?

105–108

?

sys/compat/linux/linux_file.c
319

According to Linux's arch/powerpc/kernel/syscalls/syscall.tbl llseek is common. This really should be powerpc, not powerpc64, on the off-chance I add 32-bit compat.

sys/compat/linux/linux_ioctl.h
335

Curious. I didn't know, so just checked Linux. powerpc seems to be the *only* arch that uses lowercase 't'. I'll add a comment for it. This is also the case for TCSETS, etc., so all of these should be in one block, not sprinkled like this.

410

I'll have to rework this.

sys/conf/files.powerpc
380

That's an odd one, don't know how it snuck in here.

sys/modules/linux64/Makefile
73–74

My fault. My GSoC student (last year) had made some changes to this file that I didn't want to fully revert while I was doing the final merge. I forgot to remove this and below before submitting the review.

105–108

As above.

I didn't have time for this whole thing.

sys/compat/linux/linux_ioctl.h
335

I know that PowerPC is the odd-man out for ABI issues, encoding, termios definitions, etc. All the others platforms we support on Linux use the common ABI stuff (by and large, there's interesting exceptions for i386 sometimes, but the common stuff often is the i386 stuff given Linux's development history).

When I did similar things for kboot, I created a per-arch .h file for this stuff as well as a common .h file that most things use. This ifdef soup is crazy and avoided that way.

sys/powerpc/linux/linux_genassym.c
2

This is bogus. Drop it. :)

sys/powerpc/linux/linux_locore.asm
2

The -FreeBSD SPDX identifier is obsolete and shouldn't be used at all.

sys/powerpc/linux/linux_machdep.c
32

Here and everywhere else: remove $FreeBSD$ and #include <sys/cdefs.h>

62

Should we return an error instead?