-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathpc.h
More file actions
131 lines (113 loc) · 2.36 KB
/
Copy pathpc.h
File metadata and controls
131 lines (113 loc) · 2.36 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#ifndef PC_H
#define PC_H
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#if defined(USE_AMD64)
#include "amd64.h"
#else
#include "i386.h"
#endif
#include "i8259.h"
#include "i8254.h"
#include "ide.h"
#include "vga.h"
#include "i8042.h"
#include "misc.h"
#include "adlib.h"
#include "ne2000.h"
#include "i8257.h"
#include "sb16.h"
#include "pcspk.h"
#include "pci.h"
#include "ini.h"
/// Platform HAL
uint32_t get_uticks();
void *pcmalloc(long size);
void *bigmalloc(size_t size);
int load_rom(void *phys_mem, const char *file, uword addr, int backward);
/// PC
#if defined(USE_CPUABS)
#include "kvm.h"
typedef struct CPUABS CPU;
#else
#if defined(USE_AMD64)
typedef CPUAMD64 CPU;
#else
typedef CPUI386 CPU;
#endif
#endif
typedef struct {
CPU *cpu;
PicState2 *pic;
PITState *pit;
U8250 *serial;
CMOS *cmos;
IDEIFState *ide, *ide2;
VGAState *vga;
char *phys_mem;
long phys_mem_size;
char *vga_mem;
int vga_mem_size;
int64_t boot_start_time;
SimpleFBDrawFunc *redraw;
void *redraw_data;
KBDState *i8042;
PS2KbdState *kbd;
PS2MouseState *mouse;
AdlibState *adlib;
NE2000State *ne2000;
I8257State *isa_dma, *isa_hdma;
SB16State *sb16;
PCSpkState *pcspk;
I440FXState *i440fx;
PCIBus *pcibus;
PCIDevice *pci_ide;
PCIDevice *pci_vga;
uword pci_vga_ram_addr;
EMULINK *emulink;
// non-owning strings
const char *bios;
const char *vga_bios;
u8 port92;
int shutdown_state;
int reset_request;
// non-owning strings
const char *linuxstart;
const char *kernel;
const char *initrd;
const char *cmdline;
int enable_serial;
int full_update;
} PC;
// if filled by ini_parse(), all strings are malloc'd
typedef struct {
const char *linuxstart;
const char *kernel;
const char *initrd;
const char *cmdline;
const char *bios;
const char *vga_bios;
long mem_size;
long vga_mem_size;
const char *disks[4];
int iscd[4];
const char *fdd[2];
int fill_cmos;
int width;
int height;
int cpu_gen;
int fpu;
int enable_serial;
int vga_force_8dm;
const char *cpuid_vendor; // amd64-specific for now
} PCConfig;
PC *pc_new(SimpleFBDrawFunc *redraw, void *redraw_data,
u8 *fb, PCConfig *conf);
void pc_vga_step(void *o);
void pc_step(PC *pc);
void mixer_callback(void *opaque, uint8_t *stream, int free);
int parse_conf_ini(void* user, const char* section,
const char* name, const char* value);
void load_bios_and_reset(PC *pc);
#endif /* PC_H */