/*
   Crash the kernel by disabling interrupts (for testing watchdog)

   Copyright (C)  2008 Timo Juhani Lindfors <timo.lindfors@iki.fi>

   This module is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This module is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this module; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/semaphore.h>

static int __init init_crash(void) {
    printk(KERN_EMERG "crash: Initialized. rmmod crash will crash the system");
    return 0;
}

static void __exit cleanup_crash(void) {
    struct semaphore sem;
    
    sema_init(&sem, 1);
    down(&sem);
    down(&sem);
}

MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("crash the system");
MODULE_AUTHOR("Timo Juhani Lindfors <timo.lindfors@iki.fi>");
module_init(init_crash);
module_exit(cleanup_crash);
