lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180114143254.15429-3-andriy.shevchenko@linux.intel.com>
Date:   Sun, 14 Jan 2018 16:32:51 +0200
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     "H. Peter Anvin" <hpa@...or.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, x86@...nel.org,
        linux-kernel@...r.kernel.org
Cc:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Subject: [PATCH v1 3/6] x86/boot: Add MMIO byte accessors

readb() and writeb() would help to access serial device
via MMIO address space.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
 arch/x86/boot/boot.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/x86/boot/boot.h b/arch/x86/boot/boot.h
index 7e6ac187275c..09f6829f2778 100644
--- a/arch/x86/boot/boot.h
+++ b/arch/x86/boot/boot.h
@@ -79,6 +79,18 @@ static inline void io_delay(void)
 	asm volatile("outb %%al,%0" : : "dN" (DELAY_PORT));
 }
 
+static inline u8 readb(const volatile void __iomem *addr)
+{
+	u8 v;
+	asm volatile("movb %1,%0" : "=q" (v) : "m" (*(volatile u8 __force *)addr));
+	return v;
+}
+
+static inline void writeb(u8 v, volatile void __iomem *addr)
+{
+	asm volatile("movb %0,%1" : : "q" (v), "m" (*(volatile u8 __force *)addr));
+}
+
 /* These functions are used to reference data in other segments. */
 
 static inline u16 ds(void)
-- 
2.15.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