linuxdebug/kernel/universe.c

61 lines
2.4 KiB
C

#include <linux/hrtimer.h>
#include <linux/printk.h>
#include <linux/delay.h>
static struct hrtimer timer;
static void boom(void) {
printk("⠀⠀⠀⠀⠀⠀⠀⠀⣀⡤⠤⢒⣦⠶⠶⠶⣦⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀\n");
printk(" ⠀⠀⠀⠀⠀⢀⡴⠋⠿⠀⠀⠈⠋⠀⠀⠀⠁⠙⠷⣦⣤⣀⠀⠀⠀⠀⠀\n");
printk(" ⠀⢀⡴⠶⣴⠻⠀⠀⠐⣶⠞⠁⠀⢀⠀⠀⠀⣀⠀⠙⠀⠹⢶⣀⠀⠀⠀\n");
printk(" ⢠⡿⠀⠀⠗⠀⠀⠀⠀⠃⠀⠀⢰⣏⠁⠀⠀⠈⡏⠉⠀⠀⠸⡏⢣⠀⠀\n");
printk(" ⣺⠂⠀⣖⠀⠀⠀⠀⢀⡀⢀⣹⣦⡽⣦⣴⣤⣀⢠⡀⠀⢀⠀⠑⠼⣇⠀\n");
printk(" ⠹⡟⡄⢈⣩⠀⠀⠲⠾⠛⡛⠋⠉⠀⡀⢀⣿⠙⠾⣦⡐⢿⡁⠀⡀⢸⡀\n");
printk(" ⠀⢿⣷⡀⠀⢚⡀⠈⢉⡳⢵⡄⢠⠀⠇⣿⣿⠒⠚⠍⠁⢀⣤⡰⠛⠛⠁\n");
printk(" ⠀⠀⠈⠛⠛⠋⠈⠉⠉⠙⠓⣷⠸⣼⣸⢻⣛⠓⠶⠞⠓⠛⠉⠀⠀⠀⠀\n");
printk(" ⠀⠀⠀⠀⠀⠀⢀⣠⡴⣞⣭⣿⡄⠋⡇⢸⢥⡽⢳⣤⡀⠀⠀⠀⠀⠀⠀\n");
printk(" ⠀⠀⠀⠀⠀⠐⣯⡁⣉⠛⢏⣸⣇⣷⣉⣿⡴⢧⠈⠊⠹⣧⡀⠀⠀⠀⠀\n");
printk(" ⠀⠀⠀⠀⠀⠀⠙⠶⣷⣆⣀⣌⠁⠘⣁⣨⡀⢈⣀⣰⣠⣿⠇⠀⠀⠀⠀\n");
printk(" ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⣿⣷⠛⡋⣏⠙⠿⠛⠉⠉⠁⠀⠀⠀⠀⠀\n");
printk(" ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⢻⠀⡇⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\n");
printk(" ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⢸⠃⡇⢻⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\n");
printk(" ⠀⠀⠀⠀⠀⠀⠀⠀⡀⣴⣿⠟⠀⠀⣷⠈⢿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀\n");
printk(" ⠀⠀⠀⠀⠀⠀⠀⠀⠐⠋⠁⠠⠃⠀⠈⠀⠈⠙⠂⠀⠀⠀⠀⠀⠀⠀⠀\n");
}
<<<<<<< HEAD
=======
>>>>>>> 872f2f071428594c941a76a302e55e515be334d1
static enum hrtimer_restart sst_cb(struct hrtimer *timer) {
timer = NULL;
printk("Three...\n");
mdelay(1000);
printk("two...\n");
mdelay(1000);
printk("one...\n");
mdelay(1000);
boom();
// Marvin knows everything about cookies.
<<<<<<< HEAD
//timer->function = NULL;
=======
timer->function = NULL;
>>>>>>> 872f2f071428594c941a76a302e55e515be334d1
return HRTIMER_NORESTART;
}
void arm_sst(void) {
hrtimer_init(&timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
timer.function = sst_cb;
printk("Armed the universe's timer.\n");
hrtimer_start(&timer, ms_to_ktime(75000), HRTIMER_MODE_REL);
<<<<<<< HEAD
=======
>>>>>>> 872f2f071428594c941a76a302e55e515be334d1
}