guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#45742] [PATCH] gnu: Add x86emu.


From: Tobias Geerinckx-Rice
Subject: [bug#45742] [PATCH] gnu: Add x86emu.
Date: Sat, 09 Jan 2021 16:49:24 +0100

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: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]