/* begincopyright
  Copyright (c) 1988 Xerox Corporation. All rights reserved.
  Use and copying of this software and preparation of derivative works based
  upon this software are permitted. Any distribution of this software or
  derivative works must comply with all applicable United States export
  control laws. This software is made available AS IS, and Xerox Corporation
  makes no warranty about the software, its performance or its conformity to
  any specification. Any person obtaining a copy of this software is requested
  to send their name and post office or electronic mail address to:
    PCR Coordinator
    Xerox PARC
    3333 Coyote Hill Rd.
    Palo Alto, CA 94304
  endcopyright */

/*
 * CirioNubEnvironment.h
 *
 * Demers, January 5, 1990 12:42:37 pm PST
 *
 * This is the environment in which CirioNub procedures run
 * on the slave IOP.  It describes
 *
 *   - global state shared among CirioNub procs
 *   - some useful utilities
 */

#ifndef ←CIRIO←NUB←ENVIRONMENT←
#define ←CIRIO←NUB←ENVIRONMENT←

#include "xr/CirioNubProtocol.h"
#include "xr/CirioNubMarshall.h"

/*
 * Global state on slave processor
 */

typedef struct CirioNubState {
    bool cns←gotSig;
    bool cns←memerrJmpBufValid;
    struct XR←JmpBufRep cns←memerrJmpBuf;
    int cns←printConsoleMessages;
};

extern struct CirioNubState cns;


/*
 * Memory accessibility test
 */

extern bool
CirioNubCanAccess(/*
    char *p,
    int nBytes,
    bool write
*/);
/*
    Check to be sure specified addresses are accessible.
    Return TRUE if accessible, FALSE if not.
*/


/*
 * Pause utility
 */

extern int
CirioNubSlaveSleep(/* unsigned Msecs */);
/*
    Pause for specified number of milliseconds, using a "select" system call
    rather than the sleep library routine (which doesn't work right
    in the slave iop environment).
    Return 0 on success, errno (usually EINTR) on failure.
*/


/*
 * send signal to debuggee
 */

extern void
CirioNubKickDebuggee();
/*
    Send resched signal to debuggee,
        (with luck) making him respond to our most recent command.
*/


#endif /* ←CIRIO←NUB←ENVIRONMENT← */