GMMOS: the Guru Meditation Micro OS, alive under the PSOGM
A panic no longer ends in a picture. The report is drawn as before, and
then GMMOS runs under it: the real kernel stays dead -- the other
processors are halted, and nothing of it is called that locks, sleeps,
allocates or waits for an interrupt -- and GMMOS keeps its own clock
(the TSC), its own keyboard (micro drivers, polled), and the screen.
On the report: a live status line counting down the three-minute
power-off, which any key cancels, and the keys.
Space the last 300 lines of this boot's log as QR codes, a page per
symbol, numbered; + and - trade module size for capacity
L the log on screen, scrolled
T a terminal: why, log, grep, ps, cpus, pci, mem (page tables
walked first, so a bad address cannot fault), uptime, restart,
poweroff
R R restart; P P power off -- twice, so a stray key does neither
The first micro driver is PS/2, polled: kbd.c with everything but the
keys taken out. The probe asks the keyboard to echo, so a controller
with nothing behind it is not offered as one. Polling also sidesteps the
IRQ 1 polarity quirk, which is about interrupt routing.
A panic inside GMMOS (or a second one in the report) is reported and
then only blinks; it does not re-enter GMMOS.
Checked under QEMU: every screen; two QR pages read off a screenshot
with zbar decode to the log text exactly; restart reboots; left alone it
still powers off at three minutes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4
This commit is contained in:
parent
38c89b1a9a
commit
cb9b06d46f
9 changed files with 1317 additions and 7 deletions
|
|
@ -566,6 +566,7 @@ int proc_exists(int);
|
|||
int proc_num(void);
|
||||
struct procinfo;
|
||||
int proc_snapshot(int idx, struct procinfo *out);
|
||||
int proc_peek(int idx, struct procinfo *out); // no lock: GMMOS
|
||||
int proc_snapshot_pid(int pid, struct procinfo *out);
|
||||
void pinit(void);
|
||||
void procdump(void);
|
||||
|
|
|
|||
|
|
@ -41,4 +41,5 @@ void klog_putc(int c);
|
|||
int klog_read(uint64 off, char *dst, int n);
|
||||
uint64 klog_len(void);
|
||||
uint64 klog_prev_bytes(void);
|
||||
uint64 klog_boot_bytes(void);
|
||||
int klog_recovered(void);
|
||||
|
|
|
|||
38
include/gmmos/gmmos.h
Normal file
38
include/gmmos/gmmos.h
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#pragma once
|
||||
|
||||
#include "core/types.h"
|
||||
|
||||
// GMMOS -- Guru Meditation Micro OS. What runs after a panic.
|
||||
//
|
||||
// The PSOGM used to be the last thing the kernel did: a report, blinking
|
||||
// keyboard lights, and a machine that needed its power button. GMMOS keeps the
|
||||
// report and goes on living under it. The real kernel is dead and stays dead --
|
||||
// every other processor is halted (see trap()), and nothing of it is called
|
||||
// again that takes a lock, sleeps, allocates or waits for an interrupt. What
|
||||
// GMMOS has instead is its own: the framebuffer, a clock read from the TSC, and
|
||||
// keyboards it polls itself through micro drivers.
|
||||
//
|
||||
// A micro driver is a cut-down copy of a real one that does only what a
|
||||
// keyboard needs. The real drivers run on interrupts, threads and locks, all of
|
||||
// which belong to the kernel that just died.
|
||||
//
|
||||
// See kernel/gmmos/gmmos.c.
|
||||
|
||||
void gmmos_run(char *reason, addr_t *pcs, int npcs) __attribute__((noreturn));
|
||||
|
||||
// One keyboard GMMOS can read by polling.
|
||||
struct gmmos_kbd {
|
||||
const char *name;
|
||||
int (*probe)(void); // nonzero if it is there and usable
|
||||
// The next key, or 0 when there is none: a Unicode codepoint, or one of the
|
||||
// KBD_* codes from include/dev/kbd.h for keys that are not characters.
|
||||
int (*poll)(void);
|
||||
void (*leds)(int on); // optional: all three lights on or off
|
||||
};
|
||||
|
||||
extern const struct gmmos_kbd gmmos_ps2;
|
||||
|
||||
// From kernel/core/panic.c: draw the report again, and where its closing
|
||||
// lines are, which GMMOS writes its status and its keys into.
|
||||
void psogm_repaint(void);
|
||||
void psogm_footer(int *x, int *y, int *step);
|
||||
Loading…
Reference in a new issue