qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Warner Losh <imp@bsdimp.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: Richard Henderson <richard.henderson@linaro.org>,
	Peter Maydell <peter.maydell@linaro.org>,
	 ginu samuel <samuel.ginu2010@gmail.com>,
	qemu-devel@nongnu.org
Subject: Re: Runnig solaris binary(32 bit) on linux(64 bit)
Date: Fri, 17 Feb 2023 09:04:48 -0700	[thread overview]
Message-ID: <CANCZdfpB9XdCQ97_qbnWNsquX9mwmoeJBzbx0SRQovsZp-xTTA@mail.gmail.com> (raw)
In-Reply-To: <5c7026171d3ab5d530784308a5ce71d32e6760c7.camel@infradead.org>

[-- Attachment #1: Type: text/plain, Size: 3190 bytes --]

On Thu, Feb 16, 2023 at 12:40 PM David Woodhouse <dwmw2@infradead.org>
wrote:

> On Thu, 2023-02-16 at 09:29 -1000, Richard Henderson wrote:
> > On 2/16/23 09:02, David Woodhouse wrote:
> > > It wouldn't be beyond the wit of man to extend qemu-user to support the
> > > similar personality variations for SCO/Solaris/etc. using that as a
> > > guide.
> >
> > Not beyond wit but perhaps beyond patience.
> >
> > It would certainly be possible to emulate the "easy middle" of one POSIX
> guest on a
> > different POSIX host.  But the dusty corners are going to get in the
> way, where we
> > currently rely on guest and host having identical semantics, and pass
> the system call
> > through to the host.
> >
> > It's a big job.
>
> True, but the existing iBCS / linux-abi kernel patches should highlight
> a lot of those dusty corners.
>

So one thing to understand, the iBCS is a separate ABI. This means that
you'd
have to rewrite everything from the syscall dispatch on down. Even if this
were
relevant, it would be a huge job.

A lot would depend on how much of Solaris is used. Solaris is ELF, which is
good
(it would be even worse if it were SunOS 4, then it's a.out and a whole lot
of other
complication that's more of a bsd-user thing). However, as others have
pointed
out, linux-user assumes a linux kernel. While one can run linux-user on
FreeBSD
with its Linux ABI implementation, even that's quite limited in what it can
do (I
needed to do this for some kexec support I was adding to FreeBSD boot loader
that ran as a Linux binary). I had to make tweaks to FreeBSD's emulation
to make it work, and that was for a binary that used only 10 system calls,
no
threads, no signals, nothing "messy" and apart from some extensions to
64-bits,
nothing that wasn't in 7th Edition Unix.

And there's also a number of special filesystems, IIRC, on Solaris that are
used
like linux's /sys and /proc filesystems, but with different details. And a
million other
details. Knowing the details isn't enough, assuming you could know them from
cribbing from existing code. You have to actually go implement the details
and
that would be a very tedious job. Even if you kept it to a subset that your
program
uses...

I started on a Venix emulator (ancient Unix V7 port to 8088/8086 micros I
cut my
teeth on), and even that was daunting. Now, with 3 years of bsd-user
hacking and
upstreaming under my belt, it would be easier, but there's a *HUGE*
learning curve
to understand the CPU, its exception model, how system calls are handled,
how
memory is mapped, etc. And the 'assume we're on linux' is definitely
leveraged
for memory mapping in the existing linux-user code if you were to copy it
all
as a starting point.

When people say it's a big job, they are underselling it somewhat. It would
be
a big job for the maintainers of linux-user who have all the context and
know
where the gotchas are. For anybody else, learning everything you need to
know itself is a big job.

Your best bet is qemu-sparc-system + Solaris install.

Warner

P.S. Sorry to go into partial rant mode, but 4 years ago when I started
helping
the folks working with bsd-user, I thought how hard could it be... now I
know...

[-- Attachment #2: Type: text/html, Size: 4867 bytes --]

  parent reply	other threads:[~2023-02-17 16:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-16  9:00 Runnig solaris binary(32 bit) on linux(64 bit) ginu samuel
2023-02-16 14:36 ` Peter Maydell
2023-02-16 19:02   ` David Woodhouse
2023-02-16 19:29     ` Richard Henderson
2023-02-16 19:39       ` David Woodhouse
2023-02-17 15:31         ` Peter Maydell
2023-02-17 16:04         ` Warner Losh [this message]
2023-02-18  2:40           ` ginu samuel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CANCZdfpB9XdCQ97_qbnWNsquX9mwmoeJBzbx0SRQovsZp-xTTA@mail.gmail.com \
    --to=imp@bsdimp.com \
    --cc=dwmw2@infradead.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=samuel.ginu2010@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).