亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? generic-stub.c

?? 開放源碼實時操作系統源碼.
?? C
?? 第 1 頁 / 共 4 頁
字號:
#include "board.h"

#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS

/* Eventually, this should default to ON */
#if USE_GDBSTUB_PROTOTYPES
#include "stub-tservice.h"
#include "generic-stub.h"
#else
// Function declarations (prevents compiler warnings)
int stubhex (unsigned char ch);
static void unlock_thread_scheduler (void);
static uint32 crc32 (target_addr_t mem, int len, uint32 crc);
#endif

#include "thread-pkts.h"
  /* Defines function macros if thread support is not selected in board.h */

#ifdef __ECOS__
char GDB_stubs_version[] CYGBLD_ATTRIB_WEAK = 
    "eCos GDB stubs - built " __DATE__ " / " __TIME__;
#endif

/****************************************************************************

                THIS SOFTWARE IS NOT COPYRIGHTED

   HP offers the following for use in the public domain.  HP makes no
   warranty with regard to the software or it's performance and the
   user accepts the software "AS IS" with all faults.

   HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD
   TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES
   OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

****************************************************************************/

/****************************************************************************
 *  Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $
 *
 *  Module name: remcom.c $
 *  Revision: 1.34 $
 *  Date: 91/03/09 12:29:49 $
 *  Contributor:     Lake Stevens Instrument Division$
 *
 *  Description:     low level support for gdb debugger. $
 *
 *  Considerations:  only works on target hardware $
 *
 *  Written by:      Glenn Engel $
 *  ModuleState:     Experimental $
 *
 *  NOTES:           See Below $
 *
 *  Modified for SPARC by Stu Grossman, Red Hat.
 *  Modified for generic CygMON stub support by Bob Manson, Red Hat.
 *
 *  To enable debugger support, two things need to happen.  One, a
 *  call to set_debug_traps () is necessary in order to allow any breakpoints
 *  or error conditions to be properly intercepted and reported to gdb.
 *  Two, a breakpoint needs to be generated to begin communication.  This
 *  is most easily accomplished by a call to breakpoint ().  Breakpoint ()
 *  simulates a breakpoint by executing a trap #1.
 *
 *************
 *
 *    The following gdb commands are supported:
 *
 * command          function                               Return value
 *
 *    g             return the value of the CPU registers  hex data or ENN
 *    G             set the value of the CPU registers     OK or ENN
 *
 *    mAA..AA,LLLL  Read LLLL bytes at address AA..AA      hex data or ENN
 *    MAA..AA,LLLL: Write LLLL bytes at address AA.AA      OK or ENN
 *
 *    c             Resume at current address              SNN   ( signal NN)
 *    cAA..AA       Continue at address AA..AA             SNN
 *
 *    s             Step one instruction                   SNN
 *    sAA..AA       Step one instruction from AA..AA       SNN
 *
 *    k             kill
 *
 *    ?             What was the last sigval ?             SNN   (signal NN)
 *
 *    bBB..BB       Set baud rate to BB..BB                OK or BNN, then sets
 *                                                         baud rate
 *
 * All commands and responses are sent with a packet which includes a
 * checksum.  A packet consists of
 *
 * $<packet info>#<checksum>.
 *
 * where
 * <packet info> :: <characters representing the command or response>
 * <checksum>    :: < two hex digits computed as modulo 256 sum of <packetinfo>>
 *
 * When a packet is received, it is first acknowledged with either '+' or '-'.
 * '+' indicates a successful transfer.  '-' indicates a failed transfer.
 *
 * Example:
 *
 * Host:                  Reply:
 * $m0,10#2a               +$00010203040506070809101112131415#42
 *
 ****************************************************************************/

#ifdef __ECOS__

// We cannot share memcpy and memset with the rest of the system since
// the user may want to step through it.
static inline void*
_memcpy(void* dest, void* src, int size)
{
    unsigned char* __d = (unsigned char*) dest;
    unsigned char* __s = (unsigned char*) src;
    
    while(size--)
        *__d++ = *__s++;

    return dest;
}

