Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * Copyright (C) 2019-2022 Red Hat, Inc. Daniel Bristot de Oliveira <bristot@kernel.org>
0004  *
0005  * Panic RV reactor:
0006  *   Prints the exception msg to the kernel message log and panic().
0007  */
0008 
0009 #include <linux/ftrace.h>
0010 #include <linux/tracepoint.h>
0011 #include <linux/kernel.h>
0012 #include <linux/module.h>
0013 #include <linux/init.h>
0014 #include <linux/rv.h>
0015 
0016 static void rv_panic_reaction(char *msg)
0017 {
0018     panic(msg);
0019 }
0020 
0021 static struct rv_reactor rv_panic = {
0022     .name = "panic",
0023     .description = "panic the system if an exception is found.",
0024     .react = rv_panic_reaction
0025 };
0026 
0027 static int __init register_react_panic(void)
0028 {
0029     rv_register_reactor(&rv_panic);
0030     return 0;
0031 }
0032 
0033 static void __exit unregister_react_panic(void)
0034 {
0035     rv_unregister_reactor(&rv_panic);
0036 }
0037 
0038 module_init(register_react_panic);
0039 module_exit(unregister_react_panic);
0040 
0041 MODULE_LICENSE("GPL");
0042 MODULE_AUTHOR("Daniel Bristot de Oliveira");
0043 MODULE_DESCRIPTION("panic rv reactor: panic if an exception is found.");