linuxdebug/kernel/universe.c

61 lines
2.4 KiB
C
Raw Normal View History

2024-07-16 15:50:57 +02:00
#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");
}
2024-07-16 16:14:20 +02:00
<<<<<<< HEAD
2024-07-16 15:50:57 +02:00
2024-07-16 16:14:20 +02:00
=======
>>>>>>> 872f2f071428594c941a76a302e55e515be334d1
2024-07-16 15:50:57 +02:00
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.
2024-07-16 16:14:20 +02:00
<<<<<<< HEAD
2024-07-16 16:02:48 +02:00
//timer->function = NULL;
2024-07-16 16:14:20 +02:00
=======
2024-07-09 16:52:29 +02:00
timer->function = NULL;
2024-07-16 16:14:20 +02:00
>>>>>>> 872f2f071428594c941a76a302e55e515be334d1
2024-07-16 15:50:57 +02:00
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);
2024-07-16 16:14:20 +02:00
<<<<<<< HEAD
2024-07-16 15:50:57 +02:00
2024-07-16 16:14:20 +02:00
=======
>>>>>>> 872f2f071428594c941a76a302e55e515be334d1
2024-07-16 15:50:57 +02:00
}