From e16324887f8d949a067b8dd3a92473511288e383 Mon Sep 17 00:00:00 2001 From: apio Date: Tue, 15 Nov 2022 19:10:19 +0100 Subject: [PATCH] MMU: Properly clear flags --- kernel/src/arch/x86_64/MMU.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/kernel/src/arch/x86_64/MMU.cpp b/kernel/src/arch/x86_64/MMU.cpp index ff6e9534..e259eb47 100644 --- a/kernel/src/arch/x86_64/MMU.cpp +++ b/kernel/src/arch/x86_64/MMU.cpp @@ -242,11 +242,11 @@ namespace MMU if (l1.present) return err; // Please explicitly unmap the page before mapping it again. l1.ignore0 = l1.ignore1 = false; l1.present = true; - if (flags & Flags::ReadWrite) l1.read_write = true; - if (flags & Flags::User) l1.user = true; - if (flags & Flags::WriteThrough) l1.write_through = true; - if (flags & Flags::CacheDisable) l1.cache_disabled = true; - if (flags & Flags::NoExecute) l1.no_execute = true; + l1.read_write = (flags & Flags::ReadWrite); + l1.user = (flags & Flags::User); + l1.write_through = (flags & Flags::WriteThrough); + l1.cache_disabled = (flags & Flags::CacheDisable); + l1.no_execute = (flags & Flags::NoExecute); l1.set_address(phys); return {}; } @@ -257,11 +257,11 @@ namespace MMU if (rc.has_error()) return rc.release_error(); auto& l1 = *rc.release_value(); if (!l1.present) return err; - if (flags & Flags::ReadWrite) l1.read_write = true; - if (flags & Flags::User) l1.user = true; - if (flags & Flags::WriteThrough) l1.write_through = true; - if (flags & Flags::CacheDisable) l1.cache_disabled = true; - if (flags & Flags::NoExecute) l1.no_execute = true; + l1.read_write = (flags & Flags::ReadWrite); + l1.user = (flags & Flags::User); + l1.write_through = (flags & Flags::WriteThrough); + l1.cache_disabled = (flags & Flags::CacheDisable); + l1.no_execute = (flags & Flags::NoExecute); return {}; }