From 1e10cac3e1d951258920a6d7aed36343fe162e64 Mon Sep 17 00:00:00 2001
From: Robin Randhawa <robin.randhawa@arm.com>
Date: Thu, 28 Jan 2021 16:51:50 +0000
Subject: [PATCH] aarch64: Increase storage for FP context to consider
 AArch64's needs

Brute-forcing this at present. Would be better to wrap this
conditionally for the architecture.
---
 src/context/list.rs    | 2 +-
 src/context/mod.rs     | 2 +-
 src/syscall/process.rs | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/context/list.rs b/src/context/list.rs
index 47c6c9fe..704642e9 100644
--- a/src/context/list.rs
+++ b/src/context/list.rs
@@ -75,7 +75,7 @@ impl ContextList {
         let context_lock = self.new_context()?;
         {
             let mut context = context_lock.write();
-            let mut fx = unsafe { Box::from_raw(crate::ALLOCATOR.alloc(Layout::from_size_align_unchecked(512, 16)) as *mut [u8; 512]) };
+            let mut fx = unsafe { Box::from_raw(crate::ALLOCATOR.alloc(Layout::from_size_align_unchecked(1024, 16)) as *mut [u8; 1024]) };
             for b in fx.iter_mut() {
                 *b = 0;
             }
diff --git a/src/context/mod.rs b/src/context/mod.rs
index 6c293285..a19c428b 100644
--- a/src/context/mod.rs
+++ b/src/context/mod.rs
@@ -55,7 +55,7 @@ pub fn init() {
     let mut contexts = contexts_mut();
     let context_lock = contexts.new_context().expect("could not initialize first context");
     let mut context = context_lock.write();
-    let mut fx = unsafe { Box::from_raw(crate::ALLOCATOR.alloc(Layout::from_size_align_unchecked(512, 16)) as *mut [u8; 512]) };
+    let mut fx = unsafe { Box::from_raw(crate::ALLOCATOR.alloc(Layout::from_size_align_unchecked(1024, 16)) as *mut [u8; 1024]) };
     for b in fx.iter_mut() {
         *b = 0;
     }
diff --git a/src/syscall/process.rs b/src/syscall/process.rs
index df1b24de..9adad283 100644
--- a/src/syscall/process.rs
+++ b/src/syscall/process.rs
@@ -87,7 +87,7 @@ pub fn clone(flags: CloneFlags, stack_base: usize) -> Result<ContextId> {
             arch = context.arch.clone();
 
             if let Some(ref fx) = context.kfx {
-                let mut new_fx = unsafe { Box::from_raw(crate::ALLOCATOR.alloc(Layout::from_size_align_unchecked(512, 16)) as *mut [u8; 512]) };
+                let mut new_fx = unsafe { Box::from_raw(crate::ALLOCATOR.alloc(Layout::from_size_align_unchecked(1024, 16)) as *mut [u8; 1024]) };
                 for (new_b, b) in new_fx.iter_mut().zip(fx.iter()) {
                     *new_b = *b;
                 }
-- 
GitLab