Repository: theseus-os/Theseus (language: rust)

Issue:
qp-trie's `count` is incorrect and causes subtraction overflow in debug mode
This weird error is revealed when trying to run any application on the shell in a debug build of Theseus.

I changed the `impl Drop for AppCrateRef` drop handler to print a bit more info:
```rust
impl Drop for AppCrateRef {
    fn drop(&mut self) {
        // trace!("### Dropping AppCrateRef {:?} from namespace {:?}", self.crate_ref, self.namespace.name());
        let crate_locked = self.crate_ref.lock_as_ref();
        // First, remove the actual crate from the namespace.
        if let Some(_removed_app_crate) = self.namespace.crate_tree().lock().remove(&crate_locked.crate_name) {
            // Second, remove all of the crate's global symbols from the namespace's symbol map.
            let mut symbol_map = self.namespace.symbol_map().lock();
            for sec_to_remove in crate_locked.global_sections_iter() {
                trace!("Removing sec_to_remove {:?}", sec_to_remove.deref());
                trace!("symbol_map count: {}\n{:?}", symbol_map.count(), symbol_map.deref());
                trace!("symbol_map had weak sec: {:?}", symbol_map.get(&sec_to_remove.name));
                trace!("symbol_map had strong sec: {:?}", symbol_map.get(&sec_to_remove.name).and_then(|w| w.upgrade()));

                match symbol_map.remove(&sec_to_remove.name) {
                    Some(_removed) => {
                        trace!("Removed symbol {}: {:?}", sec_to_remove.name, _removed.upgrade());
                    }
                    None => {
                        error!("NOTE: couldn't find old symbol {:?} in the old crate {:?} to remove from namespace {:?}.", sec_to_remove.name, crate_locked.crate_name, self.namespace.name());
                    }
                }
            }
        } else {
            error!("BUG: the dropped AppCrateRef {:?} could not be removed from namespace {:?}", self.crate_ref, self.namespace.name());
        }
    }
}
```

and the log shows some strange behavior surrounding `Trie::count()`: the count is `0` but there are two elements in the map (?)...
```
[D] kernel/mod_mgmt/src/lib.rs:816: load_crate_as_application(): trying to load application crate at "/namespaces/_applications/hello-2bf26f3c151abb0a.o"
[I] kernel/mod_mgmt/src/lib.rs:824: loaded new application crate: "hello-2bf26f3c151abb0a", num sections: 111, added 1 new symbols
[D] kernel/runqueue_round_robin/src/lib.rs:204: Adding task to runqueue_round_robin 1, TaskRef(Task { name: "hello-2bf26f3c151abb0a", id: 15, running_on: None, runstate: Blocked, pinned: None })
[D] kernel/spawn/src/lib.rs:610: task_wrapper [1]: "hello-2bf26f3c151abb0a" about to call task entry func 0x72c7790 {fn(alloc::vec::Vec<alloc::string::String>) -> isize} with arg []
[D] kernel/spawn/src/lib.rs:687: task_cleanup_success: "hello-2bf26f3c151abb0a" successfully exited with return value 0
[D] kernel/runqueue_round_robin/src/lib.rs:225: Removing task from runqueue_round_robin 1, TaskRef(Task { name: "hello-2bf26f3c151abb0a", id: 15, running_on: Some(1), runstate: Exited, pinned: None })
[I] applications/shell/src/lib.rs:1056: terminal: task [15] returned exit value: Some(0)
[T] kernel/task/src/lib.rs:970: [CPU 2] Task::drop(): hello-2bf26f3c151abb0a{15}
[T] kernel/mod_mgmt/src/lib.rs:429: Removing sec_to_remove LoadedSection { name: "hello::main::h8bbf4df10c7ebacc", typ: Text, parent: "<locked>", vaddr: v0x72C7790, size: 211, .. }
[T] kernel/mod_mgmt/src/lib.rs:430: symbol_map count: 0
{"shell::main::h0a3c693b3c290b52": (Weak), "hello::main::h8bbf4df10c7ebacc": (Weak)}
[T] kernel/mod_mgmt/src/lib.rs:431: symbol_map had weak sec: Some((Weak))
[T] kernel/mod_mgmt/src/lib.rs:432: symbol_map had strong sec: Some(LoadedSection { name: "hello::main::h8bbf4df10c7ebacc", typ: Text, parent: "<locked>", vaddr: v0x72C7790, size: 211, .. })
[T] kernel/panic_wrapper/src/lib.rs:32: at top of panic_wrapper: PanicInfo { payload: Any { .. }, message: Some(attempt to subtract with overflow), location: Location { file: "/home/kevin/.cargo/registry/src/github.com-1ecc6299db9ec823/qp-trie-0.8.0/src/trie.rs", line: 323, col: 13 }, can_unwind: true }
```

