cosmopolitan/examples
tkchia d3efa47f81
Show "screen of death" on VGA console upon program crash (#650)
* [metal] Refactoring: separate out sys_writev_vga() and _vga_init() modules

* [metal] Read VGA info from BDA before long mode entry, not after

If using a pre-existing VGA text console, the VGA initialization
code now retrieves the cursor position & character height from
the BIOS data area while still in real mode — rather than
reading from the BIOS data area only after entering long mode.

(This should help make the code more correct, if Cosmopolitan
were to support UEFI graphics output in the future.  If the
program were booted via UEFI, then the long mode IsMetal()
code would still be activated, but the BIOS data area might
not have been initialized in that case.)

This change also means that there are now a few more fields
in the `struct mman`.

* [metal] VGA console can now show "screen of death" upon a crash

There is now a new function _klog_vga(), which can be called
by kprintf() to output system messages — e.g. information about
CPU exceptions — on the VGA screen.

* [metal] CPU exception handler now dumps cr2 value
* [metal] Add demo of program crash reporting w/ bare metal VGA TTY
* [metal] Reduce size of "screen of death" code
2022-10-06 05:36:15 -07:00
..
package WIP: Correct all typos (#498) 2022-07-20 14:01:15 -07:00
pyapp Fix V=0 make mode 2022-06-21 01:32:31 -07:00
pylife Cherry-pick bug fixes and Landlock Make 1.0.2 2022-08-10 12:56:45 -07:00
auto-launch-gdb-on-crash.c WIP: Correct all typos (#498) 2022-07-20 14:01:15 -07:00
auto-memory-safety-crash.c Fold LIBC_BITS into LIBC_INTRIN 2022-08-11 12:13:18 -07:00
auto-memory-safety-crash2.c Fold LIBC_BITS into LIBC_INTRIN 2022-08-11 12:13:18 -07:00
auto-memory-safety-crash3.c Fold LIBC_BITS into LIBC_INTRIN 2022-08-11 12:13:18 -07:00
breakpoint.c Make improvements 2022-04-29 00:42:47 -07:00
certapp.c Improve ZIP filesystem and change its prefix 2021-08-22 01:11:53 -07:00
check.c Make improvements 2022-05-12 06:45:36 -07:00
clock.c Improve quality of our ANSI C clock() function 2022-09-05 23:03:49 -07:00
clock_getres.c Make important improvements 2022-09-14 22:39:08 -07:00
compress.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
cosh.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
cplusplus-stl.cc Import C++ Standard Template Library 2022-03-22 06:41:54 -07:00
cplusplus.cc Fold LIBC_BITS into LIBC_INTRIN 2022-08-11 12:13:18 -07:00
crashreport.c Support thread local storage 2022-05-16 13:20:08 -07:00
crashreport2.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
ctrlc.c Improve signals and memory protection 2022-04-12 22:11:00 -07:00
curl.c Improve redbean method=get parameter handling 2022-09-19 20:04:39 -07:00
datauri.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
date.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
decompress.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
defer-statements.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
dot.c Release Landlock Make v1.0.1 2022-08-10 12:17:06 -07:00
examples.mk Add *NSYNC to libc/isystem 2022-09-13 01:47:12 -07:00
exec.c Reduce makefile dependencies by 10% 2022-06-08 20:01:28 -07:00
exit.c Make improvements 2022-05-12 06:45:36 -07:00
fastdiv.c Add SNI support to redbean and improve SSL perf 2021-07-23 13:56:13 -07:00
fastmod.c Fix some example code 2021-08-10 13:38:27 -07:00
forkexec.c Make improvements 2022-03-16 13:40:10 -07:00
forkexecwait.c Make improvements 2022-03-16 13:40:10 -07:00
forkrand.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
gc.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
generalized-automatic-datastructure-printing.c Fold LIBC_RAND into LIBC_STDIO/TINYMATH/INTRIN 2022-08-11 12:32:00 -07:00
getcpucount.c Add more POSIX threads APIs 2022-09-09 11:30:33 -07:00
getrandom.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
gettimeofday.c Refactor gettimeofday() 2022-08-05 02:13:41 -07:00
greenbean.c Change accept type to struct sockaddr * (#630) 2022-09-20 07:49:16 -07:00
gui.c Make examples folder somewhat more focused 2021-03-05 06:09:12 -08:00
hangman.c Fold LIBC_RAND into LIBC_STDIO/TINYMATH/INTRIN 2022-08-11 12:32:00 -07:00
hello.c Remove malloc() dependency on pledge() / unveil() 2022-07-24 21:51:37 -07:00
hello2.c Trim down executable sizes 2021-02-11 08:37:18 -08:00
hello3.c Improve performance of printf functions 2021-04-24 13:58:50 -07:00
hellolua.c Improve ZIP filesystem and change its prefix 2021-08-22 01:11:53 -07:00
hellolua.lua Add Hello World example for LUA C API (#97) 2021-03-08 14:15:59 -08:00
hertz.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
hostname.c Improve quality of our ANSI C clock() function 2022-09-05 23:03:49 -07:00
img.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
kilo.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
life.c Always initialize thread local storage 2022-07-19 00:21:46 -07:00
linenoise.c Fix bugs with recent change 2022-04-16 10:40:23 -07:00
loadavg.c Fix some win32 definitions 2022-03-22 19:54:36 -07:00
ls.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
lstime.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
mkhello.c Support Linux binfmt_misc and APE loading on Apple 2022-05-21 09:28:25 -07:00
mu_test.c Add *NSYNC mu_test 2022-09-11 18:56:29 -07:00
nc.c Prove that Makefile is fully defined 2022-08-06 04:05:08 -07:00
nesemu1.cc Pay off more technical debt 2022-09-12 23:36:56 -07:00
nomodifyself.c Make improvements 2022-05-24 10:58:48 -07:00
panels.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
picol.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
printargs.c Make improvements 2022-04-24 10:06:05 -07:00
printprimes.c Do code cleanup use duff device linenoise i/o 2022-04-22 18:56:52 -07:00
rlimit.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
rusage.c Reduce makefile dependencies by 10% 2022-06-08 20:01:28 -07:00
script.c Improve system call wrappers 2022-09-19 15:06:25 -07:00
script.txt Add script.com and whois.com courtesy of FreeBSD 2022-09-13 20:26:13 -07:00
seq.c Make improvements 2022-04-29 00:42:47 -07:00
setitimer.c Change sigaction_f to match sysv signature (#585) 2022-09-02 05:08:35 -07:00
sleep.c Work towards improving signals and processes 2021-01-27 19:34:02 -08:00
stackoverflow.c Improve memory safety 2021-10-13 17:27:13 -07:00
stat.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
statfs.c Polyfill statfs() and fstatfs() on Windows 2022-08-17 19:01:51 -07:00
stringbuffer.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
sysinfo.c Polyfill statfs() and fstatfs() on BSD distros 2022-08-17 14:54:03 -07:00
system.c Prove that Makefile is fully defined 2022-08-06 04:05:08 -07:00
thread.c Tidy up the threading implementation 2022-09-10 02:56:25 -07:00
time.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
tls.c Make improvements 2022-07-21 03:36:42 -07:00
ttyaudio.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
ttyinfo.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
ucontext-sigfpe-recovery.c Change sigaction_f to match sysv signature (#585) 2022-09-02 05:08:35 -07:00
uname.c Improve quality of uname/gethostname/getdomainname 2022-09-03 20:20:40 -07:00
unbourne.c Pay off more technical debt 2022-09-12 23:36:56 -07:00
vga.c Add basic character output for VGA graphics mode console (#649) 2022-10-05 06:46:50 -07:00
vga2.c Show "screen of death" on VGA console upon program crash (#650) 2022-10-06 05:36:15 -07:00
walk.c Don't relocate file descriptor memory 2022-09-09 16:54:28 -07:00
whois.c Add script.com and whois.com courtesy of FreeBSD 2022-09-13 20:26:13 -07:00
x86split.c Improve signals and memory protection 2022-04-12 22:11:00 -07:00