From d63bfac61c8f70656beffeb33d2f57628973078d Mon Sep 17 00:00:00 2001 From: "zongmin.gu" Date: Wed, 21 Oct 2020 08:37:47 +0800 Subject: [PATCH] Remove the FP area initialization code When using the optimized string lib in Occlum, the memset function would use xmm0 register, as the result, the FP area initialization code would modify the FP area before saving it. So just ignor the FP area initialization code. --- src/libos/src/syscall/mod.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libos/src/syscall/mod.rs b/src/libos/src/syscall/mod.rs index 62bb0f0e..ca39115b 100644 --- a/src/libos/src/syscall/mod.rs +++ b/src/libos/src/syscall/mod.rs @@ -908,11 +908,11 @@ pub struct FpRegs { impl FpRegs { /// Save the current CPU floating pointer states to an instance of FpRegs pub fn save() -> Self { - let mut fpregs = FpRegs { - inner: Aligned([0u8; 512]), - }; - unsafe { _fxsave(fpregs.inner.as_mut_ptr()) }; - fpregs + let mut fpregs = MaybeUninit::::uninit(); + unsafe { + _fxsave(fpregs.as_mut_ptr() as *mut u8); + fpregs.assume_init() + } } /// Restore the current CPU floating pointer states from this FpRegs instance