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  * Printk RV reactor:
0006  *   Prints the exception msg to the kernel message log.
0007  */
0008 #include <linux/ftrace.h>
0009 #include <linux/tracepoint.h>
0010 #include <linux/kernel.h>
0011 #include <linux/module.h>
0012 #include <linux/init.h>
0013 #include <linux/rv.h>
0014 
0015 static void rv_printk_reaction(char *msg)
0016 {
0017     printk_deferred(msg);
0018 }
0019 
0020 static struct rv_reactor rv_printk = {
0021     .name = "printk",
0022     .description = "prints the exception msg to the kernel message log.",
0023     .react = rv_printk_reaction
0024 };
0025 
0026 static int __init register_react_printk(void)
0027 {
0028     rv_register_reactor(&rv_printk);
0029     return 0;
0030 }
0031 
0032 static void __exit unregister_react_printk(void)
0033 {
0034     rv_unregister_reactor(&rv_printk);
0035 }
0036 
0037 module_init(register_react_printk);
0038 module_exit(unregister_react_printk);
0039 
0040 MODULE_LICENSE("GPL");
0041 MODULE_AUTHOR("Daniel Bristot de Oliveira");
0042 MODULE_DESCRIPTION("printk rv reactor: printk if an exception is hit.");