I'm not sure if this is a bug in qp-trie or an issue with how our new `StrRef` type implements `Borrow<[u8]>`, so this issue is a placeholder/TODO item until I can spend more time debugging it.


Discussion / hints:
Upon further examination of the qp-trie code, it seems like inserting or removing key-value pairs via the `entry` API does _not_ update the Trie's inner `count` at all. I will verify this with a few test programs and then likely submit an issue on that repo.
I filed https://github.com/sdleffler/qp-trie-rs/issues/31 to address this.

Fix patch:
diff --git a/Cargo.lock b/Cargo.lock
index 7f347682fd..fec745c6fa 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2770,9 +2770,9 @@ dependencies = [
 
 [[package]]
 name = "qp-trie"
-version = "0.8.0"
+version = "0.8.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a075ecba64154fed5429568c9c6a0e0eccc3276209e93e6133206413ea6834b4"
+checksum = "9569328cda9b68120dbbf855bac541eeb40c475d96a9a380cf8b5547bfe0c165"
 dependencies = [
  "new_debug_unreachable",
  "unreachable",
diff --git a/applications/heap_eval/Cargo.toml b/applications/heap_eval/Cargo.toml
index 33d375e9ed..ee8d96a915 100644
--- a/applications/heap_eval/Cargo.toml
+++ b/applications/heap_eval/Cargo.toml
@@ -5,7 +5,7 @@ description = "Benchmarks to evaluate Theseus's heap design"
 authors = ["Ramla Ijaz <ijazramla@gmail.com>"]
 
 [dependencies]
-qp-trie = "0.8.0"
+qp-trie = "0.8.1"
 getopts = "0.2.21"
 
 [dependencies.app_io]
diff --git a/kernel/crate_metadata/Cargo.toml b/kernel/crate_metadata/Cargo.toml
index 230932106b..3162cbd68b 100644
--- a/kernel/crate_metadata/Cargo.toml
+++ b/kernel/crate_metadata/Cargo.toml
@@ -8,7 +8,7 @@ edition = "2018"
 [dependencies]
 spin = "0.9.4"
 xmas-elf = { version = "0.6.2", git = "https://github.com/theseus-os/xmas-elf.git" }
-qp-trie = "0.8.0"
+qp-trie = "0.8.1"
 
 [dependencies.str_ref]
 path = "../../libs/str_ref"
diff --git a/kernel/crate_swap/Cargo.toml b/kernel/crate_swap/Cargo.toml
index 760d98b873..bed26df6ef 100644
--- a/kernel/crate_swap/Cargo.toml
+++ b/kernel/crate_swap/Cargo.toml
@@ -7,7 +7,7 @@ authors = ["Kevin Boos <kevinaboos@gmail.com>"]
 
 [dependencies]
 spin = "0.9.4"
-qp-trie = "0.8.0"
+qp-trie = "0.8.1"
 by_address = "1.0.4"
 
 
diff --git a/kernel/mod_mgmt/Cargo.toml b/kernel/mod_mgmt/Cargo.toml
index 2132880bee..1b9a29c776 100644
--- a/kernel/mod_mgmt/Cargo.toml
+++ b/kernel/mod_mgmt/Cargo.toml
@@ -9,7 +9,7 @@ edition = "2018"
 spin = "0.9.4"
 xmas-elf = { version = "0.6.2", git = "https://github.com/theseus-os/xmas-elf.git" }
 rustc-demangle = "0.1.19"
-qp-trie = "0.8.0"
+qp-trie = "0.8.1"
 cstr_core = "0.2.3"
 rangemap = { version = "1.3.0", features = [ "const_fn" ] }
 const_format = "0.2.2"
diff --git a/tlibc/Cargo.lock b/tlibc/Cargo.lock
index de1a53ea59..4c9dcb0bde 100644
--- a/tlibc/Cargo.lock
+++ b/tlibc/Cargo.lock
@@ -2,24 +2,6 @@
 # It is not intended for manual editing.
 version = 3
 
-[[package]]
-name = "acpi"
-version = "0.1.0"
-dependencies = [
- "acpi_table",
- "acpi_table_handler",
- "dmar",
- "fadt",
- "hpet",
- "iommu",
- "log",
- "madt",
- "memory",
- "rsdp",
- "rsdt",
- "spin 0.9.4",
-]
-
 [[package]]
 name = "acpi_table"
 version = "0.1.0"
@@ -30,20 +12,6 @@ dependencies = [
  "zerocopy",
 ]
 
-[[package]]
-name = "acpi_table_handler"
-version = "0.1.0"
-dependencies = [
- "acpi_table",
- "dmar",
- "fadt",
- "hpet",
- "log",
- "madt",
- "memory",
- "rsdt",
-]
-
 [[package]]
 name = "ahash"
 version = "0.7.6"
@@ -55,22 +23,6 @@ dependencies = [
  "version_check",
 ]
 
-[[package]]
-name = "ap_start"
-version = "0.1.0"
-dependencies = [
- "apic",
- "interrupts",
- "irq_safety",
- "kernel_config",
- "log",
- "memory",
- "no_drop",
- "scheduler",
- "spawn",
- "stack",
-]
-
 [[package]]
 name = "apic"
 version = "0.1.0"
@@ -86,7 +38,6 @@ dependencies = [
  "pit_clock_basic",
  "raw-cpuid",
  "spin 0.9.4",
- "static_assertions",
  "volatile 0.2.7",
  "x86_64",
  "zerocopy",
@@ -97,16 +48,28 @@ name = "app_io"
 version = "0.1.0"
 dependencies = [
  "core2",
- "event_types",
- "keycodes_ascii",
- "libterm",
+ "hashbrown",
+ "lazy_static",
+ "logger_x86_64",
+ "mutex_sleep",
+ "stdio",
+ "task",
+ "tty",
+]
+
+[[package]]
+name = "async_channel"
+version = "0.1.0"
+dependencies = [
+ "core2",
+ "crossbeam-utils",
+ "debugit",
+ "hpet",
  "log",
- "logger",
- "print",
+ "mpmc",
  "spin 0.9.4",
- "stdio",
  "task",
- "window_manager",
+ "wait_queue",
 ]
 
 [[package]]
@@ -153,17 +116,20 @@ dependencies = [
 ]
 
 [[package]]
-name = "bootloader_modules"
+name = "boot_info"
 version = "0.1.0"
 dependencies = [
+ "bitflags",
+ "kernel_config",
  "memory_structs",
 ]
 
 [[package]]
-name = "by_address"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e245704f60eb4eb45810d65cf14eb54d2eb50a6f3715fe2d7cd01ee905c2944f"
+name = "bootloader_modules"
+version = "0.1.0"
+dependencies = [
+ "memory_structs",
+]
 
 [[package]]
 name = "byteorder"
@@ -171,15 +137,6 @@ version = "1.4.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
 
-[[package]]
-name = "catch_unwind"
-version = "0.1.0"
-dependencies = [
- "log",
- "task",
- "unwind",
-]
-
 [[package]]
 name = "cbitset"
 version = "0.2.0"
@@ -207,18 +164,6 @@ version = "1.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
 
-[[package]]
-name = "color"
-version = "0.1.0"
-
-[[package]]
-name = "compositor"
-version = "0.1.0"
-dependencies = [
- "framebuffer",
- "shapes",
-]
-
 [[package]]
 name = "const_format"
 version = "0.2.22"
@@ -285,6 +230,15 @@ dependencies = [
  "memchr",
 ]
 
+[[package]]
+name = "cortex-a"
+version = "7.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bdecfbb28672ad3664e71ae05a398a52df430d86d660691501b28968cc4467e6"
+dependencies = [
+ "tock-registers",
+]
+
 [[package]]
 name = "cow_arc"
 version = "0.1.0"
@@ -293,6 +247,13 @@ dependencies = [
  "spin 0.9.4",
 ]
 
+[[package]]
+name = "cpu"
+version = "0.1.0"
+dependencies = [
+ "apic",
+]
+
 [[package]]
 name = "crate_metadata"
 version = "0.1.0"
@@ -307,7 +268,6 @@ dependencies = [
  "qp-trie",
  "serde",
  "spin 0.9.4",
- "static_assertions",
  "str_ref",
  "xmas-elf",
 ]
@@ -329,23 +289,6 @@ dependencies = [
  "path",
 ]
 
-[[package]]
-name = "crate_swap"
-version = "0.1.0"
-dependencies = [
- "by_address",
- "fs_node",
- "hashbrown",
- "hpet",
- "lazy_static",
- "log",
- "memory",
- "mod_mgmt",
- "path",
- "qp-trie",
- "spin 0.9.4",
-]
-
 [[package]]
 name = "crossbeam-utils"
 version = "0.8.12"
@@ -402,32 +345,6 @@ dependencies = [
  "syn",
 ]
 
-[[package]]
-name = "dfqueue"
-version = "0.1.0"
-
-[[package]]
-name = "displayable"
-version = "0.1.0"
-dependencies = [
- "color",
- "framebuffer",
- "shapes",
- "spin 0.9.4",
-]
-
-[[package]]
-name = "dmar"
-version = "0.1.0"
-dependencies = [
- "acpi_table",
- "log",
- "memory",
- "sdt",
- "static_assertions",
- "zerocopy",
-]
-
 [[package]]
 name = "either"
 version = "1.5.0"
@@ -444,15 +361,6 @@ dependencies = [
  "root",
 ]
 
-[[package]]
-name = "event_types"
-version = "0.1.0"
-dependencies = [
- "keycodes_ascii",
- "mouse_data",
- "shapes",
-]
-
 [[package]]
 name = "exceptions_early"
 version = "0.1.0"
@@ -476,57 +384,25 @@ dependencies = [
  "spin 0.9.4",
 ]
 
-[[package]]
-name = "fadt"
-version = "0.1.0"
-dependencies = [
- "acpi_table",
- "memory",
- "sdt",
- "static_assertions",
- "zerocopy",
-]
-
 [[package]]
 name = "fallible-iterator"
 version = "0.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7"
 
-[[package]]
-name = "fault_crate_swap"
-version = "0.1.0"
-dependencies = [
- "crate_swap",
- "fault_log",
- "fs_node",
- "log",
- "memory",
- "mod_mgmt",
- "path",
- "task",
-]
-
 [[package]]
 name = "fault_log"
 version = "0.1.0"
 dependencies = [
- "apic",
+ "app_io",
+ "cpu",
  "irq_safety",
  "log",
  "memory",
- "print",
  "task",
  "vga_buffer",
 ]
 
-[[package]]
-name = "font"
-version = "0.1.0"
-dependencies = [
- "spin 0.9.4",
-]
-
 [[package]]
 name = "frame_allocator"
 version = "0.1.0"
@@ -539,47 +415,6 @@ dependencies = [
  "static_assertions",
 ]
 
-[[package]]
-name = "framebuffer"
-version = "0.1.0"
-dependencies = [
- "color",
- "log",
- "memory",
- "multicore_bringup",
- "page_attribute_table",
- "shapes",
- "zerocopy",
-]
-
-[[package]]
-name = "framebuffer_compositor"
-version = "0.1.0"
-dependencies = [
- "compositor",
- "framebuffer",
- "hashbrown",
- "shapes",
- "spin 0.9.4",
-]
-
-[[package]]
-name = "framebuffer_drawer"
-version = "0.1.0"
-dependencies = [
- "framebuffer",
- "shapes",
-]
-
-[[package]]
-name = "framebuffer_printer"
-version = "0.1.0"
-dependencies = [
- "font",
- "framebuffer",
- "shapes",
-]
-
 [[package]]
 name = "fs_node"
 version = "0.1.0"
@@ -664,7 +499,7 @@ dependencies = [
  "memory",
  "sdt",
  "spin 0.9.4",
- "static_assertions",
+ "time",
  "volatile 0.2.7",
  "zerocopy",
 ]
@@ -709,32 +544,6 @@ dependencies = [
  "spin 0.9.4",
 ]
 
-[[package]]
-name = "ioapic"
-version = "0.1.0"
-dependencies = [
- "atomic_linked_list",
- "log",
- "memory",
- "spin 0.9.4",
- "volatile 0.2.7",
- "zerocopy",
-]
-
-[[package]]
-name = "iommu"
-version = "0.1.0"
-dependencies = [
- "bitflags",
- "irq_safety",
- "log",
- "memory",
- "spin 0.9.4",
- "static_assertions",
- "volatile 0.2.7",
- "zerocopy",
-]
-
 [[package]]
 name = "irq_safety"
 version = "0.1.1"
@@ -780,29 +589,6 @@ name = "libc"
 version = "0.2.127"
 source = "git+https://github.com/theseus-os/libc?branch=theseus#5e1da08f39d9b25c649f1152e0084585b0adf725"
 
-[[package]]
-name = "libterm"
-version = "0.1.0"
-dependencies = [
- "color",
- "dfqueue",
- "displayable",
- "environment",
- "event_types",
- "font",
- "framebuffer",
- "framebuffer_drawer",
- "framebuffer_printer",
- "log",
- "print",
- "root",
- "shapes",
- "text_display",
- "tsc",
- "window",
- "window_manager",
-]
-
 [[package]]
 name = "linked_list_allocator"
 version = "0.9.1"
@@ -844,28 +630,13 @@ dependencies = [
 ]
 
 [[package]]
-name = "logger"
+name = "logger_x86_64"
 version = "0.1.0"
 dependencies = [
+ "crossbeam-utils",
  "irq_safety",
  "log",
  "serial_port_basic",
- "spin 0.9.4",
-]
-
-[[package]]
-name = "madt"
-version = "0.1.0"
-dependencies = [
- "acpi_table",
- "apic",
- "ioapic",
- "log",
- "memory",
- "pic",
- "sdt",
- "static_assertions",
- "zerocopy",
 ]
 
 [[package]]
@@ -902,14 +673,15 @@ dependencies = [
  "atomic_linked_list",
  "bit_field 0.7.0",
  "bitflags",
+ "boot_info",
  "frame_allocator",
  "irq_safety",
  "kernel_config",
  "lazy_static",
  "log",
+ "memory_aarch64",
  "memory_structs",
  "memory_x86_64",
- "multiboot2",
  "no_drop",
  "owned_borrowed_trait",
  "page_allocator",
@@ -921,6 +693,19 @@ dependencies = [
  "zerocopy",
 ]
 
+[[package]]
+name = "memory_aarch64"
+version = "0.1.0"
+dependencies = [
+ "boot_info",
+ "cortex-a",
+ "kernel_config",
+ "log",
+ "memory_structs",
+ "pte_flags",
+ "tock-registers",
+]
+
 [[package]]
 name = "memory_structs"
 version = "0.1.0"
@@ -936,10 +721,10 @@ dependencies = [
 name = "memory_x86_64"
 version = "0.1.0"
 dependencies = [
+ "boot_info",
  "kernel_config",
  "log",
  "memory_structs",
- "multiboot2",
  "pte_flags",
  "x86_64",
 ]
@@ -962,6 +747,7 @@ dependencies = [
  "log",
  "memfs",
  "memory",
+ "no_drop",
  "path",
  "qp-trie",
  "rangemap",
@@ -969,51 +755,9 @@ dependencies = [
  "rustc-demangle",
  "serde",
  "spin 0.9.4",
- "util",
  "vfs_node",
- "xmas-elf",
-]
-
-[[package]]
-name = "modular-bitfield"
-version = "0.11.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a53d79ba8304ac1c4f9eb3b9d281f21f7be9d4626f72ce7df4ad8fbde4f38a74"
-dependencies = [
- "modular-bitfield-impl",
- "static_assertions",
-]
-
-[[package]]
-name = "modular-bitfield-impl"
-version = "0.11.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5a7d5f7076603ebc68de2dc6a650ec331a062a13abaa346975be747bbfa4b789"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "mouse"
-version = "0.1.0"
-dependencies = [
- "event_types",
- "interrupts",
- "log",
- "mouse_data",
- "mpmc",
- "ps2",
- "spin 0.9.4",
  "x86_64",
-]
-
-[[package]]
-name = "mouse_data"
-version = "0.1.0"
-dependencies = [
- "modular-bitfield",
+ "xmas-elf",
 ]
 
 [[package]]
@@ -1027,41 +771,23 @@ name = "msr"
 version = "0.1.0"
 
 [[package]]
-name = "multiboot2"
-version = "0.14.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e6170b6f12ea75d8d0f5621e3ed780b041a666c4a5b904c77261fe343d0e798d"
-dependencies = [
- "bitflags",
-]
-
-[[package]]
-name = "multicore_bringup"
+name = "mutex_preemption"
 version = "0.1.0"
 dependencies = [
- "acpi",
- "ap_start",
- "apic",
- "kernel_config",
- "log",
- "madt",
- "memory",
- "mod_mgmt",
- "pause",
- "pit_clock_basic",
+ "lockable",
+ "preemption",
  "spin 0.9.4",
- "stack",
- "volatile 0.2.7",
- "zerocopy",
 ]
 
 [[package]]
-name = "mutex_preemption"
+name = "mutex_sleep"
 version = "0.1.0"
 dependencies = [
  "lockable",
- "preemption",
+ "log",
  "spin 0.9.4",
+ "task",
+ "wait_queue",
 ]
 
 [[package]]
@@ -1137,23 +863,10 @@ dependencies = [
  "static_assertions",
 ]
 
-[[package]]
-name = "page_attribute_table"
-version = "0.1.0"
-dependencies = [
- "log",
- "memory",
- "modular-bitfield",
- "msr",
- "raw-cpuid",
- "x86_64",
-]
-
 [[package]]
 name = "page_table_entry"
 version = "0.1.0"
 dependencies = [
- "bit_field 0.7.0",
  "frame_allocator",
  "kernel_config",
  "memory_structs",
@@ -1206,10 +919,6 @@ dependencies = [
  "vfs_node",
 ]
 
-[[package]]
-name = "pause"
-version = "0.1.0"
-
 [[package]]
 name = "pic"
 version = "0.1.0"
@@ -1245,16 +954,6 @@ dependencies = [
  "log",
 ]
 
-[[package]]
-name = "print"
-version = "0.1.0"
-dependencies = [
- "dfqueue",
- "event_types",
- "log",
- "spin 0.9.4",
-]
-
 [[package]]
 name = "proc-macro2"
 version = "1.0.40"
@@ -1264,31 +963,19 @@ dependencies = [
  "unicode-ident",
 ]
 
-[[package]]
-name = "ps2"
-version = "0.1.0"
-dependencies = [
- "log",
- "modular-bitfield",
- "num_enum",
- "port_io",
- "spin 0.9.4",
-]
-
 [[package]]
 name = "pte_flags"
 version = "0.1.0"
 dependencies = [
  "bitflags",
  "cfg-if 1.0.0",
- "static_assertions",
 ]
 
 [[package]]
 name = "qp-trie"
-version = "0.8.0"
+version = "0.8.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a075ecba64154fed5429568c9c6a0e0eccc3276209e93e6133206413ea6834b4"
+checksum = "9569328cda9b68120dbbf855bac541eeb40c475d96a9a380cf8b5547bfe0c165"
 dependencies = [
  "new_debug_unreachable",
  "unreachable",
@@ -1305,8 +992,9 @@ dependencies = [
 
 [[package]]
 name = "rangemap"
-version = "1.0.3"
-source = "git+https://github.com/jeffparsons/rangemap#8b290d474bae680531bfba42e545e4d0121b70fd"
+version = "1.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b9283c6b06096b47afc7109834fdedab891175bb5241ee5d4f7d2546549f263"
 
 [[package]]
 name = "raw-cpuid"
@@ -1327,24 +1015,6 @@ dependencies = [
  "spin 0.9.4",
 ]
 
-[[package]]
-name = "rsdp"
-version = "0.1.0"
-dependencies = [
- "memory",
- "static_assertions",
- "zerocopy",
-]
-
-[[package]]
-name = "rsdt"
-version = "0.1.0"
-dependencies = [
- "acpi_table",
- "memory",
- "sdt",
-]
-
 [[package]]
 name = "runqueue"
 version = "0.1.0"
@@ -1481,7 +1151,6 @@ dependencies = [
 name = "sdt"
 version = "0.1.0"
 dependencies = [
- "static_assertions",
  "zerocopy",
 ]
 
@@ -1529,10 +1198,6 @@ dependencies = [
  "spin 0.9.4",
 ]
 
-[[package]]
-name = "shapes"
-version = "0.1.0"
-
 [[package]]
 name = "single_simd_task_optimization"
 version = "0.1.0"
@@ -1546,38 +1211,12 @@ dependencies = [
 name = "sleep"
 version = "0.1.0"
 dependencies = [
+ "crossbeam-utils",
  "irq_safety",
  "lazy_static",
  "scheduler",
  "task",
-]
-
-[[package]]
-name = "spawn"
-version = "0.1.0"
-dependencies = [
- "apic",
- "catch_unwind",
- "context_switch",
- "debugit",
- "fault_crate_swap",
- "fault_log",
- "fs_node",
- "irq_safety",
- "lazy_static",
- "log",
- "memory",
- "mod_mgmt",
- "no_drop",
- "path",
- "pause",
- "preemption",
- "runqueue",
- "scheduler",
- "spin 0.9.4",
- "stack",
- "task",
- "thread_local_macro",
+ "time",
 ]
 
 [[package]]
@@ -1680,8 +1319,8 @@ dependencies = [
 name = "task"
 version = "0.1.0"
 dependencies = [
- "apic",
  "context_switch",
+ "cpu",
  "crossbeam-utils",
  "environment",
  "irq_safety",
@@ -1700,23 +1339,11 @@ dependencies = [
 ]
 
 [[package]]
-name = "text_display"
-version = "0.1.0"
-dependencies = [
- "color",
- "displayable",
- "font",
- "framebuffer",
- "framebuffer_printer",
- "shapes",
- "spin 0.9.4",
-]
-
-[[package]]
-name = "thread_local_macro"
+name = "time"
 version = "0.1.0"
 dependencies = [
- "static_assertions",
+ "crossbeam-utils",
+ "log",
 ]
 
 [[package]]
@@ -1739,25 +1366,32 @@ dependencies = [
 ]
 
 [[package]]
-name = "tsc"
-version = "0.1.0"
-dependencies = [
- "log",
- "pit_clock_basic",
-]
+name = "tock-registers"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4ee8fba06c1f4d0b396ef61a54530bb6b28f0dc61c38bc8bc5a5a48161e6282e"
 
 [[package]]
 name = "tss"
 version = "0.1.0"
 dependencies = [
- "apic",
  "atomic_linked_list",
+ "cpu",
  "log",
  "memory",
  "spin 0.9.4",
  "x86_64",
 ]
 
+[[package]]
+name = "tty"
+version = "0.1.0"
+dependencies = [
+ "async_channel",
+ "core2",
+ "mutex_sleep",
+]
+
 [[package]]
 name = "unicode-ident"
 version = "1.0.1"
@@ -1793,10 +1427,6 @@ dependencies = [
  "task",
 ]
 
-[[package]]
-name = "util"
-version = "0.1.0"
-
 [[package]]
 name = "version_check"
 version = "0.9.4"
@@ -1818,7 +1448,7 @@ name = "vga_buffer"
 version = "0.1.0"
 dependencies = [
  "kernel_config",
- "logger",
+ "logger_x86_64",
  "spin 0.9.4",
  "volatile 0.2.7",
 ]
@@ -1844,65 +1474,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "e4c2dbd44eb8b53973357e6e207e370f0c1059990df850aca1eca8947cf464f0"
 
 [[package]]
-name = "wasi"
-version = "0.10.2+wasi-snapshot-preview1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
-
-[[package]]
-name = "window"
+name = "wait_queue"
 version = "0.1.0"
 dependencies = [
- "color",
- "dereffer",
- "event_types",
- "framebuffer",
- "framebuffer_drawer",
+ "irq_safety",
  "log",
- "mouse",
- "mpmc",
- "path",
- "shapes",
- "spawn",
- "spin 0.9.4",
- "window_inner",
- "window_manager",
-]
-
-[[package]]
-name = "window_inner"
-version = "0.1.0"
-dependencies = [
- "event_types",
- "framebuffer",
- "mpmc",
- "shapes",
+ "scheduler",
+ "task",
 ]
 
 [[package]]
-name = "window_manager"
-version = "0.1.0"
-dependencies = [
- "color",
- "compositor",
- "event_types",
- "font",
- "framebuffer",
- "framebuffer_compositor",
- "framebuffer_drawer",
- "keycodes_ascii",
- "lazy_static",
- "log",
- "mod_mgmt",
- "mouse_data",
- "mpmc",
- "path",
- "scheduler",
- "shapes",
- "spawn",
- "spin 0.9.4",
- "window_inner",
-]
+name = "wasi"
+version = "0.10.2+wasi-snapshot-preview1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
 
 [[package]]
 name = "x86_64"
diff --git a/tools/diff_crates/Cargo.lock b/tools/diff_crates/Cargo.lock
index 88479bb40e..0ada5278dd 100644
--- a/tools/diff_crates/Cargo.lock
+++ b/tools/diff_crates/Cargo.lock
@@ -1,147 +1,172 @@
 # This file is automatically @generated by Cargo.
 # It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "autocfg"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
+
 [[package]]
 name = "diff_crates"
 version = "0.1.0"
 dependencies = [
- "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
- "multimap 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "qp-trie 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)",
- "spin 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "getopts",
+ "multimap",
+ "qp-trie",
+ "serde_json",
+ "spin",
+ "walkdir",
 ]
 
 [[package]]
 name = "getopts"
 version = "0.2.17"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b900c08c1939860ce8b54dc6a89e26e00c04c380fd0e09796799bd7f12861e05"
 
 [[package]]
 name = "itoa"
 version = "0.4.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b"
+
+[[package]]
+name = "lock_api"
+version = "0.4.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df"
+dependencies = [
+ "autocfg",
+ "scopeguard",
+]
 
 [[package]]
 name = "multimap"
 version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2eb04b9f127583ed176e163fb9ec6f3e793b87e21deedd5734a69386a18a0151"
 dependencies = [
- "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde",
 ]
 
 [[package]]
 name = "new_debug_unreachable"
 version = "1.0.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f40f005c60db6e03bae699e414c58bf9aa7ea02a2d0b9bfbcf19286cc4c82b30"
 
 [[package]]
 name = "qp-trie"
-version = "0.7.6"
+version = "0.8.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9569328cda9b68120dbbf855bac541eeb40c475d96a9a380cf8b5547bfe0c165"
 dependencies = [
- "new_debug_unreachable 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "new_debug_unreachable",
+ "unreachable",
 ]
 
 [[package]]
 name = "ryu"
 version = "0.2.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7"
 
 [[package]]
 name = "same-file"
 version = "1.0.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267"
 dependencies = [
- "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi-util",
 ]
 
+[[package]]
+name = "scopeguard"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
+
 [[package]]
 name = "serde"
 version = "1.0.89"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "92514fb95f900c9b5126e32d020f5c6d40564c27a5ea6d1d7d9f157a96623560"
 
 [[package]]
 name = "serde_json"
 version = "1.0.39"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d"
 dependencies = [
- "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
+ "itoa",
+ "ryu",
+ "serde",
 ]
 
 [[package]]
 name = "spin"
-version = "0.5.0"
+version = "0.9.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7dccf47db1b41fa1573ed27ccf5e08e3ca771cb994f776668c5ebda893b248fc"
+dependencies = [
+ "lock_api",
+]
 
 [[package]]
 name = "unreachable"
 version = "1.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"
 dependencies = [
- "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "void",
 ]
 
 [[package]]
 name = "void"
 version = "1.0.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
 
 [[package]]
 name = "walkdir"
 version = "2.2.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9d9d7ed3431229a144296213105a390676cc49c9b6a72bd19f3176c98e129fa1"
 dependencies = [
- "same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "same-file",
+ "winapi",
+ "winapi-util",
 ]
 
 [[package]]
 name = "winapi"
 version = "0.3.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0"
 dependencies = [
- "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi-i686-pc-windows-gnu",
+ "winapi-x86_64-pc-windows-gnu",
 ]
 
 [[package]]
 name = "winapi-i686-pc-windows-gnu"
 version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
 
 [[package]]
 name = "winapi-util"
 version = "0.1.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9"
 dependencies = [
- "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi",
 ]
 
 [[package]]
 name = "winapi-x86_64-pc-windows-gnu"
 version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[metadata]
-"checksum getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)" = "b900c08c1939860ce8b54dc6a89e26e00c04c380fd0e09796799bd7f12861e05"
-"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b"
-"checksum multimap 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb04b9f127583ed176e163fb9ec6f3e793b87e21deedd5734a69386a18a0151"
-"checksum new_debug_unreachable 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f40f005c60db6e03bae699e414c58bf9aa7ea02a2d0b9bfbcf19286cc4c82b30"
-"checksum qp-trie 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "3feac20f371627c3c9e1fe7cb9e98a0b058a27d0a79ca022a5666407f4fc7453"
-"checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7"
-"checksum same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267"
-"checksum serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)" = "92514fb95f900c9b5126e32d020f5c6d40564c27a5ea6d1d7d9f157a96623560"
-"checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d"
-"checksum spin 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44363f6f51401c34e7be73db0db371c04705d35efbe9f7d6082e03a921a32c55"
-"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"
-"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
-"checksum walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d9d7ed3431229a144296213105a390676cc49c9b6a72bd19f3176c98e129fa1"
-"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0"
-"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
-"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9"
-"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
+checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
diff --git a/tools/diff_crates/Cargo.toml b/tools/diff_crates/Cargo.toml
index 07e6db46d9..a710dc4a46 100644
--- a/tools/diff_crates/Cargo.toml
+++ b/tools/diff_crates/Cargo.toml
@@ -8,7 +8,7 @@ authors = ["Kevin Boos <kevinaboos@gmail.com>"]
 [dependencies]
 getopts = "0.2"
 walkdir = "2.2.7"
-qp-trie = "0.8.0"
+qp-trie = "0.8.1"
 multimap = "0.4.0"
 spin = "0.9.4"
 serde_json = "1.0.39"
\ No newline at end of file


Test patch: