blob: 4d7cbff802c63a15ccb5ed0ca065d1e9bf1f3482 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Simon Glassca96f652011-10-03 19:26:37 +00002/*
3 * Copyright (c) 2011 The Chromium OS Authors.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
Simon Glassca96f652011-10-03 19:26:37 +00006 */
7
8#include <common.h>
Heinrich Schuchardt28eb5092020-11-12 00:29:56 +01009#include <efi_loader.h>
Simon Glass9b61c7c2019-11-14 12:57:41 -070010#include <irq_func.h>
Heinrich Schuchardt28eb5092020-11-12 00:29:56 +010011#include <os.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060012#include <asm/global_data.h>
Heinrich Schuchardt28eb5092020-11-12 00:29:56 +010013#include <asm-generic/signal.h>
14#include <asm/u-boot-sandbox.h>
15
16DECLARE_GLOBAL_DATA_PTR;
Simon Glassca96f652011-10-03 19:26:37 +000017
18int interrupt_init(void)
19{
20 return 0;
21}
22
23void enable_interrupts(void)
24{
25 return;
26}
27int disable_interrupts(void)
28{
29 return 0;
30}
Heinrich Schuchardt28eb5092020-11-12 00:29:56 +010031
32void os_signal_action(int sig, unsigned long pc)
33{
34 efi_restore_gd();
35
36 switch (sig) {
37 case SIGILL:
38 printf("\nIllegal instruction\n");
39 break;
40 case SIGBUS:
41 printf("\nBus error\n");
42 break;
43 case SIGSEGV:
44 printf("\nSegmentation violation\n");
45 break;
46 default:
47 break;
48 }
49 printf("pc = 0x%lx, ", pc);
50 printf("pc_reloc = 0x%lx\n\n", pc - gd->reloc_off);
51 efi_print_image_infos((void *)pc);
52
53 if (IS_ENABLED(CONFIG_SANDBOX_CRASH_RESET)) {
54 printf("resetting ...\n\n");
55 sandbox_reset();
56 } else {
57 sandbox_exit();
58 }
59}