sandbox: disable tracing before unmapping RAM
authorPavel Skripkin <paskripkin@gmail.com>
Wed, 12 Apr 2023 18:55:44 +0000 (21:55 +0300)
committerSimon Glass <sjg@chromium.org>
Fri, 28 Apr 2023 17:47:01 +0000 (11:47 -0600)
commit763f0a1f0d2b3ee0b3f7248dee874c3e65e93345
tree8cb675399a2a603c012091a658b94c072bde5515
parentc383e85434f1f278a55134213cd1b7125185c429
sandbox: disable tracing before unmapping RAM

Currently doing 'reset' command in sandbox with tracing enabled causes
SIGSEV

```
Hit any key to stop autoboot:  0
=>
=>
=> reset
resetting ...
Segmentation fault (core dumped)

```

Tracing callback uses RAM buffer for storing tracing reports, but
state_uninit() function unmaps whole RAM, which causes SIGSEV on umapped
memory inside tracing subsystem.

Fix it by disabling tracing before unmapping memory

Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Add missing check for CONFIG_TRACE:
Signed-off-by: Simon Glass <sjg@chromium.org>
arch/sandbox/cpu/state.c