Revision ad96090a vl.c
b/vl.c | ||
---|---|---|
120 | 120 |
#include "hw/usb.h" |
121 | 121 |
#include "hw/pcmcia.h" |
122 | 122 |
#include "hw/pc.h" |
123 |
#include "hw/audiodev.h" |
|
124 | 123 |
#include "hw/isa.h" |
125 | 124 |
#include "hw/baum.h" |
126 | 125 |
#include "hw/bt.h" |
... | ... | |
153 | 152 |
|
154 | 153 |
#include "disas.h" |
155 | 154 |
|
156 |
#include "exec-all.h" |
|
157 |
|
|
158 | 155 |
#include "qemu_socket.h" |
159 | 156 |
|
160 | 157 |
#include "slirp/libslirp.h" |
161 | 158 |
|
162 | 159 |
#include "qemu-queue.h" |
163 | 160 |
#include "cpus.h" |
161 |
#include "arch_init.h" |
|
164 | 162 |
|
165 | 163 |
//#define DEBUG_NET |
166 | 164 |
//#define DEBUG_SLIRP |
... | ... | |
191 | 189 |
static int rtc_date_offset = -1; /* -1 means no change */ |
192 | 190 |
QEMUClock *rtc_clock; |
193 | 191 |
int vga_interface_type = VGA_NONE; |
194 |
#ifdef TARGET_SPARC |
|
195 |
int graphic_width = 1024; |
|
196 |
int graphic_height = 768; |
|
197 |
int graphic_depth = 8; |
|
198 |
#else |
|
199 |
int graphic_width = 800; |
|
200 |
int graphic_height = 600; |
|
201 |
int graphic_depth = 15; |
|
202 |
#endif |
|
203 | 192 |
static int full_screen = 0; |
204 | 193 |
#ifdef CONFIG_SDL |
205 | 194 |
static int no_frame = 0; |
... | ... | |
209 | 198 |
CharDriverState *parallel_hds[MAX_PARALLEL_PORTS]; |
210 | 199 |
CharDriverState *virtcon_hds[MAX_VIRTIO_CONSOLES]; |
211 | 200 |
int win2k_install_hack = 0; |
212 |
#ifdef TARGET_I386 |
|
213 | 201 |
int rtc_td_hack = 0; |
214 |
#endif |
|
215 | 202 |
int usb_enabled = 0; |
216 | 203 |
int singlestep = 0; |
217 | 204 |
int smp_cpus = 1; |
... | ... | |
234 | 221 |
const char *option_rom[MAX_OPTION_ROMS]; |
235 | 222 |
int nb_option_roms; |
236 | 223 |
int semihosting_enabled = 0; |
237 |
#ifdef TARGET_ARM |
|
238 | 224 |
int old_param = 0; |
239 |
#endif |
|
240 | 225 |
const char *qemu_name; |
241 | 226 |
int alt_grab = 0; |
242 | 227 |
int ctrl_grab = 0; |
243 |
#if defined(TARGET_SPARC) || defined(TARGET_PPC) |
|
244 | 228 |
unsigned int nb_prom_envs = 0; |
245 | 229 |
const char *prom_envs[MAX_PROM_ENVS]; |
246 |
#endif |
|
247 | 230 |
int boot_menu; |
248 | 231 |
|
249 | 232 |
int nb_numa_nodes; |
... | ... | |
497 | 480 |
exit(1); |
498 | 481 |
} |
499 | 482 |
} |
500 |
#ifdef TARGET_I386 |
|
501 | 483 |
value = qemu_opt_get(opts, "driftfix"); |
502 | 484 |
if (value) { |
503 | 485 |
if (!strcmp(value, "slew")) { |
... | ... | |
509 | 491 |
exit(1); |
510 | 492 |
} |
511 | 493 |
} |
512 |
#endif |
|
513 | 494 |
} |
514 | 495 |
|
515 | 496 |
#ifdef _WIN32 |
... | ... | |
1669 | 1650 |
#endif |
1670 | 1651 |
|
1671 | 1652 |
/***********************************************************/ |
1672 |
/* ram save/restore */ |
|
1673 |
|
|
1674 |
#define RAM_SAVE_FLAG_FULL 0x01 /* Obsolete, not used anymore */ |
|
1675 |
#define RAM_SAVE_FLAG_COMPRESS 0x02 |
|
1676 |
#define RAM_SAVE_FLAG_MEM_SIZE 0x04 |
|
1677 |
#define RAM_SAVE_FLAG_PAGE 0x08 |
|
1678 |
#define RAM_SAVE_FLAG_EOS 0x10 |
|
1679 |
|
|
1680 |
static int is_dup_page(uint8_t *page, uint8_t ch) |
|
1681 |
{ |
|
1682 |
uint32_t val = ch << 24 | ch << 16 | ch << 8 | ch; |
|
1683 |
uint32_t *array = (uint32_t *)page; |
|
1684 |
int i; |
|
1685 |
|
|
1686 |
for (i = 0; i < (TARGET_PAGE_SIZE / 4); i++) { |
|
1687 |
if (array[i] != val) |
|
1688 |
return 0; |
|
1689 |
} |
|
1690 |
|
|
1691 |
return 1; |
|
1692 |
} |
|
1693 |
|
|
1694 |
static int ram_save_block(QEMUFile *f) |
|
1695 |
{ |
|
1696 |
static ram_addr_t current_addr = 0; |
|
1697 |
ram_addr_t saved_addr = current_addr; |
|
1698 |
ram_addr_t addr = 0; |
|
1699 |
int found = 0; |
|
1700 |
|
|
1701 |
while (addr < last_ram_offset) { |
|
1702 |
if (cpu_physical_memory_get_dirty(current_addr, MIGRATION_DIRTY_FLAG)) { |
|
1703 |
uint8_t *p; |
|
1704 |
|
|
1705 |
cpu_physical_memory_reset_dirty(current_addr, |
|
1706 |
current_addr + TARGET_PAGE_SIZE, |
|
1707 |
MIGRATION_DIRTY_FLAG); |
|
1708 |
|
|
1709 |
p = qemu_get_ram_ptr(current_addr); |
|
1710 |
|
|
1711 |
if (is_dup_page(p, *p)) { |
|
1712 |
qemu_put_be64(f, current_addr | RAM_SAVE_FLAG_COMPRESS); |
|
1713 |
qemu_put_byte(f, *p); |
|
1714 |
} else { |
|
1715 |
qemu_put_be64(f, current_addr | RAM_SAVE_FLAG_PAGE); |
|
1716 |
qemu_put_buffer(f, p, TARGET_PAGE_SIZE); |
|
1717 |
} |
|
1718 |
|
|
1719 |
found = 1; |
|
1720 |
break; |
|
1721 |
} |
|
1722 |
addr += TARGET_PAGE_SIZE; |
|
1723 |
current_addr = (saved_addr + addr) % last_ram_offset; |
|
1724 |
} |
|
1725 |
|
|
1726 |
return found; |
|
1727 |
} |
|
1728 |
|
|
1729 |
static uint64_t bytes_transferred; |
|
1730 |
|
|
1731 |
static ram_addr_t ram_save_remaining(void) |
|
1732 |
{ |
|
1733 |
ram_addr_t addr; |
|
1734 |
ram_addr_t count = 0; |
|
1735 |
|
|
1736 |
for (addr = 0; addr < last_ram_offset; addr += TARGET_PAGE_SIZE) { |
|
1737 |
if (cpu_physical_memory_get_dirty(addr, MIGRATION_DIRTY_FLAG)) |
|
1738 |
count++; |
|
1739 |
} |
|
1740 |
|
|
1741 |
return count; |
|
1742 |
} |
|
1743 |
|
|
1744 |
uint64_t ram_bytes_remaining(void) |
|
1745 |
{ |
|
1746 |
return ram_save_remaining() * TARGET_PAGE_SIZE; |
|
1747 |
} |
|
1748 |
|
|
1749 |
uint64_t ram_bytes_transferred(void) |
|
1750 |
{ |
|
1751 |
return bytes_transferred; |
|
1752 |
} |
|
1753 |
|
|
1754 |
uint64_t ram_bytes_total(void) |
|
1755 |
{ |
|
1756 |
return last_ram_offset; |
|
1757 |
} |
|
1758 |
|
|
1759 |
static int ram_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque) |
|
1760 |
{ |
|
1761 |
ram_addr_t addr; |
|
1762 |
uint64_t bytes_transferred_last; |
|
1763 |
double bwidth = 0; |
|
1764 |
uint64_t expected_time = 0; |
|
1765 |
|
|
1766 |
if (stage < 0) { |
|
1767 |
cpu_physical_memory_set_dirty_tracking(0); |
|
1768 |
return 0; |
|
1769 |
} |
|
1770 |
|
|
1771 |
if (cpu_physical_sync_dirty_bitmap(0, TARGET_PHYS_ADDR_MAX) != 0) { |
|
1772 |
qemu_file_set_error(f); |
|
1773 |
return 0; |
|
1774 |
} |
|
1775 |
|
|
1776 |
if (stage == 1) { |
|
1777 |
bytes_transferred = 0; |
|
1778 |
|
|
1779 |
/* Make sure all dirty bits are set */ |
|
1780 |
for (addr = 0; addr < last_ram_offset; addr += TARGET_PAGE_SIZE) { |
|
1781 |
if (!cpu_physical_memory_get_dirty(addr, MIGRATION_DIRTY_FLAG)) |
|
1782 |
cpu_physical_memory_set_dirty(addr); |
|
1783 |
} |
|
1784 |
|
|
1785 |
/* Enable dirty memory tracking */ |
|
1786 |
cpu_physical_memory_set_dirty_tracking(1); |
|
1787 |
|
|
1788 |
qemu_put_be64(f, last_ram_offset | RAM_SAVE_FLAG_MEM_SIZE); |
|
1789 |
} |
|
1790 |
|
|
1791 |
bytes_transferred_last = bytes_transferred; |
|
1792 |
bwidth = qemu_get_clock_ns(rt_clock); |
|
1793 |
|
|
1794 |
while (!qemu_file_rate_limit(f)) { |
|
1795 |
int ret; |
|
1796 |
|
|
1797 |
ret = ram_save_block(f); |
|
1798 |
bytes_transferred += ret * TARGET_PAGE_SIZE; |
|
1799 |
if (ret == 0) /* no more blocks */ |
|
1800 |
break; |
|
1801 |
} |
|
1802 |
|
|
1803 |
bwidth = qemu_get_clock_ns(rt_clock) - bwidth; |
|
1804 |
bwidth = (bytes_transferred - bytes_transferred_last) / bwidth; |
|
1805 |
|
|
1806 |
/* if we haven't transferred anything this round, force expected_time to a |
|
1807 |
* a very high value, but without crashing */ |
|
1808 |
if (bwidth == 0) |
|
1809 |
bwidth = 0.000001; |
|
1810 |
|
|
1811 |
/* try transferring iterative blocks of memory */ |
|
1812 |
if (stage == 3) { |
|
1813 |
/* flush all remaining blocks regardless of rate limiting */ |
|
1814 |
while (ram_save_block(f) != 0) { |
|
1815 |
bytes_transferred += TARGET_PAGE_SIZE; |
|
1816 |
} |
|
1817 |
cpu_physical_memory_set_dirty_tracking(0); |
|
1818 |
} |
|
1819 |
|
|
1820 |
qemu_put_be64(f, RAM_SAVE_FLAG_EOS); |
|
1821 |
|
|
1822 |
expected_time = ram_save_remaining() * TARGET_PAGE_SIZE / bwidth; |
|
1823 |
|
|
1824 |
return (stage == 2) && (expected_time <= migrate_max_downtime()); |
|
1825 |
} |
|
1826 |
|
|
1827 |
static int ram_load(QEMUFile *f, void *opaque, int version_id) |
|
1828 |
{ |
|
1829 |
ram_addr_t addr; |
|
1830 |
int flags; |
|
1831 |
|
|
1832 |
if (version_id != 3) |
|
1833 |
return -EINVAL; |
|
1834 |
|
|
1835 |
do { |
|
1836 |
addr = qemu_get_be64(f); |
|
1837 |
|
|
1838 |
flags = addr & ~TARGET_PAGE_MASK; |
|
1839 |
addr &= TARGET_PAGE_MASK; |
|
1840 |
|
|
1841 |
if (flags & RAM_SAVE_FLAG_MEM_SIZE) { |
|
1842 |
if (addr != last_ram_offset) |
|
1843 |
return -EINVAL; |
|
1844 |
} |
|
1845 |
|
|
1846 |
if (flags & RAM_SAVE_FLAG_COMPRESS) { |
|
1847 |
uint8_t ch = qemu_get_byte(f); |
|
1848 |
memset(qemu_get_ram_ptr(addr), ch, TARGET_PAGE_SIZE); |
|
1849 |
#ifndef _WIN32 |
|
1850 |
if (ch == 0 && |
|
1851 |
(!kvm_enabled() || kvm_has_sync_mmu())) { |
|
1852 |
madvise(qemu_get_ram_ptr(addr), TARGET_PAGE_SIZE, MADV_DONTNEED); |
|
1853 |
} |
|
1854 |
#endif |
|
1855 |
} else if (flags & RAM_SAVE_FLAG_PAGE) { |
|
1856 |
qemu_get_buffer(f, qemu_get_ram_ptr(addr), TARGET_PAGE_SIZE); |
|
1857 |
} |
|
1858 |
if (qemu_file_has_error(f)) { |
|
1859 |
return -EIO; |
|
1860 |
} |
|
1861 |
} while (!(flags & RAM_SAVE_FLAG_EOS)); |
|
1862 |
|
|
1863 |
return 0; |
|
1864 |
} |
|
1865 |
|
|
1866 |
void qemu_service_io(void) |
|
1867 |
{ |
|
1868 |
qemu_notify_event(); |
|
1869 |
} |
|
1870 |
|
|
1871 |
/***********************************************************/ |
|
1872 | 1653 |
/* machine registration */ |
1873 | 1654 |
|
1874 | 1655 |
static QEMUMachine *first_machine = NULL; |
... | ... | |
2295 | 2076 |
static void help(int exitcode) |
2296 | 2077 |
{ |
2297 | 2078 |
const char *options_help = |
2298 |
#define DEF(option, opt_arg, opt_enum, opt_help) \
|
|
2299 |
opt_help
|
|
2079 |
#define DEF(option, opt_arg, opt_enum, opt_help, arch_mask) \
|
|
2080 |
opt_help |
|
2300 | 2081 |
#define DEFHEADING(text) stringify(text) "\n" |
2301 | 2082 |
#include "qemu-options.h" |
2302 | 2083 |
#undef DEF |
... | ... | |
2323 | 2104 |
#define HAS_ARG 0x0001 |
2324 | 2105 |
|
2325 | 2106 |
enum { |
2326 |
#define DEF(option, opt_arg, opt_enum, opt_help) \
|
|
2107 |
#define DEF(option, opt_arg, opt_enum, opt_help, arch_mask) \
|
|
2327 | 2108 |
opt_enum, |
2328 | 2109 |
#define DEFHEADING(text) |
2329 | 2110 |
#include "qemu-options.h" |
... | ... | |
2336 | 2117 |
const char *name; |
2337 | 2118 |
int flags; |
2338 | 2119 |
int index; |
2120 |
uint32_t arch_mask; |
|
2339 | 2121 |
} QEMUOption; |
2340 | 2122 |
|
2341 | 2123 |
static const QEMUOption qemu_options[] = { |
2342 |
{ "h", 0, QEMU_OPTION_h }, |
|
2343 |
#define DEF(option, opt_arg, opt_enum, opt_help) \
|
|
2344 |
{ option, opt_arg, opt_enum }, |
|
2124 |
{ "h", 0, QEMU_OPTION_h, QEMU_ARCH_ALL },
|
|
2125 |
#define DEF(option, opt_arg, opt_enum, opt_help, arch_mask) \
|
|
2126 |
{ option, opt_arg, opt_enum, arch_mask },
|
|
2345 | 2127 |
#define DEFHEADING(text) |
2346 | 2128 |
#include "qemu-options.h" |
2347 | 2129 |
#undef DEF |
... | ... | |
2349 | 2131 |
#undef GEN_DOCS |
2350 | 2132 |
{ NULL }, |
2351 | 2133 |
}; |
2352 |
|
|
2353 |
#ifdef HAS_AUDIO |
|
2354 |
struct soundhw soundhw[] = { |
|
2355 |
#ifdef HAS_AUDIO_CHOICE |
|
2356 |
#if defined(TARGET_I386) || defined(TARGET_MIPS) |
|
2357 |
{ |
|
2358 |
"pcspk", |
|
2359 |
"PC speaker", |
|
2360 |
0, |
|
2361 |
1, |
|
2362 |
{ .init_isa = pcspk_audio_init } |
|
2363 |
}, |
|
2364 |
#endif |
|
2365 |
|
|
2366 |
#ifdef CONFIG_SB16 |
|
2367 |
{ |
|
2368 |
"sb16", |
|
2369 |
"Creative Sound Blaster 16", |
|
2370 |
0, |
|
2371 |
1, |
|
2372 |
{ .init_isa = SB16_init } |
|
2373 |
}, |
|
2374 |
#endif |
|
2375 |
|
|
2376 |
#ifdef CONFIG_CS4231A |
|
2377 |
{ |
|
2378 |
"cs4231a", |
|
2379 |
"CS4231A", |
|
2380 |
0, |
|
2381 |
1, |
|
2382 |
{ .init_isa = cs4231a_init } |
|
2383 |
}, |
|
2384 |
#endif |
|
2385 |
|
|
2386 |
#ifdef CONFIG_ADLIB |
|
2387 |
{ |
|
2388 |
"adlib", |
|
2389 |
#ifdef HAS_YMF262 |
|
2390 |
"Yamaha YMF262 (OPL3)", |
|
2391 |
#else |
|
2392 |
"Yamaha YM3812 (OPL2)", |
|
2393 |
#endif |
|
2394 |
0, |
|
2395 |
1, |
|
2396 |
{ .init_isa = Adlib_init } |
|
2397 |
}, |
|
2398 |
#endif |
|
2399 |
|
|
2400 |
#ifdef CONFIG_GUS |
|
2401 |
{ |
|
2402 |
"gus", |
|
2403 |
"Gravis Ultrasound GF1", |
|
2404 |
0, |
|
2405 |
1, |
|
2406 |
{ .init_isa = GUS_init } |
|
2407 |
}, |
|
2408 |
#endif |
|
2409 |
|
|
2410 |
#ifdef CONFIG_AC97 |
|
2411 |
{ |
|
2412 |
"ac97", |
|
2413 |
"Intel 82801AA AC97 Audio", |
|
2414 |
0, |
|
2415 |
0, |
|
2416 |
{ .init_pci = ac97_init } |
|
2417 |
}, |
|
2418 |
#endif |
|
2419 |
|
|
2420 |
#ifdef CONFIG_ES1370 |
|
2421 |
{ |
|
2422 |
"es1370", |
|
2423 |
"ENSONIQ AudioPCI ES1370", |
|
2424 |
0, |
|
2425 |
0, |
|
2426 |
{ .init_pci = es1370_init } |
|
2427 |
}, |
|
2428 |
#endif |
|
2429 |
|
|
2430 |
#endif /* HAS_AUDIO_CHOICE */ |
|
2431 |
|
|
2432 |
{ NULL, NULL, 0, 0, { NULL } } |
|
2433 |
}; |
|
2434 |
|
|
2435 |
static void select_soundhw (const char *optarg) |
|
2436 |
{ |
|
2437 |
struct soundhw *c; |
|
2438 |
|
|
2439 |
if (*optarg == '?') { |
|
2440 |
show_valid_cards: |
|
2441 |
|
|
2442 |
printf ("Valid sound card names (comma separated):\n"); |
|
2443 |
for (c = soundhw; c->name; ++c) { |
|
2444 |
printf ("%-11s %s\n", c->name, c->descr); |
|
2445 |
} |
|
2446 |
printf ("\n-soundhw all will enable all of the above\n"); |
|
2447 |
exit (*optarg != '?'); |
|
2448 |
} |
|
2449 |
else { |
|
2450 |
size_t l; |
|
2451 |
const char *p; |
|
2452 |
char *e; |
|
2453 |
int bad_card = 0; |
|
2454 |
|
|
2455 |
if (!strcmp (optarg, "all")) { |
|
2456 |
for (c = soundhw; c->name; ++c) { |
|
2457 |
c->enabled = 1; |
|
2458 |
} |
|
2459 |
return; |
|
2460 |
} |
|
2461 |
|
|
2462 |
p = optarg; |
|
2463 |
while (*p) { |
|
2464 |
e = strchr (p, ','); |
|
2465 |
l = !e ? strlen (p) : (size_t) (e - p); |
|
2466 |
|
|
2467 |
for (c = soundhw; c->name; ++c) { |
|
2468 |
if (!strncmp (c->name, p, l) && !c->name[l]) { |
|
2469 |
c->enabled = 1; |
|
2470 |
break; |
|
2471 |
} |
|
2472 |
} |
|
2473 |
|
|
2474 |
if (!c->name) { |
|
2475 |
if (l > 80) { |
|
2476 |
fprintf (stderr, |
|
2477 |
"Unknown sound card name (too big to show)\n"); |
|
2478 |
} |
|
2479 |
else { |
|
2480 |
fprintf (stderr, "Unknown sound card name `%.*s'\n", |
|
2481 |
(int) l, p); |
|
2482 |
} |
|
2483 |
bad_card = 1; |
|
2484 |
} |
|
2485 |
p += l + (e != NULL); |
|
2486 |
} |
|
2487 |
|
|
2488 |
if (bad_card) |
|
2489 |
goto show_valid_cards; |
|
2490 |
} |
|
2491 |
} |
|
2492 |
#endif |
|
2493 |
|
|
2494 | 2134 |
static void select_vgahw (const char *p) |
2495 | 2135 |
{ |
2496 | 2136 |
const char *opts; |
... | ... | |
2525 | 2165 |
} |
2526 | 2166 |
} |
2527 | 2167 |
|
2528 |
#ifdef TARGET_I386 |
|
2529 | 2168 |
static int balloon_parse(const char *arg) |
2530 | 2169 |
{ |
2531 | 2170 |
QemuOpts *opts; |
... | ... | |
2550 | 2189 |
|
2551 | 2190 |
return -1; |
2552 | 2191 |
} |
2553 |
#endif |
|
2554 | 2192 |
|
2555 | 2193 |
#ifdef _WIN32 |
2556 | 2194 |
static BOOL WINAPI qemu_ctrl_handler(DWORD type) |
... | ... | |
2560 | 2198 |
} |
2561 | 2199 |
#endif |
2562 | 2200 |
|
2563 |
int qemu_uuid_parse(const char *str, uint8_t *uuid) |
|
2564 |
{ |
|
2565 |
int ret; |
|
2566 |
|
|
2567 |
if(strlen(str) != 36) |
|
2568 |
return -1; |
|
2569 |
|
|
2570 |
ret = sscanf(str, UUID_FMT, &uuid[0], &uuid[1], &uuid[2], &uuid[3], |
|
2571 |
&uuid[4], &uuid[5], &uuid[6], &uuid[7], &uuid[8], &uuid[9], |
|
2572 |
&uuid[10], &uuid[11], &uuid[12], &uuid[13], &uuid[14], &uuid[15]); |
|
2573 |
|
|
2574 |
if(ret != 16) |
|
2575 |
return -1; |
|
2576 |
|
|
2577 |
#ifdef TARGET_I386 |
|
2578 |
smbios_add_field(1, offsetof(struct smbios_type_1, uuid), 16, uuid); |
|
2579 |
#endif |
|
2580 |
|
|
2581 |
return 0; |
|
2582 |
} |
|
2583 |
|
|
2584 |
#ifdef TARGET_I386 |
|
2585 |
static void do_acpitable_option(const char *optarg) |
|
2586 |
{ |
|
2587 |
if (acpi_table_add(optarg) < 0) { |
|
2588 |
fprintf(stderr, "Wrong acpi table provided\n"); |
|
2589 |
exit(1); |
|
2590 |
} |
|
2591 |
} |
|
2592 |
#endif |
|
2593 |
|
|
2594 |
#ifdef TARGET_I386 |
|
2595 |
static void do_smbios_option(const char *optarg) |
|
2596 |
{ |
|
2597 |
if (smbios_entry_add(optarg) < 0) { |
|
2598 |
fprintf(stderr, "Wrong smbios provided\n"); |
|
2599 |
exit(1); |
|
2600 |
} |
|
2601 |
} |
|
2602 |
#endif |
|
2603 |
|
|
2604 |
static void cpudef_init(void) |
|
2605 |
{ |
|
2606 |
#if defined(cpudef_setup) |
|
2607 |
cpudef_setup(); /* parse cpu definitions in target config file */ |
|
2608 |
#endif |
|
2609 |
} |
|
2610 |
|
|
2611 | 2201 |
#ifndef _WIN32 |
2612 | 2202 |
|
2613 | 2203 |
static void termsig_handler(int signal) |
... | ... | |
3147 | 2737 |
fclose(fp); |
3148 | 2738 |
} |
3149 | 2739 |
|
3150 |
fname = CONFIG_QEMU_CONFDIR "/target-" TARGET_ARCH ".conf";
|
|
2740 |
fname = arch_config_name;
|
|
3151 | 2741 |
fp = fopen(fname, "r"); |
3152 | 2742 |
if (fp) { |
3153 | 2743 |
if (qemu_config_parse(fp, fname) != 0) { |
... | ... | |
3169 | 2759 |
const QEMUOption *popt; |
3170 | 2760 |
|
3171 | 2761 |
popt = lookup_opt(argc, argv, &optarg, &optind); |
2762 |
if (!(popt->arch_mask & arch_type)) { |
|
2763 |
printf("Option %s not supported for this target\n", popt->name); |
|
2764 |
exit(1); |
|
2765 |
} |
|
3172 | 2766 |
switch(popt->index) { |
3173 | 2767 |
case QEMU_OPTION_M: |
3174 | 2768 |
machine = find_machine(optarg); |
... | ... | |
3372 | 2966 |
case QEMU_OPTION_fdb: |
3373 | 2967 |
drive_add(optarg, FD_ALIAS, popt->index - QEMU_OPTION_fda); |
3374 | 2968 |
break; |
3375 |
#ifdef TARGET_I386 |
|
3376 | 2969 |
case QEMU_OPTION_no_fd_bootchk: |
3377 | 2970 |
fd_bootchk = 0; |
3378 | 2971 |
break; |
3379 |
#endif |
|
3380 | 2972 |
case QEMU_OPTION_netdev: |
3381 | 2973 |
if (net_client_parse(&qemu_netdev_opts, optarg) == -1) { |
3382 | 2974 |
exit(1); |
... | ... | |
3408 | 3000 |
case QEMU_OPTION_bt: |
3409 | 3001 |
add_device_config(DEV_BT, optarg); |
3410 | 3002 |
break; |
3411 |
#ifdef HAS_AUDIO |
|
3412 | 3003 |
case QEMU_OPTION_audio_help: |
3004 |
if (!(audio_available())) { |
|
3005 |
printf("Option %s not supported for this target\n", popt->name); |
|
3006 |
exit(1); |
|
3007 |
} |
|
3413 | 3008 |
AUD_help (); |
3414 | 3009 |
exit (0); |
3415 | 3010 |
break; |
3416 | 3011 |
case QEMU_OPTION_soundhw: |
3012 |
if (!(audio_available())) { |
|
3013 |
printf("Option %s not supported for this target\n", popt->name); |
|
3014 |
exit(1); |
|
3015 |
} |
|
3417 | 3016 |
select_soundhw (optarg); |
3418 | 3017 |
break; |
3419 |
#endif |
|
3420 | 3018 |
case QEMU_OPTION_h: |
3421 | 3019 |
help(0); |
3422 | 3020 |
break; |
... | ... | |
3491 | 3089 |
case QEMU_OPTION_vga: |
3492 | 3090 |
select_vgahw (optarg); |
3493 | 3091 |
break; |
3494 |
#if defined(TARGET_PPC) || defined(TARGET_SPARC) |
|
3495 | 3092 |
case QEMU_OPTION_g: |
3496 | 3093 |
{ |
3497 | 3094 |
const char *p; |
... | ... | |
3526 | 3123 |
graphic_depth = depth; |
3527 | 3124 |
} |
3528 | 3125 |
break; |
3529 |
#endif |
|
3530 | 3126 |
case QEMU_OPTION_echr: |
3531 | 3127 |
{ |
3532 | 3128 |
char *r; |
... | ... | |
3622 | 3218 |
case QEMU_OPTION_pidfile: |
3623 | 3219 |
pid_file = optarg; |
3624 | 3220 |
break; |
3625 |
#ifdef TARGET_I386 |
|
3626 | 3221 |
case QEMU_OPTION_win2k_hack: |
3627 | 3222 |
win2k_install_hack = 1; |
3628 | 3223 |
break; |
... | ... | |
3635 | 3230 |
case QEMU_OPTION_smbios: |
3636 | 3231 |
do_smbios_option(optarg); |
3637 | 3232 |
break; |
3638 |
#endif |
|
3639 |
#ifdef CONFIG_KVM |
|
3640 | 3233 |
case QEMU_OPTION_enable_kvm: |
3234 |
if (!(kvm_available())) { |
|
3235 |
printf("Option %s not supported for this target\n", popt->name); |
|
3236 |
exit(1); |
|
3237 |
} |
|
3641 | 3238 |
kvm_allowed = 1; |
3642 | 3239 |
break; |
3643 |
#endif |
|
3644 | 3240 |
case QEMU_OPTION_usb: |
3645 | 3241 |
usb_enabled = 1; |
3646 | 3242 |
break; |
... | ... | |
3673 | 3269 |
display_type = DT_VNC; |
3674 | 3270 |
vnc_display = optarg; |
3675 | 3271 |
break; |
3676 |
#ifdef TARGET_I386 |
|
3677 | 3272 |
case QEMU_OPTION_no_acpi: |
3678 | 3273 |
acpi_enabled = 0; |
3679 | 3274 |
break; |
... | ... | |
3686 | 3281 |
exit(1); |
3687 | 3282 |
} |
3688 | 3283 |
break; |
3689 |
#endif |
|
3690 | 3284 |
case QEMU_OPTION_no_reboot: |
3691 | 3285 |
no_reboot = 1; |
3692 | 3286 |
break; |
... | ... | |
3716 | 3310 |
option_rom[nb_option_roms] = optarg; |
3717 | 3311 |
nb_option_roms++; |
3718 | 3312 |
break; |
3719 |
#if defined(TARGET_ARM) || defined(TARGET_M68K) |
|
3720 | 3313 |
case QEMU_OPTION_semihosting: |
3721 | 3314 |
semihosting_enabled = 1; |
3722 | 3315 |
break; |
3723 |
#endif |
|
3724 | 3316 |
case QEMU_OPTION_name: |
3725 | 3317 |
qemu_name = qemu_strdup(optarg); |
3726 | 3318 |
{ |
... | ... | |
3736 | 3328 |
} |
3737 | 3329 |
} |
3738 | 3330 |
break; |
3739 |
#if defined(TARGET_SPARC) || defined(TARGET_PPC) |
|
3740 | 3331 |
case QEMU_OPTION_prom_env: |
3741 | 3332 |
if (nb_prom_envs >= MAX_PROM_ENVS) { |
3742 | 3333 |
fprintf(stderr, "Too many prom variables\n"); |
... | ... | |
3745 | 3336 |
prom_envs[nb_prom_envs] = optarg; |
3746 | 3337 |
nb_prom_envs++; |
3747 | 3338 |
break; |
3748 |
#endif |
|
3749 |
#ifdef TARGET_ARM |
|
3750 | 3339 |
case QEMU_OPTION_old_param: |
3751 | 3340 |
old_param = 1; |
3752 | 3341 |
break; |
3753 |
#endif |
|
3754 | 3342 |
case QEMU_OPTION_clock: |
3755 | 3343 |
configure_alarms(optarg); |
3756 | 3344 |
break; |
... | ... | |
3795 | 3383 |
run_as = optarg; |
3796 | 3384 |
break; |
3797 | 3385 |
#endif |
3798 |
#ifdef CONFIG_XEN |
|
3799 | 3386 |
case QEMU_OPTION_xen_domid: |
3387 |
if (!(xen_available())) { |
|
3388 |
printf("Option %s not supported for this target\n", popt->name); |
|
3389 |
exit(1); |
|
3390 |
} |
|
3800 | 3391 |
xen_domid = atoi(optarg); |
3801 | 3392 |
break; |
3802 | 3393 |
case QEMU_OPTION_xen_create: |
3394 |
if (!(xen_available())) { |
|
3395 |
printf("Option %s not supported for this target\n", popt->name); |
|
3396 |
exit(1); |
|
3397 |
} |
|
3803 | 3398 |
xen_mode = XEN_CREATE; |
3804 | 3399 |
break; |
3805 | 3400 |
case QEMU_OPTION_xen_attach: |
3401 |
if (!(xen_available())) { |
|
3402 |
printf("Option %s not supported for this target\n", popt->name); |
|
3403 |
exit(1); |
|
3404 |
} |
|
3806 | 3405 |
xen_mode = XEN_ATTACH; |
3807 | 3406 |
break; |
3808 |
#endif |
|
3809 | 3407 |
case QEMU_OPTION_readconfig: |
3810 | 3408 |
{ |
3811 | 3409 |
FILE *fp; |
Also available in: Unified diff