static inline void*
_memset(void* s, int c, int size)
{
    unsigned char* __s = (unsigned char*) s;
    unsigned char __c = (unsigned char) c;
    
    while(size--)
        *__s++ = __c;

    return s;
}

#else
#include <string.h>
#include <signal.h>
#define _memcpy memcpy
#define _memset memset
#endif // __ECOS__

/************************************************************************/
/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/
/* at least NUMREGBYTES*2 are needed for register packets */
#ifdef __ECOS__
#ifdef NUMREGBYTES
#define BUFMAX (32 + (NUMREGBYTES*2))
#else
#define BUFMAX 2048
#endif
#else
#define BUFMAX 2048
#endif

static int initialized = 0;     /* !0 means we've been initialized */

static int process_exception (int sigval);
static void do_nothing (void); /* and do it gracefully */
static int syscall_do_nothing (int);

#ifdef CYGSEM_ECOS_SUPPORTS_PROGRAM_ARGS
void __free_program_args (void);
static char *__add_program_arg (int argnum, uint32 arglen);
#endif

volatile __PFI __process_exception_vec = process_exception;
volatile __PFV __process_exit_vec = do_nothing;
volatile __PFI __process_syscall_vec = syscall_do_nothing;
volatile __PFI __process_signal_vec = NULL;
volatile __PFV __init_vec = NULL;
volatile __PFV __cleanup_vec = NULL;

static const char hexchars[] = "0123456789abcdef";

static void process_query (char *pkt);
static void process_set   (char *pkt);

char
__tohex (int c)
{
  return hexchars [c & 15];
}

#define __tohex(c) hexchars[(c) & 15]

#ifndef NUMREGS_GDB
#define NUMREGS_GDB NUMREGS
#endif

/* One pushback character. */
int ungot_char = -1;

static int
readDebugChar (void)
{
  if (ungot_char > 0)
    {
      int result = ungot_char;
      ungot_char = -1;
      return result;
    }
  else
    return getDebugChar ();
}

/* Convert ch from a hex digit to an int. */

int
stubhex (ch)
     unsigned char ch;
{
  if (ch >= 'a' && ch <= 'f')
    return ch-'a'+10;
  if (ch >= '0' && ch <= '9')
    return ch-'0';
  if (ch >= 'A' && ch <= 'F')
    return ch-'A'+10;
  return -1;
}

void
__getpacket (buffer)
     char *buffer;
{
    struct gdb_packet packet;
    int res;

    packet.state = 0;
    packet.contents = buffer;
    packet.err = 0;
    while ((res = __add_char_to_packet (readDebugChar () & 0xff, &packet)) != 1) {
        if (res == -2) {
            putDebugChar ('-'); // Tell host packet was not processed
            // Reset for the next packet
            packet.state = 0;
            packet.err = 0;
        }
    }
}

int
__add_char_to_packet (ch, packet)
     unsigned int ch;
     struct gdb_packet *packet;
{
  if (packet->state == 0)
    {
      if (ch == '$')
        {
          packet->state = 1;
          packet->length = 0;
          packet->checksum = 0;
          packet->xmitcsum = -1;
        }
      return 0;
    }
  
  if (packet->state == 1)
    {
      if (packet->length == BUFMAX)
        {
          packet->state = 0;
          packet->err = 1;
        }
      else if (ch == '#')
        {
          packet->contents[packet->length] = 0;
          packet->state = 2;
        }
      else 
        {
          packet->checksum += ch;
          packet->contents[packet->length++] = ch;
        }
      return 0;
    }

  if (packet->state == 2)
    {
      packet->xmitcsum = stubhex (ch) << 4;
      packet->state = 3;
      return 0;
    }

