Skip to content

Commit 1f6f510

Browse files
committed
[feat] set pat and mtrr_def_type read from LinuxContext in construct_guest64
1 parent 324f30d commit 1f6f510

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/context.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ impl LinuxContext {
161161
/// The initialized context of the instance's first process.
162162
/// It is used to initialize the vCPU context for the shim kernel which enters
163163
/// under Intel's long mode.
164-
pub fn construct_guest64(rip: u64, cr3: u64, cr4: Cr4Flags) -> Self {
164+
pub fn construct_guest64(rip: u64, cr3: u64, cr4: Cr4Flags, linux: &LinuxContext) -> Self {
165165
Self {
166166
rsp: 0,
167167
rip,
@@ -238,8 +238,8 @@ impl LinuxContext {
238238
ia32_sysenter_esp: 0,
239239
ia32_sysenter_eip: 0,
240240
kernel_gsbase: 0,
241-
pat: 0,
242-
mtrr_def_type: 0,
241+
pat: linux.pat, // Reuse PAT value provided by Linux.
242+
mtrr_def_type: linux.mtrr_def_type, // Reuse MTRR value provided by Linux.
243243
}
244244
}
245245

0 commit comments

Comments
 (0)