bootloader/boot/dat.h

49 lines
760 B
C

// IO Port Access Type Purpose
// 0x60 Read/Write Data Port
// 0x64 Read Status Register
// 0x64 Write Command Register
enum{
CON_PC,
CON_SRI,
CON_END,
};
struct BIOSreg{
u32 ax;
u32 cx;
u32 dx;
u32 bx;
u32 bp;
u32 si;
u32 di;
u32 ds;
u32 es;
}__attribute__((packed));
typedef struct{
char *name;
void (**probes)(void);
uint cnt;
}BootProbe;
typedef struct ConDev ConDev;
struct ConDev{
int (*probe)(ConDev*);
void (*init)(ConDev *);
int (*getc)(int);
void (*putc)(int, int);
uint dev;
uchar pri; // the higher the better
};
// gdt.S
extern volatile struct BIOSreg BIOSreg;
// boot.c
extern void (*probe1[])(void);
extern void (*probe2[])(void);
extern BootProbe probes[];
extern ConDev contab[CON_END];
extern ConDev *con;