unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Tobias Geerinckx-Rice via Guix-patches via <guix-patches@gnu.org>
To: Vincent Legoll <vincent.legoll@gmail.com>
Cc: 45742@debbugs.gnu.org
Subject: [bug#45742] [PATCH] gnu: Add x86emu.
Date: Sat, 09 Jan 2021 16:49:24 +0100	[thread overview]
Message-ID: <874kjq6rgb.fsf@nckx> (raw)
In-Reply-To: <20210109143038.1918-1-vincent.legoll@gmail.com>

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

Vincent,

Vincent Legoll 写道:
> * gnu/packages/linux.scm (x86emu): New variable.

I don't see the connection to Linux.  How about emulators.scm?

> +(define-public x86emu

There's at least one other x86emu (declared obsolete upstream[0]) 
and I wouldn't be surprised if there were twenty.  But if (this) 
upstream insists on such a generic name, so be it.

What's your use case for this package?  Is it a fun hack, or more?

> +         (replace 'build
> +           (lambda* (#:key inputs outputs #:allow-other-keys)
> +             (invoke "make" "all")))

The ‘all’ is presumably to build the ‘os’ (bios + sample kernel) 
images, but they aren't installed below.  Is that intentional?

The emulator is useless without them:

  $ x86emu
  [WARN] run_emulator (main.cpp:141) cannot load image
  'sample/kernel.img'
  Segmentation fault

  $ x86emu .../sample/kernel.img
  [hangs]

  $ strace x86emu .../sample/kernel.img
  [...]
  openat(AT_FDCWD, "bios/bios.bin", O_RDONLY) = -1 ENOENT
  openat(AT_FDCWD, "bios/crt0.bin", O_RDONLY) = -1 ENOENT
  [hangs]

Put them in a separate :os output if you like[1].

> +         (replace 'install
> +           (lambda* (#:key inputs outputs #:allow-other-keys)

‘inputs’ is unused.

> +             (let* ((out (assoc-ref outputs "out"))
> +                    (outbin (string-append out "/bin")))

Subjective nitpick: please just call this ‘bin’ :-)

> +               (mkdir-p outbin)
> +               (copy-file "x86emu" (string-append outbin 
> "/x86emu"))

These two lines can be replaced with the simpler:

  (install-file "x86emu" bin)

> +               (copy-recursively "include" (string-append out 
> "/include"))
> +               #t))))))
> +    (native-inputs
> +     `(("nasm" ,nasm)))
> +    (inputs
> +     `(("glfw" ,glfw)))
> +    (home-page "https://github.com/shift-crops/x86emu")
> +    (synopsis "simple x86 emulator")

Running ‘guix lint x86emu’ will point out possible issues, like 
this lowercase s.

> +    (description "x86emu is an emulator of the x86 
> architecture.  It supports
> +multiple CPU modes (16bit/32bit, Real/Protected), and some 
> devices.  You can
> +boot via FDD simulator (DMA not supported), and operate with 
> mouse and keyboard.")
> +    (license license:x11))))

This should be ‘expat’.  The X11 variant is extremely rare.

I made these changes (and a few more) in the attached patch and 
the emulator starts, but hangs on a black screen with

  [WARN] hundle_interrupt (interrupt.cpp:40) exception interrupt 
  11 (!idt.P)

looped on stderr.  I didn't look into it.

Thanks!

T G-R

[0]: 
https://web.archive.org/web/20090218022239/http://www.scitechsoft.com/products/dev/x86_emulator.html
[1]: I'm not sure where they belong.  They're x86 but 
‘architecture independent’ from the host's point of view so I put 
them in /share nonetheless.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]

  parent reply	other threads:[~2021-01-09 15:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-09 14:30 [bug#45742] [PATCH] gnu: Add x86emu Vincent Legoll
2021-01-09 14:40 ` Vincent Legoll
2021-01-09 15:49 ` Tobias Geerinckx-Rice via Guix-patches via [this message]
2021-01-09 15:51   ` Tobias Geerinckx-Rice via Guix-patches via
2021-01-09 16:15   ` pelzflorian (Florian Pelz)
2021-01-09 20:30     ` Tobias Geerinckx-Rice via Guix-patches via
2021-01-10 10:31       ` Vincent Legoll

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=874kjq6rgb.fsf@nckx \
    --to=guix-patches@gnu.org \
    --cc=45742@debbugs.gnu.org \
    --cc=me@tobias.gr \
    --cc=vincent.legoll@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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).