Monitor multiplexing
I would like to submit the monitor multiplexing patch again. It is ported against the latest CVS.
It allows adding monitor capabilities like stdio but with tcp for instance, and the escape character can be changed from the default.
Index: monitor.c
===================================================================
RCS file: /sources/qemu/qemu/monitor.c,v
retrieving revision 1.64
monitor.c +28 -4
@@ -54,7 +54,8 @@const char *help; } term_cmd_t; -static CharDriverState *monitor_hd; +#define MAX_MON 4 +static CharDriverState *monitor_hd[MAX_MON ];static int hide_banner;static term_cmd_t term_cmds[];
@@ -69,8 +70,11 @@void term_flush (void ) { +int i;if (term_outbuf_index >0 ) { -qemu_chr_write (monitor_hd, term_outbuf, term_outbuf_index); +for (i =0 ; i <MAX_MON ; i++) +if (monitor_hd[i] && monitor_hd[i]->focus ==0 ) +qemu_chr_write (monitor_hd[i], term_outbuf, term_outbuf_index); term_outbuf_index =0 ; } }
@@ -2452,9 +2456,25 @@monitor_start_input (); } +static int is_first_init =1 ; +void monitor_init (CharDriverState *hd,int show_banner) { - monitor_hd = hd; +int i; + +if (is_first_init) { +for (i =0 ; i <MAX_MON ; i++) { + monitor_hd[i] =NULL ; + } + is_first_init =0 ; + } +for (i =0 ; i <MAX_MON ; i++) { +if (monitor_hd[i] ==NULL ) { + monitor_hd[i] = hd; +break ; + } + } + hide_banner = !show_banner;qemu_chr_add_handlers (hd, term_can_read, term_read, term_event,NULL );
@@ -2475,8 +2495,12 @@void monitor_readline (const char *prompt,int is_password,char *buf,int buf_size) { +int i; +if (is_password) { -qemu_chr_send_event (monitor_hd,CHR_EVENT_FOCUS ); +for (i =0 ; i <MAX_MON ; i++) +if (monitor_hd[i] && monitor_hd[i]->focus ==0 ) +qemu_chr_send_event (monitor_hd[i],CHR_EVENT_FOCUS ); }readline_start (prompt, is_password, monitor_readline_cb,NULL ); monitor_readline_buf = buf;
Index: qemu-doc.texi
===================================================================
RCS file: /sources/qemu/qemu/qemu-doc.texi,v
retrieving revision 1.128
qemu-doc.texi +27 -0
@@ -610,6 +610,18 @@ same as if you had specified @code{-serial tcp} except the unix domain socket @var{path} is used for connections. +@item mon:dev_string +This is a special option to allow the monitor to be multiplexed onto +another serial port. The monitor is accessed with key sequence of +@key{Control-a} and then pressing @key{c}. See monitor access +@ref{pcsys_keys} in the -nographic section for more keys. +@var{dev_string} should be any one of the serial devices specified +above. An example to multiplex the monitor onto a server telnet server +listening on port 4444 would be: +@table @code +@item -serial mon:telnet::4444,server,nowait +@end table + @end table @item -parallel dev
@@ -629,6 +641,19 @@ The default device is @code{vc} in graphical mode and @code{stdio} in non graphical mode. +@item -echr numeric_ascii_value +Change the escape character used for switching to the monitor when using +monitor and serial sharing. The default is @code{0x01} when using the +@code{-nographic} option. @code{0x01} is equal to pressing +@code{Control-a}. You can select a different character from the ascii +control keys where 1 through 26 map to Control-a through Control-z. For +instance you could use the either of the following to change the escape +character to Control-t. +@table @code +@item -echr 0x14 +@item -echr 20 +@end table + @item -s Wait gdb connection to port 1234 (@pxref{gdb_usage}). @item -p port
@@ -711,6 +736,8 @@ Exit emulator @item Ctrl-a s Save disk data back to file (if -snapshot) +@item Ctrl-a t +toggle console timestamps @item Ctrl-a b Send break (magic sysrq in Linux) @item Ctrl-a c
Index: vl.c
===================================================================
RCS file: /sources/qemu/qemu/vl.c,v
retrieving revision 1.248
vl.c +279 -162
525 lines not on this page · raw message
Index: vl.h
===================================================================
RCS file: /sources/qemu/qemu/vl.h,v
retrieving revision 1.184
vl.h +1 -0
@@ -300,6 +300,7 @@void (*chr_send_event)(struct CharDriverState *chr,int event);void (*chr_close)(struct CharDriverState *chr);void *opaque; +int focus;QEMUBH *bh; } CharDriverState;