The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/port/rdb.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 #include "u.h"
    2 #include "../port/lib.h"
    3 #include "mem.h"
    4 #include "dat.h"
    5 #include "fns.h"
    6 #include "io.h"
    7 #include "ureg.h"
    8 
    9 #define DBG     if(0)scrprint
   10 #pragma varargck argpos scrprint 1
   11 static Ureg ureg;
   12 
   13 static void
   14 scrprint(char *fmt, ...)
   15 {
   16         char buf[128];
   17         va_list va;
   18         int n;
   19 
   20         va_start(va, fmt);
   21         n = vseprint(buf, buf+sizeof buf, fmt, va)-buf;
   22         va_end(va);
   23         putstrn(buf, n);
   24 }
   25 
   26 static char*
   27 getline(void)
   28 {
   29         static char buf[128];
   30         int i, c;
   31 
   32         for(;;){
   33                 for(i=0; i<nelem(buf) && (c=uartgetc()) != '\n'; i++){
   34                         DBG("%c...", c);
   35                         buf[i] = c;
   36                 }
   37 
   38                 if(i < nelem(buf)){
   39                         buf[i] = 0;
   40                         return buf;
   41                 }
   42         }
   43 }
   44 
   45 static void*
   46 addr(char *s, Ureg *ureg, char **p)
   47 {
   48         ulong a;
   49 
   50         a = strtoul(s, p, 16);
   51         if(a < sizeof(Ureg))
   52                 return ((uchar*)ureg)+a;
   53         return (void*)a;
   54 }
   55 
   56 static void
   57 talkrdb(Ureg *ureg)
   58 {
   59         uchar *a;
   60         char *p, *req;
   61 
   62         serialoq = nil;         /* turn off serial console */
   63         kprintoq = nil;         /* turn off /dev/kprint if active */
   64 //      scrprint("Plan 9 debugger\n");
   65         iprint("Edebugger reset\n");
   66         for(;;){
   67                 req = getline();
   68                 switch(*req){
   69                 case 'r':
   70                         a = addr(req+1, ureg, nil);
   71                         DBG("read %p\n", a);
   72                         iprint("R%.8lux %.2ux %.2ux %.2ux %.2ux\n",
   73                                 strtoul(req+1, 0, 16), a[0], a[1], a[2], a[3]);
   74                         break;
   75 
   76                 case 'w':
   77                         a = addr(req+1, ureg, &p);
   78                         *(ulong*)a = strtoul(p, nil, 16);
   79                         iprint("W\n");
   80                         break;
   81 /*
   82  *              case Tmput:
   83                         n = min[4];
   84                         if(n > 4){
   85                                 mesg(Rerr, Ecount);
   86                                 break;
   87                         }
   88                         a = addr(min+0);
   89                         scrprint("mput %.8lux\n", a);
   90                         memmove(a, min+5, n);
   91                         mesg(Rmput, mout);
   92                         break;
   93  *
   94  */
   95                 default:
   96                         DBG("unknown %c\n", *req);
   97                         iprint("Eunknown message\n");
   98                         break;
   99                 }
  100         }
  101 }
  102 
  103 void
  104 rdb(void)
  105 {
  106         splhi();
  107         iprint("rdb...");
  108         callwithureg(talkrdb);
  109 }

Cache object: 2609f77da055c3b29e479276b0b52314


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.