ia64/xen-unstable

changeset 938:eaaf88bbc222

bitkeeper revision 1.597 (3fb26743975c08pGlW-UntXWf-IBnQ)

Merge labyrinth.cl.cam.ac.uk:/auto/groups/xeno/BK/xeno.bk
into labyrinth.cl.cam.ac.uk:/auto/anfs/scratch/labyrinth/br260/xeno.bk
author br260@labyrinth.cl.cam.ac.uk
date Wed Nov 12 17:00:51 2003 +0000 (2003-11-12)
parents 464dff9c4e15 106bc1c68738
children 151801bd4e5e
files .rootkeys BitKeeper/etc/logging_ok tools/internal/Makefile tools/internal/xi_read_console_ring.c xen/common/console.c xen/common/dom0_ops.c xen/common/kernel.c xen/include/hypervisor-ifs/dom0_ops.h xen/include/xeno/console.h
line diff
     1.1 --- a/.rootkeys	Wed Nov 12 14:46:39 2003 +0000
     1.2 +++ b/.rootkeys	Wed Nov 12 17:00:51 2003 +0000
     1.3 @@ -170,6 +170,7 @@ 3eb781fdcJ0fF7rWfzAOArW-x4-gwA tools/int
     1.4  3ec43c5dmQxGDvgJJXbV1yLxT30Y1A tools/internal/xi_helper
     1.5  3f108ad5wQm0ZaQ4GXFoUhH1W1aW9w tools/internal/xi_list.c
     1.6  3f0458aaXhD8BQAggO81gv30RQ-ifA tools/internal/xi_phys_grant.c
     1.7 +3fb14ab76b0aJu66S18CVjlemLwk4Q tools/internal/xi_read_console_ring.c
     1.8  3fa9861aBdNV1yCjfY4cLPr4Mtrpuw tools/internal/xi_restore_linux.c
     1.9  3fa98615LWZfagwDBp7XfuC-u9wi3w tools/internal/xi_save_linux.c
    1.10  3f108adb2b5OkKL6-faG3lMiOYDf_w tools/internal/xi_sched_domain.c
    1.11 @@ -239,6 +240,7 @@ 3ddb79bdff-gj-jFGKjOejeHLqL8Lg xen/commo
    1.12  3e397e66AyyD5fYraAySWuwi9uqSXg xen/common/ac_timer.c
    1.13  3ddb79bddEYJbcURvqqcx99Yl2iAhQ xen/common/block.c
    1.14  3ddb79bdrqnW93GR9gZk1OJe1qK-iQ xen/common/brlock.c
    1.15 +3fb10d07GscSWPKxBqpvNfU-dYfa0g xen/common/console.c
    1.16  3fa152581E5KhrAtqZef2Sr5NKTz4w xen/common/debug.c
    1.17  3ddb79bdLX_P6iB7ILiblRLWvebapg xen/common/dom0_ops.c
    1.18  3e6377e4i0c9GtKN65e99OtRbw3AZw xen/common/dom_mem_ops.c
     2.1 --- a/BitKeeper/etc/logging_ok	Wed Nov 12 14:46:39 2003 +0000
     2.2 +++ b/BitKeeper/etc/logging_ok	Wed Nov 12 17:00:51 2003 +0000
     2.3 @@ -6,6 +6,7 @@ akw27@labyrinth.cl.cam.ac.uk
     2.4  akw27@plucky.localdomain
     2.5  bd240@boulderdash.cl.cam.ac.uk
     2.6  bd240@labyrinth.cl.cam.ac.uk
     2.7 +br260@labyrinth.cl.cam.ac.uk
     2.8  br260@laudney.cl.cam.ac.uk
     2.9  iap10@freefall.cl.cam.ac.uk
    2.10  iap10@labyrinth.cl.cam.ac.uk
     3.1 --- a/tools/internal/Makefile	Wed Nov 12 14:46:39 2003 +0000
     3.2 +++ b/tools/internal/Makefile	Wed Nov 12 17:00:51 2003 +0000
     3.3 @@ -11,6 +11,7 @@ TARGETS  = xi_create xi_start xi_stop xi
     3.4  TARGETS += xi_phys_grant xi_list xi_save_linux xi_restore_linux
     3.5  TARGETS += xi_sched_global xi_sched_domain xi_usage xi_vif_params
     3.6  TARGETS += xi_vbd_create xi_vbd_add xi_vbd_list xi_vbd_info 
     3.7 +TARGETS += xi_read_console_ring
     3.8  INSTALL  = $(TARGETS) xi_vifinit xi_helper
     3.9  
    3.10  all: check-for-zlib $(TARGETS)
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/tools/internal/xi_read_console_ring.c	Wed Nov 12 17:00:51 2003 +0000
     4.3 @@ -0,0 +1,47 @@
     4.4 +/* 
     4.5 + * Usage: <executable> [-c]
     4.6 + */
     4.7 +
     4.8 +#include "dom0_defs.h"
     4.9 +
    4.10 +#define CONSOLE_RING_SIZE 16392
    4.11 +static char *argv0 = "read_console_ring";
    4.12 +
    4.13 +static long read_console_ring(char *str, unsigned count)
    4.14 +{
    4.15 +    int ret;
    4.16 +    dom0_op_t op;
    4.17 +
    4.18 +    op.cmd = DOM0_READCONSOLE;
    4.19 +    op.u.readconsole.str = str;
    4.20 +    op.u.readconsole.count = count;
    4.21 +
    4.22 +    ret = do_dom0_op(&op);
    4.23 +    if (ret > 0) {
    4.24 +        *(str + ret) = '\0';
    4.25 +    }
    4.26 +
    4.27 +    return ret;
    4.28 +}    
    4.29 +
    4.30 +int main(int argc, char **argv)
    4.31 +{
    4.32 +    char str[CONSOLE_RING_SIZE];
    4.33 +
    4.34 +    if ( argv[0] != NULL ) 
    4.35 +        argv0 = argv[0];
    4.36 +    
    4.37 +    if ( argc > 2) {
    4.38 +        fprintf(stderr, "Usage: %s [-r]\n", argv0);
    4.39 +        return 1;
    4.40 +    }
    4.41 +    
    4.42 +    if ( read_console_ring(str, CONSOLE_RING_SIZE) < 0 ) {
    4.43 +	printf("Read console ring error.\n");
    4.44 +	printf("%s", str);
    4.45 +        return 1;
    4.46 +    }
    4.47 +
    4.48 +    printf("%s", str);
    4.49 +    return 0;
    4.50 +}
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/xen/common/console.c	Wed Nov 12 17:00:51 2003 +0000
     5.3 @@ -0,0 +1,26 @@
     5.4 +/*
     5.5 + * console.c
     5.6 + *
     5.7 + * read domain console output buffer ring in Xen 
     5.8 + *
     5.9 + */
    5.10 +
    5.11 +#include <xeno/console.h>
    5.12 +#include <asm-i386/uaccess.h>
    5.13 +
    5.14 +void init_console_ring()
    5.15 +{
    5.16 +    console_ring.len = 0;
    5.17 +}
    5.18 +
    5.19 +long read_console_ring(char *str, unsigned int count)
    5.20 +{
    5.21 +    unsigned int len;
    5.22 +    
    5.23 +    len = (console_ring.len < count)? console_ring.len : count;
    5.24 +    
    5.25 +    if ( copy_to_user(str, console_ring.buf, len) )
    5.26 +        return -EFAULT;
    5.27 +
    5.28 +    return len;
    5.29 +}
     6.1 --- a/xen/common/dom0_ops.c	Wed Nov 12 14:46:39 2003 +0000
     6.2 +++ b/xen/common/dom0_ops.c	Wed Nov 12 17:00:51 2003 +0000
     6.3 @@ -412,6 +412,14 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
     6.4          ret = 0;
     6.5      }
     6.6      break;
     6.7 +    
     6.8 +    case DOM0_READCONSOLE:
     6.9 +    {
    6.10 +    	extern long read_console_ring(char *, unsigned int);
    6.11 +        ret = read_console_ring(op.u.readconsole.str, 
    6.12 +                         	op.u.readconsole.count); 
    6.13 +    }
    6.14 +    break;    
    6.15  
    6.16      default:
    6.17          ret = -ENOSYS;
     7.1 --- a/xen/common/kernel.c	Wed Nov 12 14:46:39 2003 +0000
     7.2 +++ b/xen/common/kernel.c	Wed Nov 12 17:00:51 2003 +0000
     7.3 @@ -156,6 +156,7 @@ void cmain (unsigned long magic, multibo
     7.4      }
     7.5  
     7.6      init_serial();
     7.7 +    init_console_ring();
     7.8      init_vga();
     7.9      cls();
    7.10  
    7.11 @@ -447,12 +448,27 @@ void putchar_console(int c) {}
    7.12  
    7.13  #endif
    7.14  
    7.15 +#ifdef CONFIG_OUTPUT_CONSOLE_RING
    7.16 +
    7.17 +void putchar_console_ring(int c)
    7.18 +{
    7.19 +    if (console_ring.len < CONSOLE_RING_SIZE)
    7.20 +        console_ring.buf[console_ring.len++] = (char)c;
    7.21 +}
    7.22 +
    7.23 +#else
    7.24 +
    7.25 +void putchar_console_ring(int c) {}
    7.26 +
    7.27 +#endif
    7.28 +
    7.29  
    7.30  static void putchar(int c)
    7.31  {
    7.32      if ( (c != '\n') && ((c < 32) || (c > 126)) ) return;
    7.33      putchar_serial(c);
    7.34      putchar_console(c);
    7.35 +    putchar_console_ring(c);
    7.36  }
    7.37  
    7.38  
     8.1 --- a/xen/include/hypervisor-ifs/dom0_ops.h	Wed Nov 12 14:46:39 2003 +0000
     8.2 +++ b/xen/include/hypervisor-ifs/dom0_ops.h	Wed Nov 12 17:00:51 2003 +0000
     8.3 @@ -185,6 +185,17 @@ typedef struct dom0_settime_st
     8.4      u64 system_time;
     8.5  } dom0_settime_t;
     8.6  
     8.7 +/*
     8.8 + * Read console content from Xen buffer ring.
     8.9 + */
    8.10 +
    8.11 +#define DOM0_READCONSOLE      19
    8.12 +typedef struct dom0_readconsole_st
    8.13 +{
    8.14 +    char *str;
    8.15 +    unsigned int count;
    8.16 +} dom0_readconsole_t;
    8.17 +
    8.18  typedef struct dom0_op_st
    8.19  {
    8.20      unsigned long cmd;
    8.21 @@ -205,6 +216,7 @@ typedef struct dom0_op_st
    8.22  	dom0_msr_t              msr;
    8.23  	dom0_debug_t            debug;
    8.24  	dom0_settime_t          settime;
    8.25 +	dom0_readconsole_t	readconsole;
    8.26      } u;
    8.27  } dom0_op_t;
    8.28  
     9.1 --- a/xen/include/xeno/console.h	Wed Nov 12 14:46:39 2003 +0000
     9.2 +++ b/xen/include/xeno/console.h	Wed Nov 12 17:00:51 2003 +0000
     9.3 @@ -37,7 +37,21 @@
     9.4   * yet, so this will do for now.
     9.5   */
     9.6  
     9.7 +#define CONFIG_OUTPUT_SERIAL  1
     9.8  #define CONFIG_OUTPUT_CONSOLE 1
     9.9 -#define CONFIG_OUTPUT_SERIAL  1
    9.10 +#define CONFIG_OUTPUT_CONSOLE_RING 1
    9.11  
    9.12  extern int opt_console;
    9.13 +
    9.14 +#define CONSOLE_RING_SIZE     16392
    9.15 +
    9.16 +typedef struct console_ring_st
    9.17 +{
    9.18 +    char buf[CONSOLE_RING_SIZE];
    9.19 +    unsigned int len;
    9.20 +} console_ring_t;
    9.21 +
    9.22 +console_ring_t console_ring;
    9.23 +
    9.24 +void init_console_ring();
    9.25 +long read_console_ring(char *str, unsigned int count);