Commit dc887a4dae9bb118c6f29db5006ac7c1d58fdeb1
1 parent
b9f19507
make the bios be a ROM memory - glibc hacks for setvbuf and signals - correct ce…
…ntury storage in CMOS emulation git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@526 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
15 additions
and
2 deletions
vl.c
... | ... | @@ -458,6 +458,7 @@ void hw_error(const char *fmt, ...) |
458 | 458 | |
459 | 459 | /* PC cmos mappings */ |
460 | 460 | #define REG_EQUIPMENT_BYTE 0x14 |
461 | +#define REG_IBM_CENTURY_BYTE 0x32 | |
461 | 462 | |
462 | 463 | uint8_t cmos_data[128]; |
463 | 464 | uint8_t cmos_index; |
... | ... | @@ -557,6 +558,7 @@ void cmos_init(void) |
557 | 558 | cmos_data[RTC_REG_D] = 0x80; |
558 | 559 | |
559 | 560 | /* various important CMOS locations needed by PC/Bochs bios */ |
561 | + cmos_data[REG_IBM_CENTURY_BYTE] = to_bcd((tm->tm_year / 100) + 19); | |
560 | 562 | |
561 | 563 | cmos_data[REG_EQUIPMENT_BYTE] = 0x02; /* FPU is there */ |
562 | 564 | cmos_data[REG_EQUIPMENT_BYTE] |= 0x04; /* PS/2 mouse installed */ |
... | ... | @@ -2961,7 +2963,7 @@ struct option long_options[] = { |
2961 | 2963 | #ifdef CONFIG_SDL |
2962 | 2964 | /* SDL use the pthreads and they modify sigaction. We don't |
2963 | 2965 | want that. */ |
2964 | -#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) | |
2966 | +#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) | |
2965 | 2967 | extern void __libc_sigaction(); |
2966 | 2968 | #define sigaction(sig, act, oact) __libc_sigaction(sig, act, oact) |
2967 | 2969 | #else |
... | ... | @@ -3111,8 +3113,15 @@ int main(int argc, char **argv) |
3111 | 3113 | if (hd_filename[0] == '\0' && boot_device == 'c') |
3112 | 3114 | boot_device = 'd'; |
3113 | 3115 | |
3114 | - /* init debug */ | |
3116 | +#if !defined(CONFIG_SOFTMMU) | |
3117 | + /* must avoid mmap() usage of glibc by setting a buffer "by hand" */ | |
3118 | + { | |
3119 | + static uint8_t stdout_buf[4096]; | |
3120 | + setvbuf(stdout, stdout_buf, _IOLBF, sizeof(stdout_buf)); | |
3121 | + } | |
3122 | +#else | |
3115 | 3123 | setvbuf(stdout, NULL, _IOLBF, 0); |
3124 | +#endif | |
3116 | 3125 | |
3117 | 3126 | /* init network tun interface */ |
3118 | 3127 | if (net_fd < 0) |
... | ... | @@ -3221,6 +3230,7 @@ int main(int argc, char **argv) |
3221 | 3230 | |
3222 | 3231 | /* setup basic memory access */ |
3223 | 3232 | env->cr[0] = 0x00000033; |
3233 | + env->hflags |= HF_PE_MASK; | |
3224 | 3234 | cpu_x86_init_mmu(env); |
3225 | 3235 | |
3226 | 3236 | memset(params->idt_table, 0, sizeof(params->idt_table)); |
... | ... | @@ -3268,6 +3278,9 @@ int main(int argc, char **argv) |
3268 | 3278 | env->cr[0] = 0x60000010; |
3269 | 3279 | cpu_x86_init_mmu(env); |
3270 | 3280 | |
3281 | + cpu_register_physical_memory(0xc0000, 0x10000, 0xc0000 | IO_MEM_ROM); | |
3282 | + cpu_register_physical_memory(0xf0000, 0x10000, 0xf0000 | IO_MEM_ROM); | |
3283 | + | |
3271 | 3284 | env->idt.limit = 0xffff; |
3272 | 3285 | env->gdt.limit = 0xffff; |
3273 | 3286 | env->ldt.limit = 0xffff; | ... | ... |