From 3bc4b9a69158b1e377891c1b33544fae539286b1 Mon Sep 17 00:00:00 2001
From: 4lDO2 <4lDO2@protonmail.com>
Date: Sun, 19 Apr 2020 09:38:36 +0200
Subject: [PATCH] Allow the MADT to be read from userspace,

and fix a typo that prevented multiple tables from being listed
correctly.
---
 src/scheme/acpi.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/scheme/acpi.rs b/src/scheme/acpi.rs
index b11739b4..12eb2d78 100644
--- a/src/scheme/acpi.rs
+++ b/src/scheme/acpi.rs
@@ -43,7 +43,7 @@ pub struct AcpiScheme {
 }
 
 const TOPLEVEL_DIR_CONTENTS: &[u8] = b"tables\n";
-const ALLOWED_TABLES: &[[u8; 4]] = &[*b"MCFG"];
+const ALLOWED_TABLES: &[[u8; 4]] = &[*b"MCFG", *b"APIC"];
 
 // XXX: Why can't core also have something like std::io::Take? It's not even real I/O!
 /// An internal wrapper struct that limits the number of bytes that can be fmt-written, in order to
@@ -409,7 +409,7 @@ impl Scheme for AcpiScheme {
                     buf[..bytes_to_read].copy_from_slice(&src_buf[..bytes_to_read]);
                     bytes_read += bytes_to_read;
                     bytes_to_skip = 0;
-                    buf = &mut buf[..bytes_to_read];
+                    buf = &mut buf[bytes_to_read..];
                 }
                 *offset += bytes_read;
                 Ok(bytes_read)
-- 
GitLab