summaryrefslogtreecommitdiff
path: root/src/kernel/vbe.h
blob: 6fcdb5658f091881cfc4986947219c91be824b52 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef VBE_H
#define VBE_H

#include <stdint.h>

struct segoff {
  uint16_t offset;
  uint16_t segment;
} __attribute__ ((__packed__));

#define RM_PTR(type, segoff) ((type *)((segoff).segment * 16 + (segoff).offset))

enum vbe_capabilities {
  VBE_CAP_SWITCHABLE_DAC = 0x1,
  VBE_CAP_NON_VGA        = 0x2,
  VBE_CAP_WEIRD_RAMDAC   = 0x4
};

#define VBE_INFO                      \
  ((struct {                          \
      uint8_t signature[4];           \
      uint8_t minor_version;          \
      uint8_t major_version;          \
      struct segoff oem_name;         \
      uint32_t capabilities;          \
      struct segoff mode_list;        \
      /*in units of 64kiB*/           \
      uint16_t total_memory;          \
      uint16_t version_rev;           \
      struct segoff vendor_name;      \
      struct segoff product_name;     \
      struct segoff product_rev_name; \
    } __attribute__ ((__packed__)) *)0x4200)

#define VBE_MODE_INFO             \
  ((struct {                      \
      uint16_t attribs;           \
      uint8_t wina_attribs;       \
      uint8_t winb_attribs;       \
      uint16_t win_gran;          \
      uint16_t win_size;          \
      uint16_t wina_seg;          \
      uint16_t winb_seg;          \
      struct segoff win_func;     \
      uint16_t pitch;/*in bytes*/ \
      uint16_t width;             \
      uint16_t height;            \
      uint8_t char_width;         \
      uint8_t char_height;        \
      uint8_t n_planes;           \
      uint8_t bpp;                \
      uint8_t n_banks;            \
      uint8_t mem_model;          \
      uint8_t bank_size;/*in kiB*/\
      uint8_t image_pages;        \
      uint8_t reserved;           \
      uint8_t red_len;            \
      uint8_t red_off;            \
      uint8_t green_len;          \
      uint8_t green_off;          \
      uint8_t blue_len;           \
      uint8_t blue_off;           \
      uint8_t alpha_len;          \
      uint8_t alpha_off;          \
      uint8_t color_attribs;      \
      void *frame_buf;            \
      void *off_screen;           \
      uint16_t off_screen_length; \
    } __attribute__ ((__packed__)) *)0x4400)

#endif