ia64/xen-unstable

changeset 872:b45309ecb56a

bitkeeper revision 1.544 (3fa15259IWpuWetGe_175Hq5izSLnA)

hypercall jumps to pervasive debugger
author ach61@labyrinth.cl.cam.ac.uk
date Thu Oct 30 18:03:05 2003 +0000 (2003-10-30)
parents b147d210dca8
children be83edd7ec0f
files .rootkeys BitKeeper/etc/ignore xen/common/debug.c xen/common/dom0_ops.c xen/include/hypervisor-ifs/dom0_ops.h xen/include/xeno/sched.h
line diff
     1.1 --- a/.rootkeys	Thu Oct 30 17:33:18 2003 +0000
     1.2 +++ b/.rootkeys	Thu Oct 30 18:03:05 2003 +0000
     1.3 @@ -234,6 +234,7 @@ 3ddb79bdff-gj-jFGKjOejeHLqL8Lg xen/commo
     1.4  3e397e66AyyD5fYraAySWuwi9uqSXg xen/common/ac_timer.c
     1.5  3ddb79bddEYJbcURvqqcx99Yl2iAhQ xen/common/block.c
     1.6  3ddb79bdrqnW93GR9gZk1OJe1qK-iQ xen/common/brlock.c
     1.7 +3fa152581E5KhrAtqZef2Sr5NKTz4w xen/common/debug.c
     1.8  3ddb79bdLX_P6iB7ILiblRLWvebapg xen/common/dom0_ops.c
     1.9  3e6377e4i0c9GtKN65e99OtRbw3AZw xen/common/dom_mem_ops.c
    1.10  3ddb79bdYO5D8Av12NHqPeSviav7cg xen/common/domain.c
     2.1 --- a/BitKeeper/etc/ignore	Thu Oct 30 17:33:18 2003 +0000
     2.2 +++ b/BitKeeper/etc/ignore	Thu Oct 30 18:03:05 2003 +0000
     2.3 @@ -479,3 +479,4 @@ tools/misc/xen_cpuperf
     2.4  tools/misc/xen_log
     2.5  tools/misc/xen_refresh_dev
     2.6  xenolinux-2.4.22-sparse/arch/xeno/drivers/block/device
     2.7 +xen/common/debug.c~
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/xen/common/debug.c	Thu Oct 30 18:03:05 2003 +0000
     3.3 @@ -0,0 +1,84 @@
     3.4 +/*
     3.5 + * debug.c
     3.6 + *
     3.7 + * xen pervasive debugger
     3.8 + */
     3.9 +
    3.10 +#include <xeno/config.h>
    3.11 +#include <xeno/types.h>
    3.12 +#include <xeno/lib.h>
    3.13 +#include <hypervisor-ifs/dom0_ops.h>
    3.14 +#include <xeno/sched.h>
    3.15 +#include <xeno/event.h>
    3.16 +
    3.17 +#define DEBUG_TRACE
    3.18 +#ifdef DEBUG_TRACE
    3.19 +#define TRC(_x) _x
    3.20 +#else
    3.21 +#define TRC(_x)
    3.22 +#endif
    3.23 +
    3.24 +void pdb_do_debug (dom0_op_t *op)
    3.25 +{
    3.26 +    op->u.debug.status = 0;
    3.27 +    op->u.debug.out1 = op->u.debug.in2 + 10;
    3.28 +    op->u.debug.out2 = op->u.debug.in1 + 100;
    3.29 +
    3.30 +    TRC(printk("PDB: op:%c, dom:%x, in1:%x, in2:%x\n",
    3.31 +	       op->u.debug.opcode, op->u.debug.domain,
    3.32 +	       op->u.debug.in1, op->u.debug.in2));
    3.33 +
    3.34 +    if (op->u.debug.domain == 0)
    3.35 +    {
    3.36 +        op->u.debug.status = 1;
    3.37 +	return;
    3.38 +    }
    3.39 +
    3.40 +    switch (op->u.debug.opcode)
    3.41 +    {
    3.42 +        case 'r' :
    3.43 +	{
    3.44 +	    struct task_struct * p = find_domain_by_id(op->u.debug.domain);
    3.45 +	    if ( p != NULL )
    3.46 +	    {
    3.47 +	        if ( (p->flags & PF_CONSTRUCTED) != 0 )
    3.48 +		{
    3.49 +		    wake_up(p);
    3.50 +		    reschedule(p);
    3.51 +		}
    3.52 +		put_task_struct(p);
    3.53 +	    }
    3.54 +	    else
    3.55 +	    {
    3.56 +	        op->u.debug.status = 2;                    /* invalid domain */
    3.57 +	    }
    3.58 +	    break;
    3.59 +	}
    3.60 +        case 's' :
    3.61 +	{
    3.62 +	    unsigned long cpu_mask;
    3.63 +	    struct task_struct * p = find_domain_by_id(op->u.debug.domain);
    3.64 +
    3.65 +	    if (p != NULL)
    3.66 +	    {
    3.67 +	        if (p->state != TASK_SUSPENDED)
    3.68 +		{
    3.69 +		    cpu_mask = mark_hyp_event(p, _HYP_EVENT_STOP);
    3.70 +		    hyp_event_notify(cpu_mask);
    3.71 +		}
    3.72 +		put_task_struct(p);
    3.73 +	    }
    3.74 +	    else
    3.75 +	    {
    3.76 +	        op->u.debug.status = 2;                    /* invalid domain */
    3.77 +	    }
    3.78 +	    break;
    3.79 +	}
    3.80 +        default :
    3.81 +	{
    3.82 +	    printk("PDB error: unknown debug opcode %c (0x%x)\n",
    3.83 +		   op->u.debug.opcode, op->u.debug.opcode);
    3.84 +	}
    3.85 +    }
    3.86 +    return;
    3.87 +}
     4.1 --- a/xen/common/dom0_ops.c	Thu Oct 30 17:33:18 2003 +0000
     4.2 +++ b/xen/common/dom0_ops.c	Thu Oct 30 18:03:05 2003 +0000
     4.3 @@ -310,8 +310,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
     4.4  
     4.5      case DOM0_DEBUG:
     4.6      {
     4.7 -        op.u.debug.out1 = op.u.debug.in2 + 1;
     4.8 -        op.u.debug.out2 = op.u.debug.in1 + 1;
     4.9 +        pdb_do_debug(&op);
    4.10          copy_to_user(u_dom0_op, &op, sizeof(op));
    4.11          ret = 0;
    4.12      }
     5.1 --- a/xen/include/hypervisor-ifs/dom0_ops.h	Thu Oct 30 17:33:18 2003 +0000
     5.2 +++ b/xen/include/hypervisor-ifs/dom0_ops.h	Thu Oct 30 18:03:05 2003 +0000
     5.3 @@ -106,16 +106,15 @@ typedef struct dom0_msr_st
     5.4      unsigned int in1, in2;
     5.5      /* OUT variables. */
     5.6      unsigned int out1, out2;
     5.7 -
     5.8  } dom0_msr_t;
     5.9  
    5.10  typedef struct dom0_debug_st
    5.11  {
    5.12      /* IN variables. */
    5.13 -    int in1, in2;
    5.14 +    char opcode;
    5.15 +    int domain, in1, in2;
    5.16      /* OUT variables. */
    5.17 -    int out1, out2;
    5.18 -
    5.19 +    int status, out1, out2;
    5.20  } dom0_debug_t;
    5.21  
    5.22  /*
     6.1 --- a/xen/include/xeno/sched.h	Thu Oct 30 17:33:18 2003 +0000
     6.2 +++ b/xen/include/xeno/sched.h	Thu Oct 30 18:03:05 2003 +0000
     6.3 @@ -171,7 +171,7 @@ struct task_struct
     6.4   * TASK_UNINTERRUPTIBLE: Domain is blocked but may not be woken up by an
     6.5   *                       arbitrary event or timer.
     6.6   * TASK_WAIT:            Domains CPU allocation expired.
     6.7 - * TASK_SUSPENDED:       Domain is in supsended state (eg. start of day)
     6.8 + * TASK_SUSPENDED:       Domain is suspended (startofday or pervasive debugger)
     6.9   * TASK_DYING:           Domain is about to cross over to the land of the dead.
    6.10   *
    6.11   * If you update these then please update the mapping to text names in