summaryrefslogtreecommitdiffstats
path: root/monitor.c
Commit message (Collapse)AuthorAgeFilesLines
* monitor: Convert do_closefd() to QObjectLuiz Capitulino2009-10-271-1/+1
| | | | | | | Note that errors are not being converted yet. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Convert do_getfd() to QObjectLuiz Capitulino2009-10-271-1/+1
| | | | | | | Note that errors are not being converted yet. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Convert do_eject() to QObjectLuiz Capitulino2009-10-271-1/+1
| | | | | | | Note that errors are not being converted yet. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Convert do_physical_memory_save() to QObjectLuiz Capitulino2009-10-271-1/+2
| | | | | | | Note that errors are not being converted yet. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Convert do_memory_save() to QObjectLuiz Capitulino2009-10-271-1/+1
| | | | | | | Note that errors are not being converted yet. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* char: rename CHR_EVENT_RESET to CHR_EVENT_OPENEDAmit Shah2009-10-211-1/+1
| | | | | | | | | The char event RESET is emitted when a char device is opened. Give it a better name. Patchworks-ID: 35287 Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Convert do_info_cpus() to QObjectLuiz Capitulino2009-10-081-14/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | Each CPU information is stored in a QDict and the returned QObject is a QList of all CPUs. The QDict contains the following information: - "CPU": cpu index - "current": "yes" or "no" - "pc": current PC - "halted": "yes" or "no" The user output in the Monitor should not change and the future monitor protocol is expected to emit something like: [ { "CPU": 0, "current": "yes", "pc": 0x..., "halted": "no" }, { "CPU": 1, "current": "no", "pc": 0x..., "halted": "yes" } ] which corresponds to the following user output: * CPU #0: pc=0x00000000fffffff0 CPU #1: pc=0x00000000fffffff0 (halted) Patchworks-ID: 35352 Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Convert do_info_balloon() to QObjectLuiz Capitulino2009-10-081-3/+13
| | | | | | | | | | | | | On success return a QInt with the balloon's value. This also introduces monitor_print_balloon() to print the balloon information in the user protocol. Please, note that errors are not being converted yet. Patchworks-ID: 35351 Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Convert do_info_version() to QObjectLuiz Capitulino2009-10-081-3/+25
| | | | | | | | | | | The returned data is always a QString. Also introduces monitor_print_qobject(), which can be used as a standard way to print QObjects in the user protocol format. Patchworks-ID: 35350 Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Convert do_balloon() to QObjectLuiz Capitulino2009-10-081-2/+4
| | | | | | | | | It is important to note that it never fails, as big refactoring of the virtio code would be needed to get the proper error code. Patchworks-ID: 35349 Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Convert do_cont() to QObjectLuiz Capitulino2009-10-081-2/+5
| | | | | | | | | | | Appropriate error handling support will be needed to have encrypted images working under the future machine protocol, but this initial conversion will work with the current user protocol. Patchworks-ID: 35348 Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Convert do_system_powerdown() to QObjectLuiz Capitulino2009-10-081-1/+5
| | | | | | Patchworks-ID: 35346 Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Convert do_system_reset() to QObjectLuiz Capitulino2009-10-081-1/+5
| | | | | | Patchworks-ID: 35347 Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Convert do_stop() to QObjectLuiz Capitulino2009-10-081-1/+4
| | | | | | Patchworks-ID: 35343 Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Convert do_quit() do QObjectLuiz Capitulino2009-10-081-1/+4
| | | | | | Patchworks-ID: 35345 Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: do_info(): handle new and old info handlersLuiz Capitulino2009-10-081-7/+22
| | | | | | | | | | | | | | | | | | | | | | | | | do_info() is special, its job is to call 'info handlers'. This is similar to what monitor_handle_command() does, therefore do_info() also has to distinguish among new and old style info handlers. This commit converts do_info() to the new QObject style and makes the appropriate changes so that it can handle both info handlers styles. In the future, when all handlers are converted to QObject's style, it will be possible to share more code with monitor_handle_command(). This commit also introduces a new function called monitor_user_noop(), it should be used by handlers which do not have data to print. This is the case of do_info(). Patchworks-ID: 35341 Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Handle new and old style handlersLuiz Capitulino2009-10-081-3/+23
| | | | | | | | | | | | | | | | | | | | This commit changes monitor_handle_command() to support old style _and_ new style handlers. New style handlers are protocol independent, they return their data to the Monitor, which in turn decides how to print them (ie. user protocol vs. machine protocol). Converted handlers will use the 'user_print' member of 'mon_cmd_t' to define its user protocol function, which will be called to print data in the user protocol format. Handlers which don't have 'user_print' defined are not converted and are handled as usual. Patchworks-ID: 35340 Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Add user_print() to mon_cmd_tLuiz Capitulino2009-10-081-0/+1
| | | | | | | | | | | | This new struct member will store a pointer to a function that should be used to output data in the user protocol format. It will also serve as a flag to say if a given handler has already been converted to the new QObject style. Patchworks-ID: 35339 Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: union for command handlersLuiz Capitulino2009-10-081-7/+2
| | | | | | | | | | | | This commits adds a new union member to mon_cmd_t for command handlers and convert monitor_handle_command() and qemu-monitor.hx to use it. This improves type safety. Patchworks-ID: 35337 Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: union for info handlersLuiz Capitulino2009-10-081-38/+39
| | | | | | | | | | | | | This commit adds a union to mon_cmd_t for info handlers and converts do_info() and info_cmds[] array to use it. This improves type safety. Next commit will convert command handlers. Patchworks-ID: 35336 Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Convert mon_cmd_t initializations to C99 styleLuiz Capitulino2009-10-081-70/+248
| | | | | | Patchworks-ID: 35335 Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Reorganize option rom (+linux kernel) loading.Gerd Hoffmann2009-10-061-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds infrastructure to maintain memory regions which must be restored on reset. That includes roms (vga bios and option roms on pc), but is also used when loading linux kernels directly. Features: - loading files is supported. - passing blobs is supported. - target address range is supported (for optionrom area). - fixed target memory address is supported (linux kernel). New in v2: - writes to ROM are done only at initial boot. - also handle aout and uimage loaders. - drop unused fread_targphys() function. The final memory layout is created once all memory regions are registered. The option roms get addresses assigned and the registered regions are checked against overlaps. Finally all data is copyed to the guest memory. Advantages: (1) Filling memory on initial boot and on reset takes the same code path, making reset more robust. (2) The need to keep track of the option rom load address is gone. (3) Due to (2) option roms can be loaded outside pc_init(). This allows to move the pxe rom loading into the nic drivers for example. Additional bonus: There is a 'info roms' monitor command now. The patch also switches over pc.c and removes the option_rom_setup_reset() and load_option_rom() functions. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Revert "Get rid of _t suffix"Anthony Liguori2009-10-011-27/+27
| | | | | | | | | | | | In the very least, a change like this requires discussion on the list. The naming convention is goofy and it causes a massive merge problem. Something like this _must_ be presented on the list first so people can provide input and cope with it. This reverts commit 99a0949b720a0936da2052cb9a46db04ffc6db29. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Get rid of _t suffixmalc2009-10-011-27/+27
| | | | | | | Some not so obvious bits, slirp and Xen were left alone for the time being. Signed-off-by: malc <av1474@comtv.ru>
* Fix build with profiler enabledAurelien Jarno2009-09-301-0/+3
| | | | | | Broken by 4a1418e07bdcfaa3177739e04707ecaec75d89e1 Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* ioports: remove unused env parameter and compile only onceBlue Swirl2009-09-201-7/+7
| | | | | | | The CPU state parameter is not used, remove it and adjust callers. Now we can compile ioport.c once for all targets. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Fix sys-queue.h conflict for goodBlue Swirl2009-09-121-16/+16
| | | | | | | | | | | | | | | Problem: Our file sys-queue.h is a copy of the BSD file, but there are some additions and it's not entirely compatible. Because of that, there have been conflicts with system headers on BSD systems. Some hacks have been introduced in the commits 15cc9235840a22c289edbe064a9b3c19c5f49896, f40d753718c72693c5f520f0d9899f6e50395e94, 96555a96d724016e13190b28cffa3bc929ac60dc and 3990d09adf4463eca200ad964cc55643c33feb50 but the fixes were fragile. Solution: Avoid the conflict entirely by renaming the functions and the file. Revert the previous hacks. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Unexport ticks_per_sec variable. Create get_ticks_per_sec() functionJuan Quintela2009-09-111-3/+3
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: fix muxingGerd Hoffmann2009-09-111-11/+24
| | | | | | | | | | | | make the mux driver send mux_in and mux_out events when switching focus while hooking up more handlers. stop using CharDriverState->focus in monitor.c, track state using the mux events instead. This also removes the implicit assumtion that a muxed monitor allways has mux channel 0. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Update supported types documentationLuiz Capitulino2009-09-041-1/+3
| | | | | Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: fail when 'i' type is greater than 32-bitLuiz Capitulino2009-09-041-0/+6
| | | | | | | | | | | The 'i' argument type is for 32-bit only and most handlers will use an 'int' to store its value. It's better to fail gracefully when the user enters a value greater than 32-bit than to get subtle casting bugs. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Drop args[] handling codeLuiz Capitulino2009-09-041-61/+10
| | | | | | | | This commit drops all the code used to handle the 'args[]' array, as now we use a dictionary to pass arguments. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Drop str_allocated[]Luiz Capitulino2009-09-041-11/+2
| | | | | | | | It's not used anymore, as QDict is now used to handle string memory allocation/deallocation. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Drop unused macrosLuiz Capitulino2009-09-041-12/+0
| | | | | | | | GET_TLONG() and GET_TPHYSADDR() are not needed anymore, QInt can handle such conversions. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Split monitor_handle_command()Luiz Capitulino2009-09-041-34/+39
| | | | | | | | | | | | In order to help the integration with unit-tests and having a better design, this commit splits monitor_handle_command() into two parts. The parsing code is moved to a function called monitor_parse_command(), while allocating memory and calling the handler is still done by monitor_handle_command(). Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Port handler_10 to use QDictLuiz Capitulino2009-09-041-18/+8
| | | | | | | | This commit ports command handlers that receive ten arguments to use the new monitor's dictionary. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Drop handler_8 and handler_9Luiz Capitulino2009-09-041-16/+0
| | | | | | | | | | | Commit 79c4f6b08009a1d23177c2be8bd003253cf3686a added handler_8 and handler_9 handling, but there isn't any command handler with those number of arguments. Just drop them. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Port handler_7 to use QDictLuiz Capitulino2009-09-041-12/+10
| | | | | | | | This commit ports command handlers that receive seven arguments to use the new monitor's dictionary. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Port handler_6 to use QDictLuiz Capitulino2009-09-041-8/+6
| | | | | | | | This commit ports command handlers that receive six arguments to use the new monitor's dictionary. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Port handler_5 to use QDictLuiz Capitulino2009-09-041-21/+28
| | | | | | | | | | This commit ports command handlers that receive five arguments to use the new monitor's dictionary. Note that GET_TLONG() and GET_TPHYSADDR() macros are not used anymore. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Port handler_4 to use QDictLuiz Capitulino2009-09-041-13/+9
| | | | | | | | | | This commit ports command handlers that receive four arguments to use the new monitor's dictionary. Note that GET_TLONG() and GET_TPHYSADDR() macros are not used anymore. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Port handler_3 to use QDictLuiz Capitulino2009-09-041-11/+13
| | | | | | | | This commit ports command handlers that receive three arguments to use the new monitor's dictionary. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Port handler_2 to use QDictLuiz Capitulino2009-09-041-10/+13
| | | | | | | | This commit ports command handlers that receive two arguments to use the new monitor's dictionary. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Port handler_1 to use QDictLuiz Capitulino2009-09-041-28/+41
| | | | | | | | This commit ports command handlers that receive one argument to use the new monitor's dictionary. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Port handler_0 to use QDictLuiz Capitulino2009-09-041-9/+9
| | | | | | | | | | | | This commit ports command handlers that receive no arguments to use the new monitor's dictionary. It might seem no sense to do this, as the handlers have no arguments, but at the end of this porting work all handlers will have the same structure. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Setup a QDict with arguments to handlersLuiz Capitulino2009-09-041-0/+18
| | | | | | | | | | | | | | | | | | | | With this commit monitor_handle_command() will be able to setup a QDict with arguments to command handlers. However, the current 'args[]' method is still being used, next changes will port commands to get their arguments from the dictionary. Two changes are worth noting: 1. The '/' argument type always adds the following standard keys in the dictionary: 'count', 'format' and 'size'. This way, the argument name used in the 'args_type' string doesn't matter 2. The optional argument type '?' doesn't need to pass the additional 'has_arg' argument, hanlders can do the same check with qdict_haskey() Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: New format for handlers argument typesLuiz Capitulino2009-09-041-5/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current handlers argument types, as defined in qemu-monitor.hx file, are a sequence of chars where each one represents one argument type of the command handler. The number of chars is also used to know how many arguments a given handler accepts. This commit defines a new format, which makes mandatory the use of a name for each argument. For example, do_eject() command handler is currently defined as: { "eject", "-fB", do_eject, ... } With the new format it becomes: { "eject", "force:-f,filename:B", do_eject, ... } This way the Monitor will be capable of setting up a dictionary, using each argument's name as the key and the argument itself as the value. This commit also adds two new functions: key_get_info() and next_arg_type(), both are used to parse the new format. Currently key_get_info() consumes the 'key' part of the new format and discards it, this way the current parsing code is not affected by this change. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Add wrappers to functions used by the MonitorLuiz Capitulino2009-09-041-0/+5
| | | | | | | | | | | | | | | | | | | | | Some functions exported to be used by the Monitor as command handlers are also called in other places as regular functions. When those functions got ported to use the Monitor dictionary to pass argments, the callers will have to setup a dictionary to be able to call them. To avoid this problem, this commit add wrappers to those functions, so that we change the wrapper to accept the dictionary, letting the current functions as is. The following wrappers are being added: - do_help_cmd() - do_pci_device_hot_remove() Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Fix breakage due to __threadBlue Swirl2009-08-311-1/+1
| | | | | | Thread-local storage is not supported on all hosts. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* add qemu_error() + friendsGerd Hoffmann2009-08-271-1/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds some functions for error reporting to address the problem that error messages should be routed to different destinations depending on the context of the caller, i.e. monitor command errors should go to the monitor, command line errors to stderr. qemu_error() is a printf-like function to report errors. qemu_errors_to_file() and qemu_errors_to_mon() switch the destination for the error message to the specified file or monitor. When setting a new destination the old one will be kept. One can switch back using qemu_errors_to_previous(). i.e. it works like a stack. main() calls qemu_errors_to_file(stderr), so errors go to stderr by default. monitor callbacks are wrapped into qemu_errors_to_mon() + qemu_errors_to_previous(), so any errors triggered by monitor commands will go to the monitor. Each thread has its own error message destination. qemu-kvm probably should add a qemu_errors_to_file(stderr) call to the i/o-thread initialization code. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
OpenPOWER on IntegriCloud