1 /* xscreensaver, Copyright (c) 1998-2016 Jamie Zawinski <jwz@jwz.org>
3 * Permission to use, copy, modify, distribute, and sell this software and its
4 * documentation for any purpose is hereby granted without fee, provided that
5 * the above copyright notice appear in all copies and that both that
6 * copyright notice and this permission notice appear in supporting
7 * documentation. No representations are made about the suitability of this
8 * software for any purpose. It is provided "as is" without express or
11 * Blue Screen of Death: the finest in personal computer emulation.
12 * Concept cribbed from Stephen Martin <smartin@mks.com>;
13 * this version written by jwz, 4-Jun-98.
14 * Mostly rewritten by jwz, 20-Feb-2006.
20 - Define a function `new_os(dpy,win)' that returns a `bsod_state' struct.
21 - Draw on the window to set up its frame-zero state. This must be fast:
22 no sleeping or long loops!
23 - Populate the bsod_state structure with additional actions to take by
24 using the various BSOD_ macros. Note that you can control the delays
25 when printing text on a per-character or per-line basis.
26 - Insert your function in the `all_modes' table.
27 - Add a `doXXX' entry to `bsod_defaults'.
28 - Add fonts or colors to `bsod_defaults' if necessary.
30 Look at windows_31() for a simple example.
32 Look at linux_fsck() for a more complicated example with random behavior.
34 Or, you can bypass all that: look at nvidia() for a really hairy example.
38 #include "screenhack.h"
39 #include "xpm-pixmap.h"
45 #ifdef HAVE_XSHM_EXTENSION
50 # include <sys/utsname.h>
51 #endif /* HAVE_UNAME */
53 #if defined(HAVE_GDK_PIXBUF) || defined(HAVE_XPM) || defined(HAVE_JWXYZ)
58 # include "images/amiga.xpm"
59 # include "images/hmac.xpm"
60 # include "images/osx_10_2.xpm"
61 # include "images/osx_10_3.xpm"
62 # include "images/android.xpm"
64 #include "images/atari.xbm"
65 #include "images/mac.xbm"
66 #include "images/macbomb.xbm"
67 #include "images/atm.xbm"
70 #define countof(x) (sizeof((x))/sizeof((*x)))
74 # define MIN(A,B) ((A)<(B)?(A):(B))
75 # define MAX(A,B) ((A)>(B)?(A):(B))
80 LEFT_FULL, CENTER_FULL, RIGHT_FULL,
81 COLOR, INVERT, MOVETO, MARGINS,
82 CURSOR_BLOCK, CURSOR_LINE, RECT, COPY, PIXMAP, IMG, FONT,
83 PAUSE, CHAR_DELAY, LINE_DELAY,
89 void *arg1, *arg2, *arg3, *arg4, *arg5, *arg6;
95 XWindowAttributes xgwa;
96 XFontStruct *font, *fontA, *fontB, *fontC;
99 int left_margin, right_margin; /* for text wrapping */
100 int top_margin, bottom_margin; /* for text scrolling */
104 Pixmap pixmap; /* Source image used by BSOD_PIXMAP */
106 int x, y; /* current text-drawing position */
107 int current_left; /* don't use this */
109 int pos; /* position in queue */
111 struct bsod_event *queue;
113 unsigned long char_delay; /* delay between printing characters */
114 unsigned long line_delay; /* delay between printing lines */
116 Bool macx_eol_kludge;
119 int (*draw_cb) (struct bsod_state *);
120 void (*free_cb) (struct bsod_state *);
122 async_load_state *img_loader;
126 # if !defined(__GNUC__) && !defined(__extension__)
127 /* don't warn about "string length is greater than the length ISO C89
128 compilers are required to support" in these string constants... */
129 # define __extension__ /**/
133 /* Draw text at the current position; align is LEFT, CENTER, RIGHT, or *_FULL
134 (meaning to clear the whole line margin to margin).
136 #define BSOD_TEXT(bst,align,string) do { \
137 ensure_queue (bst); \
138 (bst)->queue[(bst)->pos].type = (align); \
139 (bst)->queue[(bst)->pos].arg1 = (void *) strdup (__extension__ (string)); \
140 (bst)->queue[(bst)->pos].arg2 = (bst)->queue[(bst)->pos].arg1; \
141 (bst)->queue[(bst)->pos].arg3 = (void *) 0; \
145 /* Flip the foreground and background colors
147 #define BSOD_INVERT(bst) do { \
148 ensure_queue (bst); \
149 (bst)->queue[(bst)->pos].type = INVERT; \
153 /* Set the foreground and background colors to the given pixels
155 #define BSOD_COLOR(bst,fg,bg) do { \
156 ensure_queue (bst); \
157 (bst)->queue[(bst)->pos].type = COLOR; \
158 (bst)->queue[(bst)->pos].arg1 = (void *) fg; \
159 (bst)->queue[(bst)->pos].arg2 = (void *) bg; \
163 /* Set the position of the next text.
164 Note that this is the baseline: lower left corner of next char printed.
166 #define BSOD_MOVETO(bst,x,y) do { \
167 ensure_queue (bst); \
168 (bst)->queue[(bst)->pos].type = MOVETO; \
169 (bst)->queue[(bst)->pos].arg1 = (void *) ((long) (x)); \
170 (bst)->queue[(bst)->pos].arg2 = (void *) ((long) (y)); \
174 /* Delay for at least the given number of microseconds.
176 #define BSOD_PAUSE(bst,usec) do { \
177 ensure_queue (bst); \
178 (bst)->queue[(bst)->pos].type = PAUSE; \
179 (bst)->queue[(bst)->pos].arg1 = (void *) ((long) (usec)); \
183 /* Set the delay after each character is printed.
185 #define BSOD_CHAR_DELAY(bst,usec) do { \
186 ensure_queue (bst); \
187 (bst)->queue[(bst)->pos].type = CHAR_DELAY; \
188 (bst)->queue[(bst)->pos].arg1 = (void *) ((long) (usec)); \
192 /* Set the delay after each newline.
194 #define BSOD_LINE_DELAY(bst,usec) do { \
195 ensure_queue (bst); \
196 (bst)->queue[(bst)->pos].type = LINE_DELAY; \
197 (bst)->queue[(bst)->pos].arg1 = (void *) (usec); \
201 /* Set the prevailing left/right margins (used when strings have
202 embedded newlines, and when centering or right-justifying text.)
204 #define BSOD_MARGINS(bst,left,right) do { \
205 ensure_queue (bst); \
206 (bst)->queue[(bst)->pos].type = MARGINS; \
207 (bst)->queue[(bst)->pos].arg1 = (void *) ((long) (left)); \
208 (bst)->queue[(bst)->pos].arg2 = (void *) ((long) (right)); \
212 /* Draw a blinking cursor; type is CURSOR_BLOCK or CURSOR_LINE.
213 usec is how long 1/2 of a cycle is. count is how many times to blink.
214 (You can pass a gigantic number if this is the last thing in your mode.)
216 #define BSOD_CURSOR(bst,ctype,usec,count) do { \
217 ensure_queue (bst); \
218 (bst)->queue[(bst)->pos].type = (ctype); \
219 (bst)->queue[(bst)->pos].arg1 = (void *) (usec); \
220 (bst)->queue[(bst)->pos].arg2 = (void *) (count); \
224 /* Draw or fill a rectangle. You can set line-width in the GC.
226 #define BSOD_RECT(bst,fill,x,y,w,h) do { \
227 ensure_queue (bst); \
228 (bst)->queue[(bst)->pos].type = RECT; \
229 (bst)->queue[(bst)->pos].arg1 = (void *) ((long) (fill)); \
230 (bst)->queue[(bst)->pos].arg2 = (void *) ((long) (x)); \
231 (bst)->queue[(bst)->pos].arg3 = (void *) ((long) (y)); \
232 (bst)->queue[(bst)->pos].arg4 = (void *) ((long) (w)); \
233 (bst)->queue[(bst)->pos].arg5 = (void *) ((long) (h)); \
237 /* Copy a rect from the window, to the window.
239 #define BSOD_COPY(bst,srcx,srcy,w,h,tox,toy) do { \
240 ensure_queue (bst); \
241 (bst)->queue[(bst)->pos].type = COPY; \
242 (bst)->queue[(bst)->pos].arg1 = (void *) ((long) (srcx)); \
243 (bst)->queue[(bst)->pos].arg2 = (void *) ((long) (srcy)); \
244 (bst)->queue[(bst)->pos].arg3 = (void *) ((long) (w)); \
245 (bst)->queue[(bst)->pos].arg4 = (void *) ((long) (h)); \
246 (bst)->queue[(bst)->pos].arg5 = (void *) ((long) (tox)); \
247 (bst)->queue[(bst)->pos].arg6 = (void *) ((long) (toy)); \
251 /* Copy a rect from bst->pixmap to the window.
253 #define BSOD_PIXMAP(bst,srcx,srcy,w,h,tox,toy) do { \
254 BSOD_COPY(bst,srcx,srcy,w,h,tox,toy); \
255 (bst)->queue[(bst)->pos-1].type = PIXMAP; \
258 /* Load a random image (or the desktop) onto the window.
260 #define BSOD_IMG(bst) do { \
261 ensure_queue (bst); \
262 (bst)->queue[(bst)->pos].type = IMG; \
266 /* Switch between fonts A, B and C.
268 #define BSOD_FONT(bst,n) do { \
269 ensure_queue (bst); \
270 (bst)->queue[(bst)->pos].type = FONT; \
271 (bst)->queue[(bst)->pos].arg1 = (void *) ((long) (n)); \
275 /* Jump around in the state table. You can use this as the last thing
276 in your state table to repeat the last N elements forever.
278 #define BSOD_LOOP(bst,off) do { \
279 ensure_queue (bst); \
280 (bst)->queue[(bst)->pos].type = LOOP; \
281 (bst)->queue[(bst)->pos].arg1 = (void *) (off); \
285 /* Restart the whole thing from the beginning.
287 #define BSOD_RESET(bst) do { \
288 ensure_queue (bst); \
289 (bst)->queue[(bst)->pos].type = RESET; \
295 ensure_queue (struct bsod_state *bst)
298 if (bst->pos + 1 < bst->queue_size)
301 n = bst->queue_size + 10;
305 bst->queue = (struct bsod_event *)
306 realloc (bst->queue, n * sizeof(*bst->queue));
307 if (!bst->queue) abort();
308 memset (bst->queue + bst->queue_size, 0,
309 (n - bst->queue_size) * sizeof(*bst->queue));
315 position_for_text (struct bsod_state *bst, const char *line)
319 const char *start = line;
321 if (bst->queue[bst->pos].type != LEFT &&
322 bst->queue[bst->pos].type != LEFT_FULL)
325 int dir, ascent, descent;
327 const char *end = start;
328 while (*end && *end != '\r' && *end != '\n')
331 XTextExtents (bst->font, start, end-start,
332 &dir, &ascent, &descent, &ov);
333 if (ov.width > max_width)
334 max_width = ov.width;
339 switch (bst->queue[bst->pos].type) {
342 bst->current_left = bst->left_margin;
346 bst->x = max_width - bst->right_margin;
347 bst->current_left = bst->x;
352 int w = (bst->xgwa.width - bst->left_margin - bst->right_margin -
355 bst->x = bst->left_margin + (w / 2);
356 bst->current_left = bst->x;
366 bst_crlf (struct bsod_state *bst)
368 int lh = bst->font->ascent + bst->font->descent;
369 bst->x = bst->current_left;
370 if (!bst->scroll_p ||
371 bst->y + lh < bst->xgwa.height - bst->bottom_margin)
375 int w = bst->xgwa.width - bst->right_margin - bst->left_margin;
376 int h = bst->xgwa.height - bst->top_margin - bst->bottom_margin;
377 XCopyArea (bst->dpy, bst->window, bst->window, bst->gc,
379 bst->top_margin + lh,
383 XClearArea (bst->dpy, bst->window,
384 bst->left_margin, bst->top_margin + h - lh, w, lh, False);
390 draw_char (struct bsod_state *bst, char c)
396 bst->x = bst->current_left;
400 if (bst->macx_eol_kludge)
402 /* Special case for the weird way OSX crashes print newlines... */
403 XDrawImageString (bst->dpy, bst->window, bst->gc,
404 bst->x, bst->y, " ", 1);
405 XDrawImageString (bst->dpy, bst->window, bst->gc,
407 bst->y + bst->font->ascent + bst->font->descent,
412 else if (c == '\b') /* backspace */
414 int cw = (bst->font->per_char
415 ? bst->font->per_char['n'-bst->font->min_char_or_byte2].width
416 : bst->font->min_bounds.width);
418 if (bst->x < bst->left_margin)
419 bst->x = bst->left_margin;
423 int dir, ascent, descent;
425 XTextExtents (bst->font, &c, 1, &dir, &ascent, &descent, &ov);
428 bst->x + ov.width > bst->xgwa.width - bst->right_margin)
431 XDrawImageString (bst->dpy, bst->window, bst->gc,
432 bst->x, bst->y, &c, 1);
439 bsod_pop (struct bsod_state *bst)
441 bsod_event_type type = bst->queue[bst->pos].type;
444 return bst->draw_cb (bst);
446 if (bst->pos < 0) /* already done */
451 case LEFT: case LEFT_FULL:
452 case CENTER: case CENTER_FULL:
453 case RIGHT: case RIGHT_FULL:
455 const char *s = (const char *) bst->queue[bst->pos].arg2;
460 long delay = bst->line_delay;
462 bst->current_left = bst->left_margin;
466 if (! bst->queue[bst->pos].arg3) /* "done once" */
468 position_for_text (bst, s);
469 bst->queue[bst->pos].arg4 = (void *) bst->queue[bst->pos].type;
470 bst->queue[bst->pos].type = LEFT;
472 if (type == CENTER_FULL ||
476 XSetForeground (bst->dpy, bst->gc, bst->bg);
477 XFillRectangle (bst->dpy, bst->window, bst->gc,
479 bst->y - bst->font->ascent,
481 bst->font->ascent + bst->font->descent);
482 XSetForeground (bst->dpy, bst->gc, bst->fg);
488 bst->queue[bst->pos].arg2 = (void *) s;
489 bst->queue[bst->pos].arg3 = (void *) 1; /* "done once" */
491 return (c == '\r' || c == '\n'
497 unsigned long swap = bst->fg;
500 XSetForeground (bst->dpy, bst->gc, bst->fg);
501 XSetBackground (bst->dpy, bst->gc, bst->bg);
507 bst->fg = (unsigned long) bst->queue[bst->pos].arg1;
508 bst->bg = (unsigned long) bst->queue[bst->pos].arg2;
509 XSetForeground (bst->dpy, bst->gc, bst->fg);
510 XSetBackground (bst->dpy, bst->gc, bst->bg);
516 bst->x = (long) bst->queue[bst->pos].arg1;
517 bst->y = (long) bst->queue[bst->pos].arg2;
523 int f = (long) bst->queue[bst->pos].arg1;
524 int x = (long) bst->queue[bst->pos].arg2;
525 int y = (long) bst->queue[bst->pos].arg3;
526 int w = (long) bst->queue[bst->pos].arg4;
527 int h = (long) bst->queue[bst->pos].arg5;
529 XFillRectangle (bst->dpy, bst->window, bst->gc, x, y, w, h);
531 XDrawRectangle (bst->dpy, bst->window, bst->gc, x, y, w, h);
538 int srcx = (long) bst->queue[bst->pos].arg1;
539 int srcy = (long) bst->queue[bst->pos].arg2;
540 int w = (long) bst->queue[bst->pos].arg3;
541 int h = (long) bst->queue[bst->pos].arg4;
542 int tox = (long) bst->queue[bst->pos].arg5;
543 int toy = (long) bst->queue[bst->pos].arg6;
545 (type == PIXMAP ? bst->pixmap : bst->window),
546 bst->window, bst->gc,
547 srcx, srcy, w, h, tox, toy);
553 if (bst->img_loader) abort();
554 bst->img_loader = load_image_async_simple (0, bst->xgwa.screen,
555 bst->window, bst->window,
562 switch ((long) bst->queue[bst->pos].arg1) {
563 case 0: bst->font = bst->fontA; break;
564 case 1: bst->font = bst->fontB; break;
565 case 2: bst->font = bst->fontC; break;
566 default: abort(); break;
568 XSetFont (bst->dpy, bst->gc, bst->font->fid);
574 long delay = (long) bst->queue[bst->pos].arg1;
580 bst->char_delay = (long) bst->queue[bst->pos].arg1;
586 bst->line_delay = (long) bst->queue[bst->pos].arg1;
592 bst->left_margin = (long) bst->queue[bst->pos].arg1;
593 bst->right_margin = (long) bst->queue[bst->pos].arg2;
600 long delay = (long) bst->queue[bst->pos].arg1;
601 long count = (long) bst->queue[bst->pos].arg2;
604 if (type == CURSOR_BLOCK)
606 unsigned long swap = bst->fg;
609 XSetForeground (bst->dpy, bst->gc, bst->fg);
610 XSetBackground (bst->dpy, bst->gc, bst->bg);
611 draw_char (bst, ' ');
615 draw_char (bst, (count & 1 ? ' ' : '_'));
616 draw_char (bst, ' ');
622 bst->queue[bst->pos].arg2 = (void *) count;
630 long off = (long) bst->queue[bst->pos].arg1;
632 if (bst->pos < 0 || bst->pos >= bst->queue_size)
639 for (i = 0; i < bst->queue_size; i++)
640 switch (bst->queue[i].type) {
641 case LEFT: case LEFT_FULL:
642 case CENTER: case CENTER_FULL:
643 case RIGHT: case RIGHT_FULL:
644 bst->queue[i].arg2 = bst->queue[i].arg1;
645 bst->queue[i].arg3 = 0;
646 bst->queue[i].type = (bsod_event_type) bst->queue[i].arg4;
665 static struct bsod_state *
666 make_bsod_state (Display *dpy, Window window,
667 const char *name, const char *class)
670 struct bsod_state *bst;
671 char buf1[1024], buf2[1024];
672 char buf3[1024], buf4[1024];
673 char buf5[1024], buf6[1024];
674 char buf7[1024], buf8[1024];
675 const char *font1, *font2, *font3, *font4;
677 bst = (struct bsod_state *) calloc (1, sizeof (*bst));
678 bst->queue_size = 10;
679 bst->queue = (struct bsod_event *) calloc (bst->queue_size,
680 sizeof (*bst->queue));
682 bst->window = window;
683 XGetWindowAttributes (dpy, window, &bst->xgwa);
685 /* If the window is small:
686 use ".font" if it is loadable, else use ".font2".
688 If the window is big:
689 use ".bigFont" if it is loadable, else use ".bigFont2".
695 bst->xgwa.height < 640
699 sprintf (buf1, "%.100s.font", name);
700 sprintf (buf2, "%.100s.font", class);
701 sprintf (buf3, "%.100s.font2", name);
702 sprintf (buf4, "%.100s.font2", class);
706 sprintf (buf1, "%.100s.bigFont", name);
707 sprintf (buf2, "%.100s.bigFont", class);
708 sprintf (buf3, "%.100s.bigFont2", name);
709 sprintf (buf4, "%.100s.bigFont2", class);
711 sprintf (buf5, "%.100s.fontB", name);
712 sprintf (buf6, "%.100s.fontB", class);
713 sprintf (buf7, "%.100s.fontC", name);
714 sprintf (buf8, "%.100s.fontC", class);
716 font1 = get_string_resource (dpy, buf1, buf2);
717 font2 = get_string_resource (dpy, buf3, buf4);
718 font3 = get_string_resource (dpy, buf5, buf6);
719 font4 = get_string_resource (dpy, buf7, buf8);
721 /* If there was no ".mode.font2" resource also look for ".font2".
722 Under real X11, the wildcard does this, so this is redundant,
723 but jwxyz needs it because it doesn't implement wildcards.
725 # define RES2(VAR, BUF1, BUF2) do { \
727 VAR = get_string_resource (dpy, \
728 strchr (BUF1, '.') + 1, \
729 strchr (BUF2, '.') + 1); \
731 RES2 (font1, buf1, buf2);
732 RES2 (font2, buf3, buf4);
733 RES2 (font3, buf5, buf6);
734 RES2 (font4, buf7, buf8);
738 bst->font = XLoadQueryFont (dpy, font1);
739 if (! bst->font && font2)
740 bst->font = XLoadQueryFont (dpy, font2);
742 /* If neither of those worked, try some defaults. */
745 bst->font = XLoadQueryFont (dpy,"-*-courier-bold-r-*-*-*-120-*-*-m-*-*-*");
747 bst->font = XLoadQueryFont (dpy, "fixed");
752 bst->fontB = XLoadQueryFont (dpy, font3);
754 bst->fontC = XLoadQueryFont (dpy, font4);
756 if (! bst->fontB) bst->fontB = bst->font;
757 if (! bst->fontC) bst->fontC = bst->font;
759 bst->fontA = bst->font;
762 gcv.font = bst->font->fid;
764 sprintf (buf1, "%.100s.foreground", name);
765 sprintf (buf2, "%.100s.Foreground", class);
766 bst->fg = gcv.foreground = get_pixel_resource (dpy, bst->xgwa.colormap,
768 sprintf (buf1, "%.100s.background", name);
769 sprintf (buf2, "%.100s.Background", class);
770 bst->bg = gcv.background = get_pixel_resource (dpy, bst->xgwa.colormap,
772 bst->gc = XCreateGC (dpy, window, GCFont|GCForeground|GCBackground, &gcv);
775 jwxyz_XSetAntiAliasing (dpy, bst->gc, True);
778 bst->left_margin = bst->right_margin = 10;
779 bst->x = bst->left_margin;
780 bst->y = bst->font->ascent + bst->left_margin;
782 XSetWindowBackground (dpy, window, gcv.background);
788 free_bsod_state (struct bsod_state *bst)
795 XFreePixmap(bst->dpy, bst->pixmap);
797 XFreeFont (bst->dpy, bst->font);
798 XFreeGC (bst->dpy, bst->gc);
800 for (i = 0; i < bst->queue_size; i++)
801 switch (bst->queue[i].type) {
802 case LEFT: case LEFT_FULL:
803 case RIGHT: case RIGHT_FULL:
804 case CENTER: case CENTER_FULL:
805 free ((char *) bst->queue[i].arg1);
817 double_pixmap (Display *dpy, GC gc, Visual *visual, int depth, Pixmap pixmap,
818 int pix_w, int pix_h)
821 Pixmap p2 = XCreatePixmap(dpy, pixmap, pix_w*2, pix_h*2, depth);
822 XImage *i1 = XGetImage(dpy, pixmap, 0, 0, pix_w, pix_h, ~0L, ZPixmap);
823 XImage *i2 = XCreateImage(dpy, visual, depth, ZPixmap, 0, 0,
824 pix_w*2, pix_h*2, 8, 0);
825 i2->data = (char *) calloc(i2->height, i2->bytes_per_line);
826 for (y = 0; y < pix_h; y++)
827 for (x = 0; x < pix_w; x++)
829 unsigned long p = XGetPixel(i1, x, y);
830 XPutPixel(i2, x*2, y*2, p);
831 XPutPixel(i2, x*2+1, y*2, p);
832 XPutPixel(i2, x*2, y*2+1, p);
833 XPutPixel(i2, x*2+1, y*2+1, p);
835 free(i1->data); i1->data = 0;
837 XPutImage(dpy, p2, gc, i2, 0, 0, 0, 0, i2->width, i2->height);
838 free(i2->data); i2->data = 0;
840 XFreePixmap(dpy, pixmap);
845 /*****************************************************************************
846 *****************************************************************************/
848 static struct bsod_state *
849 windows_31 (Display *dpy, Window window)
851 struct bsod_state *bst = make_bsod_state (dpy, window, "windows", "Windows");
853 BSOD_TEXT (bst, CENTER, "Windows\n");
855 BSOD_TEXT (bst, CENTER,
856 "A fatal exception 0E has occured at F0AD:42494C4C\n"
857 "the current application will be terminated.\n"
859 "* Press any key to terminate the current application.\n"
860 "* Press CTRL+ALT+DELETE again to restart your computer.\n"
861 " You will lose any unsaved information in all applications.\n"
864 BSOD_TEXT (bst, CENTER, "Press any key to continue");
866 bst->y = ((bst->xgwa.height -
867 ((bst->font->ascent + bst->font->descent) * 9))
870 XClearWindow (dpy, window);
875 static struct bsod_state *
876 windows_nt (Display *dpy, Window window)
878 struct bsod_state *bst = make_bsod_state (dpy, window, "nt", "NT");
880 BSOD_TEXT (bst, LEFT,
881 "*** STOP: 0x0000001E (0x80000003,0x80106fc0,0x8025ea21,0xfd6829e8)\n"
882 "Unhandled Kernel exception c0000047 from fa8418b4 (8025ea21,fd6829e8)\n"
884 "Dll Base Date Stamp - Name Dll Base Date Stamp - Name\n"
885 "80100000 2be154c9 - ntoskrnl.exe 80400000 2bc153b0 - hal.dll\n"
886 "80258000 2bd49628 - ncrc710.sys 8025c000 2bd49688 - SCSIPORT.SYS \n"
887 "80267000 2bd49683 - scsidisk.sys 802a6000 2bd496b9 - Fastfat.sys\n"
888 "fa800000 2bd49666 - Floppy.SYS fa810000 2bd496db - Hpfs_Rec.SYS\n"
889 "fa820000 2bd49676 - Null.SYS fa830000 2bd4965a - Beep.SYS\n"
890 "fa840000 2bdaab00 - i8042prt.SYS fa850000 2bd5a020 - SERMOUSE.SYS\n"
891 "fa860000 2bd4966f - kbdclass.SYS fa870000 2bd49671 - MOUCLASS.SYS\n"
892 "fa880000 2bd9c0be - Videoprt.SYS fa890000 2bd49638 - NCC1701E.SYS\n"
893 "fa8a0000 2bd4a4ce - Vga.SYS fa8b0000 2bd496d0 - Msfs.SYS\n"
894 "fa8c0000 2bd496c3 - Npfs.SYS fa8e0000 2bd496c9 - Ntfs.SYS\n"
895 "fa940000 2bd496df - NDIS.SYS fa930000 2bd49707 - wdlan.sys\n"
896 "fa970000 2bd49712 - TDI.SYS fa950000 2bd5a7fb - nbf.sys\n"
897 "fa980000 2bd72406 - streams.sys fa9b0000 2bd4975f - ubnb.sys\n"
898 "fa9c0000 2bd5bfd7 - usbser.sys fa9d0000 2bd4971d - netbios.sys\n"
899 "fa9e0000 2bd49678 - Parallel.sys fa9f0000 2bd4969f - serial.SYS\n"
900 "faa00000 2bd49739 - mup.sys faa40000 2bd4971f - SMBTRSUP.SYS\n"
901 "faa10000 2bd6f2a2 - srv.sys faa50000 2bd4971a - afd.sys\n"
902 "faa60000 2bd6fd80 - rdr.sys faaa0000 2bd49735 - bowser.sys\n"
904 "Address dword dump Dll Base - Name\n"
905 "801afc20 80106fc0 80106fc0 00000000 00000000 80149905 : "
906 "fa840000 - i8042prt.SYS\n"
907 "801afc24 80149905 80149905 ff8e6b8c 80129c2c ff8e6b94 : "
908 "8025c000 - SCSIPORT.SYS\n"
909 "801afc2c 80129c2c 80129c2c ff8e6b94 00000000 ff8e6b94 : "
910 "80100000 - ntoskrnl.exe\n"
911 "801afc34 801240f2 80124f02 ff8e6df4 ff8e6f60 ff8e6c58 : "
912 "80100000 - ntoskrnl.exe\n"
913 "801afc54 80124f16 80124f16 ff8e6f60 ff8e6c3c 8015ac7e : "
914 "80100000 - ntoskrnl.exe\n"
915 "801afc64 8015ac7e 8015ac7e ff8e6df4 ff8e6f60 ff8e6c58 : "
916 "80100000 - ntoskrnl.exe\n"
917 "801afc70 80129bda 80129bda 00000000 80088000 80106fc0 : "
918 "80100000 - ntoskrnl.exe\n"
920 "Kernel Debugger Using: COM2 (Port 0x2f8, Baud Rate 19200)\n"
921 "Restart and set the recovery options in the system control panel\n"
922 "or the /CRASHDEBUG system start option. If this message reappears,\n"
923 "contact your system administrator or technical support group."
926 bst->line_delay = 750;
928 XClearWindow (dpy, window);
933 static struct bsod_state *
934 windows_2k (Display *dpy, Window window)
936 struct bsod_state *bst = make_bsod_state (dpy, window, "windows", "Windows");
938 BSOD_TEXT (bst, LEFT,
939 "*** STOP: 0x000000D1 (0xE1D38000,0x0000001C,0x00000000,0xF09D42DA)\n"
940 "DRIVER_IRQL_NOT_LESS_OR_EQUAL \n"
942 "*** Address F09D42DA base at F09D4000, DateStamp 39f459ff - CRASHDD.SYS\n"
944 "Beginning dump of physical memory\n");
945 BSOD_PAUSE (bst, 4000000);
946 BSOD_TEXT (bst, LEFT,
947 "Physical memory dump complete. Contact your system administrator or\n"
948 "technical support group.\n");
950 bst->left_margin = 40;
951 bst->y = (bst->font->ascent + bst->font->descent) * 10;
952 bst->line_delay = 750;
954 XClearWindow (dpy, window);
959 static struct bsod_state *
960 windows_me (Display *dpy, Window window)
962 struct bsod_state *bst = make_bsod_state (dpy, window, "windows", "Windows");
964 BSOD_TEXT (bst, LEFT,
965 "Windows protection error. You need to restart your computer.\n\n"
967 BSOD_CURSOR (bst, CURSOR_LINE, 120000, 999999);
969 bst->left_margin = 40;
970 bst->y = ((bst->xgwa.height -
971 ((bst->font->ascent + bst->font->descent) * 3))
974 XClearWindow (dpy, window);
979 static struct bsod_state *
980 windows_xp (Display *dpy, Window window)
982 struct bsod_state *bst = make_bsod_state (dpy, window, "windows", "Windows");
984 BSOD_TEXT (bst, LEFT, /* From Wm. Rhodes <xscreensaver@27.org> */
985 "A problem has been detected and windows has been shut down to prevent "
987 "to your computer.\n"
989 "If this is the first time you've seen this Stop error screen,\n"
990 "restart your computer. If this screen appears again, follow\n"
993 "Check to be sure you have adequate disk space. If a driver is\n"
994 "identified in the Stop message, disable the driver or check\n"
995 "with the manufacturer for driver updates. Try changing video\n"
998 "Check with your hardware vendor for any BIOS updates. Disable\n"
999 "BIOS memory options such as caching or shadowing. If you need\n"
1000 "to use Safe Mode to remove or disable components, restart your\n"
1001 "computer, press F8 to select Advanced Startup Options, and then\n"
1002 "select Safe Mode.\n"
1004 "Technical information:\n"
1006 "*** STOP: 0x0000007E (0xC0000005,0xF88FF190,0x0xF8975BA0,0xF89758A0)\n"
1009 "*** EPUSBDSK.sys - Address F88FF190 base at FF88FE000, datestamp "
1012 "Beginning dump of physical memory\n");
1013 BSOD_PAUSE (bst, 4000000);
1014 BSOD_TEXT (bst, LEFT,
1015 "Physical memory dump complete.\n"
1016 "Contact your system administrator or technical support group for "
1020 XClearWindow (dpy, window);
1025 static struct bsod_state *
1026 windows_lh (Display *dpy, Window window)
1028 struct bsod_state *bst =
1029 make_bsod_state (dpy, window, "windowslh", "WindowsLH");
1031 unsigned long fg = bst->fg;
1032 unsigned long bg = bst->bg;
1033 unsigned long bg2 = get_pixel_resource (dpy, bst->xgwa.colormap,
1034 "windowslh.background2",
1035 "WindowsLH.Background");
1037 /* The "RSOD" that appeared with "Windows Longhorn 5048.050401-0536_x86fre"
1038 As reported by http://joi.ito.com/RedScreen.jpg
1040 BSOD_COLOR (bst, bg, bg2);
1041 BSOD_TEXT (bst, CENTER_FULL, "Windows Boot Error\n");
1042 BSOD_COLOR (bst, fg, bg);
1043 BSOD_TEXT (bst, CENTER,
1045 "Windows Boot Manager has experienced a problem.\n"
1048 " Status: 0xc000000f\n"
1052 " Info: An error occurred transferring exectuion." /* (sic) */
1056 "You can try to recover the system with the Microsoft Windows "
1058 "Tools. (You might need to restart the system manually.)\n"
1060 "If the problem continues, please contact your system administrator "
1064 BSOD_MOVETO (bst, bst->left_margin, bst->xgwa.height - bst->font->descent);
1065 BSOD_COLOR (bst, bg, bg2);
1066 BSOD_TEXT (bst, LEFT_FULL, " SPACE=Continue\n");
1068 bst->y = bst->font->ascent;
1070 XClearWindow (dpy, window);
1075 static struct bsod_state *
1076 windows_10 (Display *dpy, Window window)
1078 struct bsod_state *bst =
1079 make_bsod_state (dpy, window, "win10", "Win10");
1083 static const unsigned char qr_bits[] = {
1084 0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,
1085 0x03,0x9A,0x70,0xEE,0x80,0x01,0xFB,0x22,0xAA,0xA6,0xBE,0x01,
1086 0x8B,0x8E,0x74,0xE7,0xA2,0x01,0x8B,0xEE,0x42,0xC4,0xA2,0x01,
1087 0x8B,0x42,0x6E,0xED,0xA2,0x01,0xFB,0xDA,0x63,0xA6,0xBE,0x01,
1088 0x03,0xAA,0xAA,0xAA,0x80,0x01,0xFF,0x8B,0xD8,0x9D,0xFF,0x01,
1089 0x63,0x62,0xDA,0x1B,0x98,0x01,0x6F,0x67,0x98,0x9F,0xBC,0x01,
1090 0x4F,0xCC,0x55,0x81,0x83,0x01,0xB7,0x6D,0xFF,0x68,0xB2,0x01,
1091 0xC3,0x10,0x87,0x8B,0x96,0x01,0x6F,0xB1,0x91,0x58,0x94,0x01,
1092 0xE3,0x36,0x88,0x84,0xB8,0x01,0x83,0x9B,0xFE,0x59,0xD7,0x01,
1093 0x3B,0x74,0x98,0x5C,0xB4,0x01,0x37,0x75,0xDC,0x91,0xA6,0x01,
1094 0x77,0xDE,0x01,0x54,0xBA,0x01,0xBB,0x6D,0x8B,0xB9,0xB5,0x01,
1095 0x1F,0x06,0xBD,0x9B,0xB4,0x01,0xD3,0xBD,0x91,0x19,0x84,0x01,
1096 0x0B,0x20,0xD8,0x91,0xB4,0x01,0x33,0x95,0xBC,0x0A,0xD5,0x01,
1097 0xB3,0x60,0xDC,0xD9,0xB6,0x01,0xEF,0x77,0x18,0x09,0xA4,0x01,
1098 0xA3,0xC2,0x95,0x51,0xB2,0x01,0xDF,0x63,0xDB,0xBE,0xB3,0x01,
1099 0x03,0x08,0xC9,0x09,0xF0,0x01,0xFF,0xA3,0x19,0xBD,0xFB,0x01,
1100 0x03,0x2E,0x84,0xA5,0xAA,0x01,0xFB,0x9A,0xFC,0x9B,0xBB,0x01,
1101 0x8B,0x7E,0x9C,0x1D,0xB0,0x01,0x8B,0x6E,0x58,0xA1,0xDB,0x01,
1102 0x8B,0xDA,0xD5,0x65,0xA2,0x01,0xFB,0x72,0xFB,0xE9,0xF0,0x01,
1103 0x03,0x02,0x99,0x3B,0xB3,0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,
1104 0xFF,0xFF,0xFF,0xFF,0xFF,0x01};
1107 const char *lines[] = {
1110 "Your PC ran into a problem and needs to restart. We're just\n",
1111 "collecting some error info, and then we'll restart for you.\n",
1115 "For more information about this issue and\n",
1116 "possible fixes, visit\n",
1117 /* "https://www.jwz.org/xscreensaver\n",*/
1118 "http://youtu.be/-RjmN9RZyr4\n",
1120 "If you call a support person, give them this info:\n",
1121 "Stop code CRITICAL_PROCESS_DIED",
1123 int i, y = 0, y0 = 0;
1124 int line_height0 = bst->fontB->ascent;
1125 int line_height1 = bst->fontA->ascent + bst->fontA->descent;
1126 int line_height2 = bst->fontC->ascent + bst->fontC->descent;
1127 int line_height = line_height0;
1128 int top, left0, left;
1129 int stop = 60 + (random() % 39);
1131 line_height1 *= 1.3;
1132 line_height2 *= 1.5;
1134 top = ((bst->xgwa.height - (line_height0 * 1 +
1140 int dir, ascent, descent;
1142 const char *s = lines[2];
1143 XTextExtents (bst->fontA, s, strlen(s),
1144 &dir, &ascent, &descent, &ov);
1145 left = left0 = (bst->xgwa.width - ov.width) / 2;
1148 pixmap = XCreatePixmapFromBitmapData (dpy, window, (char *) qr_bits,
1149 qr_width, qr_height,
1150 bst->fg, bst->bg, bst->xgwa.depth);
1151 for (i = 0; i < 2; i++)
1153 pixmap = double_pixmap (dpy, bst->gc, bst->xgwa.visual, bst->xgwa.depth,
1154 pixmap, qr_width, qr_height);
1158 bst->pixmap = pixmap;
1161 line_height = line_height0;
1163 for (i = 0; i < countof(lines); i++)
1165 BSOD_MOVETO (bst, left, y);
1166 BSOD_TEXT (bst, LEFT, lines[i]);
1171 line_height = line_height1;
1176 y += line_height / 2;
1177 BSOD_PIXMAP (bst, 0, 0, qr_width, qr_height, left, y + line_height1);
1179 line_height = line_height2;
1180 left += qr_width + line_height2 / 2;
1189 for (i = 0; i <= stop; i++)
1192 sprintf (buf, "%d%% complete", i);
1193 BSOD_MOVETO (bst, left, y0);
1194 BSOD_TEXT (bst, LEFT, buf);
1195 BSOD_PAUSE (bst, 85000);
1197 BSOD_PAUSE (bst, 3000000);
1199 XClearWindow (dpy, window);
1204 static struct bsod_state *
1205 windows_other (Display *dpy, Window window)
1207 /* Lump all of the 2K-ish crashes together and select them randomly...
1209 int which = (random() % 4);
1211 case 0: return windows_2k (dpy, window); break;
1212 case 1: return windows_me (dpy, window); break;
1213 case 2: return windows_xp (dpy, window); break;
1214 case 3: return windows_lh (dpy, window); break;
1215 default: abort(); break;
1220 /* As seen in Portal 2. By jwz.
1222 static struct bsod_state *
1223 glados (Display *dpy, Window window)
1225 struct bsod_state *bst = make_bsod_state (dpy, window, "glaDOS", "GlaDOS");
1226 const char * panicstr[] = {
1228 "MOLTEN CORE WARNING\n",
1230 "An operator error exception has occurred at FISSREAC0020093:09\n",
1231 "FISSREAC0020077:14 FISSREAC0020023:17 FISSREAC0020088:22\n",
1232 "neutron multiplication rate at spikevalue 99999999\n",
1234 "* Press any key to vent radiological emissions into atmosphere.\n",
1235 "* Consult reactor core manual for instructions on proper reactor core\n",
1236 "maintenance and repair.\n",
1238 "Press any key to continue\n",
1243 bst->y = ((bst->xgwa.height -
1244 ((bst->font->ascent + bst->font->descent) * countof(panicstr)))
1247 BSOD_MOVETO (bst, 0, bst->y);
1249 BSOD_TEXT (bst, CENTER, "OPERATOR ERROR\n");
1251 for (i = 0; i < countof(panicstr); i++)
1252 BSOD_TEXT (bst, CENTER, panicstr[i]);
1253 BSOD_PAUSE (bst, 1000000);
1255 BSOD_RECT (bst, True, 0, 0, bst->xgwa.width, bst->xgwa.height);
1257 BSOD_PAUSE (bst, 250000);
1260 XClearWindow (dpy, window);
1266 /* SCO OpenServer 5 panic, by Tom Kelly <tom@ancilla.toronto.on.ca>
1268 static struct bsod_state *
1269 sco (Display *dpy, Window window)
1271 struct bsod_state *bst = make_bsod_state (dpy, window, "sco", "SCO");
1273 BSOD_TEXT (bst, LEFT,
1274 "Unexpected trap in kernel mode:\n"
1276 "cr0 0x80010013 cr2 0x00000014 cr3 0x00000000 tlb 0x00000000\n"
1277 "ss 0x00071054 uesp 0x00012055 efl 0x00080888 ipl 0x00000005\n"
1278 "cs 0x00092585 eip 0x00544a4b err 0x004d4a47 trap 0x0000000E\n"
1279 "eax 0x0045474b ecx 0x0042544b edx 0x57687920 ebx 0x61726520\n"
1280 "esp 0x796f7520 ebp 0x72656164 esi 0x696e6720 edi 0x74686973\n"
1281 "ds 0x3f000000 es 0x43494c48 fs 0x43525343 gs 0x4f4d4b53\n"
1283 "PANIC: k_trap - kernel mode trap type 0x0000000E\n"
1284 "Trying to dump 5023 pages to dumpdev hd (1/41), 63 pages per '.'\n"
1286 BSOD_CHAR_DELAY (bst, 100000);
1287 BSOD_TEXT (bst, LEFT,
1288 "................................................................."
1291 BSOD_CHAR_DELAY (bst, 0);
1292 BSOD_TEXT (bst, LEFT,
1293 "5023 pages dumped\n"
1297 BSOD_PAUSE (bst, 2000000);
1298 BSOD_TEXT (bst, LEFT,
1299 "** Safe to Power Off **\n"
1301 "** Press Any Key to Reboot **\n"
1304 bst->y = ((bst->xgwa.height -
1305 ((bst->font->ascent + bst->font->descent) * 18)));
1307 XClearWindow (dpy, window);
1312 /* Linux (sparc) panic, by Tom Kelly <tom@ancilla.toronto.on.ca>
1314 static struct bsod_state *
1315 sparc_linux (Display *dpy, Window window)
1317 struct bsod_state *bst = make_bsod_state (dpy, window,
1318 "sparclinux", "SparcLinux");
1319 bst->scroll_p = True;
1320 bst->y = bst->xgwa.height - bst->font->ascent - bst->font->descent;
1322 BSOD_TEXT (bst, LEFT,
1323 "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
1324 "Unable to handle kernel paging request at virtual address f0d4a000\n"
1325 "tsk->mm->context = 00000014\n"
1326 "tsk->mm->pgd = f26b0000\n"
1328 " \"@'/ ,. \\`@\"\n"
1331 "gawk(22827): Oops\n"
1332 "PSR: 044010c1 PC: f001c2cc NPC: f001c2d0 Y: 00000000\n"
1333 "g0: 00001000 g1: fffffff7 g2: 04401086 g3: 0001eaa0\n"
1334 "g4: 000207dc g5: f0130400 g6: f0d4a018 g7: 00000001\n"
1335 "o0: 00000000 o1: f0d4a298 o2: 00000040 o3: f1380718\n"
1336 "o4: f1380718 o5: 00000200 sp: f1b13f08 ret_pc: f001c2a0\n"
1337 "l0: efffd880 l1: 00000001 l2: f0d4a230 l3: 00000014\n"
1338 "l4: 0000ffff l5: f0131550 l6: f012c000 l7: f0130400\n"
1339 "i0: f1b13fb0 i1: 00000001 i2: 00000002 i3: 0007c000\n"
1340 "i4: f01457c0 i5: 00000004 i6: f1b13f70 i7: f0015360\n"
1341 "Instruction DUMP:\n"
1344 XClearWindow (dpy, window);
1349 /* BSD Panic by greywolf@starwolf.com - modeled after the Linux panic above.
1350 By Grey Wolf <greywolf@siteROCK.com>
1352 static struct bsod_state *
1353 bsd (Display *dpy, Window window)
1355 struct bsod_state *bst = make_bsod_state (dpy, window, "bsd", "BSD");
1357 const char * const panicstr[] = {
1358 "panic: ifree: freeing free inode\n",
1359 "panic: blkfree: freeing free block\n",
1360 "panic: improbability coefficient below zero\n",
1361 "panic: cgsixmmap\n",
1362 "panic: crazy interrupts\n",
1364 "panic: attempted windows install\n",
1366 "panic: free inode isn't\n",
1367 "panic: cpu_fork: curproc\n",
1368 "panic: malloc: out of space in kmem_map\n",
1369 "panic: vogon starship detected\n",
1370 "panic: teleport chamber: out of order\n",
1371 "panic: Brain fried - core dumped\n"
1374 char syncing[80], bbuf[5];
1376 for (i = 0; i < sizeof(syncing); i++)
1379 i = (random() % (sizeof(panicstr) / sizeof(*panicstr)));
1380 BSOD_TEXT (bst, LEFT, panicstr[i]);
1381 BSOD_TEXT (bst, LEFT, "Syncing disks: ");
1383 b = (random() % 40);
1384 for (n = 0; (n < 20) && (b > 0); n++)
1388 i = (random() & 0x7);
1389 b -= (random() & 0xff) % 20;
1393 sprintf (bbuf, "%d ", b);
1394 BSOD_TEXT (bst, LEFT, bbuf);
1395 BSOD_PAUSE (bst, 1000000);
1398 BSOD_TEXT (bst, LEFT, "\n");
1399 BSOD_TEXT (bst, LEFT, (b ? "damn!" : "sunk!"));
1400 BSOD_TEXT (bst, LEFT, "\nRebooting\n");
1402 bst->y = ((bst->xgwa.height -
1403 ((bst->font->ascent + bst->font->descent) * 4)));
1405 XClearWindow (dpy, window);
1410 static struct bsod_state *
1411 amiga (Display *dpy, Window window)
1413 struct bsod_state *bst = make_bsod_state (dpy, window, "amiga", "Amiga");
1416 int pix_w = 0, pix_h = 0;
1420 unsigned long bg2 = get_pixel_resource (dpy, bst->xgwa.colormap,
1421 "amiga.background2",
1422 "Amiga.Background");
1425 pixmap = xpm_data_to_pixmap (dpy, window, (char **) amiga_hand,
1427 # endif /* DO_XPM */
1430 MIN (bst->xgwa.width, bst->xgwa.height) > 600) /* scale up the bitmap */
1432 pixmap = double_pixmap (dpy, bst->gc, bst->xgwa.visual, bst->xgwa.depth,
1433 pixmap, pix_w, pix_h);
1438 XSetLineAttributes (dpy, bst->gc, lw, LineSolid, CapButt, JoinMiter);
1440 height = (bst->font->ascent + bst->font->descent) * 6;
1442 BSOD_PAUSE (bst, 2000000);
1443 BSOD_COPY (bst, 0, 0, bst->xgwa.width, bst->xgwa.height - height, 0, height);
1446 BSOD_RECT (bst, True, 0, 0, bst->xgwa.width, height);
1448 BSOD_TEXT (bst, CENTER,
1450 "Software failure. Press left mouse button to continue.\n"
1451 "Guru Meditation #00000003.00C01570"
1453 BSOD_RECT (bst, False, lw/2, lw/2, bst->xgwa.width - lw, height);
1454 BSOD_PAUSE (bst, 1000000);
1456 BSOD_LOOP (bst, -3);
1458 XSetWindowBackground (dpy, window, bg2);
1459 XClearWindow (dpy, window);
1460 XSetWindowBackground (dpy, window, bst->bg);
1464 int x = (bst->xgwa.width - pix_w) / 2;
1465 int y = ((bst->xgwa.height - pix_h) / 2);
1466 XCopyArea (dpy, pixmap, bst->window, bst->gc, 0, 0, pix_w, pix_h, x, y);
1476 /* Atari ST, by Marcus Herbert <rhoenie@nobiscum.de>
1477 Marcus had this to say:
1479 Though I still have my Atari somewhere, I hardly remember
1480 the meaning of the bombs. I think 9 bombs was "bus error" or
1481 something like that. And you often had a few bombs displayed
1482 quickly and then the next few ones coming up step by step.
1483 Perhaps somebody else can tell you more about it.. its just
1486 static struct bsod_state *
1487 atari (Display *dpy, Window window)
1489 struct bsod_state *bst = make_bsod_state (dpy, window, "atari", "Atari");
1492 int pix_w = atari_width;
1493 int pix_h = atari_height;
1497 pixmap = XCreatePixmapFromBitmapData (dpy, window, (char *) atari_bits,
1499 bst->fg, bst->bg, bst->xgwa.depth);
1500 pixmap = double_pixmap (dpy, bst->gc, bst->xgwa.visual, bst->xgwa.depth,
1501 pixmap, pix_w, pix_h);
1507 y = bst->xgwa.height/2;
1510 for (i = 1; i< 7; i++)
1511 BSOD_COPY (bst, x, y, pix_w, pix_h, (x + (i*offset)), y);
1515 BSOD_PAUSE (bst, 1000000);
1516 BSOD_COPY (bst, x, y, pix_w, pix_h, (x + (i*offset)), y);
1519 XClearWindow (dpy, window);
1520 XCopyArea (dpy, pixmap, window, bst->gc, 0, 0, pix_w, pix_h, x, y);
1521 XFreePixmap (dpy, pixmap);
1527 static struct bsod_state *
1528 mac (Display *dpy, Window window)
1530 struct bsod_state *bst = make_bsod_state (dpy, window, "mac", "Mac");
1533 int pix_w = mac_width;
1534 int pix_h = mac_height;
1535 int offset = mac_height * 4;
1538 const char *string = ("0 0 0 0 0 0 0 F\n"
1541 pixmap = XCreatePixmapFromBitmapData(dpy, window, (char *) mac_bits,
1542 mac_width, mac_height,
1543 bst->fg, bst->bg, bst->xgwa.depth);
1545 for (i = 0; i < 2; i++)
1547 pixmap = double_pixmap (dpy, bst->gc, bst->xgwa.visual, bst->xgwa.depth,
1548 pixmap, pix_w, pix_h);
1549 pix_w *= 2; pix_h *= 2;
1552 bst->x = (bst->xgwa.width - pix_w) / 2;
1553 bst->y = (((bst->xgwa.height + offset) / 2) -
1555 (bst->font->ascent + bst->font->descent) * 2);
1556 if (bst->y < 0) bst->y = 0;
1558 XClearWindow (dpy, window);
1559 XCopyArea (dpy, pixmap, window, bst->gc, 0, 0, pix_w, pix_h, bst->x, bst->y);
1560 XFreePixmap (dpy, pixmap);
1562 bst->y += offset + bst->font->ascent + bst->font->descent;
1563 BSOD_TEXT (bst, CENTER, string);
1569 static struct bsod_state *
1570 macsbug (Display *dpy, Window window)
1572 struct bsod_state *bst = make_bsod_state (dpy, window, "macsbug", "MacsBug");
1575 const char *left = (" SP \n"
1622 const char *bottom = (" _A09D\n"
1623 " +00884 40843714 #$0700,SR "
1625 " +00886 40843765 *+$0400 "
1627 " +00888 40843718 $0004(A7),([0,A7[)"
1628 " ; 04E8D0AE | 66B8");
1630 const char * body = ("PowerPC unmapped memory exception at 003AFDAC "
1631 "BowelsOfTheMemoryMgr+04F9C\n"
1632 " Calling chain using A6/R1 links\n"
1633 " Back chain ISA Caller\n"
1634 " 00000000 PPC 28C5353C __start+00054\n"
1635 " 24DB03C0 PPC 28B9258C main+0039C\n"
1636 " 24DB0350 PPC 28B9210C MainEvent+00494\n"
1637 " 24DB02B0 PPC 28B91B40 HandleEvent+00278\n"
1638 " 24DB0250 PPC 28B83DAC DoAppleEvent+00020\n"
1639 " 24DB0210 PPC FFD3E5D0 "
1640 "AEProcessAppleEvent+00020\n"
1641 " 24DB0132 68K 00589468\n"
1642 " 24DAFF8C 68K 00589582\n"
1643 " 24DAFF26 68K 00588F70\n"
1644 " 24DAFEB3 PPC 00307098 "
1645 "EmToNatEndMoveParams+00014\n"
1646 " 24DAFE40 PPC 28B9D0B0 DoScript+001C4\n"
1647 " 24DAFDD0 PPC 28B9C35C RunScript+00390\n"
1648 " 24DAFC60 PPC 28BA36D4 run_perl+000E0\n"
1649 " 24DAFC10 PPC 28BC2904 perl_run+002CC\n"
1650 " 24DAFA80 PPC 28C18490 Perl_runops+00068\n"
1651 " 24DAFA30 PPC 28BE6CC0 Perl_pp_backtick+000FC\n"
1652 " 24DAF9D0 PPC 28BA48B8 Perl_my_popen+00158\n"
1653 " 24DAF980 PPC 28C5395C sfclose+00378\n"
1654 " 24DAF930 PPC 28BA568C free+0000C\n"
1655 " 24DAF8F0 PPC 28BA6254 pool_free+001D0\n"
1656 " 24DAF8A0 PPC FFD48F14 DisposePtr+00028\n"
1657 " 24DAF7C9 PPC 00307098 "
1658 "EmToNatEndMoveParams+00014\n"
1659 " 24DAF780 PPC 003AA180 __DisposePtr+00010");
1664 int char_width, line_height;
1665 int col_right, row_top, row_bottom, page_right, page_bottom, body_top;
1668 unsigned long fg = bst->fg;
1669 unsigned long bg = bst->bg;
1670 unsigned long bc = get_pixel_resource (dpy, bst->xgwa.colormap,
1671 "macsbug.borderColor",
1672 "MacsBug.BorderColor");
1674 for (s = body; *s; s++) if (*s == '\n') body_lines++;
1676 char_width = (bst->font->per_char
1677 ? bst->font->per_char['n'-bst->font->min_char_or_byte2].width
1678 : bst->font->min_bounds.width);
1679 line_height = bst->font->ascent + bst->font->descent;
1681 col_right = char_width * 12; /* number of columns in `left' */
1682 page_bottom = line_height * 47; /* number of lines in `left' */
1684 if (page_bottom > bst->xgwa.height)
1685 page_bottom = bst->xgwa.height;
1687 row_bottom = page_bottom - line_height;
1688 row_top = row_bottom - (line_height * 4);
1689 page_right = col_right + (char_width * 88);
1690 body_top = row_top - (line_height * body_lines);
1699 xoff = (bst->xgwa.width - page_right) / 2;
1700 yoff = (bst->xgwa.height - page_bottom) / 2;
1702 if (xoff < 0) xoff = 0;
1703 if (yoff < 0) yoff = 0;
1705 BSOD_MARGINS (bst, xoff, yoff);
1707 BSOD_COLOR (bst, bc, bg);
1708 BSOD_RECT (bst, True, 0, 0, bst->xgwa.width, bst->xgwa.height);
1709 BSOD_COLOR (bst, bg, bg);
1710 BSOD_RECT (bst, True, xoff-2, yoff, page_right+4, page_bottom);
1711 BSOD_COLOR (bst, fg, bg);
1713 BSOD_MOVETO (bst, xoff, yoff + line_height);
1714 BSOD_TEXT (bst, LEFT, left);
1715 BSOD_MOVETO (bst, xoff+col_right, yoff + row_top + line_height);
1716 BSOD_TEXT (bst, LEFT, bottom);
1718 BSOD_RECT (bst, True, xoff + col_right, yoff, 2, page_bottom);
1719 BSOD_RECT (bst, True, xoff + col_right, yoff + row_top,
1720 page_right - col_right, 1);
1721 BSOD_RECT (bst, True, xoff + col_right, yoff + row_bottom,
1722 page_right - col_right, 1);
1723 BSOD_RECT (bst, False, xoff-2, yoff, page_right+4, page_bottom);
1725 BSOD_LINE_DELAY (bst, 500);
1727 xoff + col_right + char_width,
1728 yoff + body_top + line_height);
1729 BSOD_MARGINS (bst, xoff + col_right + char_width, yoff);
1730 BSOD_TEXT (bst, LEFT, body);
1732 BSOD_RECT (bst, False, xoff-2, yoff, page_right+4, page_bottom); /* again */
1734 BSOD_RECT (bst, False,
1735 xoff + col_right + (char_width/2)+2,
1736 yoff + row_bottom + 2,
1738 page_bottom - row_bottom - 4);
1740 BSOD_PAUSE (bst, 666666);
1742 BSOD_LOOP (bst, -3);
1744 XClearWindow (dpy, window);
1749 static struct bsod_state *
1750 mac1 (Display *dpy, Window window)
1752 struct bsod_state *bst = make_bsod_state (dpy, window, "mac1", "Mac1");
1755 int pix_w = macbomb_width;
1756 int pix_h = macbomb_height;
1759 pixmap = XCreatePixmapFromBitmapData (dpy, window, (char *) macbomb_bits,
1760 macbomb_width, macbomb_height,
1761 bst->fg, bst->bg, bst->xgwa.depth);
1763 x = (bst->xgwa.width - pix_w) / 2;
1764 y = (bst->xgwa.height - pix_h) / 2;
1767 XClearWindow (dpy, window);
1768 XCopyArea (dpy, pixmap, window, bst->gc, 0, 0, pix_w, pix_h, x, y);
1774 /* This is what kernel panics looked like on MacOS X 10.0 through 10.1.5.
1775 In later releases, it's a graphic of a power button with text in
1776 English, French, German, and Japanese overlayed transparently.
1778 static struct bsod_state *
1779 macx_10_0 (Display *dpy, Window window)
1781 struct bsod_state *bst = make_bsod_state (dpy, window, "macx", "MacX");
1783 XClearWindow (dpy, window);
1784 XSetForeground (dpy, bst->gc,
1785 get_pixel_resource (dpy, bst->xgwa.colormap,
1786 "macx.textForeground",
1787 "MacX.TextForeground"));
1788 XSetBackground (dpy, bst->gc,
1789 get_pixel_resource (dpy, bst->xgwa.colormap,
1790 "macx.textBackground",
1791 "MacX.TextBackground"));
1797 int x, y, pix_w, pix_h;
1798 pixmap = xpm_data_to_pixmap (dpy, window, (char **) happy_mac,
1799 &pix_w, &pix_h, &mask);
1804 pixmap = double_pixmap (dpy, bst->gc, bst->xgwa.visual,
1805 bst->xgwa.depth, pixmap, pix_w, pix_h);
1806 mask = double_pixmap (dpy, bst->gc, bst->xgwa.visual,
1807 1, mask, pix_w, pix_h);
1813 x = (bst->xgwa.width - pix_w) / 2;
1814 y = (bst->xgwa.height - pix_h) / 2;
1816 XSetClipMask (dpy, bst->gc, mask);
1817 XSetClipOrigin (dpy, bst->gc, x, y);
1818 XCopyArea (dpy, pixmap, window, bst->gc, 0, 0, pix_w, pix_h, x, y);
1819 XSetClipMask (dpy, bst->gc, None);
1820 XFreePixmap (dpy, pixmap);
1824 bst->left_margin = 0;
1825 bst->right_margin = 0;
1826 bst->y = bst->font->ascent;
1827 bst->macx_eol_kludge = True;
1830 BSOD_PAUSE (bst, 3000000);
1831 BSOD_TEXT (bst, LEFT,
1832 "panic(cpu 0): Unable to find driver for this platform: "
1833 "\"PowerMac 3,5\".\n"
1835 "backtrace: 0x0008c2f4 0x0002a7a0 0x001f0204 0x001d4e4c 0x001d4c5c "
1836 "0x001a56cc 0x01d5dbc 0x001c621c 0x00037430 0x00037364\n"
1840 "No debugger configured - dumping debug information\n"
1842 "version string : Darwin Kernel Version 1.3:\n"
1843 "Thu Mar 1 06:56:40 PST 2001; root:xnu/xnu-123.5.obj~1/RELEASE_PPC\n"
1848 "DBAT0: 00000000 00000000\n"
1849 "DBAT1: 00000000 00000000\n"
1850 "DBAT2: 80001FFE 8000003A\n"
1851 "DBAT3: 90001FFE 9000003A\n"
1853 "backtrace: 0x0008c2f4 0x0002a7a0 0x001f0204 0x001d4e4c 0x001d4c5c "
1854 "0x001a56cc 0x01d5dbc 0x001c621c 0x00037430 0x00037364\n"
1856 "panic: We are hanging here...\n");
1863 static struct bsod_state *
1864 macx_10_2 (Display *dpy, Window window, Bool v10_3_p)
1866 struct bsod_state *bst = make_bsod_state (dpy, window, "macx", "MacX");
1869 int pix_w = 0, pix_h = 0;
1872 pixmap = xpm_data_to_pixmap (dpy, window,
1873 (char **) (v10_3_p ? osx_10_3 : osx_10_2),
1875 if (! pixmap) abort();
1878 if (bst->xgwa.height > 600) /* scale up the bitmap */
1880 pixmap = double_pixmap (dpy, bst->gc, bst->xgwa.visual, bst->xgwa.depth,
1881 pixmap, pix_w, pix_h);
1882 if (! pixmap) abort();
1889 BSOD_PAUSE (bst, 2000000);
1891 bst->pixmap = pixmap;
1893 x = (bst->xgwa.width - pix_w) / 2;
1894 y = ((bst->xgwa.height - pix_h) / 2);
1895 BSOD_PIXMAP (bst, 0, 0, pix_w, pix_h, x, y);
1899 # endif /* DO_XPM */
1902 /* 2006 Mac Mini with MacOS 10.6 failing with a bad boot drive. By jwz.
1904 static struct bsod_state *
1905 mac_diskfail (Display *dpy, Window window)
1907 struct bsod_state *bst = make_bsod_state (dpy, window, "macdisk", "Mac");
1908 int cw = (bst->font->per_char
1909 ? bst->font->per_char['n'-bst->font->min_char_or_byte2].width
1910 : bst->font->min_bounds.width);
1911 int h = bst->font->ascent + bst->font->descent;
1912 int L = (bst->xgwa.width - (cw * 80)) / 2;
1913 int T = (bst->xgwa.height - (h * 10)) / 2;
1915 unsigned long fg = bst->fg;
1916 unsigned long bg = bst->bg;
1917 unsigned long bg2 = get_pixel_resource (dpy, bst->xgwa.colormap,
1924 bst->scroll_p = True;
1926 BSOD_COLOR(bst, bg2, bg);
1927 BSOD_RECT (bst, True, 0, 0, bst->xgwa.width, bst->xgwa.height);
1928 BSOD_PAUSE (bst, 3000000);
1930 BSOD_COLOR(bst, bg, fg);
1931 BSOD_RECT (bst, True, 0, 0, bst->xgwa.width, bst->xgwa.height);
1932 BSOD_COLOR(bst, fg, bg);
1934 BSOD_MARGINS (bst, L, L);
1935 BSOD_MOVETO (bst, L, T);
1937 BSOD_TEXT (bst, LEFT,
1938 "efiboot loaded from device: Acpi(PNP0A03,0)/Pci*1F|2)/Ata"
1939 "(Primary,Slave)/HD(Part\n"
1940 "2,Sig8997E427-064E-4FE7-8CB9-F27A784B232C)\n"
1941 "boot file path: \\System\\Library\\CoreServices\\boot.efi\n"
1942 ".Loading kernel cache file 'System\\Library\\Caches\\"
1943 "com.apple.kext.caches\\Startup\\\n"
1944 "kernelcache_i386.2A14EC2C'\n"
1945 "Loading 'mach_kernel'...\n"
1947 BSOD_CHAR_DELAY (bst, 7000);
1948 BSOD_TEXT (bst, LEFT,
1949 ".....................\n"
1951 BSOD_CHAR_DELAY (bst, 0);
1952 BSOD_TEXT (bst, LEFT,
1953 "root device uuid is 'B62181B4-6755-3C27-BFA1-49A0E053DBD6\n"
1954 "Loading drivers...\n"
1955 "Loading System\\Library\\Caches\\com.apple.kext.caches\\"
1956 "Startup\\Extensions.mkext....\n"
1958 BSOD_CHAR_DELAY (bst, 7000);
1959 BSOD_TEXT (bst, LEFT,
1960 "..............................................................."
1961 ".................\n"
1962 "..............................................................."
1963 ".................\n"
1967 BSOD_RECT (bst, True, 0, 0, bst->xgwa.width, bst->xgwa.height);
1970 BSOD_MARGINS (bst, 0, 0);
1971 BSOD_MOVETO (bst, 0, h);
1973 BSOD_CHAR_DELAY (bst, 0);
1974 BSOD_LINE_DELAY (bst, 5000);
1975 BSOD_TEXT (bst, LEFT,
1978 "Darwin Kernel Version 10.8.9: Tue Jun 7 16:33:36 PDT 2011;"
1979 " root:xnu-1504.15.3~1/RELEASE_I386\n"
1980 "vm_page_bootstrap: 508036 free pages and 16252 wired pages\n"
1981 "standard timeslicing quantum is 10000 us\n"
1982 "mig_table_max_displ = 73\n"
1983 "AppleACPICPU: ProcessorId=0 LocalApicId=0 Enabled\n"
1984 "AppleACPICPU: ProcessorId=1 LocalApicId=1 Enabled\n"
1985 "calling npo_policy_init for Quarantine\n"
1986 "Security policy loaded: Quaantine policy (Quarantine)\n"
1987 "calling npo_policy_init for Sandbox\n"
1988 "Security policy loaded: Seatbelt sandbox policy (Sandbox)\n"
1989 "calling npo_policy_init for TMSafetyNet\n"
1990 "Security policy loaded: Safety net for Time Machine "
1992 "Copyright (c) 1982, 1986, 1989, 1991, 1993\n"
1993 "The Regents of the University of California. All rights "
1996 "MAC Framework successfully initialized\n"
1997 "using 10485 buffer headers and 4096 cluster IO buffer headers\n"
1998 "IOAPIC: Version 0x20 Vectors 64:87\n"
1999 "ACPI: System State [S0 S3 S4 S5] (S3)\n"
2000 "PFM64 0x10000000, 0xf0000000\n"
2001 "[ PCI configuration begin ]\n"
2002 "PCI configuration changed (bridge=1 device=1 cardbus=0)\n"
2003 "[ PCI configuration end, bridges 4 devices 17 ]\n"
2004 "nbinit: done (64 MB memory set for nbuf pool)\n"
2005 "rooting via boot-uuid from /chosen: "
2006 "B62181B4-6755-3C27-BFA1-49A0E053DBD6\n"
2007 "Waiting on <dict ID=\"0\"><key>IOProviderClass</key>"
2008 "<string ID=\"1\">IOResources</string><key>IOResourceMatch</key>"
2009 "<string ID=\"2\">boot-uuid-nedia</string></dict>\n"
2010 "com.apple.AppleFSCCompressionTypeZlib kmod start\n"
2011 "com.apple.AppleFSCCompressionTypeZlib kmod succeeded\n"
2012 "AppleIntelCPUPowerManagementClient: ready\n"
2013 "FireWire (OHCI) Lucent ID 5811 built-in now active, GUID "
2014 "0019e3fffe97f8b4; max speed s400.\n"
2015 "Got boot device = IOService:/AppleACPIPlatformExpert/PCI000/"
2016 "AppleACPIPCI/SATA@1F,2/AppleAHCI/PRI202/IOAHCIDevice@0/"
2017 "AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/"
2018 "IOBlockStorageDriver/ST96812AS Media/IOGUIDPartitionScheme/"
2021 BSOD_PAUSE (bst, 1000000);
2022 BSOD_TEXT (bst, LEFT,
2023 "BSD root: Disk0s, major 14, minor 2\n"
2024 "[Bluetooth::CSRHIDTransition] switchtoHCIMode (legacy)\n"
2025 "[Bluetooth::CSRHIDTransition] transition complete.\n"
2026 "CSRUSBBluetoothHCIController::setupHardware super returned 0\n"
2028 BSOD_PAUSE (bst, 3000000);
2029 BSOD_TEXT (bst, LEFT,
2030 "disk0s2: I/O error.\n"
2031 "0 [Level 3] [ReadUID 0] [Facility com.apple.system.fs] "
2032 "[ErrType IO] [ErrNo 5] [IOType Read] [PBlkNum 48424] "
2033 "[LBlkNum 1362] [FSLogMsgID 2009724291] [FSLogMsgOrder First]\n"
2034 "0 [Level 3] [ReadUID 0] [Facility com.apple.system.fs] "
2035 "[DevNode root_device] [MountPt /] [FSLogMsgID 2009724291] "
2036 "[FSLogMsgOrder Last]\n"
2037 "panic(cpu 0 caller 0x47f5ad): \"Process 1 exec of /sbin/launchd"
2038 " failed, errno 5\\n\"0/SourceCache/xnu/xnu-1504.15.3/bsd/kern/"
2039 "kern_exec.c:3145\n"
2040 "Debugger called: <panic>\n"
2041 "Backtrace (CPU 0), Frame : Return Address (4 potential args "
2043 "0x34bf3e48 : 0x21b837 (0x5dd7fc 0x34bf3e7c 0x223ce1 0x0)\n"
2044 "0x34bf3e98 : 0x47f5ad (0x5cf950 0x831c08 0x5 0x0)\n"
2045 "0x34bf3ef8 : 0x4696d2 (0x4800d20 0x1fe 0x45a69a0 0x80000001)\n"
2046 "0x34bf3f38 : 0x48fee5 (0x46077a8 0x84baa0 0x34bf3f88 "
2048 "0x34bf3f68 : 0x219432 (0x46077a8 0xffffff7f 0x0 0x227c4b)\n"
2049 "0x34bf3fa8 : 0x2aacb4 (0xffffffff 0x1 0x22f8f5 0x227c4b)\n"
2050 "0x34bf3fc8 : 0x2a1976 (0x0 0x0 0x2a17ab 0x4023ef0)\n"
2052 "BSD process name corresponding to current thread: init\n"
2058 "Darwin Kernel version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; "
2059 "root:xnu-1504.15-3~1/RELEASE_I386\n"
2060 "System model name: Macmini1,1 (Mac-F4208EC0)\n"
2062 "System uptime in nanoseconds: 13239332027\n"
2064 BSOD_CURSOR (bst, CURSOR_BLOCK, 500000, 999999);
2066 XClearWindow (dpy, window);
2073 static struct bsod_state *
2074 macx (Display *dpy, Window window)
2077 switch (random() % 4) {
2078 case 0: return macx_10_0 (dpy, window); break;
2079 case 1: return macx_10_2 (dpy, window, False); break;
2080 case 2: return macx_10_2 (dpy, window, True); break;
2081 case 3: return mac_diskfail (dpy, window); break;
2084 # else /* !DO_XPM */
2085 switch (random() % 2) {
2086 case 0: return macx_10_0 (dpy, window); break;
2087 default: return mac_diskfail (dpy, window); break;
2089 # endif /* !DO_XPM */
2093 #ifndef HAVE_JWXYZ /* #### I have no idea how to implement this without
2094 real plane-masks. I don't think it would look
2095 right if done with alpha-transparency... */
2098 * by Martin Pool <mbp@samba.org>, Feb 2000.
2100 * This is meant to look like the preferred failure mode of NCD
2101 * Xterms. The parameters for choosing what to copy where might not
2102 * be quite right, but it looks about ugly enough.
2104 static struct bsod_state *
2105 blitdamage (Display *dpy, Window window)
2107 struct bsod_state *bst =
2108 make_bsod_state (dpy, window, "blitdamage", "BlitDamage");
2111 int delta_x = 0, delta_y = 0;
2113 int chunk_h, chunk_w;
2118 w = bst->xgwa.width;
2119 h = bst->xgwa.height;
2121 XSetPlaneMask (dpy, bst->gc, random());
2124 chunk_w = w / (random() % 1 + 1);
2125 chunk_h = h / (random() % 1 + 1);
2126 if (random() & 0x1000)
2127 delta_y = random() % 600;
2128 if (!delta_y || (random() & 0x2000))
2129 delta_x = random() % 600;
2136 for (i = 0; i < steps; i++) {
2137 if (x + chunk_w > w)
2142 if (y + chunk_h > h)
2147 BSOD_COPY (bst, src_x, src_y, chunk_w, chunk_h, x, y);
2148 BSOD_PAUSE (bst, 1000);
2153 #endif /* !HAVE_JWXYZ */
2157 * OS/2 panics, by Knut St. Osmundsen <bird-xscreensaver@anduin.net>
2159 * All but one messages are real ones, some are from my test machines
2160 * and system dumps, others are reconstructed from google results.
2161 * Please, don't be to hard if the formatting of the earlier systems
2162 * aren't 100% correct.
2164 static struct bsod_state *
2165 os2 (Display *dpy, Window window)
2167 struct bsod_state *bst = make_bsod_state (dpy, window, "os2", "OS2");
2170 static const char * const os2_panics[] =
2171 { /* OS/2 2.0 trap - details are bogus (CR0++). */
2172 "TRAP 0002 ERRCD=0000 ERACC=**** ERLIM=********\n"
2173 "EAX=7d240a58 EBX=ff202fdc ECX=00064423 EDX=00003624\n"
2174 "ESI=fff3272c EDI=7d240004 EBP=00004a44 FLG=00003202\n"
2175 "CS:EIP=0160:fff702a6 CSACC=c09d CSLIM=ffffffff\n"
2176 "SS:ESP=0030:00004a38 SSACC=1097 SSLIM=00003fff\n"
2177 "DS=0158 DSACC=c0f3 DSLIM=ffffffff CR0=fffffffb\n"
2178 "ES=0158 ESACC=c0f3 ESLIM=ffffffff CR2=1a060014\n"
2179 "FS=0000 FSACC=**** FSLIM=********\n"
2180 "GS=0000 GSACC=**** GSLIM=********\n"
2182 "The system detected an internal processing error\n"
2183 "at location ##0160:fff6453f - 000d:a53f\n"
2187 "Internal revision 6.307, 92/03/01\n"
2190 /* warp 3 (early) */
2191 "TRAP 000e ERRCD=0000 ERACC=**** ERLIM=********\n"
2192 "EAX=ff050c20 EBX=000000bb ECX=ffff00c1 EDx=fff379b8\n"
2193 "ESI=ffe55a3c EDI=00000000 EBP=00004eb8 FLG=00013282\n"
2194 "CS:EIP=0160:fff8dbb8 CSACC=c09b CSLIM=ffffffff\n"
2195 "SS:EIP=0030:00004eb4 SSACC=1097 SSLIM=00003fff\n"
2196 "DS=0158 DSACC=c0f3 DSLIM=ffffffff CR0=8001001b\n"
2197 "ES=0158 DSACC=c0f3 DSLIM=ffffffff CR2=000000c7\n"
2198 "FS=0000 FSACC=**** FSLIM=********\n"
2199 "GS=0000 GSACC=**** GSLIM=********\n"
2201 "The system detected an internal processing error\n"
2202 "at location ##0160:fff66bf0 - 000d:9bf0.\n"
2206 "Internal revision 8.125, 94/02/16\n"
2208 "The system is stopped. Record the location number of the error\n"
2209 "and contact your service representative.\n",
2212 "TRAP 000e ERRCD=0002 ERACC=**** ERLIM=********\n"
2213 "EAX=00000000 EBX=fdef1e0c ECX=00003824 EDX=0000edf9\n"
2214 "ESI=fdf30e80 EDI=fc8b0000 EBP=00005658 FLG=00012246\n"
2215 "CS:EIP=0160:fff8ada3 CSACC=c09b CSLIM=ffffffff\n"
2216 "SS:ESP=0030:000055d4 SSACC=1097 SSLIM=0000480f\n"
2217 "DS=0158 DSACC=c093 DSLIM=ffffffff CR0=8001001b\n"
2218 "ES=0158 ESACC=c093 ESLIM=ffffffff CR2=fc8b0000\n"
2219 "FS=03b8 FSACC=0093 FSLIM=00000023\n"
2220 "GS=0000 GSACC=**** GSLIM=********\n"
2222 "The system detected an internal processing error\n"
2223 "at location ##0160:fff5c364 - 000d:a364.\n"
2227 "Internal revision 8200,94/11/07\n"
2229 "The system is stopped. Record all of the above information and\n"
2230 "contact your service representative.\n",
2233 "TRAP 000d ERRCD=2200 ERACC=1092 ERLIM=00010fff\n"
2234 "EAX=0000802e EBX=fff001c8 ECX=9bd80000 EDX=00000000\n"
2235 "ESI=fff09bd8 EDI=fdeb001b EBP=00000000 FLG=00012012\n"
2236 "CS:EIP=0168:fff480a2 CSACC=c09b CSLIM=ffffffff\n"
2237 "SS:ESP=00e8:00001f32 SSACC=0093 SSLIM=00001fff\n"
2238 "DS=0940 DSACC=0093 DSLIM=00000397 CR0=8001001b\n"
2239 "ES=00e8 ESACC=0093 ESLIM=00001fff CR2=15760008\n"
2240 "FS=0000 FSACC=**** FSLIM=****\n"
2241 "GS=0000 GSACC=**** GSLIM=****\n"
2243 "The system detected an internal processing error\n"
2244 "at location ##0168:fff4b06e - 000e:c06e\n"
2248 "Internal revision 8.259_uni,98/01/07\n"
2250 "The system is stopped. Record all of the above information and\n"
2251 "contact your service representative.\n",
2253 /* Warp 4.52+ - the official r0trap.exe from the debugging classes */
2254 "Exception in module: OS2KRNL\n"
2255 "TRAP 000e ERRCD=0002 ERACC=**** ERLIM=********\n"
2256 "EAX=00000001 EBX=80010002 ECX=ffed4638 EDX=0003f17b\n"
2257 "ESI=00000001 EDI=00000002 EBP=00005408 FLG=00012202\n"
2258 "CS:EIP=0168:fff3cd2e CSACC=c09b CSLIM=ffffffff\n"
2259 "SS:ESP=0030:000053ec SSACC=1097 SSLIM=000044ff\n"
2260 "DS=0160 DSACC=c093 DSLIM=ffffffff CR0=8001001b\n"
2261 "ES=0160 ESACC=c093 ESLIM=ffffffff CR2=00000001\n"
2262 "FS=0000 FSACC=**** FSLIM=********\n"
2263 "GS=0000 GSACC=**** GSLIM=********\n"
2265 "The system detected an internal processing error at\n"
2266 "location ##0168:fff1e3f3 - 000e:c3f3.\n"
2270 "Internal revision 14.097_UNI\n"
2272 "The system is stopped. Record all of the above information and\n"
2273 "contact your service representative.\n",
2275 /* Warp 4.52+, typical JFS problem. */
2276 "Exeption in module: JFS\n"
2277 "TRAP 0003 ERRCD=0000 ERACC=**** ERLIM=********\n"
2278 "EAX=00000000 EBX=ffffff05 ECX=00000001 EDX=f5cd8010\n"
2279 "ESI=000000e6 EDI=000000e7 EBP=f9c7378e FLG=00002296\n"
2280 "CS:EIP=0168:f8df3250 CSACC=c09b CSLIM=ffffffff\n"
2281 "SS:ESP=1550:fdc73778 SSACC=c093 SSLIM=ffffffff\n"
2282 "DS=0160 DSACC=c093 DSLIM=ffffffff CR0=80010016\n"
2283 "ES=0160 ESACC=c093 DSLIM=ffffffff CR2=05318000\n"
2284 "FS=03c0 FSACC=0093 DSLIM=00000023\n"
2285 "GS=0160 GSACC=c093 DSLIM=ffffffff\n"
2287 "The system detected an internal processing error\n"
2288 "at location ##0168:fff1e2ab - 000e:c2ab.\n"
2293 "Internal revision 14.100c_UNI\n"
2295 "The system is stopped. Record all of the above information and\n"
2296 "contact your service representative.\n"
2299 BSOD_TEXT (bst, LEFT, os2_panics[random() % countof(os2_panics)]);
2300 BSOD_CURSOR (bst, CURSOR_LINE, 240000, 999999);
2302 XClearWindow (dpy, window);
2307 /* SPARC Solaris panic. Should look pretty authentic on Solaris boxes.
2308 * Anton Solovyev <solovam@earthlink.net>
2310 static struct bsod_state *
2311 sparc_solaris (Display *dpy, Window window)
2313 struct bsod_state *bst = make_bsod_state (dpy, window, "solaris", "Solaris");
2316 bst->scroll_p = True;
2318 bst->left_margin = bst->right_margin = bst->xgwa.width * 0.07;
2319 bst->top_margin = bst->bottom_margin = bst->xgwa.height * 0.07;
2320 bst->y = bst->top_margin + bst->font->ascent;
2323 BSOD_PAUSE (bst, 3000000);
2326 BSOD_RECT (bst, True,
2327 bst->left_margin, bst->top_margin,
2328 bst->xgwa.width - bst->left_margin - bst->right_margin,
2329 bst->xgwa.height - bst->top_margin - bst->bottom_margin);
2332 BSOD_TEXT (bst, LEFT,
2333 "BAD TRAP: cpu=0 type=0x31 rp=0x2a10043b5e0 addr=0xf3880 mmu_fsr=0x0\n"
2334 "BAD TRAP occurred in module \"unix\" due to an illegal access to a"
2336 "adb: trap type = 0x31\n"
2338 "pid=307, pc=0x100306e4, sp=0x2a10043ae81, tstate=0x4480001602,"
2340 "g1-g7: 1045b000, 32f, 10079440, 180, 300000ebde8, 0, 30000953a20\n"
2341 "Begin traceback... sp = 2a10043ae81\n"
2342 "Called from 100bd060, fp=2a10043af31, args=f3700 300008cc988 f3880 0"
2344 "Called from 101fe1bc, fp=2a10043b011, args=3000045a240 104465a0"
2345 " 300008e47d0 300008e48fa 300008ae350 300008ae410\n"
2346 "Called from 1007c520, fp=2a10043b0c1, args=300008e4878 300003596e8 0"
2347 " 3000045a320 0 3000045a220\n"
2348 "Called from 1007c498, fp=2a10043b171, args=1045a000 300007847f0 20"
2349 " 3000045a240 1 0\n"
2350 "Called from 1007972c, fp=2a10043b221, args=1 300009517c0 30000951e58 1"
2352 "Called from 10031e10, fp=2a10043b2d1, args=3000095b0c8 0 300009396a8"
2353 " 30000953a20 0 1\n"
2354 "Called from 10000bdd8, fp=ffffffff7ffff1c1, args=0 57 100131480"
2355 " 100131480 10012a6e0 0\n"
2356 "End traceback...\n"
2357 "panic[cpu0]/thread=30000953a20: trap\n"
2358 "syncing file systems...");
2360 BSOD_PAUSE (bst, 3000000);
2362 BSOD_TEXT (bst, LEFT, " 1 done\n");
2363 BSOD_TEXT (bst, LEFT, "dumping to /dev/dsk/c0t0d0s3, offset 26935296\n");
2364 BSOD_PAUSE (bst, 2000000);
2367 for (i = 1; i <= 100; ++i)
2370 sprintf (buf, "\b\b\b\b\b\b\b\b\b\b\b%3d%% done", i);
2371 BSOD_TEXT (bst, LEFT, buf);
2372 BSOD_PAUSE (bst, 100000);
2375 BSOD_TEXT (bst, LEFT,
2376 ": 2803 pages dumped, compression ratio 2.88, dump succeeded\n");
2377 BSOD_PAUSE (bst, 2000000);
2379 BSOD_TEXT (bst, LEFT,
2387 /* Linux panic and fsck, by jwz
2389 static struct bsod_state *
2390 linux_fsck (Display *dpy, Window window)
2392 struct bsod_state *bst = make_bsod_state (dpy, window, "linux", "Linux");
2395 const char *sysname;
2398 const char *linux_panic[] = {
2399 " kernel: Unable to handle kernel paging request at virtual "
2400 "address 0000f0ad\n",
2401 " kernel: printing eip:\n",
2402 " kernel: c01becd7\n",
2403 " kernel: *pde = 00000000\n",
2404 " kernel: Oops: 0000\n",
2405 " kernel: CPU: 0\n",
2406 " kernel: EIP: 0010:[<c01becd7>] Tainted: P \n",
2407 " kernel: EFLAGS: 00010286\n",
2408 " kernel: eax: 0000ff00 ebx: ca6b7e00 ecx: ce1d7a60 edx: ce1d7a60\n",
2409 " kernel: esi: ca6b7ebc edi: 00030000 ebp: d3655ca0 esp: ca6b7e5c\n",
2410 " kernel: ds: 0018 es: 0018 ss: 0018\n",
2411 " kernel: Process crond (pid: 1189, stackpage=ca6b7000)\n",
2412 " kernel: Stack: d3655ca0 ca6b7ebc 00030054 ca6b7e7c c01c1e5b "
2413 "00000287 00000020 c01c1fbf \n",
2415 " kernel: 00005a36 000000dc 000001f4 00000000 00000000 "
2416 "ce046d40 00000001 00000000 \n",
2418 " kernel: ffffffff d3655ca0 d3655b80 00030054 c01bef93 "
2419 "d3655ca0 ca6b7ebc 00030054 \n",
2421 " kernel: Call Trace: [<c01c1e5b>] [<c01c1fbf>] [<c01bef93>] "
2422 "[<c01bf02b>] [<c0134c4f>]\n",
2424 " kernel: [<c0142562>] [<c0114f8c>] [<c0134de3>] [<c010891b>]\n",
2426 " kernel: Code: 2a 00 75 08 8b 44 24 2c 85 c0 74 0c 8b 44 24 58 83 48 18 "
2431 bst->scroll_p = True;
2433 bst->left_margin = bst->right_margin = 10;
2434 bst->top_margin = bst->bottom_margin = 10;
2441 if (uname (&uts) >= 0)
2442 sysname = uts.nodename;
2443 s = strchr (sysname, '.');
2446 # endif /* !HAVE_UNAME */
2449 BSOD_TEXT (bst, LEFT, "waiting for X server to shut down ");
2450 BSOD_PAUSE (bst, 100000);
2451 BSOD_TEXT (bst, LEFT,
2452 "XIO: fatal IO error 2 (broken pipe) on X server \":0.0\"\n"
2453 " after 339471 requests (339471 known processed) "
2454 "with 0 events remaining\n");
2455 BSOD_CHAR_DELAY (bst, 300000);
2456 BSOD_TEXT (bst, LEFT, ".........\n");
2457 BSOD_CHAR_DELAY (bst, 0);
2458 BSOD_TEXT (bst, LEFT,
2459 "xinit: X server slow to shut down, sending KILL signal.\n"
2460 "waiting for server to die ");
2461 BSOD_CHAR_DELAY (bst, 300000);
2462 BSOD_TEXT (bst, LEFT, "...\n");
2463 BSOD_CHAR_DELAY (bst, 0);
2464 BSOD_TEXT (bst, LEFT, "xinit: Can't kill server\n");
2465 BSOD_PAUSE (bst, 2000000);
2467 sprintf (buf, "\n%s Login: ", sysname);
2468 BSOD_TEXT (bst, LEFT, buf);
2469 BSOD_PAUSE (bst, 1000000);
2470 BSOD_TEXT (bst, LEFT,
2472 "Parallelizing fsck version 1.22 (22-Jun-2001)\n"
2473 "e2fsck 1.22, 22-Jun-2001 for EXT2 FS 0.5b, 95/08/09\n"
2474 "Warning! /dev/hda1 is mounted.\n"
2475 "/dev/hda1 contains a file system with errors, check forced.\n");
2476 BSOD_PAUSE (bst, 1000000);
2478 if (0 == random() % 2)
2479 BSOD_TEXT (bst, LEFT,
2480 "Couldn't find ext2 superblock, trying backup blocks...\n"
2481 "The filesystem size (according to the superblock) is 3644739 blocks\n"
2482 "The physical size of the device is 3636706 blocks\n"
2483 "Either the superblock or the partition table is likely to be corrupt!\n"
2485 BSOD_PAUSE (bst, 1000000);
2489 BSOD_TEXT (bst, LEFT, "Pass 1: Checking inodes, blocks, and sizes\n");
2490 BSOD_PAUSE (bst, 2000000);
2492 i = (random() % 60) - 20;
2495 int b = random() % 0xFFFF;
2496 sprintf (buf, "Deleted inode %d has zero dtime. Fix<y>? yes\n\n", b);
2497 BSOD_TEXT (bst, LEFT, buf);
2498 BSOD_PAUSE (bst, 1000);
2501 i = (random() % 40) - 10;
2504 int g = random() % 0xFFFF;
2505 int b = random() % 0xFFFFFFF;
2507 BSOD_PAUSE (bst, 1000000);
2509 sprintf (buf, "Warning: Group %d's copy of the group descriptors "
2510 "has a bad block (%d).\n", g, b);
2511 BSOD_TEXT (bst, LEFT, buf);
2513 b = random() % 0x3FFFFF;
2516 b += random() % 0xFFFF;
2518 "Error reading block %d (Attempt to read block "
2519 "from filesystem resulted in short read) while doing "
2520 "inode scan. Ignore error<y>?",
2522 BSOD_TEXT (bst, LEFT, buf);
2523 BSOD_PAUSE (bst, 10000);
2524 BSOD_TEXT (bst, LEFT, " yes\n\n");
2528 if (0 == (random() % 10))
2530 BSOD_PAUSE (bst, 1000000);
2532 i = 3 + (random() % 10);
2535 BSOD_TEXT (bst, LEFT,
2536 "Could not allocate 256 block(s) for inode table: "
2537 "No space left on device\n");
2538 BSOD_PAUSE (bst, 1000);
2540 BSOD_TEXT (bst, LEFT, "Restarting e2fsck from the beginning...\n");
2541 BSOD_PAUSE (bst, 2000000);
2546 i = (random() % 20) - 5;
2549 BSOD_PAUSE (bst, 1000000);
2553 int j = 5 + (random() % 10);
2554 int w = random() % 4;
2558 int b = random() % 0xFFFFF;
2559 int g = random() % 0xFFF;
2561 if (0 == (random() % 10))
2563 else if (0 == (random() % 10))
2568 "Inode table for group %d not in group. (block %d)\n"
2569 "WARNING: SEVERE DATA LOSS POSSIBLE.\n"
2574 "Block bitmap for group %d not in group. (block %d)\n"
2579 "Inode bitmap %d for group %d not in group.\n"
2582 else /* if (w == 3) */
2584 "Bad block %d in group %d's inode table.\n"
2585 "WARNING: SEVERE DATA LOSS POSSIBLE.\n"
2589 BSOD_TEXT (bst, LEFT, buf);
2590 BSOD_TEXT (bst, LEFT, " yes\n\n");
2591 BSOD_PAUSE (bst, 1000);
2596 if (0 == random() % 10) goto PANIC;
2597 BSOD_TEXT (bst, LEFT, "Pass 2: Checking directory structure\n");
2598 BSOD_PAUSE (bst, 2000000);
2600 i = (random() % 20) - 5;
2603 int n = random() % 0xFFFFF;
2604 int o = random() % 0xFFF;
2605 sprintf (buf, "Directory inode %d, block 0, offset %d: "
2606 "directory corrupted\n"
2609 BSOD_TEXT (bst, LEFT, buf);
2610 BSOD_PAUSE (bst, 1000);
2611 BSOD_TEXT (bst, LEFT, " yes\n\n");
2613 if (0 == (random() % 100))
2615 sprintf (buf, "Missing '.' in directory inode %d.\nFix<y>?", n);
2616 BSOD_TEXT (bst, LEFT, buf);
2617 BSOD_PAUSE (bst, 1000);
2618 BSOD_TEXT (bst, LEFT, " yes\n\n");
2622 if (0 == random() % 10)
2625 BSOD_TEXT (bst, LEFT,
2626 "Pass 3: Checking directory connectivity\n"
2627 "/lost+found not found. Create? yes\n");
2628 BSOD_PAUSE (bst, 2000000);
2630 /* Unconnected directory inode 4949 (/var/spool/squid/06/???)
2631 Connect to /lost+found<y>? yes
2633 '..' in /var/spool/squid/06/08 (20351) is <The NULL inode> (0), should be
2634 /var/spool/squid/06 (20350).
2637 Unconnected directory inode 128337 (/var/spool/squid/06/???)
2638 Connect to /lost+found<y>? yes
2642 if (0 == random() % 10) goto PANIC;
2643 BSOD_TEXT (bst, LEFT, "Pass 4: Checking reference counts\n");
2644 BSOD_PAUSE (bst, 2000000);
2646 /* Inode 2 ref count is 19, should be 20. Fix<y>? yes
2648 Inode 4949 ref count is 3, should be 2. Fix<y>? yes
2652 Inode 128336 ref count is 3, should be 2. Fix<y>? yes
2654 Inode 128337 ref count is 3, should be 2. Fix<y>? yes
2659 if (0 == random() % 10) goto PANIC;
2660 BSOD_TEXT (bst, LEFT, "Pass 5: Checking group summary information\n");
2661 BSOD_PAUSE (bst, 2000000);
2663 i = (random() % 200) - 50;
2666 BSOD_TEXT (bst, LEFT, "Block bitmap differences: ");
2669 sprintf (buf, " %d", -(random() % 0xFFF));
2670 BSOD_TEXT (bst, LEFT, buf);
2671 BSOD_PAUSE (bst, 1000);
2673 BSOD_TEXT (bst, LEFT, "\nFix? yes\n\n");
2677 i = (random() % 100) - 50;
2680 BSOD_TEXT (bst, LEFT, "Inode bitmap differences: ");
2683 sprintf (buf, " %d", -(random() % 0xFFF));
2684 BSOD_TEXT (bst, LEFT, buf);
2685 BSOD_PAUSE (bst, 1000);
2687 BSOD_TEXT (bst, LEFT, "\nFix? yes\n\n");
2690 i = (random() % 20) - 5;
2693 int g = random() % 0xFFFF;
2694 int c = random() % 0xFFFF;
2696 "Free blocks count wrong for group #0 (%d, counted=%d).\nFix? ",
2698 BSOD_TEXT (bst, LEFT, buf);
2699 BSOD_PAUSE (bst, 1000);
2700 BSOD_TEXT (bst, LEFT, " yes\n\n");
2706 BSOD_TEXT (bst, LEFT, "\n\n");
2707 while (linux_panic[i])
2709 time_t t = time ((time_t *) 0);
2710 struct tm *tm = localtime (&t);
2713 if (*linux_panic[i])
2715 strftime (prefix, sizeof(prefix)-1, "%b %d %H:%M:%S ", tm);
2716 BSOD_TEXT (bst, LEFT, prefix);
2717 BSOD_TEXT (bst, LEFT, sysname);
2718 BSOD_TEXT (bst, LEFT, linux_panic[i]);
2719 BSOD_PAUSE (bst, 1000);
2722 BSOD_PAUSE (bst, 300000);
2726 BSOD_PAUSE (bst, 4000000);
2728 XClearWindow(dpy, window);
2734 * Linux (hppa) panic, by Stuart Brady <sdbrady@ntlworld.com>
2735 * Output courtesy of M. Grabert
2737 static struct bsod_state *
2738 hppa_linux (Display *dpy, Window window)
2740 struct bsod_state *bst =
2741 make_bsod_state (dpy, window, "hppalinux", "HPPALinux");
2744 const char *release, *sysname, *gccversion, *version;
2745 long int linedelay = 0;
2748 struct { long int delay; const char *string; } linux_panic[] =
2749 {{ 0, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
2750 "\n\n\n\n\n\n\n\n\n\n\n\n\n" },
2751 { 0, "Linux version %s (root@%s) (gcc version %s) %s\n" },
2752 { 4000, "FP[0] enabled: Rev 1 Model 16\n" },
2753 { 10, "The 32-bit Kernel has started...\n" },
2754 { -1, "Determining PDC firmware type: System Map.\n" },
2755 { -1, "model 00005bb0 00000481 00000000 00000002 7778df9f 100000f0 "
2756 "00000008 000000b2 000000b2\n" },
2757 { -1, "vers 00000203\n" },
2758 { -1, "CPUID vers 17 rev 7 (0x00000227)\n" },
2759 { -1, "capabilities 0x3\n" },
2760 { -1, "model 9000/785/C3000\n" },
2761 { -1, "Total Memory: 1024 Mb\n" },
2762 { -1, "On node 0 totalpages: 262144\n" },
2763 { -1, " DMA zone: 262144 pages, LIFO batch:16\n" },
2764 { -1, " Normal zone: 0 pages, LIFO batch:1\n" },
2765 { -1, " HighMem zone: 0 pages, LIFO batch:1\n" },
2766 { -1, "LCD display at f05d0008,f05d0000 registered\n" },
2767 { -1, "Building zonelist for node : 0\n" },
2768 { -1, "Kernel command line: ide=nodma root=/dev/sda3 HOME=/ ip=off "
2769 "console=ttyS0 TERM=vt102 palo_kernel=2/vmlinux-2.6\n" },
2770 { -1, "ide_setup: ide=nodmaIDE: Prevented DMA\n" },
2771 { -1, "PID hash table entries: 16 (order 4: 128 bytes)\n" },
2772 {500, "Console: colour dummy device 160x64\n" },
2773 { 10, "Memory: 1034036k available\n" },
2774 { -1, "Calibrating delay loop... 796.67 BogoMIPS\n" },
2775 { -1, "Dentry cache hash table entries: 131072 (order: 7, 524288 "
2777 { -1, "Inode-cache hash table entries: 65536 (order: 6, 262144 "
2779 { -1, "Mount-cache hash table entries: 512 (order: 0, 4096 bytes)\n" },
2780 { -1, "POSIX conformance testing by UNIFIX\n" },
2781 { -1, "NET: Registered protocol family 16\n" },
2782 { 100, "Searching for devices...\n" },
2783 { 25, "Found devices:\n" },
2784 { 10, "1. Astro BC Runway Port at 0xfed00000 [10] "
2785 "{ 12, 0x0, 0x582, 0x0000b }\n" },
2786 { -1, "2. Elroy PCI Bridge at 0xfed30000 [10/0] "
2787 "{ 13, 0x0, 0x782, 0x0000a }\n" },
2788 { -1, "3. Elroy PCI Bridge at 0xfed32000 [10/1] "
2789 "{ 13, 0x0, 0x782, 0x0000a }\n" },
2790 { -1, "4. Elroy PCI Bridge at 0xfed38000 [10/4] "
2791 "{ 13, 0x0, 0x782, 0x0000a }\n" },
2792 { -1, "5. Elroy PCI Bridge at 0xfed3c000 [10/6] "
2793 "{ 13, 0x0, 0x782, 0x0000a }\n" },
2794 { -1, "6. AllegroHigh W at 0xfffa0000 [32] "
2795 "{ 0, 0x0, 0x5bb, 0x00004 }\n" },
2796 { -1, "7. Memory at 0xfed10200 [49] { 1, 0x0, 0x086, 0x00009 }\n" },
2797 { -1, "CPU(s): 1 x PA8500 (PCX-W) at 400.000000 MHz\n" },
2798 { -1, "SBA found Astro 2.1 at 0xfed00000\n" },
2799 { -1, "lba version TR2.1 (0x2) found at 0xfed30000\n" },
2800 { -1, "lba version TR2.1 (0x2) found at 0xfed32000\n" },
2801 { -1, "lba version TR2.1 (0x2) found at 0xfed38000\n" },
2802 { -1, "lba version TR2.1 (0x2) found at 0xfed3c000\n" },
2803 { 100, "SCSI subsystem initialized\n" },
2804 { 10, "drivers/usb/core/usb.c: registered new driver usbfs\n" },
2805 { -1, "drivers/usb/core/usb.c: registered new driver hub\n" },
2806 { -1, "ikconfig 0.7 with /proc/config*\n" },
2807 { -1, "Initializing Cryptographic API\n" },
2808 { 250, "SuperIO: probe of 0000:00:0e.0 failed with error -1\n" },
2809 { 20, "SuperIO: Found NS87560 Legacy I/O device at 0000:00:0e.1 "
2811 { -1, "SuperIO: Serial port 1 at 0x3f8\n" },
2812 { -1, "SuperIO: Serial port 2 at 0x2f8\n" },
2813 { -1, "SuperIO: Parallel port at 0x378\n" },
2814 { -1, "SuperIO: Floppy controller at 0x3f0\n" },
2815 { -1, "SuperIO: ACPI at 0x7e0\n" },
2816 { -1, "SuperIO: USB regulator enabled\n" },
2817 { -1, "SuperIO: probe of 0000:00:0e.2 failed with error -1\n" },
2818 { -1, "Soft power switch enabled, polling @ 0xf0400804.\n" },
2819 { -1, "pty: 256 Unix98 ptys configured\n" },
2820 { -1, "Generic RTC Driver v1.07\n" },
2821 { -1, "Serial: 8250/16550 driver $" "Revision: 1.100 $ 13 ports, "
2822 "IRQ sharing disabled\n" },
2823 { -1, "ttyS0 at I/O 0x3f8 (irq = 0) is a 16550A\n" },
2824 { -1, "ttyS1 at I/O 0x2f8 (irq = 0) is a 16550A\n" },
2825 { -1, "Linux Tulip driver version 1.1.13 (May 11, 2002)\n" },
2826 { 150, "tulip0: no phy info, aborting mtable build\n" },
2827 { 10, "tulip0: MII transceiver #1 config 1000 status 782d "
2828 "advertising 01e1.\n" },
2829 { -1, "eth0: Digital DS21143 Tulip rev 65 at 0xf4008000, "
2830 "00:10:83:F9:B4:34, IRQ 66.\n" },
2831 { -1, "Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2\n" },
2832 { -1, "ide: Assuming 33MHz system bus speed for PIO modes; "
2833 "override with idebus=xx\n" },
2834 { 100, "SiI680: IDE controller at PCI slot 0000:01:06.0\n" },
2835 { 10, "SiI680: chipset revision 2\n" },
2836 { -1, "SiI680: BASE CLOCK == 133\n" },
2837 { -1, "SiI680: 100% native mode on irq 128\n" },
2838 { -1, " ide0: MMIO-DMA at 0xf4800000-0xf4800007 -- "
2839 "Error, MMIO ports already in use.\n" },
2840 { -1, " ide1: MMIO-DMA at 0xf4800008-0xf480000f -- "
2841 "Error, MMIO ports already in use.\n" },
2842 { 5, "hda: TS130220A2, ATA DISK drive\n" },
2843 { -1, " _______________________________\n" },
2844 { -1, " < Your System ate a SPARC! Gah! >\n" },
2845 { -1, " -------------------------------\n" },
2846 { -1, " \\ ^__^\n" },
2847 { -1, " \\ (xx)\\_______\n" },
2848 { -1, " (__)\\ )\\/\\\n" },
2849 { -1, " U ||----w |\n" },
2851 { -1, "swapper (pid 1): Breakpoint (code 0)\n" },
2853 { -1, " YZrvWESTHLNXBCVMcbcbcbcbOGFRQPDI\n" },
2854 { -1, "PSW: 00000000000001001111111100001111 Not tainted\n" },
2855 { -1, "r00-03 4d6f6f21 1032f010 10208f34 103fc2e0\n" },
2856 { -1, "r04-07 103fc230 00000001 00000001 0000000f\n" },
2857 { -1, "r08-11 103454f8 000f41fa 372d3980 103ee404\n" },
2858 { -1, "r12-15 3ccbf700 10344810 103ee010 f0400004\n" },
2859 { -1, "r16-19 f00008c4 f000017c f0000174 00000000\n" },
2860 { -1, "r20-23 fed32840 fed32800 00000000 0000000a\n" },
2861 { -1, "r24-27 0000ffa0 000000ff 103fc2e0 10326010\n" },
2862 { -1, "r28-31 00000000 00061a80 4ff98340 10208f34\n" },
2863 { -1, "sr0-3 00000000 00000000 00000000 00000000\n" },
2864 { -1, "sr4-7 00000000 00000000 00000000 00000000\n" },
2866 { -1, "IASQ: 00000000 00000000 IAOQ: 00000000 00000004\n" },
2867 { -1, " IIR: 00000000 ISR: 00000000 IOR: 00000000\n" },
2868 { -1, " CPU: 0 CR30: 4ff98000 CR31: 1037c000\n" },
2869 { -1, " ORIG_R28: 55555555\n" },
2870 { -1, " IAOQ[0]: 0x0\n" },
2871 { -1, " IAOQ[1]: 0x4\n" },
2872 { -1, " RP(r2): probe_hwif+0x218/0x44c\n" },
2873 { -1, "Kernel panic: Attempted to kill init!\n" },
2876 bst->scroll_p = True;
2878 bst->left_margin = bst->right_margin = 10;
2879 bst->top_margin = bst->bottom_margin = 10;
2881 release = "2.6.0-test11-pa2";
2883 version = "#2 Mon Dec 8 06:09:27 GMT 2003";
2888 if (uname (&uts) >= 0)
2890 sysname = uts.nodename;
2891 if (!strcmp (uts.sysname, "Linux"))
2893 release = uts.release;
2894 version = uts.version;
2897 s = strchr (sysname, '.');
2900 # endif /* !HAVE_UNAME */
2902 # if (defined (__GNUC__) && defined (__VERSION__))
2903 gccversion = __VERSION__;
2904 # else /* !(defined (__GNUC__) && defined (__VERSION__)) */
2905 gccversion = "3.3.2 (Debian)";
2906 # endif /* !(defined (__GNUC__) && defined (__VERSION__)) */
2908 /* Insert current host name into banner on line 2 */
2911 snprintf (ss, 1024, linux_panic[1].string,
2912 release, sysname, gccversion, version);
2913 linux_panic[1].string = ss;
2916 BSOD_PAUSE (bst, 100000);
2917 while (linux_panic[i].string)
2919 if (linux_panic[i].delay != -1)
2920 linedelay = linux_panic[i].delay * 1000;
2921 BSOD_PAUSE (bst, linedelay);
2922 BSOD_TEXT (bst, LEFT, linux_panic[i].string);
2926 bst->y = bst->xgwa.height - bst->font->ascent - bst->font->descent;
2928 XClearWindow(dpy, window);
2933 /* VMS by jwz (text sent by Roland Barmettler <roli@barmettler.net>)
2935 static struct bsod_state *
2936 vms (Display *dpy, Window window)
2938 struct bsod_state *bst = make_bsod_state (dpy, window, "vms", "VMS");
2940 const char *sysname;
2942 int dot_delay = 40000;
2943 int chunk_delay = 500000;
2950 const char *lines[] = {
2951 "%CNXMAN, Lost connection to system #\n"
2952 "%SHADOW-I-VOLPROC, DSA0: shadow master has changed. "
2953 "Dump file WILL be written if system crashes.\n"
2957 "%CNXMAN, Quorum lost, blocking activity\n"
2958 "%CNXMAN, Timed-out lost connection to system #\n"
2959 "%CNXMAN, Timed-out lost connection to system #\n"
2960 "%CNXMAN, Timed-out lost connection to system #\n"
2961 "%CNXMAN, Proposing reconfiguration of the VMScluster\n",
2964 "%CNXMAN, Removed from VMScluster system #\n"
2965 "%CNXMAN, Removed from VMScluster system #\n"
2966 "%CNXMAN, Removed from VMScluster system #\n"
2967 "%CNXMAN, Completing VMScluster state transition\n",
2970 "**** OpenVMS (TM) Alpha Operating system V7.3-1 - BUGCHECK ****\n"
2972 "** Bugcheck code = 000005DC: CLUEXIT, Node voluntarily exiting "
2974 "** Crash CPU: 00 Primary CPU: 00 Active CPUs: 00000001\n"
2975 "** Current Process = NULL\n"
2976 "** Current PSB ID = 00000001\n"
2979 "** Dumping error log buffers to HBVS unit 0\n"
2980 "**** Unable to dump error log buffers to remaining shadow set members\n"
2981 "** Error log buffers not dumped to HBVS unit 200\n"
2983 "** Dumping memory to HBVS unit 0\n"
2984 "**** Starting compressed selective memory dump at #...\n",
2989 "**** Memory dump complete - not all processes or global pages saved\n",
2997 "HALT instruction executed\n"
2998 "PC = ffffffff800c3884\n",
3004 "resetting all I/O buses\n"
3011 bst->scroll_p = True;
3013 bst->left_margin = bst->right_margin = 10;
3014 bst->top_margin = bst->bottom_margin = 10;
3020 if (uname (&uts) >= 0)
3021 sysname = uts.nodename;
3022 s = strchr (sysname, '.');
3025 # endif /* !HAVE_UNAME */
3027 args[0] = malloc (strlen(sysname) + 7);
3028 strcpy (args[0], sysname);
3031 /* Pick three numbers, 1-9, no overlaps. */
3032 ids[0] = 1 + (random() % 9);
3033 do { ids[1] = 1 + (random() % 9); } while (ids[1]==ids[0]);
3034 do { ids[2] = 1 + (random() % 9); } while (ids[2]==ids[0] || ids[2]==ids[1]);
3036 i = strlen(args[0])-1;
3038 args[0][i] = '0' + ids[0];
3041 for (s = args[0]; *s; s++)
3042 if (isalpha(*s)) *s = toupper (*s);
3044 args[1] = strdup (args[0]);
3045 args[2] = strdup (args[0]); args[2][i] = '0' + ids[1];
3046 args[3] = strdup (args[0]); args[3][i] = '0' + ids[2];
3048 args[4] = strdup (args[1]);
3049 args[5] = strdup (args[2]);
3050 args[6] = strdup (args[3]);
3053 time_t t = time ((time_t *) 0);
3054 struct tm *tm = localtime (&t);
3055 args[7] = malloc (30);
3056 strftime (args[7], 29, "%d-%b-%Y %H:%M", tm);
3057 for (s = args[7]; *s; s++)
3058 if (isalpha(*s)) *s = toupper (*s);
3062 for (i = 0; i < countof(lines); i++)
3064 const char *fmt = lines[i];
3065 if (! strcmp (fmt, "..."))
3067 int steps = 180 + (random() % 60);
3068 while (--steps >= 0)
3070 BSOD_TEXT (bst, LEFT, ".");
3071 BSOD_PAUSE (bst, dot_delay);
3076 char *fmt2 = malloc (strlen (fmt) * 2 + 1);
3077 for (s = (char *) fmt, s1 = fmt2; *s; s++)
3081 strcpy (s1, args[arg_count++]);
3088 BSOD_CHAR_DELAY (bst, char_delay);
3089 BSOD_TEXT (bst, LEFT, fmt2);
3091 BSOD_CHAR_DELAY (bst, 0);
3092 BSOD_PAUSE (bst, chunk_delay);
3096 for (i = 0; i < countof (args); i++)
3099 XClearWindow(dpy, window);
3104 /* HVX (formerly GCOS6) and TPS6 crash
3105 by Brian Garratt <brian-m.garratt@bull.co.uk>
3107 GCOS6 is a Unix-like operating system developed by Honeywell in the
3108 1970s in collaboration with MIT and AT&T (who called their version
3109 UNIX). Both are very much like MULTICS which Honeywell got from GE.
3111 HVX ("High-performance Virtual System on Unix") is an AIX application
3112 which emulates GCOS6 hardware on RS6000-like machines.
3114 static struct bsod_state *
3115 hvx (Display *dpy, Window window)
3117 struct bsod_state *bst = make_bsod_state (dpy, window, "hvx", "HVX");
3119 bst->scroll_p = True;
3121 bst->y = bst->xgwa.height - bst->bottom_margin - bst->font->ascent;
3123 BSOD_CHAR_DELAY (bst, 10000);
3124 BSOD_TEXT (bst, LEFT,
3125 "(TP) Trap no E Effective address 00000000 Instruction D7DE\n"
3126 "(TP) Registers :\n"
3127 "(TP) B1 -> B7 03801B02 00000000 03880D45 038BABDB 0388AFFD"
3128 " 0389B3F8 03972317\n"
3129 "(TP) R1 -> R7 0001 0007 F10F 090F 0020 0106 0272\n"
3130 "(TP) P I Z M1 0388A18B 3232 0000 FF00\n"
3131 "(TP) Program counter is at offset 0028 from string YTPAD\n"
3132 "(TP) User id of task which trapped is LT 626\n"
3135 BSOD_PAUSE (bst, 1000000);
3137 BSOD_CHAR_DELAY (bst, 100000);
3138 BSOD_TEXT (bst, LEFT, " TP CLOSE ALL");
3140 BSOD_CHAR_DELAY (bst, 10000);
3141 BSOD_TEXT (bst, LEFT, "\n(TP)?\n");
3142 BSOD_PAUSE (bst, 1000000);
3144 BSOD_CHAR_DELAY (bst, 100000);
3145 BSOD_TEXT (bst, LEFT, " TP ABORT -LT ALL");
3147 BSOD_CHAR_DELAY (bst, 10000);
3148 BSOD_TEXT (bst, LEFT, "\n(TP)?\n");
3149 BSOD_PAUSE (bst, 1000000);
3151 BSOD_CHAR_DELAY (bst, 100000);
3152 BSOD_TEXT (bst, LEFT, " TP STOP KILL");
3154 BSOD_CHAR_DELAY (bst, 10000);
3155 BSOD_TEXT (bst, LEFT,
3158 "Core dumps initiated for selected HVX processes ...\n"
3159 "Core dumps complete.\n"
3160 "Fri Jul 19 15:53:09 2002\n"
3161 "Live registers for cp 0:\n"
3162 " P = 7de3 IW=0000 I=32 CI=30000000 S=80006013"
3163 " IV=aa0 Level=13\n"
3164 " R1-7 = 1f 913 13 4 8 0 0\n"
3165 " B1-7 = 64e71b a93 50e 64e73c 6c2c 7000 b54\n"
3166 "Memory dump starting to file /var/hvx/dp01/diag/Level2 ...\n"
3167 "Memory dump complete.\n"
3170 XClearWindow(dpy, window);
3175 /* HPUX panic, by Tobias Klausmann <klausman@schwarzvogel.de>
3177 static struct bsod_state *
3178 hpux (Display *dpy, Window window)
3180 struct bsod_state *bst = make_bsod_state (dpy, window, "hpux", "HPUX");
3181 const char *sysname;
3184 bst->scroll_p = True;
3185 bst->y = bst->xgwa.height - bst->bottom_margin - bst->font->ascent;
3192 if (uname (&uts) >= 0)
3193 sysname = uts.nodename;
3194 s = strchr (sysname, '.');
3197 # endif /* !HAVE_UNAME */
3199 BSOD_TEXT (bst, LEFT,
3203 sprintf (buf, "%.100s [HP Release B.11.00] (see /etc/issue)\n", sysname);
3204 BSOD_TEXT (bst, LEFT, buf);
3205 BSOD_PAUSE (bst, 1000000);
3206 BSOD_TEXT (bst, LEFT,
3209 " ******* Unexpected HPMC/TOC. Processor HPA FFFFFFFF'"
3210 "FFFA0000 *******\n"
3211 " GENERAL REGISTERS:\n"
3212 "r00/03 00000000'00000000 00000000'00000000 00000000'00000000 00000000'"
3214 "r04/07 00000000'00000001 00000000'0126E328 00000000'00000000 00000000'"
3216 "r08/11 00000000'00000000 00000000'0198CFC0 00000000'000476FE 00000000'"
3218 "r12/15 00000000'40013EE8 00000000'08000080 00000000'4002530C 00000000'"
3220 "r16/19 00000000'7F7F2A00 00000000'00000001 00000000'00000000 00000000'"
3222 "r20/23 00000000'006C8048 00000000'00000001 00000000'00000000 00000000'"
3224 "r24/27 00000000'00000000 00000000'00000000 00000000'00000000 00000000'"
3226 "r28/31 00000000'00000000 00000000'007DD628 00000000'0199F2B0 00000000'"
3228 " CONTROL REGISTERS:\n"
3229 "sr0/3 00000000'0F3B4000 00000000'0C2A2000 00000000'016FF800 00000000'"
3231 "sr4/7 00000000'00000000 00000000'016FF800 00000000'0DBF1400 00000000'"
3233 "pcq = 00000000'00000000.00000000'00104950 00000000'00000000.00000000'"
3235 "isr = 00000000'10240006 ior = 00000000'67D9E220 iir = 08000240 rctr = "
3238 "pid reg cr8/cr9 00007700'0000B3A9 00000000'0000C5D8\n"
3239 "pid reg cr12/cr13 00000000'00000000 00000000'00000000\n"
3240 "ipsw = 000000FF'080CFF1F iva = 00000000'0002C000 sar = 3A ccr = C0\n"
3241 "tr0/3 00000000'006C76C0 00000000'00000001 00000000'00000000 00000000'"
3243 "tr4/7 00000000'03790000 0000000C'4FB68340 00000000'C07EE13F 00000000'"
3245 "eiem = FFFFFFF0'FFFFFFFF eirr = 80000000'00000000 itmr = 0000000C'"
3247 "cr1/4 00000000'00000000 00000000'00000000 00000000'00000000 00000000'"
3249 "cr5/7 00000000'00000000 00000000'00000000 00000000'"
3251 " MACHINE CHECK PARAMETERS:\n"
3252 "Check Type = 00000000 CPU STATE = 9E000001 Cache Check = 00000000\n"
3253 "TLB Check = 00000000 Bus Check = 00000000 PIM State = ? SIU "
3254 "Status = ????????\n"
3255 "Assists = 00000000 Processor = 00000000\n"
3256 "Slave Addr = 00000000'00000000 Master Addr = 00000000'00000000\n"
3259 "TOC, pcsq.pcoq = 0'0.0'104950 , isr.ior = 0'10240006.0'67d9e220\n"
3260 "@(#)B2352B/9245XB HP-UX (B.11.00) #1: Wed Nov 5 22:38:19 PST 1997\n"
3261 "Transfer of control: (display==0xd904, flags==0x0)\n"
3265 "*** A system crash has occurred. (See the above messages for details.)\n"
3266 "*** The system is now preparing to dump physical memory to disk, for use\n"
3267 "*** in debugging the crash.\n"
3269 "*** The dump will be a SELECTIVE dump: 40 of 256 megabytes.\n"
3270 "*** To change this dump type, press any key within 10 seconds.\n"
3271 "*** Proceeding with selective dump.\n"
3273 "*** The dump may be aborted at any time by pressing ESC.\n");
3279 for (i = 0; i <= steps; i++)
3281 if (i > steps) i = steps;
3283 "*** Dumping: %3d%% complete (%d of 40 MB) (device 64:0x2)\r",
3286 BSOD_TEXT (bst, LEFT, buf);
3287 BSOD_PAUSE (bst, 1500000);
3291 BSOD_TEXT (bst, LEFT, "\n*** System rebooting.\n");
3293 XClearWindow(dpy, window);
3298 /* IBM OS/390 aka MVS aka z/OS.
3299 Text from Dan Espen <dane@mk.telcordia.com>.
3300 Apparently this isn't actually a crash, just a random session...
3303 static struct bsod_state *
3304 os390 (Display *dpy, Window window)
3306 struct bsod_state *bst = make_bsod_state (dpy, window, "os390", "OS390");
3308 bst->scroll_p = True;
3309 bst->y = bst->xgwa.height - bst->bottom_margin - bst->font->ascent;
3311 BSOD_LINE_DELAY (bst, 100000);
3312 BSOD_TEXT (bst, LEFT,
3313 "\n*** System rebooting.\n"
3314 "* ISPF Subtask abend *\n"
3315 "SPF ENDED DUE TO ERROR+\n"
3318 "IEA995I SYMPTOM DUMP OUTPUT\n"
3319 " USER COMPLETION CODE=0222\n"
3320 " TIME=23.00.51 SEQ=03210 CPU=0000 ASID=00AE\n"
3321 " PSW AT TIME OF ERROR 078D1000 859DAF18 ILC 2 INTC 0D\n"
3322 " NO ACTIVE MODULE FOUND\n"
3324 " DATA AT PSW 059DAF12 - 00181610 0A0D9180 70644710\n"
3325 " AR/GR 0: 00000000/80000000 1: 00000000/800000DE\n"
3326 " 2: 00000000/196504DC 3: 00000000/00037A78\n"
3327 " 4: 00000000/00037B78 5: 00000000/0003351C\n"
3328 " 6: 00000000/0000F0AD 7: 00000000/00012000\n"
3329 " 8: 00000000/059DAF10 9: 00000000/0002D098\n"
3330 " A: 00000000/059D9F10 B: 00000000/059D8F10\n"
3331 " C: 00000000/859D7F10 D: 00000000/00032D60\n"
3332 " E: 00000000/00033005 F: 01000002/00000041\n"
3333 " END OF SYMPTOM DUMP\n"
3334 "ISPS014 - ** Logical screen request failed - abend 0000DE **\n"
3335 "ISPS015 - ** Contact your system programmer or dialog developer.**\n"
3336 "*** ISPF Main task abend ***\n"
3337 "IEA995I SYMPTOM DUMP OUTPUT\n"
3338 " USER COMPLETION CODE=0222\n"
3339 " TIME=23.00.52 SEQ=03211 CPU=0000 ASID=00AE\n"
3340 " PSW AT TIME OF ERROR 078D1000 8585713C ILC 2 INTC 0D\n"
3341 " ACTIVE LOAD MODULE ADDRESS=05855000 OFFSET=0000213C\n"
3343 " DATA AT PSW 05857136 - 00181610 0A0D9180 D3304770\n"
3344 " GR 0: 80000000 1: 800000DE\n"
3345 " 2: 00015260 3: 00000038\n"
3346 " 4: 00012508 5: 00000000\n"
3347 " 6: 000173AC 7: FFFFFFF8\n"
3348 " 8: 05858000 9: 00012CA0\n"
3349 " A: 05857000 B: 05856000\n"
3350 " C: 85855000 D: 00017020\n"
3351 " E: 85857104 F: 00000000\n"
3352 " END OF SYMPTOM DUMP\n"
3355 BSOD_CURSOR (bst, CURSOR_LINE, 240000, 999999);
3357 XClearWindow(dpy, window);
3362 /* Compaq Tru64 Unix panic, by jwz as described by
3363 Tobias Klausmann <klausman@schwarzvogel.de>
3365 static struct bsod_state *
3366 tru64 (Display *dpy, Window window)
3368 struct bsod_state *bst = make_bsod_state (dpy, window, "tru64", "Tru64");
3369 const char *sysname;
3372 bst->scroll_p = True;
3373 bst->y = bst->xgwa.height - bst->bottom_margin - bst->font->ascent;
3375 sysname = "127.0.0.1";
3379 if (uname (&uts) >= 0)
3380 sysname = uts.nodename;
3382 # endif /* !HAVE_UNAME */
3385 "Compaq Tru64 UNIX V5.1B (Rev. 2650) (%.100s) console\n"
3389 BSOD_TEXT (bst, LEFT, buf);
3390 BSOD_PAUSE (bst, 6000000);
3392 BSOD_TEXT (bst, LEFT,
3393 "panic (cpu 0): trap: illegal instruction\n"
3394 "kernel inst fault=gentrap, ps=0x5, pc=0xfffffc0000593878, inst=0xaa\n"
3395 "kernel inst fault=gentrap, ps=0x5, pc=0xfffffc0000593878, inst=0xaa\n"
3397 "DUMP: blocks available: 1571600\n"
3398 "DUMP: blocks wanted: 100802 (partial compressed dump) [OKAY]\n"
3399 "DUMP: Device Disk Blocks Available\n"
3400 "DUMP: ------ ---------------------\n"
3401 "DUMP: 0x1300023 1182795 - 1571597 (of 1571598) [primary swap]\n"
3402 "DUMP.prom: Open: dev 0x5100041, block 2102016: SCSI 0 11 0 2 200 0 0\n"
3403 "DUMP: Writing header... [1024 bytes at dev 0x1300023, block 1571598]\n"
3404 "DUMP: Writing data");
3408 int steps = 4 + (random() % 8);
3409 BSOD_CHAR_DELAY (bst, 1000000);
3410 for (i = 0; i < steps; i++)
3411 BSOD_TEXT (bst, LEFT, ".");
3412 BSOD_CHAR_DELAY (bst, 0);
3413 sprintf (buf, "[%dMB]\n", steps);
3414 BSOD_TEXT (bst, LEFT, buf);
3417 BSOD_TEXT (bst, LEFT,
3418 "DUMP: Writing header... [1024 bytes at dev 0x1300023, block 1571598]\n"
3419 "DUMP: crash dump complete.\n"
3420 "kernel inst fault=gentrap, ps=0x5, pc=0xfffffc0000593878, inst=0xaa\n"
3422 "DUMP: second crash dump skipped: 'dump_savecnt' enforced.\n");
3423 BSOD_PAUSE (bst, 4000000);
3425 BSOD_TEXT (bst, LEFT,
3430 "HALT instruction executed\n"
3431 "PC = fffffc00005863b0\n");
3432 BSOD_PAUSE (bst, 3000000);
3434 BSOD_TEXT (bst, LEFT,
3441 XClearWindow(dpy, window);
3448 static struct bsod_state *
3449 msdos (Display *dpy, Window window)
3451 struct bsod_state *bst = make_bsod_state (dpy, window, "msdos", "MSDOS");
3453 BSOD_CHAR_DELAY (bst, 10000);
3454 BSOD_TEXT (bst, LEFT, "C:\\WINDOWS>");
3455 BSOD_CURSOR (bst, CURSOR_LINE, 200000, 8);
3457 BSOD_CHAR_DELAY (bst, 200000);
3458 BSOD_TEXT (bst, LEFT, "dir a:");
3459 BSOD_PAUSE (bst, 1000000);
3461 BSOD_CHAR_DELAY (bst, 10000);
3462 BSOD_TEXT (bst, LEFT, "\nNot ready reading drive A\nAbort, Retry, Fail?");
3464 BSOD_CURSOR (bst, CURSOR_LINE, 200000, 10);
3465 BSOD_CHAR_DELAY (bst, 200000);
3466 BSOD_TEXT (bst, LEFT, "f");
3467 BSOD_PAUSE (bst, 1000000);
3469 BSOD_CHAR_DELAY (bst, 10000);
3470 BSOD_TEXT (bst, LEFT,
3471 "\n\n\nNot ready reading drive A\nAbort, Retry, Fail?");
3473 BSOD_CURSOR (bst, CURSOR_LINE, 200000, 10);
3474 BSOD_CHAR_DELAY (bst, 200000);
3475 BSOD_TEXT (bst, LEFT, "f");
3476 BSOD_PAUSE (bst, 1000000);
3478 BSOD_CHAR_DELAY (bst, 10000);
3479 BSOD_TEXT (bst, LEFT, "\nVolume in drive A has no label\n\n"
3480 "Not ready reading drive A\nAbort, Retry, Fail?");
3482 BSOD_CURSOR (bst, CURSOR_LINE, 200000, 12);
3483 BSOD_CHAR_DELAY (bst, 200000);
3484 BSOD_TEXT (bst, LEFT, "a");
3485 BSOD_PAUSE (bst, 1000000);
3487 BSOD_CHAR_DELAY (bst, 10000);
3488 BSOD_TEXT (bst, LEFT, "\n\nC:\\WINDOWS>");
3490 BSOD_CURSOR (bst, CURSOR_LINE, 200000, 999999);
3492 XClearWindow(dpy, window);
3499 * This is what happens if an Nvidia card goes into some crazy text mode.
3500 * Most often seen on the second screen of a dual-head system when the
3501 * proper driver isn't loaded.
3503 typedef struct { int fg; int bg; int bit; Bool blink; } nvcell;
3506 nvspatter (nvcell *grid, int rows, int cols, int ncolors, int nbits,
3509 int max = rows * cols;
3510 int from = fill_p ? 0 : random() % (max - 1);
3511 int len = fill_p ? max : random() % (cols * 4);
3512 int to = from + len;
3514 Bool noisy = ((random() % 4) == 0);
3515 Bool diag = (noisy || fill_p) ? 0 : ((random() % 4) == 0);
3517 int fg = random() % ncolors;
3518 int bg = random() % ncolors;
3519 int blink = ((random() % 4) == 0);
3520 int bit = (random() % nbits);
3522 if (to > max) to = max;
3526 int src = random() % (rows * cols);
3527 int len2 = (cols / 2) - (random() % 5);
3529 for (i = from; i < to; i++, j++)
3531 if (j > src + len2 || j >= max)
3533 if (i >= max) abort();
3534 if (j >= max) abort();
3539 for (i = from; i < to; i++)
3541 nvcell *cell = &grid[i];
3545 cell->blink = blink;
3549 fg = random() % ncolors;
3550 bg = random() % ncolors;
3551 blink = ((random() % 8) == 0);
3557 struct bsod_state *bst;
3564 unsigned long colors[256];
3570 nvidia_free (struct bsod_state *bst)
3572 nvstate *nvs = (nvstate *) bst->closure;
3574 XFreeColors (bst->dpy, bst->xgwa.colormap, nvs->colors, nvs->ncolors, 0);
3575 for (i = 0; i < countof(nvs->bits); i++)
3576 XFreePixmap (bst->dpy, nvs->bits[i]);
3577 XFreeGC (bst->dpy, nvs->gc1);
3583 nvidia_draw (struct bsod_state *bst)
3585 nvstate *nvs = (nvstate *) bst->closure;
3588 for (y = 0; y < nvs->rows; y++)
3589 for (x = 0; x < nvs->cols; x++)
3591 nvcell *cell = &nvs->grid[y * nvs->cols + x];
3592 unsigned long fg = nvs->colors[cell->fg];
3593 unsigned long bg = nvs->colors[cell->bg];
3594 Bool flip = cell->blink && (nvs->tick & 1);
3595 XSetForeground (bst->dpy, bst->gc, flip ? fg : bg);
3596 XSetBackground (bst->dpy, bst->gc, flip ? bg : fg);
3597 XCopyPlane (bst->dpy, nvs->bits[cell->bit], bst->window, bst->gc,
3598 0, 0, nvs->cellw, nvs->cellh,
3599 x * nvs->cellw, y * nvs->cellh, 1L);
3603 if ((random() % 5) == 0) /* change the display */
3604 nvspatter (nvs->grid, nvs->rows, nvs->cols, nvs->ncolors,
3605 countof(nvs->bits), False);
3611 static struct bsod_state *
3612 nvidia (Display *dpy, Window window)
3614 struct bsod_state *bst = make_bsod_state (dpy, window, "nvidia", "nVidia");
3615 nvstate *nvs = (nvstate *) calloc (1, sizeof (*nvs));
3622 bst->draw_cb = nvidia_draw;
3623 bst->free_cb = nvidia_free;
3627 nvs->cellw = bst->xgwa.width / nvs->cols;
3628 nvs->cellh = bst->xgwa.height / nvs->rows;
3629 if (nvs->cellw < 8 || nvs->cellh < 18)
3630 nvs->cellw = 8, nvs->cellh = 18;
3631 nvs->cols = (bst->xgwa.width / nvs->cellw) + 1;
3632 nvs->rows = (bst->xgwa.height / nvs->cellh) + 1;
3634 nvs->grid = (nvcell *) calloc (sizeof(*nvs->grid), nvs->rows * nvs->cols);
3639 for (i = 0; i < nvs->ncolors; i++)
3642 c.red = random() & 0xFFFF;
3643 c.green = random() & 0xFFFF;
3644 c.blue = random() & 0xFFFF;
3645 c.flags = DoRed|DoGreen|DoBlue;
3646 XAllocColor (dpy, bst->xgwa.colormap, &c);
3647 nvs->colors[i] = c.pixel;
3650 /* Construct corrupted character bitmaps
3652 for (i = 0; i < countof(nvs->bits); i++)
3656 nvs->bits[i] = XCreatePixmap (dpy, window, nvs->cellw, nvs->cellh, 1);
3657 if (!nvs->gc1) nvs->gc1 = XCreateGC (dpy, nvs->bits[i], 0, &gcv);
3659 XSetForeground (dpy, nvs->gc1, 0);
3660 XFillRectangle (dpy, nvs->bits[i], nvs->gc1, 0, 0,
3661 nvs->cellw, nvs->cellh);
3662 XSetForeground (dpy, nvs->gc1, 1);
3664 if ((random() % 40) != 0)
3665 for (j = 0; j < ((nvs->cellw * nvs->cellh) / 16); j++)
3666 XFillRectangle (dpy, nvs->bits[i], nvs->gc1,
3667 (random() % (nvs->cellw-2)) & ~1,
3668 (random() % (nvs->cellh-2)) & ~1,
3672 /* Randomize the grid
3674 nvspatter (nvs->grid, nvs->rows, nvs->cols, nvs->ncolors,
3675 countof(nvs->bits), True);
3676 for (i = 0; i < 20; i++)
3677 nvspatter (nvs->grid, nvs->rows, nvs->cols, nvs->ncolors,
3678 countof(nvs->bits), False);
3685 * Simulate various Apple ][ crashes. The memory map encouraged many programs
3686 * to use the primary hi-res video page for various storage, and the secondary
3687 * hi-res page for active display. When it crashed into Applesoft or the
3688 * monitor, it would revert to the primary page and you'd see memory garbage on
3689 * the screen. Also, it was common for copy-protected games to use the primary
3690 * text page for important code, because that made it really hard to
3691 * reverse-engineer them. The result often looked like what this generates.
3693 * The Apple ][ logic and video hardware is in apple2.c. The TV is emulated by
3694 * analogtv.c for maximum realism
3696 * Trevor Blackwell <tlb@tlb.org>
3699 static const char * const apple2_basic_errors[]={
3703 "RETURN WITHOUT GOSUB",
3707 "BAD SUBSCRIPT ERROR",
3710 "FORMULA TOO COMPLEX",
3715 "DEFAULT ARGUMENTS ARE NOT ALLOWED IN DECLARATION OF FRIEND "
3716 "TEMPLATE SPECIALIZATION"
3720 static const char * const apple2_dos_errors[]={
3724 "NO BUFFERS AVAILABLE",
3725 "PROGRAM TOO LARGE",
3728 static void a2controller_crash(apple2_sim_t *sim, int *stepno,
3729 double *next_actiontime)
3731 apple2_state_t *st=sim->st;
3740 if (!sim->controller_data)
3741 sim->controller_data = calloc(sizeof(struct mydata),1);
3742 mine=(struct mydata *) sim->controller_data;
3747 a2_init_memory_active(sim);
3748 sim->dec->powerup = 1000.0;
3750 if (random()%3==0) {
3752 *next_actiontime+=0.4;
3755 else if (random()%4==0) {
3756 st->gr_mode=A2_GR_LORES;
3757 if (random()%3==0) st->gr_mode |= A2_GR_FULL;
3758 *next_actiontime+=0.4;
3761 else if (random()%2==0) {
3762 st->gr_mode=A2_GR_HIRES;
3766 st->gr_mode=A2_GR_HIRES;
3767 *next_actiontime+=0.4;
3773 /* An illegal instruction or a reset caused it to drop into the
3774 assembly language monitor, where you could disassemble code & view
3776 if (random()%3==0) {
3779 int addr=0xd000+random()%0x3000;
3781 "%02X",random()%0xff);
3784 sprintf(sim->printing_buf,
3787 " A=%02X X=%02X Y=%02X S=%02X F=%02X\n"
3790 random()%0xff, random()%0xff,
3791 random()%0xff, random()%0xff,
3793 sim->printing=sim->printing_buf;
3801 *next_actiontime += 2.0 + (random()%1000)*0.0002;
3804 /* Lots of programs had at least their main functionality in
3805 Applesoft Basic, which had a lot of limits (memory, string
3806 length, etc) and would sometimes crash unexpectedly. */
3807 sprintf(sim->printing_buf,
3813 apple2_basic_errors[random() %
3814 (sizeof(apple2_basic_errors)
3816 (1000*(random()%(random()%59+1)) +
3817 100*(random()%(random()%9+1)) +
3818 5*(random()%(random()%199+1)) +
3819 1*(random()%(random()%(random()%2+1)+1))));
3820 sim->printing=sim->printing_buf;
3824 *next_actiontime += 2.0 + (random()%1000)*0.0002;
3829 if (random()%3==0) {
3830 /* This was how you reset the Basic interpreter. The sort of
3831 incantation you'd have on a little piece of paper taped to the
3832 side of your machine */
3833 sim->typing="CALL -1370";
3836 else if (random()%2==0) {
3837 sim->typing="CATALOG\n";
3841 *next_actiontime+=1.0;
3848 *next_actiontime += 0.5;
3855 for (s="APPLE ]["; *s; s++) a2_printc(st,*s);
3858 *next_actiontime+=1.0;
3863 if (random()%50==0) {
3864 sprintf(sim->printing_buf,
3865 "\nDISK VOLUME 254\n\n"
3869 sim->printing=sim->printing_buf;
3872 sprintf(sim->printing_buf,"\n?%s\n]",
3873 apple2_dos_errors[random()%
3874 (sizeof(apple2_dos_errors) /
3876 sim->printing=sim->printing_buf;
3879 *next_actiontime+=1.0;
3883 if (random()%2==0) {
3884 /* This was how you went back to text mode in the monitor */
3885 sim->typing="FB4BG";
3888 *next_actiontime+=1.0;
3899 *next_actiontime+=2.0;
3903 /* This reset things into Basic */
3904 if (random()%2==0) {
3905 sim->typing="FAA6G";
3910 *next_actiontime+=sim->delay;
3915 for (i=0; i<1500; i++) {
3916 a2_poke(st, mine->fillptr, mine->fillbyte);
3918 mine->fillbyte = (mine->fillbyte+1)&0xff;
3920 *next_actiontime += 0.08;
3921 /* When you hit c000, it changed video settings */
3922 if (mine->fillptr>=0xc000) {
3926 /* And it seemed to reset around here, I dunno why */
3927 if (mine->fillptr>=0xcf00) *stepno=130;
3933 case A2CONTROLLER_FREE:
3941 a2_draw (struct bsod_state *bst)
3943 apple2_sim_t *sim = (apple2_sim_t *) bst->closure;
3945 sim = apple2_start (bst->dpy, bst->window, 9999999, a2controller_crash);
3949 if (! apple2_one_frame (sim)) {
3957 a2_free (struct bsod_state *bst)
3959 apple2_sim_t *sim = (apple2_sim_t *) bst->closure;
3961 sim->stepno = A2CONTROLLER_DONE;
3962 a2_draw (bst); /* finish up */
3963 if (bst->closure) abort(); /* should have been freed by now */
3968 static struct bsod_state *
3969 apple2crash (Display *dpy, Window window)
3971 struct bsod_state *bst = make_bsod_state (dpy, window, "apple2", "Apple2");
3972 bst->draw_cb = a2_draw;
3973 bst->free_cb = a2_free;
3978 /* A crash spotted on a cash machine circa 2006, by jwz. I didn't note
3979 what model it was; probably a Tranax Mini-Bank 1000 or similar vintage.
3981 static struct bsod_state *
3982 atm (Display *dpy, Window window)
3984 struct bsod_state *bst = make_bsod_state (dpy, window, "atm", "ATM");
3987 int pix_w = atm_width;
3988 int pix_h = atm_height;
3992 XClearWindow (dpy, window);
3994 pixmap = XCreatePixmapFromBitmapData (dpy, window, (char *) atm_bits,
3995 atm_width, atm_height,
3996 bst->fg, bst->bg, bst->xgwa.depth);
3998 while (pix_w <= bst->xgwa.width * scale &&
3999 pix_h <= bst->xgwa.height * scale)
4001 pixmap = double_pixmap (dpy, bst->gc, bst->xgwa.visual, bst->xgwa.depth,
4002 pixmap, pix_w, pix_h);
4008 x = (bst->xgwa.width - pix_w) / 2;
4009 y = (bst->xgwa.height - pix_h) / 2;
4015 XSetForeground (dpy, bst->gc,
4016 get_pixel_resource (dpy, bst->xgwa.colormap,
4019 for (j = -1; j < pix_w; j += i+1)
4020 XDrawLine (bst->dpy, pixmap, bst->gc, j, 0, j, pix_h);
4021 for (j = -1; j < pix_h; j += i+1)
4022 XDrawLine (bst->dpy, pixmap, bst->gc, 0, j, pix_w, j);
4025 XCopyArea (dpy, pixmap, window, bst->gc, 0, 0, pix_w, pix_h, x, y);
4027 XFreePixmap (dpy, pixmap);
4033 /* An Android phone boot loader, by jwz.
4035 static struct bsod_state *
4036 android (Display *dpy, Window window)
4038 struct bsod_state *bst = make_bsod_state (dpy, window, "android", "Android");
4040 unsigned long bg = get_pixel_resource (dpy, bst->xgwa.colormap,
4041 "android.background",
4042 "Android.Background");
4043 unsigned long fg = get_pixel_resource (dpy, bst->xgwa.colormap,
4044 "android.foreground",
4045 "Android.Foreground");
4046 unsigned long c1 = get_pixel_resource (dpy, bst->xgwa.colormap,
4048 "Android.Foreground");
4049 unsigned long c2 = get_pixel_resource (dpy, bst->xgwa.colormap,
4051 "Android.Foreground");
4052 unsigned long c3 = get_pixel_resource (dpy, bst->xgwa.colormap,
4054 "Android.Foreground");
4055 unsigned long c4 = get_pixel_resource (dpy, bst->xgwa.colormap,
4057 "Android.Foreground");
4058 unsigned long c5 = get_pixel_resource (dpy, bst->xgwa.colormap,
4060 "Android.Foreground");
4061 unsigned long c6 = get_pixel_resource (dpy, bst->xgwa.colormap,
4063 "Android.Foreground");
4064 unsigned long c7 = get_pixel_resource (dpy, bst->xgwa.colormap,
4066 "Android.Foreground");
4068 const char *lines0[] = {
4069 "Calculating... please wait\n",
4070 "osbl: 0x499DF907\n",
4071 "amss: 0x73162409\n",
4072 "hboot: 0xE46C3327\n",
4073 "boot: 0xBA570E7A\n",
4074 "recovery: 0xC8BBA213\n",
4075 "system: 0x87C3B1F0\n",
4077 "Press power key to go back.\n",
4080 const char *lines1[] = {
4081 "Checking SD card update...\n",
4083 " SD Checking...\n",
4084 " Failed to open zipfile\n",
4085 " loading preload_content...\n",
4086 " [Caution] Preload Content Not Found\n",
4087 " loading HTCUpdateZipName image...\n",
4089 " Checking...[PG46IMG.zip]\n",
4090 "Please plug off USB\n",
4093 const char *lines2[] = {
4094 " SD Checking...\n",
4095 " Loading...[PK76DIAG.zip]\n",
4097 " Loading...[PK76DIAG.nbh]\n",
4098 " No image or wrong image!\n",
4099 " Loading...[PK76IMG.zip]\n",
4101 " Loading...[PK76IMG.nbh]\n",
4102 " No image or wrong image!\n",
4103 " Loading...[PK76IMG.tar]\n",
4105 " Loading...[PK76IMG.aes]\n",
4107 " Loading...[PK76IMG.enc]\n",
4111 int cw = (bst->font->per_char
4112 ? bst->font->per_char['n'-bst->font->min_char_or_byte2].width
4113 : bst->font->min_bounds.width);
4114 int line_height = bst->font->ascent + bst->font->descent;
4119 int pix_w = 0, pix_h = 0;
4122 pixmap = xpm_data_to_pixmap (dpy, window, (char **) android_skate,
4124 if (! pixmap) abort();
4125 bst->pixmap = pixmap;
4126 # endif /* DO_XPM */
4128 bst->left_margin = (bst->xgwa.width - (cw * 40)) / 2;
4129 if (bst->left_margin < 0) bst->left_margin = 0;
4132 unsigned long delay =
4134 state == countof(lines0) ||
4135 state == countof(lines0) + countof(lines1) ||
4136 state == countof(lines0) + countof(lines1) + countof(lines2))
4138 BSOD_LINE_DELAY (bst, delay);
4140 if (state <= countof(lines0) + countof(lines1) + countof(lines2))
4142 BSOD_COLOR (bst, bg, bg);
4143 BSOD_RECT (bst, True, 0, 0, bst->xgwa.width, bst->xgwa.height);
4144 BSOD_COLOR (bst, bg, c1);
4145 BSOD_MOVETO (bst, bst->left_margin, bst->top_margin + line_height);
4146 BSOD_TEXT (bst, LEFT, "*** UNLOCKED ***\n");
4147 BSOD_COLOR (bst, c2, bg);
4148 BSOD_TEXT (bst, LEFT,
4149 "PRIMOU PVT SHIP S-OFF RL\n"
4153 "RADIO-3831.17.00.23_2\n"
4154 "eMMC-bootmode: disabled\n"
4155 "CPU-bootmode : disabled\n"
4156 "HW Secure boot: enabled\n"
4157 "MODEM PATH : OFF\n"
4158 "May 15 2012, 10:28:15\n"
4160 BSOD_COLOR (bst, bg, c3);
4164 int x = (bst->xgwa.width - pix_w) / 2;
4165 int y = bst->xgwa.height - pix_h;
4166 BSOD_PIXMAP (bst, 0, 0, pix_w, pix_h, x, y);
4170 if (state == countof(lines0) ||
4171 state == countof(lines0) + countof(lines1) ||
4172 state == countof(lines0) + countof(lines1) + countof(lines2))
4174 BSOD_TEXT (bst, LEFT, "HBOOT USB\n");
4175 BSOD_COLOR (bst, c4, bg);
4176 BSOD_TEXT (bst, LEFT,
4178 "<VOL UP> to previous item\n"
4179 "<VOL DOWN> to next item\n"
4180 "<POWER> to select item\n"
4182 BSOD_COLOR (bst, c5, bg); BSOD_TEXT (bst, LEFT, "FASTBOOT\n");
4183 BSOD_COLOR (bst, c6, bg); BSOD_TEXT (bst, LEFT, "RECOVERY\n");
4184 BSOD_COLOR (bst, c7, bg); BSOD_TEXT (bst, LEFT, "FACTORY RESET\n");
4185 BSOD_COLOR (bst, c3, bg); BSOD_TEXT (bst, LEFT, "SIMLOCK\n");
4186 BSOD_COLOR (bst, bg, c3); BSOD_TEXT (bst, LEFT, "HBOOT USB\n");
4187 BSOD_COLOR (bst, fg, bg); BSOD_TEXT (bst, LEFT, "IMAGE CRC\n");
4188 BSOD_COLOR (bst, c3, bg); BSOD_TEXT (bst, LEFT, "SHOW BARCODE\n");
4189 BSOD_PAUSE (bst, 3000000);
4191 else if (state < countof(lines0))
4193 BSOD_TEXT (bst, LEFT, "IMAGE CRC\n\n");
4194 BSOD_COLOR (bst, c5, bg);
4197 for (i = 0; i <= state; i++) {
4198 const char *s = lines0[i];
4199 BSOD_COLOR (bst, (strchr(s, ':') ? c7 : c3), bg);
4200 BSOD_TEXT (bst, LEFT, s);
4203 BSOD_PAUSE (bst, 500000);
4204 if (state == countof(lines0)-1)
4205 BSOD_PAUSE (bst, 2000000);
4207 else if (state < countof(lines0) + countof(lines1))
4209 BSOD_TEXT (bst, LEFT, "HBOOT\n\n");
4210 BSOD_COLOR (bst, c5, bg);
4213 for (i = countof(lines0); i <= state; i++) {
4214 const char *s = lines1[i - countof(lines0)];
4215 BSOD_COLOR (bst, (*s == ' ' ? c6 : c3), bg);
4216 BSOD_TEXT (bst, LEFT, s);
4219 BSOD_PAUSE (bst, 500000);
4220 if (state == countof(lines0) + countof(lines1) - 1)
4221 BSOD_PAUSE (bst, 2000000);
4223 else if (state < countof(lines0) + countof(lines1) + countof(lines2))
4225 BSOD_TEXT (bst, LEFT, "HBOOT USB\n\n");
4226 BSOD_COLOR (bst, c5, bg);
4229 for (i = countof(lines0) + countof(lines1); i <= state; i++) {
4230 const char *s = lines2[i - countof(lines0) - countof(lines1)];
4231 BSOD_COLOR (bst, (*s == ' ' ? c6 : c3), bg);
4232 BSOD_TEXT (bst, LEFT, s);
4235 BSOD_PAUSE (bst, 500000);
4236 if (state == countof(lines0) + countof(lines1) + countof(lines2)-1)
4237 BSOD_PAUSE (bst, 2000000);
4245 XClearWindow (dpy, window);
4253 /*****************************************************************************
4254 *****************************************************************************/
4257 static const struct {
4259 struct bsod_state * (*fn) (Display *, Window);
4261 { "Windows", windows_31 },
4262 { "NT", windows_nt },
4263 { "Win2K", windows_other },
4264 { "Win10", windows_10 },
4267 { "MacsBug", macsbug },
4272 { "HPPALinux", hppa_linux },
4273 { "SparcLinux", sparc_linux },
4277 { "BlitDamage", blitdamage },
4279 { "Solaris", sparc_solaris },
4280 { "Linux", linux_fsck },
4287 { "Nvidia", nvidia },
4288 { "Apple2", apple2crash },
4290 { "GLaDOS", glados },
4291 { "Android", android },
4295 struct driver_state {
4297 int only, which, next_one;
4299 int delay_remaining;
4301 Bool debug_p, cycle_p;
4302 struct bsod_state *bst;
4307 hack_title (struct driver_state *dst)
4311 XFetchName (dst->bst->dpy, dst->bst->window, &oname);
4312 if (oname && !strncmp (oname, "BSOD: ", 6)) {
4313 char *tail = oname + 4;
4314 char *s = strchr (tail+1, ':');
4317 nname = malloc (strlen (tail) + strlen (dst->name) + 20);
4318 sprintf (nname, "BSOD: %s%s", dst->name, tail);
4319 XStoreName (dst->bst->dpy, dst->bst->window, nname);
4322 # endif /* !HAVE_JWXYZ */
4326 bsod_init (Display *dpy, Window window)
4328 struct driver_state *dst = (struct driver_state *) calloc (1, sizeof(*dst));
4331 dst->mode_duration = get_integer_resource (dpy, "delay", "Integer");
4332 if (dst->mode_duration < 3) dst->mode_duration = 3;
4334 dst->debug_p = get_boolean_resource (dpy, "debug", "Boolean");
4338 s = get_string_resource(dpy, "doOnly", "DoOnly");
4339 if (s && !strcasecmp (s, "cycle"))
4342 dst->cycle_p = True;
4346 int count = countof(all_modes);
4347 for (dst->only = 0; dst->only < count; dst->only++)
4348 if (!strcasecmp (s, all_modes[dst->only].name))
4350 if (dst->only >= count)
4352 fprintf (stderr, "%s: unknown -only mode: \"%s\"\n", progname, s);
4364 static unsigned long
4365 bsod_draw (Display *dpy, Window window, void *closure)
4367 struct driver_state *dst = (struct driver_state *) closure;
4372 now = time ((time_t *) 0);
4373 time_left = dst->start + dst->mode_duration - now;
4375 if (dst->bst && dst->bst->img_loader) /* still loading */
4377 dst->bst->img_loader =
4378 load_image_async_simple (dst->bst->img_loader, 0, 0, 0, 0, 0);
4383 /* Rather than returning a multi-second delay from the draw() routine,
4384 meaning "don't call us again for N seconds", we quantize that down
4385 to 1/10th second intervals so that it's more responsive to
4386 rotate/reshape events.
4388 if (dst->delay_remaining)
4391 int this_delay = MIN (dst->delay_remaining, inc);
4392 dst->delay_remaining = MAX (0, dst->delay_remaining - inc);
4396 if (! dst->bst && time_left > 0) /* run completed; wait out the delay */
4399 fprintf (stderr, "%s: %s: %d left\n", progname, dst->name, time_left);
4401 if (time_left > 5) time_left = 5; /* Boooored now */
4402 dst->delay_remaining = 1000000 * time_left;
4405 else if (dst->bst) /* sub-mode currently running */
4407 int this_delay = -1;
4410 this_delay = bsod_pop (dst->bst);
4412 /* XSync (dpy, False); slows down char drawing too much on HAVE_JWXYZ */
4414 if (this_delay == 0)
4415 goto AGAIN; /* no delay, not expired: stay here */
4416 else if (this_delay >= 0)
4418 dst->delay_remaining = this_delay; /* return; time to sleep */
4422 { /* sub-mode run completed or expired */
4424 fprintf (stderr, "%s: %s: done\n", progname, dst->name);
4425 free_bsod_state (dst->bst);
4430 else /* launch a new sub-mode */
4432 if (dst->next_one >= 0)
4433 dst->which = dst->next_one, dst->next_one = -1;
4434 else if (dst->cycle_p)
4435 dst->which = (dst->which + 1) % countof(all_modes);
4436 else if (dst->only >= 0)
4437 dst->which = dst->only;
4440 int count = countof(all_modes);
4443 for (i = 0; i < 200; i++)
4445 char name[100], class[100];
4446 int new_mode = (random() & 0xFF) % count;
4448 if (i < 100 && new_mode == dst->which)
4451 sprintf (name, "do%s", all_modes[new_mode].name);
4452 sprintf (class, "Do%s", all_modes[new_mode].name);
4454 if (get_boolean_resource (dpy, name, class))
4456 dst->which = new_mode;
4463 fprintf (stderr, "%s: no display modes enabled?\n", progname);
4465 dst->which = dst->only = 0;
4470 fprintf (stderr, "%s: %s: launch\n", progname,
4471 all_modes[dst->which].name);
4473 /* Run the mode setup routine...
4475 if (dst->bst) abort();
4476 dst->name = all_modes[dst->which].name;
4477 dst->bst = all_modes[dst->which].fn (dpy, window);
4478 dst->start = (dst->bst ? time ((time_t *) 0) : 0);
4480 /* Reset the structure run state to the beginning,
4481 and do some sanitization of the cursor position
4482 before the first run.
4487 fprintf (stderr, "%s: %s: queue size: %d (%d)\n", progname,
4488 dst->name, dst->bst->pos, dst->bst->queue_size);
4492 dst->bst->x = dst->bst->current_left = dst->bst->left_margin;
4494 if (dst->bst->y < dst->bst->top_margin + dst->bst->font->ascent)
4495 dst->bst->y = dst->bst->top_margin + dst->bst->font->ascent;
4504 bsod_reshape (Display *dpy, Window window, void *closure,
4505 unsigned int w, unsigned int h)
4507 struct driver_state *dst = (struct driver_state *) closure;
4510 w == dst->bst->xgwa.width &&
4511 h == dst->bst->xgwa.height)
4515 fprintf (stderr, "%s: %s: reshape reset\n", progname, dst->name);
4517 /* just restart this mode and restart when the window is resized. */
4519 free_bsod_state (dst->bst);
4522 dst->delay_remaining = 0;
4523 dst->next_one = dst->which;
4525 XClearWindow (dpy, window);
4530 bsod_event (Display *dpy, Window window, void *closure, XEvent *event)
4532 struct driver_state *dst = (struct driver_state *) closure;
4533 Bool reset_p = False;
4535 /* pick a new mode and restart when mouse clicked, or certain keys typed. */
4537 if (screenhack_event_helper (dpy, window, event))
4543 fprintf (stderr, "%s: %s: manual reset\n", progname, dst->name);
4545 free_bsod_state (dst->bst);
4548 dst->delay_remaining = 0;
4550 XClearWindow (dpy, window);
4559 bsod_free (Display *dpy, Window window, void *closure)
4561 struct driver_state *dst = (struct driver_state *) closure;
4563 free_bsod_state (dst->bst);
4568 static const char *bsod_defaults [] = {
4583 "*doAtari: False", /* boring */
4584 "*doBSD: False", /* boring */
4586 "*doSparcLinux: False", /* boring */
4587 "*doHPPALinux: True",
4588 "*doBlitDamage: True",
4603 ".foreground: White",
4604 ".background: Black",
4606 ".windows.foreground: White",
4607 ".windows.background: #0000AA", /* EGA color 0x01. */
4609 ".nt.foreground: White",
4610 ".nt.background: #0000AA", /* EGA color 0x01. */
4612 ".windowslh.foreground: White",
4613 ".windowslh.background: #AA0000", /* EGA color 0x04. */
4614 ".windowslh.background2: #AAAAAA", /* EGA color 0x07. */
4616 ".win10.foreground: White",
4617 ".win10.background: #1070AA",
4619 ".glaDOS.foreground: White",
4620 ".glaDOS.background: #0000AA", /* EGA color 0x01. */
4622 ".amiga.foreground: #FF0000",
4623 ".amiga.background: Black",
4624 ".amiga.background2: White",
4626 ".mac.foreground: #BBFFFF",
4627 ".mac.background: Black",
4629 ".atari.foreground: Black",
4630 ".atari.background: White",
4632 ".macsbug.foreground: Black",
4633 ".macsbug.background: White",
4634 ".macsbug.borderColor: #AAAAAA",
4636 ".mac1.foreground: Black",
4637 ".mac1.background: White",
4639 ".macx.foreground: White",
4640 ".macx.textForeground: White",
4641 ".macx.textBackground: Black",
4642 ".macx.background: #888888",
4644 ".sco.foreground: White",
4645 ".sco.background: Black",
4647 ".hvx.foreground: White",
4648 ".hvx.background: Black",
4650 ".linux.foreground: White",
4651 ".linux.background: Black",
4653 ".hppalinux.foreground: White",
4654 ".hppalinux.background: Black",
4656 ".sparclinux.foreground: White",
4657 ".sparclinux.background: Black",
4659 ".bsd.foreground: #c0c0c0",
4660 ".bsd.background: Black",
4662 ".solaris.foreground: Black",
4663 ".solaris.background: White",
4665 ".hpux.foreground: White",
4666 ".hpux.background: Black",
4668 ".os390.background: Black",
4669 ".os390.foreground: Red",
4671 ".tru64.foreground: White",
4672 ".tru64.background: #0000AA", /* EGA color 0x01. */
4674 ".vms.foreground: White",
4675 ".vms.background: Black",
4677 ".msdos.foreground: White",
4678 ".msdos.background: Black",
4680 ".os2.foreground: White",
4681 ".os2.background: Black",
4683 ".atm.foreground: Black",
4684 ".atm.background: #FF6600",
4686 ".android.foreground: Black",
4687 ".android.background: White",
4688 ".android.color1: #AA00AA", /* violet */
4689 ".android.color2: #336633", /* green1 */
4690 ".android.color3: #0000FF", /* blue */
4691 ".android.color4: #CC7744", /* orange */
4692 ".android.color5: #99AA55", /* green2 */
4693 ".android.color6: #66AA33", /* green3 */
4694 ".android.color7: #FF0000", /* red */
4696 "*dontClearRoot: True",
4700 #ifdef HAVE_XSHM_EXTENSION
4707 # if defined(USE_IPHONE)
4709 "*font: PxPlus IBM VGA8 16, Courier-Bold 14",
4714 ".mac.font: Courier-Bold 18",
4715 ".macsbug.font: Courier-Bold 8",
4716 ".macx.font: Courier-Bold 14",
4717 ".macdisk.font: Courier-Bold 14",
4718 ".msdos.font: PxPlus IBM VGA8 32, Courier-Bold 28",
4719 ".nt.font: PxPlus IBM VGA8 12, Courier-Bold 10",
4720 ".win10.font: Arial 12, Helvetica 12",
4721 ".win10.bigFont: Arial 12, Helvetica 12",
4722 ".win10.fontB: Arial 50, Helvetica 50",
4723 ".win10.fontC: Arial 9, Helvetica 9",
4724 ".win10.bigFont2: ",
4726 # elif defined(HAVE_ANDROID)
4728 "*font: PxPlus IBM VGA8 16",
4733 ".mac.font: -*-courier-bold-r-*-*-*-180-*-*-m-*-*-*",
4734 ".macsbug.font: -*-courier-bold-r-*-*-*-80-*-*-m-*-*-*",
4735 ".macx.font: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
4736 ".macdisk.font: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
4737 ".msdos.font: PxPlus IBM VGA8 32",
4738 ".nt.font: PxPlus IBM VGA8 12",
4740 ".win10.font: -*-helvetica-medium-r-*-*-*-120-*-*-*-*-*-*",
4741 ".win10.bigFont: -*-helvetica-medium-r-*-*-*-120-*-*-*-*-*-*",
4742 ".win10.fontB: -*-helvetica-medium-r-*-*-*-500-*-*-*-*-*-*",
4743 ".win10.fontC: -*-helvetica-medium-r-*-*-*-90-*-*-*-*-*-*",
4744 ".win10.bigFont2: ",
4746 # elif defined(HAVE_COCOA)
4748 "*font: PxPlus IBM VGA8 8, Courier-Bold 9",
4749 "*bigFont: PxPlus IBM VGA8 32, Courier-Bold 24",
4753 ".mac.font: Monaco 10, Courier-Bold 9",
4754 ".mac.bigFont: Monaco 18, Courier-Bold 18",
4756 ".macsbug.font: Monaco 10, Courier-Bold 9",
4757 ".macsbug.bigFont: Monaco 24, Courier-Bold 24",
4759 ".macx.font: Courier-Bold 9",
4760 ".macx.bigFont: Courier-Bold 14",
4761 ".macdisk.font: Courier-Bold 9",
4762 ".macdisk.bigFont: Courier-Bold 18",
4764 ".hvx.bigFont: PxPlus IBM VGA8 16, Courier-Bold 14",
4765 ".hppalinux.bigFont: PxPlus IBM VGA8 16, Courier-Bold 14",
4766 ".solaris.bigFont: PxPlus IBM VGA8 16, Courier-Bold 14",
4767 ".linux.bigFont: PxPlus IBM VGA8 16, Courier-Bold 14",
4768 ".hpux.bigFont: PxPlus IBM VGA8 16, Courier-Bold 14",
4769 ".msdos.font: PxPlus IBM VGA8 16, Courier-Bold 14",
4771 ".win10.font: Arial 24, Helvetica 24",
4772 ".win10.bigFont: Arial 24, Helvetica 24",
4773 ".win10.fontB: Arial 100, Helvetica 100",
4774 ".win10.fontC: Arial 16, Helvetica 16",
4775 ".win10.bigFont2: ",
4780 "*font2: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
4781 "*bigFont: -*-courier-bold-r-*-*-*-180-*-*-m-*-*-*",
4782 "*bigFont2: -*-courier-bold-r-*-*-*-180-*-*-m-*-*-*",
4784 ".macsbug.font: -*-courier-medium-r-*-*-*-80-*-*-m-*-*-*",
4785 ".macsbug.bigFont: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
4787 ".macdisk.font: -*-courier-bold-r-*-*-*-80-*-*-m-*-*-*",
4788 ".macdisk.bigFont: -*-courier-bold-r-*-*-*-100-*-*-m-*-*-*",
4790 ".sco.font: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
4791 ".hvx.font: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
4792 ".hppalinux.bigFont: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
4793 ".sparclinux.bigFont: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
4796 ".bsd.bigFont: -sun-console-medium-r-*-*-22-*-*-*-m-*-*-*",
4797 ".bsd.bigFont2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
4799 ".solaris.font: -sun-gallant-*-*-*-*-19-*-*-*-*-120-*-*",
4800 ".hpux.bigFont: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
4801 ".os390.bigFont: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
4802 ".tru64.bigFont: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
4803 ".vms.bigFont: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
4804 ".msdos.bigFont: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
4806 ".win10.font: -*-helvetica-medium-r-*-*-*-180-*-*-*-*-*-*",
4807 ".win10.bigFont: -*-helvetica-medium-r-*-*-*-180-*-*-*-*-*-*",
4808 ".win10.fontB: -*-helvetica-medium-r-*-*-*-240-*-*-*-*-*-*",
4809 ".win10.fontC: -*-helvetica-medium-r-*-*-*-140-*-*-*-*-*-*",
4811 ".win10.bigFont2: ",
4818 static const XrmOptionDescRec bsod_options [] = {
4819 { "-delay", ".delay", XrmoptionSepArg, 0 },
4820 { "-only", ".doOnly", XrmoptionSepArg, 0 },
4821 { "-debug", ".debug", XrmoptionNoArg, "True" },
4822 { "-windows", ".doWindows", XrmoptionNoArg, "True" },
4823 { "-no-windows", ".doWindows", XrmoptionNoArg, "False" },
4824 { "-nt", ".doNT", XrmoptionNoArg, "True" },
4825 { "-no-nt", ".doNT", XrmoptionNoArg, "False" },
4826 { "-2k", ".doWin2K", XrmoptionNoArg, "True" },
4827 { "-no-2k", ".doWin2K", XrmoptionNoArg, "False" },
4828 { "-win10", ".doWin10", XrmoptionNoArg, "True" },
4829 { "-no-win10", ".doWin10", XrmoptionNoArg, "False" },
4830 { "-amiga", ".doAmiga", XrmoptionNoArg, "True" },
4831 { "-no-amiga", ".doAmiga", XrmoptionNoArg, "False" },
4832 { "-mac", ".doMac", XrmoptionNoArg, "True" },
4833 { "-no-mac", ".doMac", XrmoptionNoArg, "False" },
4834 { "-mac1", ".doMac1", XrmoptionNoArg, "True" },
4835 { "-no-mac1", ".doMac1", XrmoptionNoArg, "False" },
4836 { "-macx", ".doMacX", XrmoptionNoArg, "True" },
4837 { "-no-macx", ".doMacX", XrmoptionNoArg, "False" },
4838 { "-atari", ".doAtari", XrmoptionNoArg, "True" },
4839 { "-no-atari", ".doAtari", XrmoptionNoArg, "False" },
4840 { "-macsbug", ".doMacsBug", XrmoptionNoArg, "True" },
4841 { "-no-macsbug", ".doMacsBug", XrmoptionNoArg, "False" },
4842 { "-apple2", ".doApple2", XrmoptionNoArg, "True" },
4843 { "-no-apple2", ".doApple2", XrmoptionNoArg, "False" },
4844 { "-sco", ".doSCO", XrmoptionNoArg, "True" },
4845 { "-no-sco", ".doSCO", XrmoptionNoArg, "False" },
4846 { "-hvx", ".doHVX", XrmoptionNoArg, "True" },
4847 { "-no-hvx", ".doHVX", XrmoptionNoArg, "False" },
4848 { "-bsd", ".doBSD", XrmoptionNoArg, "True" },
4849 { "-no-bsd", ".doBSD", XrmoptionNoArg, "False" },
4850 { "-linux", ".doLinux", XrmoptionNoArg, "True" },
4851 { "-no-linux", ".doLinux", XrmoptionNoArg, "False" },
4852 { "-hppalinux", ".doHPPALinux", XrmoptionNoArg, "True" },
4853 { "-no-hppalinux", ".doHPPALinux", XrmoptionNoArg, "False" },
4854 { "-sparclinux", ".doSparcLinux", XrmoptionNoArg, "True" },
4855 { "-no-sparclinux", ".doSparcLinux", XrmoptionNoArg, "False" },
4856 { "-blitdamage", ".doBlitDamage", XrmoptionNoArg, "True" },
4857 { "-no-blitdamage", ".doBlitDamage", XrmoptionNoArg, "False" },
4858 { "-nvidia", ".doNvidia", XrmoptionNoArg, "True" },
4859 { "-no-nvidia", ".doNvidia", XrmoptionNoArg, "False" },
4860 { "-solaris", ".doSolaris", XrmoptionNoArg, "True" },
4861 { "-no-solaris", ".doSolaris", XrmoptionNoArg, "False" },
4862 { "-hpux", ".doHPUX", XrmoptionNoArg, "True" },
4863 { "-no-hpux", ".doHPUX", XrmoptionNoArg, "False" },
4864 { "-os390", ".doOS390", XrmoptionNoArg, "True" },
4865 { "-no-os390", ".doOS390", XrmoptionNoArg, "False" },
4866 { "-tru64", ".doHPUX", XrmoptionNoArg, "True" },
4867 { "-no-tru64", ".doTru64", XrmoptionNoArg, "False" },
4868 { "-vms", ".doVMS", XrmoptionNoArg, "True" },
4869 { "-no-vms", ".doVMS", XrmoptionNoArg, "False" },
4870 { "-msdos", ".doMSDOS", XrmoptionNoArg, "True" },
4871 { "-no-msdos", ".doMSDOS", XrmoptionNoArg, "False" },
4872 { "-os2", ".doOS2", XrmoptionNoArg, "True" },
4873 { "-no-os2", ".doOS2", XrmoptionNoArg, "False" },
4874 { "-atm", ".doATM", XrmoptionNoArg, "True" },
4875 { "-no-atm", ".doATM", XrmoptionNoArg, "False" },
4876 { "-glados", ".doGLaDOS", XrmoptionNoArg, "True" },
4877 { "-no-glados", ".doGLaDOS", XrmoptionNoArg, "False" },
4878 { "-android", ".doAndroid", XrmoptionNoArg, "True" },
4879 { "-no-android", ".doAndroid", XrmoptionNoArg, "False" },
4885 XSCREENSAVER_MODULE ("BSOD", bsod)