ia64/xen-unstable

changeset 4139:d4b85d775de2

bitkeeper revision 1.1236.32.1 (4235db7asX6jSkYD5v9LR5aXTXVuVg)

Bug fix for debugtrace_dump stuff.

Signed-off-by: michael.fetterman@cl.cam.ac.uk
author mafetter@fleming.research
date Mon Mar 14 18:44:10 2005 +0000 (2005-03-14)
parents e93d8f53eabb
children 67c3463e70f1
files xen/drivers/char/console.c
line diff
     1.1 --- a/xen/drivers/char/console.c	Fri Feb 25 17:06:27 2005 +0000
     1.2 +++ b/xen/drivers/char/console.c	Mon Mar 14 18:44:10 2005 +0000
     1.3 @@ -511,7 +511,10 @@ void debugtrace_dump(void)
     1.4  
     1.5      spin_lock_irqsave(&debugtrace_lock, flags);
     1.6  
     1.7 +    printk("debugtrace_dump() starting\n");
     1.8 +
     1.9      /* Print oldest portion of the ring. */
    1.10 +    ASSERT(debugtrace_buf[debugtrace_bytes - 1] == 0);
    1.11      serial_puts(sercon_handle, &debugtrace_buf[debugtrace_prd]);
    1.12  
    1.13      /* Print youngest portion of the ring. */
    1.14 @@ -520,6 +523,8 @@ void debugtrace_dump(void)
    1.15  
    1.16      memset(debugtrace_buf, '\0', debugtrace_bytes);
    1.17  
    1.18 +    printk("debugtrace_dump() finished\n");
    1.19 +
    1.20      spin_unlock_irqrestore(&debugtrace_lock, flags);
    1.21  
    1.22      watchdog_on = _watchdog_on;
    1.23 @@ -538,6 +543,8 @@ void debugtrace_printk(const char *fmt, 
    1.24  
    1.25      spin_lock_irqsave(&debugtrace_lock, flags);
    1.26  
    1.27 +    ASSERT(debugtrace_buf[debugtrace_bytes - 1] == 0);
    1.28 +
    1.29      va_start(args, fmt);
    1.30      (void)vsnprintf(buf, sizeof(buf), fmt, args);
    1.31      va_end(args);
    1.32 @@ -563,20 +570,24 @@ void debugtrace_printk(const char *fmt, 
    1.33  static int __init debugtrace_init(void)
    1.34  {
    1.35      int order;
    1.36 -    unsigned int kbytes;
    1.37 +    unsigned int kbytes, bytes;
    1.38  
    1.39      /* Round size down to next power of two. */
    1.40      while ( (kbytes = (debugtrace_kilobytes & (debugtrace_kilobytes-1))) != 0 )
    1.41          debugtrace_kilobytes = kbytes;
    1.42  
    1.43 -    debugtrace_bytes = debugtrace_kilobytes << 10;
    1.44 -    if ( debugtrace_bytes == 0 )
    1.45 +    bytes = debugtrace_kilobytes << 10;
    1.46 +    if ( bytes == 0 )
    1.47          return 0;
    1.48  
    1.49 -    order = get_order(debugtrace_bytes);
    1.50 +    order = get_order(bytes);
    1.51      debugtrace_buf = (unsigned char *)alloc_xenheap_pages(order);
    1.52      ASSERT(debugtrace_buf != NULL);
    1.53  
    1.54 +    memset(debugtrace_buf, '\0', bytes);
    1.55 +
    1.56 +    debugtrace_bytes = bytes;
    1.57 +
    1.58      return 0;
    1.59  }
    1.60  __initcall(debugtrace_init);