1 |
/* |
2 |
* Copyright (C) 2005-2006 Anders Gavare. All rights reserved. |
3 |
* |
4 |
* Redistribution and use in source and binary forms, with or without |
5 |
* modification, are permitted provided that the following conditions are met: |
6 |
* |
7 |
* 1. Redistributions of source code must retain the above copyright |
8 |
* notice, this list of conditions and the following disclaimer. |
9 |
* 2. Redistributions in binary form must reproduce the above copyright |
10 |
* notice, this list of conditions and the following disclaimer in the |
11 |
* documentation and/or other materials provided with the distribution. |
12 |
* 3. The name of the author may not be used to endorse or promote products |
13 |
* derived from this software without specific prior written permission. |
14 |
* |
15 |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
16 |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
17 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 |
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
19 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
20 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
21 |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
22 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
23 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
24 |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
25 |
* SUCH DAMAGE. |
26 |
* |
27 |
* |
28 |
* $Id: machine_x86.c,v 1.2 2006/06/24 10:19:19 debug Exp $ |
29 |
*/ |
30 |
|
31 |
#include <stdio.h> |
32 |
#include <string.h> |
33 |
|
34 |
#include "bus_isa.h" |
35 |
#include "cpu.h" |
36 |
#include "device.h" |
37 |
#include "devices.h" |
38 |
#include "machine.h" |
39 |
#include "machine_interrupts.h" |
40 |
#include "memory.h" |
41 |
#include "misc.h" |
42 |
|
43 |
|
44 |
extern int quiet_mode; |
45 |
|
46 |
|
47 |
MACHINE_SETUP(barex86) |
48 |
{ |
49 |
machine->machine_name = "\"Bare\" x86 machine"; |
50 |
machine->stable = 1; |
51 |
} |
52 |
|
53 |
|
54 |
MACHINE_SETUP(x86) |
55 |
{ |
56 |
if (machine->machine_subtype == MACHINE_X86_XT) |
57 |
machine->machine_name = "PC XT"; |
58 |
else |
59 |
machine->machine_name = "Generic x86 PC"; |
60 |
|
61 |
machine->md_interrupt = x86_pc_interrupt; |
62 |
|
63 |
bus_isa_init(machine, BUS_ISA_IDE0 | BUS_ISA_IDE1 | BUS_ISA_VGA | |
64 |
BUS_ISA_PCKBC_FORCE_USE | |
65 |
(machine->machine_subtype == MACHINE_X86_XT? |
66 |
BUS_ISA_NO_SECOND_PIC : 0) | BUS_ISA_FDC, |
67 |
X86_IO_BASE, 0x00000000, 0, 16); |
68 |
|
69 |
if (machine->prom_emulation) |
70 |
pc_bios_init(cpu); |
71 |
|
72 |
if (!machine->use_x11 && !quiet_mode) |
73 |
fprintf(stderr, "-------------------------------------" |
74 |
"------------------------------------------\n" |
75 |
"\n WARNING! You are emulating a PC without -X. " |
76 |
"You will miss graphical output!\n\n" |
77 |
"-------------------------------------" |
78 |
"------------------------------------------\n"); |
79 |
} |
80 |
|
81 |
|
82 |
MACHINE_DEFAULT_CPU(barex86) |
83 |
{ |
84 |
machine->cpu_name = strdup("AMD64"); |
85 |
} |
86 |
|
87 |
|
88 |
MACHINE_DEFAULT_CPU(x86) |
89 |
{ |
90 |
if (machine->machine_subtype == MACHINE_X86_XT) { |
91 |
machine->cpu_name = strdup("8086"); |
92 |
return; |
93 |
} |
94 |
|
95 |
machine->cpu_name = strdup("AMD64"); |
96 |
} |
97 |
|
98 |
|
99 |
MACHINE_DEFAULT_RAM(x86) |
100 |
{ |
101 |
if (machine->machine_subtype == MACHINE_X86_XT) { |
102 |
machine->physical_ram_in_mb = 1; |
103 |
return; |
104 |
} |
105 |
|
106 |
machine->physical_ram_in_mb = 64; |
107 |
} |
108 |
|
109 |
|
110 |
MACHINE_REGISTER(barex86) |
111 |
{ |
112 |
MR_DEFAULT(barex86, "Generic \"bare\" X86 machine", ARCH_X86, |
113 |
MACHINE_BAREX86); |
114 |
|
115 |
machine_entry_add_alias(me, "barex86"); |
116 |
} |
117 |
|
118 |
|
119 |
MACHINE_REGISTER(x86) |
120 |
{ |
121 |
MR_DEFAULT(x86, "x86-based PC", ARCH_X86, MACHINE_X86); |
122 |
|
123 |
machine_entry_add_alias(me, "pc"); |
124 |
machine_entry_add_alias(me, "x86"); |
125 |
|
126 |
machine_entry_add_subtype(me, "Generic PC", MACHINE_X86_GENERIC, |
127 |
"pc", "generic", NULL); |
128 |
|
129 |
machine_entry_add_subtype(me, "PC XT", MACHINE_X86_XT, |
130 |
"xt", NULL); |
131 |
|
132 |
me->set_default_ram = machine_default_ram_x86; |
133 |
} |
134 |
|