From: "Blue Swirl" <blauwirbel@gmail.com>
To: "M. Warner Losh" <imp@bsdimp.com>
Cc: agraf@suse.de, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH, RFC] BSD user emulator
Date: Mon, 1 Sep 2008 21:21:51 +0300 [thread overview]
Message-ID: <f43fc5580809011121m397096f1m7e8f29e67189a636@mail.gmail.com> (raw)
In-Reply-To: <20080901.115557.139568165.imp@bsdimp.com>
On 9/1/08, M. Warner Losh <imp@bsdimp.com> wrote:
> In message: <5EF2D60B-861A-4306-A553-15626B92C463@suse.de>
>
> Alexander Graf <agraf@suse.de> writes:
> :
> :
>
> :
> :
> : Am 01.09.2008 um 18:25 schrieb "M. Warner Losh" <imp@bsdimp.com>:
>
> :
> : > In message: <3ACB420B-8C07-4417-80F5-1B74896D1533@suse.de>
> : > Alexander Graf <agraf@suse.de> writes:
> : > :
> : > : On Aug 30, 2008, at 10:31 AM, Blue Swirl wrote:
> : > :
> : > : > Hi,
> : > : >
> : > : > This version can actually execute some programs, for example:
> : > : >
> : > : > ./sparc64-bsd-user/qemu-sparc64 -d in_asm /bin/cat /etc/motd
> : > : > OpenBSD 4.4 (GENERIC) #1715: Mon Aug 11 17:55:10 MDT 2008
> : > : >
> : > : > Welcome to OpenBSD: The proactively secure Unix-like operating
> : > system.
> : > : >
> : > : > Please use the sendbug(1) utility to report bugs in the system.
> : > : > Before reporting a bug, please try to reproduce it with the latest
> : > : > version of the code. With bug reports, please try to ensure that
> : > : > enough information to reproduce the problem is enclosed, and if a
> : > : > known fix for it exists, include that as well.
> : > : >
> : > : > Something is not correct with errno handling, it could also be a
> : > bug
> : > : > in CPU emulation:
> : > : > /sparc64-bsd-user/qemu-sparc64 -d in_asm /bin/cat /foobar
> : > : > cat: /foobar: Undefined error: 0
> : > : >
> : > : > Some other programs just fail:
> : > : > ./sparc64-bsd-user/qemu-sparc64 -d in_asm /bin/ls
> : > : > ls: Cannot allocate memory
> : > : > ./sparc64-bsd-user/qemu-sparc64 -d in_asm /bin/ksh
> : > : > ksh in malloc(): error: chunk overflow
> : > : > ./sparc64-bsd-user/qemu-sparc64 -d in_asm /usr/bin/id
> : > : > Segmentation fault
> : > : > ./sparc64-bsd-user/qemu-sparc64 -d in_asm /sbin/ifconfig
> : > : > lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 0¸
> : > : > ifconfig: getifgroups: Cannot allocate memory
> : > : >
> : > : > I've cleaned up the patch a bit. Signals, ioctls and structure
> : > : > conversions are still unimplemented and as usual, no docs.
> : > : >
> : > : > I think this is getting ready to be committed pretty soon. Any
> : > : > comments, objections?
> : > :
> : > : Just off the top of my head: Shouldn't BSD userspace and Darwin
> : > : userspace emulation be able to share a good bunch of syscalls?
> : > : IIRC the positive Darwin syscalls should be some recent FreeBSD
> : > : syscalls that should look pretty similar to OpenBSD syscalls. I
> : > might
> : > : be totally wrong here though ;-).
> : >
> : > Kinda.
> : >
> : > The system calls are mostly similar between the BSDs, but do vary for
> : > syscalls added since 4.4BSD Lite-2.
> : >
> :
> : So darwin and all bsds could share most 4.4 bsd syscalls and implement
> : the others depending on their specific target? Sounds like a big win
> : to me.
> :
> : Too bad fabrice doesn't agree to this.
>
>
> Well, it isn't quite *that* simple. If you look at the syscall lists,
> you'll see they are mostly in common. However, theres been some
> divergence so you'll need multiple tables, one for each BSD. Maybe
> 90-95% of each of them will be the same.
>
> I've not specifically looked at Darwin system calls, but NetBSD did a
> Darwin emulator without a lot of hassle. They had to do a lot for
> Mach-O image activation, of course, and fill in a number of missing
> system calls.
>
> I think that Fabrice likely will see the light when the tangible
> benefits are shown. He's likely worried about the same problem that
> the FreeBSD Linux ABI implementation suffered from: lots of special
> cases because Linux returns this error rather than that error, or
> treats group wheel differently in this case or that, etc. These
> problems have been mostly solved in the FreeBSD implementation in the
> kernel by having the emulation layers use a common set of core kernel
> routines to implement things, arranging for the right set of flags and
> such to be passed down.
>
> Anyway, that's just my two cents and speculation... Others, including
> those speculated about, may differ... Objects in the mirror are
> closer than they appear... If mail reader catches fire, leave the
> room and call for help...
Time for some statistics:
grep 'SYS_[a-z_]' fbsd-syscall.h |sed 's/[ ][ ]*/ /g'|sort -k
3 -n >fbsd-syscalls
grep 'SYS_[a-z_]' nbsd-syscall.h |sed 's/[ ][ ]*/ /g'|sort -k
2 -n >nbsd-syscalls
grep 'SYS_[a-z_]' obsd-syscall.h |sed 's/[ ][ ]*/ /g'|sort -k
3 -n >obsd-syscalls
wc -l *bsd-syscalls
365 fbsd-syscalls
366 nbsd-syscalls
187 obsd-syscalls
918 total
diff -u nbsd-syscalls fbsd-syscalls |diffstat
fbsd-syscalls | 475 ++++++++++++++++++++++++++++------------------------------
1 file changed, 237 insertions(+), 238 deletions(-)
diff -u obsd-syscalls fbsd-syscalls |diffstat
fbsd-syscalls | 298 ++++++++++++++++++++++++++++++++++++++++++++++------------
1 file changed, 238 insertions(+), 60 deletions(-)
diff -u obsd-syscalls nbsd-syscalls |diffstat
nbsd-syscalls | 297 ++++++++++++++++++++++++++++++++++++++++++++++------------
1 file changed, 238 insertions(+), 59 deletions(-)
Some are just renames, but those are still large numbers. I have to
add syscall number conversion tables, I thought host SYS_xx were
almost always equal to target SYS_xx.
next prev parent reply other threads:[~2008-09-01 18:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-30 8:31 [Qemu-devel] [PATCH, RFC] BSD user emulator Blue Swirl
2008-09-01 8:58 ` Alexander Graf
2008-09-01 9:19 ` Andreas Färber
2008-09-01 16:25 ` M. Warner Losh
2008-09-01 16:44 ` Alexander Graf
2008-09-01 17:55 ` M. Warner Losh
2008-09-01 18:21 ` Blue Swirl [this message]
2008-09-01 19:13 ` M. Warner Losh
2008-09-02 17:13 ` Blue Swirl
-- strict thread matches above, loose matches on Subject: below --
2008-08-25 18:45 Blue Swirl
2008-08-25 19:03 ` M. Warner Losh
2008-08-27 19:38 ` Andreas Färber
2008-08-28 15:49 ` Blue Swirl
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=f43fc5580809011121m397096f1m7e8f29e67189a636@mail.gmail.com \
--to=blauwirbel@gmail.com \
--cc=agraf@suse.de \
--cc=imp@bsdimp.com \
--cc=qemu-devel@nongnu.org \
/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).