  if (packet->state == 3)
    {
      packet->xmitcsum |= stubhex (ch);
      if (packet->err) {
          // Packet was too long - just tell the consumer
          return -2;
      }
      if ((packet->checksum & 255) != packet->xmitcsum)
        {
          putDebugChar ('-');   /* failed checksum */
          packet->state = 0;
          return -1;
        }
      else
        {
          putDebugChar ('+'); /* successful transfer */
          /* if a sequence char is present, reply the sequence ID */
          if (packet->contents[2] == ':')
            {
              uint32 count = packet->length;
              uint32 i;
              putDebugChar (packet->contents[0]);
              putDebugChar (packet->contents[1]);
              /* remove sequence chars from buffer */
              for (i=3; i <= count; i++)
                packet->contents[i-3] = packet->contents[i];
            }
          return 1;
        }
    }
  /* We should never get here. */
  packet->state = 0;
  return -1;
}

/* send the packet in buffer.  */

void
__putpacket (buffer)
     char *buffer;
{
  unsigned char checksum;
  uint32 count;
  unsigned char ch;

  /*  $<packet info>#<checksum>. */
  do
    {
      putDebugChar ('$');
      checksum = 0;
      count = 0;

      while ((ch = buffer[count]))
        {
          putDebugChar (ch);
          checksum += ch;
          count += 1;
        }

      putDebugChar ('#');
      putDebugChar (hexchars[(checksum >> 4) & 0xf]);
      putDebugChar (hexchars[checksum & 0xf]);

    }
  while ((readDebugChar () & 0x7f) != '+');
}

char __remcomInBuffer[BUFMAX];
char __remcomOutBuffer[BUFMAX];

/* Indicate to caller of mem2hex or hex2mem that there has been an
   error.  */
volatile int __mem_fault = 0;


#ifndef TARGET_HAS_OWN_MEM_FUNCS
/*
 * _target_readmem_hook / _target_writemem_hook:
 * Allow target to get involved in reading/writing memory.
 *
 * If these hooks are defined by the target, they will be
 * called for each user program memory access.  Otherwise, the stub
 * will simply dereference a pointer to access user program memory.
 */

unsigned char (*_target_readmem_hook)  (unsigned char* addr);
void          (*_target_writemem_hook) (unsigned char* addr, 
                                        unsigned char value);

static unsigned char
get_target_byte (volatile unsigned char *address)
{
  if (_target_readmem_hook)     /* target needs to control memory access */
    return _target_readmem_hook ((unsigned char *) address);
  else
    return *address;
}

static void
put_target_byte (volatile unsigned char *address, unsigned char value)
{
  if (_target_writemem_hook)    /* target needs to control memory access */
    _target_writemem_hook ((unsigned char *) address, value);
  else
    *address = value;
}

/* These are the "arguments" to __do_read_mem and __do_write_mem, 
   which are passed as globals to avoid squeezing them thru
   __set_mem_fault_trap.  */

static volatile target_register_t memCount;
static volatile unsigned char    *memSrc,  *memDst;

/*
 * __do_read_mem:
 * Copy from target memory to trusted memory.
 */

static void
__do_read_mem (void)
{
  __mem_fault = 0;
  while (memCount)
    {
      unsigned char ch = get_target_byte (memSrc++);

      if (__mem_fault)
        return;
      *memDst++ = ch;
      memCount--;
    }
}

/*
 * __do_write_mem:
 * Copy from trusted memory to target memory.
 */

static void
__do_write_mem (void)
{
  __mem_fault = 0;
  while (memCount)
    {
      unsigned char ch = *memSrc++;

      put_target_byte (memDst++, ch);
      if (__mem_fault)
        return;
      memCount--;
    }
}

/*
 * __read_mem_safe:
 * Get contents of target memory, abort on error.
 */

int
__read_mem_safe (void *dst, target_register_t src, int count)
{
  memCount = count;
  memSrc   = (unsigned char *) src;
  memDst   = (unsigned char *) dst;
  __set_mem_fault_trap (__do_read_mem);
  return count - memCount;      /* return number of bytes successfully read */
}

/*
 * __write_mem_safe:
 * Set contents of target memory, abort on error.
 */

int
__write_mem_safe (unsigned char *src, target_register_t dst, int count)
{
  memCount = count;
  memSrc   = (unsigned char *) src;
  memDst   = (unsigned char *) dst;
  __set_mem_fault_trap (__do_write_mem);
  return count - memCount;      /* return number of bytes successfully read */
}

