From 326ddb5e688b05b8a95582117ddda2027d0f7b84 Mon Sep 17 00:00:00 2001 From: Sandipan Das Date: Sat, 6 Feb 2021 17:39:59 +0530 Subject: [PATCH] arch-power: Fix process initialization During process initialization, special purpose registers, represented as misc registers, should either be explicitly set or cleared. These contain flag bits which might have unforseen side effects on the execution of a program. Change-Id: If7c5af9a93283a53717cc8cbba4bf373a7e40560 Signed-off-by: Sandipan Das --- src/arch/power/process.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/arch/power/process.cc b/src/arch/power/process.cc index 735b3d9de..ea1972de3 100644 --- a/src/arch/power/process.cc +++ b/src/arch/power/process.cc @@ -332,6 +332,10 @@ PowerProcess::argsInit(int pageSize) //Set the stack pointer register tc->setIntReg(StackPointerReg, stack_min); + //Reset the special-purpose registers + for (int i = 0; i < NumMiscRegs; i++) + tc->setMiscRegNoEffect(i, 0); + //Set the machine status for a typical userspace Msr msr = 0; msr.sf = is64bit; -- 2.30.2