Add some definitions for Linux frame buffer/console ioctl APIs (#712)

Co-authored-by: tkchia <tkchia-cosmo@gmx.com>
This commit is contained in:
tkchia 2023-01-02 08:28:03 +08:00 committed by GitHub
parent d2f811eff3
commit 73507d5f4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 133 additions and 0 deletions

View file

@ -0,0 +1,15 @@
#ifndef COSMOPOLITAN_LIBC_CALLS_STRUCT_FRAMEBUFFERCOLORMAP_H_
#define COSMOPOLITAN_LIBC_CALLS_STRUCT_FRAMEBUFFERCOLORMAP_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
struct FrameBufferColorMap {
uint32_t start;
uint32_t len;
uint16_t *red;
uint16_t *green;
uint16_t *blue;
uint16_t *transp;
};
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_FRAMEBUFFERCOLORMAP_H_ */

View file

@ -1755,6 +1755,28 @@ syscon misc FALLOC_FL_ZERO_RANGE 0x10 -1 -1 -1 -1 0x000980C8 # bsd
syscon misc FALLOC_FL_INSERT_RANGE 0x20 -1 -1 -1 -1 -1 # bsd consensus syscon misc FALLOC_FL_INSERT_RANGE 0x20 -1 -1 -1 -1 -1 # bsd consensus
syscon misc FALLOC_FL_UNSHARE_RANGE 0x40 -1 -1 -1 -1 -1 # bsd consensus syscon misc FALLOC_FL_UNSHARE_RANGE 0x40 -1 -1 -1 -1 -1 # bsd consensus
# Video Output Control Ioctls (mostly platform-specific)
#
# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary
syscon vid FBIOGET_VSCREENINFO 0x4600 0 0 0 0 0
syscon vid FBIOPUT_VSCREENINFO 0x4601 0 0 0 0 0
syscon vid FBIOGET_FSCREENINFO 0x4602 0 0 0 0 0
syscon vid FBIOGETCMAP 0x4604 0 0 0 0 0
syscon vid FBIOPUTCMAP 0x4605 0 0 0 0 0
syscon vid FBIOPAN_DISPLAY 0x4606 0 0 0 0 0
syscon vid FBIO_WAITFORVSYNC 0x40044620 0 0 0 0 0
#syscon vid FBIO_CACHE_SYNC 0x4630 0 0 0 0 0 # does any Linux kernel driver actually implement this ioctl? only Chinese sources mention it
syscon vid GIO_FONT 0x4b60 0 0 0 0 0
syscon vid PIO_FONT 0x4b61 0 0 0 0 0
syscon vid GIO_FONTX 0x4b6b 0 0 0 0 0
syscon vid PIO_FONTX 0x4b6c 0 0 0 0 0
syscon vid PIO_FONT8x8 0 0 0x88006340 0 0 0
syscon vid PIO_FONT8x14 0 0 0x8e006342 0 0 0
syscon vid PIO_FONT8x16 0 0 0x90006344 0 0 0
syscon vid PIO_VFONT 0 0 0x84086346 0 0 0
syscon vid PIO_FONTRESET 0x4b6d 0 0x20006348 0 0 0 # PIO_VFONT_DEFAULT on FreeBSD, absent on OpenBSD
syscon vid KDFONTOP 0x4b72 0 0 0 0 0
# System Call Numbers. # System Call Numbers.
# #
# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology # group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon vid,FBIOGETCMAP,0x4604,0,0,0,0,0

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon vid,FBIOGET_FSCREENINFO,0x4602,0,0,0,0,0

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon vid,FBIOGET_VSCREENINFO,0x4600,0,0,0,0,0

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon vid,FBIOPAN_DISPLAY,0x4606,0,0,0,0,0

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon vid,FBIOPUTCMAP,0x4605,0,0,0,0,0

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon vid,FBIOPUT_VSCREENINFO,0x4601,0,0,0,0,0

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon vid,FBIO_WAITFORVSYNC,0x40044620,0,0,0,0,0

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon vid,GIO_FONT,0x4b60,0,0,0,0,0

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon vid,GIO_FONTX,0x4b6b,0,0,0,0,0

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon vid,KDFONTOP,0x4b72,0,0,0,0,0

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon vid,PIO_FONT,0x4b61,0,0,0,0,0

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon vid,PIO_FONT8x14,0,0,0x8e006342,0,0,0

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon vid,PIO_FONT8x16,0,0,0x90006344,0,0,0

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon vid,PIO_FONT8x8,0,0,0x88006340,0,0,0

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon vid,PIO_FONTRESET,0x4b6d,0,0x20006348,0,0,0

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon vid,PIO_FONTX,0x4b6c,0,0,0,0,0

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon vid,PIO_VFONT,0,0,0x84086346,0,0,0

26
libc/sysv/consts/fbio.h Normal file
View file

@ -0,0 +1,26 @@
#ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_FB_H_
#define COSMOPOLITAN_LIBC_SYSV_CONSTS_FB_H_
#include "libc/runtime/symbolic.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
extern const uint64_t FBIOGET_VSCREENINFO;
extern const uint64_t FBIOPUT_VSCREENINFO;
extern const uint64_t FBIOGET_FSCREENINFO;
extern const uint64_t FBIOGETCMAP;
extern const uint64_t FBIOPUTCMAP;
extern const uint64_t FBIOPAN_DISPLAY;
extern const uint64_t FBIO_WAITFORVSYNC;
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#define FBIOGET_VSCREENINFO SYMBOLIC(FBIOGET_VSCREENINFO)
#define FBIOPUT_VSCREENINFO SYMBOLIC(FBIOPUT_VSCREENINFO)
#define FBIOGET_FSCREENINFO SYMBOLIC(FBIOGET_FSCREENINFO)
#define FBIOGETCMAP SYMBOLIC(FBIOGETCMAP)
#define FBIOPUTCMAP SYMBOLIC(FBIOPUTCMAP)
#define FBIOPAN_DISPLAY SYMBOLIC(FBIOPAN_DISPLAY)
#define FBIO_WAITFORVSYNC SYMBOLIC(FBIO_WAITFORVSYNC)
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_FB_H_ */

36
libc/sysv/consts/kd.h Normal file
View file

@ -0,0 +1,36 @@
#ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_KD_H_
#define COSMOPOLITAN_LIBC_SYSV_CONSTS_KD_H_
#include "libc/runtime/symbolic.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
extern const uint64_t GIO_FONT;
extern const uint64_t PIO_FONT;
extern const uint64_t GIO_FONTX;
extern const uint64_t PIO_FONTX;
extern const uint64_t PIO_FONT8x8;
extern const uint64_t PIO_FONT8x14;
extern const uint64_t PIO_FONT8x16;
extern const uint64_t PIO_VFONT;
extern const uint64_t PIO_FONTRESET;
extern const uint64_t KDFONTOP;
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#define GIO_FONT SYMBOLIC(GIO_FONT)
#define PIO_FONT SYMBOLIC(PIO_FONT)
#define GIO_FONTX SYMBOLIC(GIO_FONTX)
#define PIO_FONTX SYMBOLIC(PIO_FONTX)
#define PIO_FONT8x8 SYMBOLIC(PIO_FONT8x8)
#define PIO_FONT8x14 SYMBOLIC(PIO_FONT8x14)
#define PIO_FONT8x16 SYMBOLIC(PIO_FONT8x14)
#define PIO_VFONT SYMBOLIC(PIO_VFONT)
#define PIO_FONTRESET SYMBOLIC(PIO_FONTRESET)
#define KDFONTOP SYMBOLIC(KDFONTOP)
#ifdef _BSD_SOURCE
#define PIO_VFONT_DEFAULT PIO_FONTRESET
#endif
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_KD_H_ */