mirror of
https://github.com/Leonmmcoset/cleonos.git
synced 2026-04-24 19:34:01 +00:00
Alt+Ctrl+C
This commit is contained in:
@@ -32,6 +32,7 @@ static int ush_cmd_help(void) {
|
||||
ush_writeln(" kill <pid> [signal]");
|
||||
ush_writeln(" jobs [-a] / ps [-a] [-u] / top [--once] [-n loops] [-d ticks]");
|
||||
ush_writeln(" sleep <ticks>");
|
||||
ush_writeln(" spin (busy loop test for Alt+Ctrl+C)");
|
||||
ush_writeln(" yield");
|
||||
ush_writeln(" shutdown / restart");
|
||||
ush_writeln(" exit [code]");
|
||||
|
||||
16
cleonos/c/apps/spin_main.c
Normal file
16
cleonos/c/apps/spin_main.c
Normal file
@@ -0,0 +1,16 @@
|
||||
#include <cleonos_syscall.h>
|
||||
|
||||
int cleonos_app_main(void) {
|
||||
static const char banner[] =
|
||||
"spin: busy loop started (test Alt+Ctrl+C force stop)\n";
|
||||
volatile u64 noise = 0xC1E0C1E0ULL;
|
||||
|
||||
(void)cleonos_sys_tty_write(banner, (u64)(sizeof(banner) - 1U));
|
||||
|
||||
for (;;) {
|
||||
noise ^= (noise << 7);
|
||||
noise ^= (noise >> 9);
|
||||
noise ^= 0x9E3779B97F4A7C15ULL;
|
||||
noise += 0xA5A5A5A5A5A5A5A5ULL;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user