feat(loader, kernel): impl part of loader and initialize kernel structure
This commit is contained in:
67
arch/x86_64/boot/video.zig
Normal file
67
arch/x86_64/boot/video.zig
Normal file
@@ -0,0 +1,67 @@
|
||||
// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
|
||||
// Ported from Linux kernel include/uapi/linux/screen_info.h
|
||||
|
||||
const std = @import("std");
|
||||
|
||||
pub const ScreenInfo = extern struct{
|
||||
orig_x: u8 align(1), // 0x00
|
||||
orig_y: u8 align(1), // 0x01
|
||||
ext_mem_k: u16 align(1), // 0x02
|
||||
orig_video_page: u16 align(1), // 0x04
|
||||
orig_video_mode: u8 align(1), // 0x06
|
||||
orig_video_cols: u8 align(1), // 0x07
|
||||
flags: u8 align(1), // 0x08
|
||||
unused2: u8 align(1), // 0x09
|
||||
orig_video_ega_bx: u16 align(1), // 0x0a
|
||||
unused3: u16 align(1), // 0x0c
|
||||
orig_video_lines: u8 align(1), // 0x0e
|
||||
orig_video_isVGA: u8 align(1), // 0x0f
|
||||
orig_video_points: u16 align(1), // 0x10
|
||||
|
||||
// VESA graphic mode -- linear frame buffer
|
||||
lfb_width: u16 align(1), // 0x12
|
||||
lfb_height: u16 align(1), // 0x14
|
||||
lfb_depth: u16 align(1), // 0x16
|
||||
lfb_base: u32 align(1), // 0x18
|
||||
lfb_size: u32 align(1), // 0x1c
|
||||
cl_magic: u16 align(1), // 0x20
|
||||
cl_offset: u16 align(1), // 0x22
|
||||
lfb_linelength: u16 align(1), // 0x24
|
||||
red_size: u8 align(1), // 0x26
|
||||
red_pos: u8 align(1), // 0x27
|
||||
green_size: u8 align(1), // 0x28
|
||||
green_pos: u8 align(1), // 0x29
|
||||
blue_size: u8 align(1), // 0x2a
|
||||
blue_pos: u8 align(1), // 0x2b
|
||||
rsvd_size: u8 align(1), // 0x2c
|
||||
rsvd_pos: u8 align(1), // 0x2d
|
||||
vesapm_seg: u16 align(1), // 0x2e
|
||||
vesapm_off: u16 align(1), // 0x30
|
||||
pages: u16 align(1), // 0x32
|
||||
vesa_attributes: u16 align(1), // 0x34
|
||||
capabilities: u32 align(1), // 0x36
|
||||
ext_lfb_base: u32 align(1), // 0x3a
|
||||
_reserved: [2]u8 align(1), // 0x3e
|
||||
};
|
||||
|
||||
// Common video types
|
||||
pub const VideoType = enum(u8) {
|
||||
MDA = 0x10, // Monochrome Text Display
|
||||
CGA = 0x11, // CGA Display
|
||||
EGAM = 0x20, // EGA/VGA in Monochrome Mode
|
||||
EGAC = 0x21, // EGA in Color Mode
|
||||
VGAC = 0x22, // VGA+ in Color Mode
|
||||
VLFB = 0x23, // VESA VGA in graphic mode
|
||||
EFI = 0x70, // EFI graphic mode
|
||||
};
|
||||
|
||||
// Video flags
|
||||
pub const VIDEO_FLAGS_NOCURSOR: u8 = 1 << 0; // The video mode has no cursor set
|
||||
|
||||
// Video capabilities
|
||||
pub const VIDEO_CAPABILITY_SKIP_QUIRKS: u32 = 1 << 0;
|
||||
pub const VIDEO_CAPABILITY_64BIT_BASE: u32 = 1 << 1; // Frame buffer base is 64-bit
|
||||
|
||||
comptime {
|
||||
std.debug.assert(@sizeOf(ScreenInfo) == 0x40);
|
||||
}
|
||||
Reference in New Issue
Block a user