#endif /* TARGET_HAS_OWN_MEM_FUNCS */

/* These are the "arguments" to __mem2hex_helper and __hex2mem_helper, 
   which are passed as globals to avoid squeezing them thru
   __set_mem_fault_trap.  */

static int   hexMemCount;
static char *hexMemSrc, *hexMemDst;
static int   may_fault_mode;
#ifdef TARGET_HAS_HARVARD_MEMORY
static int   progMem;
#endif

/* Hamburger helper? */
static void
__mem2hex_helper (void)
{
    union {
        unsigned long  long_val;
        unsigned char  bytes[sizeof(long)];
    } val;
    int len, i;
    unsigned char ch;
    __mem_fault = 0;
    while (hexMemCount > 0) {
        if (may_fault_mode) {
            if ((hexMemCount >= sizeof(long)) &&
                (((target_register_t)hexMemSrc & (sizeof(long)-1)) == 0)) {
                // Should be safe to access via a long
                len = sizeof(long);
            } else if ((hexMemCount >= sizeof(short)) &&
                       (((target_register_t)hexMemSrc & (sizeof(short)-1)) == 0)) {
                // Should be safe to access via a short
                len = sizeof(short);
            } else {
                len = 1;
            }
#ifdef TARGET_HAS_HARVARD_MEMORY
	    if (progMem)
		__read_progmem_safe(&val.bytes[0], hexMemSrc, len);
	    else
#endif
            __read_mem_safe(&val.bytes[0], hexMemSrc, len);
        } else {
            len = 1;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美另类久久久品| 一二三区精品视频| 精品一区二区综合| 欧美性大战久久久| 亚洲精品视频观看| 看片网站欧美日韩| 精品免费国产二区三区| 精品制服美女丁香| 这里只有精品免费| 免费看黄色91| 久久影院午夜论| 久久精品国产第一区二区三区| 3d动漫精品啪啪| 日本va欧美va精品发布| www.欧美.com| 成人欧美一区二区三区| 成人av免费网站| 中文字幕一区不卡| 色噜噜狠狠成人中文综合| 欧美高清在线视频| 99麻豆久久久国产精品免费| 国产精品女主播av| 色哟哟亚洲精品| 亚洲va欧美va天堂v国产综合| 在线观看亚洲一区| 琪琪久久久久日韩精品| 欧美日韩卡一卡二| 久久国产精品第一页| 国产欧美精品国产国产专区| 99亚偷拍自图区亚洲| 一区二区三区在线免费视频| 在线观看免费亚洲| 国产在线乱码一区二区三区| 亚洲手机成人高清视频| 欧美tk丨vk视频| 色欧美乱欧美15图片| 久久99精品一区二区三区| 亚洲精品视频一区二区| 久久免费视频色| 欧美日本国产一区| 91在线视频18| 国产成人免费视频一区| 日韩精品乱码免费| 亚洲精品久久久蜜桃| 石原莉奈在线亚洲三区| 国产农村妇女精品| 精品久久久久99| 欧美日韩精品高清| av一区二区久久| 国产一区在线精品| 五月激情丁香一区二区三区| 中文字幕在线观看一区| 欧美大片在线观看一区| 欧美日韩一区不卡| 色婷婷激情综合| 成人国产电影网| 国产精品资源网站| 老鸭窝一区二区久久精品| 亚洲va国产天堂va久久en| 1024精品合集| 中文字幕在线一区免费| 久久久久亚洲蜜桃| 欧美一级欧美三级| 欧美一区二区三区小说| 欧美三级欧美一级| 欧美日韩亚洲高清一区二区| 色先锋资源久久综合| 色综合视频一区二区三区高清| 丁香激情综合国产| 国产高清视频一区| 国产乱人伦偷精品视频不卡 | 国产校园另类小说区| 在线不卡的av| 欧美理论电影在线| 欧美日韩国产高清一区| 在线观看视频一区| 色欧美88888久久久久久影院| www.日韩在线| 91论坛在线播放| 91猫先生在线| 91黄色在线观看| 欧美日韩日日骚| 欧美精品色综合| 91精品国产黑色紧身裤美女| 欧美精品777| 日韩三区在线观看| 精品少妇一区二区三区日产乱码 | 亚洲精品视频观看| 一区二区不卡在线播放| 午夜视频在线观看一区二区| 午夜电影一区二区三区| 日韩有码一区二区三区| 久久超碰97中文字幕| 激情六月婷婷久久| 成人国产一区二区三区精品| 91网址在线看| 欧美老女人第四色| 精品人伦一区二区色婷婷| 久久久高清一区二区三区| 国产精品久久一级| 亚洲午夜视频在线| 免费不卡在线观看| 国产成人av影院| 91福利视频网站| 91精品国产综合久久久蜜臀图片| 日韩亚洲欧美在线观看| 日韩二区三区四区| 国产精品18久久久| 色婷婷综合久久久久中文一区二区 | 色综合久久综合网97色综合 | 欧美国产亚洲另类动漫| 亚洲精品成人天堂一二三| 日韩成人免费在线| 成人激情动漫在线观看| 欧美日本在线看| 国产网站一区二区| 亚洲一区二区免费视频| 国产一区二区三区日韩| 在线视频综合导航| 2021久久国产精品不只是精品| 国产精品久久久久久久久久久免费看 | 国产欧美一区二区精品久导航| 亚洲日本在线观看| 久久99精品久久久久婷婷| 色综合久久综合网| 久久―日本道色综合久久| 一区二区久久久| 国产福利一区二区三区视频 | 精品一区二区三区影院在线午夜 | 日韩精品久久理论片| 成人手机在线视频| 欧美一卡二卡在线| 一区二区免费视频| av电影天堂一区二区在线| 精品日韩在线观看| 一区二区三区四区在线播放| 国产一区二区三区在线观看精品| 欧美日韩精品一区二区三区四区 | 欧美日韩在线播| 《视频一区视频二区| 久久精品久久综合| 欧美日韩一级二级三级| 一区在线中文字幕| 国产精品原创巨作av| 日韩一级欧美一级| 午夜久久久久久久久久一区二区| av亚洲精华国产精华| 洋洋av久久久久久久一区| 日韩欧美在线网站| 成人国产在线观看| 99国产精品99久久久久久| 日韩一卡二卡三卡四卡| 亚洲国产日韩一区二区| 色综合中文字幕| 国产精品福利一区二区三区| 国模大尺度一区二区三区| 欧美刺激脚交jootjob| 性做久久久久久免费观看| 欧美亚洲免费在线一区| 综合久久久久久久| 成人av在线播放网站| 国产偷v国产偷v亚洲高清| 加勒比av一区二区| 日韩欧美国产成人一区二区| 视频一区中文字幕| 欧美精品久久久久久久多人混战| 亚洲美女屁股眼交| 色综合久久综合网| 亚洲激情在线播放| 欧美性色aⅴ视频一区日韩精品| 亚洲婷婷国产精品电影人久久| 成人性生交大片免费看在线播放| 久久先锋影音av| 国产成a人无v码亚洲福利| 国产三级欧美三级日产三级99| 韩国视频一区二区| 国产午夜精品福利| eeuss国产一区二区三区| 欧美激情一区二区在线| av成人老司机| 亚洲一卡二卡三卡四卡无卡久久| 在线观看av一区| 日本欧美韩国一区三区| 欧美精品一区二区三区高清aⅴ | 26uuuu精品一区二区| 国产久卡久卡久卡久卡视频精品| 久久久亚洲精华液精华液精华液| 国产裸体歌舞团一区二区| 中文字幕欧美国产| 91在线视频观看| 五月天久久比比资源色| 久久夜色精品一区| 99九九99九九九视频精品| 亚洲激情网站免费观看| 91精品欧美一区二区三区综合在| 国产一区不卡在线| 玉米视频成人免费看| 日韩欧美成人一区| jlzzjlzz欧美大全| 五月开心婷婷久久|