1 |
/* |
/* |
2 |
* QEMU based User Mode Linux |
* QEMU PC System Emulator |
3 |
* |
* |
4 |
* This file is part of proprietary software - it is published here |
* Copyright (c) 2003 Fabrice Bellard |
|
* only for demonstration and information purposes. |
|
5 |
* |
* |
6 |
* Copyright (c) 2003 Fabrice Bellard |
* Permission is hereby granted, free of charge, to any person obtaining a copy |
7 |
|
* of this software and associated documentation files (the "Software"), to deal |
8 |
|
* in the Software without restriction, including without limitation the rights |
9 |
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
10 |
|
* copies of the Software, and to permit persons to whom the Software is |
11 |
|
* furnished to do so, subject to the following conditions: |
12 |
|
* |
13 |
|
* The above copyright notice and this permission notice shall be included in |
14 |
|
* all copies or substantial portions of the Software. |
15 |
|
* |
16 |
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 |
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 |
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
19 |
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
20 |
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
21 |
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
22 |
|
* THE SOFTWARE. |
23 |
*/ |
*/ |
24 |
#include <stdlib.h> |
#include <stdlib.h> |
25 |
#include <stdio.h> |
#include <stdio.h> |
26 |
|
#include <stdarg.h> |
27 |
#include <string.h> |
#include <string.h> |
28 |
#include <getopt.h> |
#include <getopt.h> |
29 |
#include <inttypes.h> |
#include <inttypes.h> |
179 |
|
|
180 |
char phys_ram_file[1024]; |
char phys_ram_file[1024]; |
181 |
CPUX86State *global_env; |
CPUX86State *global_env; |
182 |
|
CPUX86State *cpu_single_env; |
183 |
FILE *logfile = NULL; |
FILE *logfile = NULL; |
184 |
int loglevel; |
int loglevel; |
185 |
IOPortReadFunc *ioport_readb_table[MAX_IOPORTS]; |
IOPortReadFunc *ioport_readb_table[MAX_IOPORTS]; |
1675 |
static void host_alarm_handler(int host_signum, siginfo_t *info, |
static void host_alarm_handler(int host_signum, siginfo_t *info, |
1676 |
void *puc) |
void *puc) |
1677 |
{ |
{ |
1678 |
/* just exit from the cpu to have a change to handle timers */ |
/* just exit from the cpu to have a chance to handle timers */ |
1679 |
cpu_x86_interrupt(global_env); |
cpu_x86_interrupt(global_env); |
1680 |
timer_irq_pending = 1; |
timer_irq_pending = 1; |
1681 |
} |
} |
1828 |
/* init CPU state */ |
/* init CPU state */ |
1829 |
env = cpu_init(); |
env = cpu_init(); |
1830 |
global_env = env; |
global_env = env; |
1831 |
|
cpu_single_env = env; |
1832 |
|
|
1833 |
/* setup basic memory access */ |
/* setup basic memory access */ |
1834 |
env->cr[0] = 0x00000033; |
env->cr[0] = 0x00000033; |
1911 |
} |
} |
1912 |
} |
} |
1913 |
|
|
1914 |
/* just for testing */ |
/* timer IRQ */ |
1915 |
if (timer_irq_pending) { |
if (timer_irq_pending) { |
1916 |
pic_set_irq(0, 1); |
pic_set_irq(0, 1); |
1917 |
pic_set_irq(0, 0); |
pic_set_irq(0, 0); |