Received: from list by lists.gnu.org with archive (Exim 4.71) id 1h23M3-0005qk-3X for mharc-grub-devel@gnu.org; Thu, 07 Mar 2019 19:27:15 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47473) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h23Lz-0005qA-SI for grub-devel@gnu.org; Thu, 07 Mar 2019 19:27:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h23Ly-0002vh-SU for grub-devel@gnu.org; Thu, 07 Mar 2019 19:27:11 -0500 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:52698) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h23Ly-0002t9-GJ for grub-devel@gnu.org; Thu, 07 Mar 2019 19:27:10 -0500 Received: by mail-wm1-x342.google.com with SMTP id f65so10984927wma.2 for ; Thu, 07 Mar 2019 16:27:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=PsvVgywti1vm/GK/CxuhppUemR7HM+I5nhXScZYADx4=; b=GKBwg1RccCpWT4PFNkd3NTWSFnMmYsPZm8X/gFj1aUPIUBSa6/9SulgL+G4O7SFC6v 5leTdx8ysNDD6b6fs+IXFhuwwE7Dkd7o0EaQKO8Zphq76oVbKiBXKRehiryaZ9n6MT1t NEUCv0y6gZoIWuXVl6s5IeAyuCp4HkX/+KkxNPED11ErEEWmrjK7WuKblgkyaqGnnZ8m ZYRxv9XZW8SYmc3oRI9Zaw1x4SoX3GyatEPc0q1wS+cCOBrBwqwZRTf15alc5b8G4+0I 9f4Z7CoSNjD5AM8+HvqcQB3V3MHCrnM/B6KzZOJyHAw+19yKy9blB5Gnz2J19hk955V5 l/2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=PsvVgywti1vm/GK/CxuhppUemR7HM+I5nhXScZYADx4=; b=VSUd48nvQWnHF/p2QpZ0fg3xAjonxW/ZutXKjcbL6rydzTAk4X9KAMpXxr6QfnLlyQ GdfCU0sH2XHX71+iWMbDBRZE7+N66pmOzVzQMJ+G6rj+cs0/PW70pJw/1nyVkhtoMntw cyhsPZVLX62HyZ1mwGE+Mp2gwlb4/tEJgHnMsfom4mjynqR05Ah0mhfspbkfNIYfXIZ3 I6Kh2MdBDrPCKxUBz8L8iMf6HxksAAbbmYKUDvwcCO9cjmqcgae7sZNGRxZIF1AU8RuT 5AEzUZXTLInW1KGXkkK1/0gRZL6nJdm4zbds3bZrR2HphuoJvPiBNhICPE7d4CYpuE/P iT+A== X-Gm-Message-State: APjAAAW7CLfuXkAAhHxk6URjtCUfZ+XRSS1Eq0FpkfUb4MjAhGmPhLZj gzMtXGPVljlES6KzWdnkUfJkPDC6 X-Google-Smtp-Source: APXvYqyJGJHNEcyHJJ+q4Z7QCopGLj6AT8NpKG/WoQ3lLwXcfAFtOLpqlHhq6CSaRcWz5O+2LHoU5g== X-Received: by 2002:a1c:e489:: with SMTP id b131mr7291508wmh.130.1552004827019; Thu, 07 Mar 2019 16:27:07 -0800 (PST) Received: from izanagi.home.vikt0ry.com (112.red-81-47-147.staticip.rima-tde.net. [81.47.147.112]) by smtp.gmail.com with ESMTPSA id o8sm10436916wma.1.2019.03.07.16.27.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Mar 2019 16:27:06 -0800 (PST) From: =?UTF-8?q?Jes=C3=BAs=20Di=C3=A9guez=20Fern=C3=A1ndez?= To: grub-devel@gnu.org Cc: =?UTF-8?q?Jes=C3=BAs=20Di=C3=A9guez=20Fern=C3=A1ndez?= Subject: [PATCH v3 0/2] i386: Code cleanup and new MSR modules Date: Fri, 8 Mar 2019 01:26:35 +0100 Message-Id: <20190308002637.31530-1-jesusdf@gmail.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2019 00:27:12 -0000 This patch series consist in a code cleanup and two new modules to access MSR: The first patch replaces __asm__ __volatile__ with asm volatile. The second patch adds the modules rdmsr and wrmsr, which register two commands with the same name to read from and write to MSR. Currently, it lacks a GP# handler, and therefore accessing a reserved or unimplemented MSR, results in a general protection exception and system reboot. Changes in v3: - Add a cover letter to the patch series. - In Makefile.core.def, leave only x86. - Fixed incorrect #endif positioning. - Fixed variable types and parameter parsing. - Check that the CPU supports the MSR instructions. - Add TODO comments indicating that a GP# handler should be implemented. - Add a warning to the documentation, explaining that accessing a reserved or unimplemented MSR address results in a general protection exception. Changes in v2: - Patch all source code files with s/__asm__ __volatile__/asm volatile/g. - Split the module in two (rdmsr/wrmsr). - Include the wrmsr module in the forbidden modules efi list. - Code indentation and cleanup. - Copyright year update. - Implicit casting mask removed. - Use the same assembly code for x86 and x86_64. - Add missing documentation. - Patch submitted with Signed-off-by. Jesús Diéguez Fernández (2): Replace __asm__ __volatile__ with asm volatile. Add new MSR modules (rdmsr/wrmsr) docs/grub.texi | 53 +++++++++++++-- grub-core/Makefile.core.def | 10 +++ grub-core/commands/efi/shim_lock.c | 2 +- grub-core/commands/i386/rdmsr.c | 101 +++++++++++++++++++++++++++++ grub-core/commands/i386/wrmsr.c | 92 ++++++++++++++++++++++++++ grub-core/efiemu/runtime/efiemu.c | 10 +-- grub-core/lib/i386/halt.c | 2 +- include/grub/arm/time.h | 2 +- include/grub/arm64/time.h | 2 +- include/grub/i386/io.h | 12 ++-- include/grub/i386/rdmsr.h | 34 ++++++++++ include/grub/i386/time.h | 2 +- include/grub/i386/tsc.h | 2 +- include/grub/i386/wrmsr.h | 32 +++++++++ include/grub/x86_64/time.h | 2 +- 15 files changed, 335 insertions(+), 23 deletions(-) create mode 100644 grub-core/commands/i386/rdmsr.c create mode 100644 grub-core/commands/i386/wrmsr.c create mode 100644 include/grub/i386/rdmsr.h create mode 100644 include/grub/i386/wrmsr.h -- 2.17.1