Alt+Ctrl+C

This commit is contained in:
2026-04-17 18:09:30 +08:00
parent 42b5925222
commit cb2406cbed
7 changed files with 310 additions and 7 deletions

View File

@@ -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]");

View 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;
}
}