From: Heinrich Schuchardt Date: Tue, 27 Oct 2020 08:29:22 +0100 Subject: [PATCH 4/5] sandbox: implement reset In-Reply-To: References: <20201025060441.11961-1-xypron.glpk@gmx.de> <20201025060441.11961-5-xypron.glpk@gmx.de> Message-ID: <44dd8950-038e-88b9-720f-e8f70c00eb78@gmx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 27.10.20 05:52, Simon Glass wrote: > Hi Heinrich, > > On Sun, 25 Oct 2020 at 00:04, Heinrich Schuchardt wrote: >> >> Up to now the sandbox would shutdown upon a cold reset request. Instead it >> should be reset. >> >> In our coding we use static variables. The only safe way to return to an >> initial state is to relaunch the U-Boot binary. > > This is unfortunate, but I suspect you may be right. Have you looked at it? I am not so much worried about the sandbox specific code, where you find static variables like: arch/sandbox/cpu/os.c:165:static bool term_setup; arch/sandbox/cpu/os.c:166:static bool term_nonblock; My worry is about the main U-Boot where it is completely legal to expect that static variables are initialized, e.g. lib/efi_loader/efi_boottime.c:28:LIST_HEAD(efi_obj_list); lib/efi_loader/efi_boottime.c:34:LIST_HEAD(efi_event_queue); lib/efi_loader/efi_boottime.c:40:LIST_HEAD(efi_register_notify_events); Best regards Heinrich > >> >> The reset implementation uses a longjmp() to return to the main() function >> and then relaunches U-Boot using execv(). >> >> Signed-off-by: Heinrich Schuchardt