Commit a2f659ee48edc5de6f7ca1064a4f2af6227323a6
1 parent
d7d02e3c
new reset API - shutdown support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@939 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
16 additions
and
0 deletions
hw/pc.c
... | ... | @@ -217,6 +217,9 @@ static uint32_t ioport92_read(void *opaque, uint32_t addr) |
217 | 217 | |
218 | 218 | void bochs_bios_write(void *opaque, uint32_t addr, uint32_t val) |
219 | 219 | { |
220 | + static const char shutdown_str[8] = "Shutdown"; | |
221 | + static int shutdown_index = 0; | |
222 | + | |
220 | 223 | switch(addr) { |
221 | 224 | /* Bochs BIOS messages */ |
222 | 225 | case 0x400: |
... | ... | @@ -229,6 +232,18 @@ void bochs_bios_write(void *opaque, uint32_t addr, uint32_t val) |
229 | 232 | fprintf(stderr, "%c", val); |
230 | 233 | #endif |
231 | 234 | break; |
235 | + case 0x8900: | |
236 | + /* same as Bochs power off */ | |
237 | + if (val == shutdown_str[shutdown_index]) { | |
238 | + shutdown_index++; | |
239 | + if (shutdown_index == 8) { | |
240 | + shutdown_index = 0; | |
241 | + qemu_system_shutdown_request(); | |
242 | + } | |
243 | + } else { | |
244 | + shutdown_index = 0; | |
245 | + } | |
246 | + break; | |
232 | 247 | |
233 | 248 | /* LGPL'ed VGA BIOS messages */ |
234 | 249 | case 0x501: |
... | ... | @@ -250,6 +265,7 @@ void bochs_bios_init(void) |
250 | 265 | register_ioport_write(0x401, 1, 2, bochs_bios_write, NULL); |
251 | 266 | register_ioport_write(0x402, 1, 1, bochs_bios_write, NULL); |
252 | 267 | register_ioport_write(0x403, 1, 1, bochs_bios_write, NULL); |
268 | + register_ioport_write(0x8900, 1, 1, bochs_bios_write, NULL); | |
253 | 269 | |
254 | 270 | register_ioport_write(0x501, 1, 2, bochs_bios_write, NULL); |
255 | 271 | register_ioport_write(0x502, 1, 2, bochs_bios_write, NULL); | ... | ... |