unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Raghav Gururajan via Guix-patches via <guix-patches@gnu.org>
To: 50283@debbugs.gnu.org
Cc: Raghav Gururajan <rg@raghavgururajan.name>,
	Petr Hodina <phodina@protonmail.com>,
	Vincent Legoll <vincent.legoll@gmail.com>
Subject: [bug#50283] [PATCH v3 1/2] gnu: Add libx86emu.
Date: Mon, 30 Aug 2021 19:33:52 -0400	[thread overview]
Message-ID: <20210830233353.19811-1-rg@raghavgururajan.name> (raw)
In-Reply-To: <2c8e9e9d-c492-ea37-3414-c38e8bc4b2a1@raghavgururajan.name>

* gnu/packages/virtualization.scm (libx86emu): New variable.

Co-authored-by: Petr Hodina <phodina@protonmail.com>
Co-authored-by: Vincent Legoll <vincent.legoll@gmail.com>
---
 gnu/packages/virtualization.scm | 71 +++++++++++++++++++++++++++++++++
 1 file changed, 71 insertions(+)

diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index e952c009b5..5901524269 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -20,6 +20,9 @@
 ;;; Copyright © 2021 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
 ;;; Copyright © 2021 Dion Mendel <guix@dm9.info>
+;;; Copyright © 2021 Vincent Legoll <vincent.legoll@gmail.com>
+;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
+;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -130,6 +133,74 @@
   #:use-module (srfi srfi-26)
   #:use-module (ice-9 match))
 
+(define-public libx86emu
+  (package
+    (name "libx86emu")
+    (version "3.1")
+    (home-page "https://github.com/wfeldt/libx86emu")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url home-page)
+         (commit version)))
+       (file-name (git-file-name name version))
+       (modules
+        '((guix build utils)))
+       (snippet
+        `(begin
+           ;; Remove git2log program file.
+           (delete-file "git2log")
+           ;; Remove variables that depends on git2log.
+           (substitute* "Makefile"
+             (("GIT2LOG.*=.*$") "")
+             (("GITDEPS.*=.*$") "")
+             (("BRANCH.*=.*$") ""))
+           #t))
+       (sha256
+        (base32 "104xqc6nj9rpi7knl3dfqvasf087hlz2n5yndb1iycw35a6j509b"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:test-target "test"
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (include (string-append out "/include"))
+                    (lib (string-append out "/lib")))
+               ;; Correct the values of version and install directories.
+               (substitute* "Makefile"
+                 (("VERSION.*=.*$")
+                  (string-append "VERSION := "
+                                 ,version "\n"))
+                 (("PREFIX.*=.*$")
+                  (string-append "PREFIX := " out "\n"))
+                 (("MAJOR_VERSION.*=.*$")
+                  (string-append "MAJOR_VERSION := "
+                                 ,(version-major version) "\n"))
+                 (("LIBDIR.*=.*$")
+                  (string-append "LIBDIR = " lib "\n"))
+                 (("/usr/include") include)))))
+         (delete 'configure))))         ; no configure script
+    (native-inputs
+     `(("nasm" ,nasm)
+       ("perl" ,perl)))
+    (synopsis "Library for x86 emulation")
+    (description "Libx86emu is a small library to emulate x86 instructions.  The
+focus here is not a complete emulation but to cover enough for typical
+firmware blobs.  You can,
+@enumerate
+@item intercept any memory access or directly map real memory ranges
+@item intercept any i/o access, map real i/o ports, or block any real i/o
+@item intercept any interrupt
+@item provides a hook to run after each instruction
+@item recognize a special x86 instruction that can trigger logging
+@item use integrated logging
+@end enumerate")
+    (license (license:non-copyleft "file:///LICENSE"))))
+
 (define (qemu-patch commit file-name sha256-bv)
   "Return an origin for COMMIT."
   (origin
-- 
2.33.0





  parent reply	other threads:[~2021-08-30 23:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-30 19:31 [bug#50283] HwInfo Raghav Gururajan via Guix-patches via
2021-08-30 19:35 ` [bug#50283] [PATCH v1 1/2] gnu: Add libx86emu Raghav Gururajan via Guix-patches via
2021-08-30 19:35   ` [bug#50283] [PATCH v1 2/2] gnu: Add hwinfo Raghav Gururajan via Guix-patches via
2021-08-30 23:13   ` [bug#50283] [PATCH v1 1/2] gnu: Add libx86emu pelzflorian (Florian Pelz)
2021-08-30 23:27     ` [bug#50283] HwInfo Raghav Gururajan via Guix-patches via
2021-08-31  9:35       ` pelzflorian (Florian Pelz)
2021-08-31  9:41         ` pelzflorian (Florian Pelz)
2021-08-31  9:48           ` pelzflorian (Florian Pelz)
2021-08-30 22:27 ` [bug#50283] [PATCH v2 1/2] gnu: Add libx86emu Raghav Gururajan via Guix-patches via
2021-08-30 22:27   ` [bug#50283] [PATCH v2 2/2] gnu: Add hwinfo Raghav Gururajan via Guix-patches via
2021-08-30 23:33 ` Raghav Gururajan via Guix-patches via [this message]
2021-08-30 23:33   ` [bug#50283] [PATCH v3 " Raghav Gururajan via Guix-patches via
2021-08-31 11:18     ` phodina via Guix-patches via
2021-09-01  1:28       ` Raghav Gururajan via Guix-patches via
2021-09-18 12:59 ` [bug#50283] Patch status phodina via Guix-patches via
2021-10-01 23:30 ` [bug#50283] HwInfo Raghav Gururajan via Guix-patches via

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=20210830233353.19811-1-rg@raghavgururajan.name \
    --to=guix-patches@gnu.org \
    --cc=50283@debbugs.gnu.org \
    --cc=phodina@protonmail.com \
    --cc=rg@raghavgururajan.name \
    --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).