Initial commit: Schunix as it stands before the SchOS rename
An x86-64 operating system built from xv6, now largely rewritten: SMP, a copy-on-write root filesystem (SchFS), PCI/USB/virtio drivers, a TTF rasteriser, and a Linux-numbered syscall ABI. No history before this point -- the tree was never under version control. This commit exists so the rename that follows has something to undo to.
This commit is contained in:
commit
d0f7acf9eb
275 changed files with 51417 additions and 0 deletions
95
include/fb.h
Normal file
95
include/fb.h
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
#pragma once
|
||||
|
||||
// Framebuffer device ABI -- /dev/fb0.
|
||||
//
|
||||
// These are Linux's fbdev request numbers and structure layouts, not ours.
|
||||
// Schunix invented this device, so nothing forced the choice; matching Linux
|
||||
// was still the right one. A framebuffer is the first thing a graphics
|
||||
// program looks for, and every such program already knows how to ask
|
||||
// FBIOGET_VSCREENINFO. Inventing a private struct would have meant patching
|
||||
// each one we ever port, and -- worse -- a Linux-ABI binary calling
|
||||
// FBIOGET_VSCREENINFO would have gotten a *differently shaped* answer to a
|
||||
// request it thought it understood, which is the failure mode that made
|
||||
// `>>` truncate back when include/fcntl.h held xv6's open flags instead of
|
||||
// Linux's. Same lesson, applied before it bites rather than after.
|
||||
//
|
||||
// Plain C types throughout (no types.h) so userspace can include this
|
||||
// directly. Both sides are LP64.
|
||||
|
||||
#define FBIOGET_VSCREENINFO 0x4600
|
||||
#define FBIOPUT_VSCREENINFO 0x4601
|
||||
#define FBIOGET_FSCREENINFO 0x4602
|
||||
#define FBIOBLANK 0x4611
|
||||
|
||||
// fb_fix_screeninfo.type
|
||||
#define FB_TYPE_PACKED_PIXELS 0
|
||||
|
||||
// fb_fix_screeninfo.visual
|
||||
#define FB_VISUAL_TRUECOLOR 2
|
||||
|
||||
// fb_var_screeninfo.activate
|
||||
#define FB_ACTIVATE_NOW 0
|
||||
|
||||
// One colour channel's position within a pixel. `offset` is the bit position
|
||||
// of the channel's least significant bit; `length` is how many bits it gets.
|
||||
// A length of 0 means the channel does not exist -- which is how an opaque
|
||||
// framebuffer reports `transp`.
|
||||
struct fb_bitfield {
|
||||
unsigned int offset;
|
||||
unsigned int length;
|
||||
unsigned int msb_right; // != 0 means bit 0 is the MSB; never here
|
||||
};
|
||||
|
||||
struct fb_var_screeninfo {
|
||||
unsigned int xres; // visible resolution
|
||||
unsigned int yres;
|
||||
unsigned int xres_virtual; // virtual resolution; == visible, no panning
|
||||
unsigned int yres_virtual;
|
||||
unsigned int xoffset; // offset of visible area within virtual
|
||||
unsigned int yoffset;
|
||||
unsigned int bits_per_pixel;
|
||||
unsigned int grayscale; // 0 == colour
|
||||
struct fb_bitfield red;
|
||||
struct fb_bitfield green;
|
||||
struct fb_bitfield blue;
|
||||
struct fb_bitfield transp;
|
||||
unsigned int nonstd; // 0 == standard pixel format
|
||||
unsigned int activate;
|
||||
unsigned int height; // physical size in mm; 0 == unknown, and
|
||||
unsigned int width; // VBE does not tell us, so it stays 0
|
||||
unsigned int accel_flags;
|
||||
// Timings. The mode is whatever the bootloader's VBE call established and
|
||||
// we cannot change it, so these are all reported as zero rather than
|
||||
// invented.
|
||||
unsigned int pixclock;
|
||||
unsigned int left_margin;
|
||||
unsigned int right_margin;
|
||||
unsigned int upper_margin;
|
||||
unsigned int lower_margin;
|
||||
unsigned int hsync_len;
|
||||
unsigned int vsync_len;
|
||||
unsigned int sync;
|
||||
unsigned int vmode;
|
||||
unsigned int rotate;
|
||||
unsigned int colorspace;
|
||||
unsigned int reserved[4];
|
||||
};
|
||||
|
||||
struct fb_fix_screeninfo {
|
||||
char id[16]; // "schunixfb"
|
||||
unsigned long smem_start; // physical address of the framebuffer
|
||||
unsigned int smem_len; // its length in bytes
|
||||
unsigned int type;
|
||||
unsigned int type_aux;
|
||||
unsigned int visual;
|
||||
unsigned short xpanstep; // 0 == panning unsupported
|
||||
unsigned short ypanstep;
|
||||
unsigned short ywrapstep;
|
||||
unsigned int line_length; // bytes per scanline (the VBE stride, which
|
||||
// is NOT always xres * bytes_per_pixel)
|
||||
unsigned long mmio_start; // no separate register aperture
|
||||
unsigned int mmio_len;
|
||||
unsigned int accel; // no acceleration
|
||||
unsigned short capabilities;
|
||||
unsigned short reserved[2];
|
||||
};
|
||||
Loading…
Reference in a new issue