1 /* sim_defs.h: simulator definitions 2 3 Copyright (c) 1993-2019, Robert M Supnik 4 5 Permission is hereby granted, free of charge, to any person obtaining a 6 copy of this software and associated documentation files (the "Software"), 7 to deal in the Software without restriction, including without limitation 8 the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 and/or sell copies of the Software, and to permit persons to whom the 10 Software is furnished to do so, subject to the following conditions: 11 12 The above copyright notice and this permission notice shall be included in 13 all copies or substantial portions of the Software. 14 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 ROBERT M SUPNIK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 22 Except as contained in this notice, the name of Robert M Supnik shall not be 23 used in advertising or otherwise to promote the sale, use or other dealings 24 in this Software without prior written authorization from Robert M Supnik. 25 26 26-Oct-19 RMS Removed MTAB_VAL definition 27 23-Jun-17 RMS Added #include sim_rev.h (Mark Pizzolato) 28 25-Sep-16 RMS Removed KBD_WAIT and friends 29 08-Mar-16 RMS Added shutdown invisible switch 30 03-Feb-16 JDB [4.0] Added "help_base" and "message" fields to sim_ctab 31 24-Dec-14 JDB Added T_ADDR_FMT 32 14-Dec-14 JDB Extended sim_device for compatibility 33 04-Nov-14 JDB Added UNIT.dynflags field for tape density support 34 05-Feb-13 JDB Added REG_V_UF and REG_UFMASK for VM-specific register flags 35 21-Jul-08 RMS Removed inlining support 36 28-May-08 RMS Added inlining support 37 28-Jun-07 RMS Added IA64 VMS support (Norm Lastovica) 38 18-Jun-07 RMS Added UNIT_IDLE flag 39 18-Mar-07 RMS Added UNIT_TEXT flag 40 07-Mar-07 JDB Added DEBUG_PRJ macro 41 18-Oct-06 RMS Added limit check for clock synchronized keyboard waits 42 13-Jul-06 RMS Guarantee CBUFSIZE is at least 256 43 07-Jan-06 RMS Added support for breakpoint spaces 44 Added REG_FIT flag 45 16-Aug-05 RMS Fixed C++ declaration and cast problems 46 11-Mar-05 RMS Moved 64b data type definitions outside USE_INT64 47 07-Feb-05 RMS Added assertion fail stop 48 05-Nov-04 RMS Added support for SHOW opt=val 49 20-Oct-04 RMS Converted all base types to typedefs 50 21-Sep-04 RMS Added switch to flag stop message printout 51 06-Feb-04 RMS Moved device and unit user flags fields (V3.2) 52 RMS Added REG_VMAD 53 29-Dec-03 RMS Added output stall status 54 15-Jun-03 RMS Added register flag REG_VMIO 55 23-Apr-03 RMS Revised for 32b/64b t_addr 56 14-Mar-03 RMS Lengthened default serial output wait 57 31-Mar-03 RMS Added u5, u6 fields 58 18-Mar-03 RMS Added logical name support 59 Moved magtape definitions to sim_tape.h 60 Moved breakpoint definitions from scp.c 61 03-Mar-03 RMS Added sim_fsize 62 08-Feb-03 RMS Changed sim_os_sleep to void, added match_ext 63 05-Jan-03 RMS Added hidden switch definitions, device dyn memory support, 64 parameters for function pointers, case sensitive SET support 65 22-Dec-02 RMS Added break flag 66 08-Oct-02 RMS Increased simulator error code space 67 Added Telnet errors 68 Added end of medium support 69 Added help messages to CTAB 70 Added flag and context fields to DEVICE 71 Added restore flag masks 72 Revised 64b definitions 73 02-May-02 RMS Removed log status codes 74 22-Apr-02 RMS Added magtape record length error 75 30-Dec-01 RMS Generalized timer package, added circular arrays 76 07-Dec-01 RMS Added breakpoint package 77 01-Dec-01 RMS Added read-only unit support, extended SET/SHOW features, 78 improved error messages 79 24-Nov-01 RMS Added unit-based registers 80 27-Sep-01 RMS Added queue count prototype 81 17-Sep-01 RMS Removed multiple console support 82 07-Sep-01 RMS Removed conditional externs on function prototypes 83 31-Aug-01 RMS Changed int64 to t_int64 for Windoze 84 17-Jul-01 RMS Added additional function prototypes 85 27-May-01 RMS Added multiple console support 86 15-May-01 RMS Increased string buffer size 87 25-Feb-01 RMS Revisions for V2.6 88 15-Oct-00 RMS Editorial revisions for V2.5 89 11-Jul-99 RMS Added unsigned int data types 90 14-Apr-99 RMS Converted t_addr to unsigned 91 04-Oct-98 RMS Additional definitions for V2.4 92 93 The interface between the simulator control package (SCP) and the 94 simulator consists of the following routines and data structures 95 96 sim_name simulator name string 97 sim_devices[] array of pointers to simulated devices 98 sim_PC pointer to saved PC register descriptor 99 sim_interval simulator interval to next event 100 sim_stop_messages[] array of pointers to stop messages 101 sim_instr() instruction execution routine 102 sim_load() binary loader routine 103 sim_emax maximum number of words in an instruction 104 105 In addition, the simulator must supply routines to print and parse 106 architecture specific formats 107 108 print_sym print symbolic output 109 parse_sym parse symbolic input 110 */ 111 112 #ifndef _SIM_DEFS_H_ 113 #define _SIM_DEFS_H_ 0 114 115 #include "sim_rev.h" 116 #include <stddef.h> 117 #include <stdlib.h> 118 #include <stdio.h> 119 #include <stdarg.h> 120 #include <string.h> 121 #include <errno.h> 122 #include <limits.h> 123 124 #ifndef TRUE 125 #define TRUE 1 126 #define FALSE 0 127 #endif 128 129 /* Length specific integer declarations */ 130 131 typedef signed char int8; 132 typedef signed short int16; 133 typedef signed int int32; 134 typedef unsigned char uint8; 135 typedef unsigned short uint16; 136 typedef unsigned int uint32; 137 typedef int t_stat; /* status */ 138 typedef int t_bool; /* boolean */ 139 140 /* 64b integers */ 141 142 #if defined (__GNUC__) /* GCC */ 143 typedef signed long long t_int64; 144 typedef unsigned long long t_uint64; 145 #elif defined (_WIN32) /* Windows */ 146 typedef signed __int64 t_int64; 147 typedef unsigned __int64 t_uint64; 148 #elif (defined (__ALPHA) || defined (__ia64)) && defined (VMS) /* 64b VMS */ 149 typedef signed __int64 t_int64; 150 typedef unsigned __int64 t_uint64; 151 #elif defined (__ALPHA) && defined (__unix__) /* Alpha UNIX */ 152 typedef signed long t_int64; 153 typedef unsigned long t_uint64; 154 #else /* default */ 155 #define t_int64 signed long long 156 #define t_uint64 unsigned long long 157 #endif /* end 64b */ 158 159 #if defined (USE_INT64) /* 64b data */ 160 typedef t_int64 t_svalue; /* signed value */ 161 typedef t_uint64 t_value; /* value */ 162 #else /* 32b data */ 163 typedef int32 t_svalue; 164 typedef uint32 t_value; 165 #endif /* end 64b data */ 166 167 #if defined (USE_INT64) && defined (USE_ADDR64) /* 64b address */ 168 typedef t_uint64 t_addr; 169 #define T_ADDR_W 64 170 #define T_ADDR_FMT LL_FMT 171 #else /* 32b address */ 172 typedef uint32 t_addr; 173 #define T_ADDR_W 32 174 #define T_ADDR_FMT "" 175 #endif /* end 64b address */ 176 177 #if defined (_WIN32) 178 #define LL_FMT "I64" 179 #else 180 #define LL_FMT "ll" 181 #endif 182 183 /* Stubs for inlining */ 184 185 #define SIM_INLINE 186 187 /* System independent definitions */ 188 189 #define FLIP_SIZE (1 << 16) /* flip buf size */ 190 #if !defined (PATH_MAX) /* usually in limits */ 191 #define PATH_MAX 512 192 #endif 193 #if (PATH_MAX >= 128) 194 #define CBUFSIZE (128 + PATH_MAX) /* string buf size */ 195 #else 196 #define CBUFSIZE 256 197 #endif 198 199 /* Breakpoint spaces definitions */ 200 201 #define SIM_BKPT_N_SPC 64 /* max number spaces */ 202 #define SIM_BKPT_V_SPC 26 /* location in arg */ 203 204 /* Extended switch definitions (bits >= 26) */ 205 206 #define SIM_SW_HIDE (1u << 26) /* enable hiding */ 207 #define SIM_SW_REST (1u << 27) /* attach/restore */ 208 #define SIM_SW_REG (1u << 28) /* register value */ 209 #define SIM_SW_STOP (1u << 29) /* stop message */ 210 #define SIM_SW_SHUT (1u << 30) /* shutdown */ 211 212 /* Simulator status codes 213 214 0 ok 215 1 - (SCPE_BASE - 1) simulator specific 216 SCPE_BASE - n general 217 */ 218 219 #define SCPE_OK 0 /* normal return */ 220 #define SCPE_BASE 64 /* base for messages */ 221 #define SCPE_NXM (SCPE_BASE + 0) /* nxm */ 222 #define SCPE_UNATT (SCPE_BASE + 1) /* no file */ 223 #define SCPE_IOERR (SCPE_BASE + 2) /* I/O error */ 224 #define SCPE_CSUM (SCPE_BASE + 3) /* loader cksum */ 225 #define SCPE_FMT (SCPE_BASE + 4) /* loader format */ 226 #define SCPE_NOATT (SCPE_BASE + 5) /* not attachable */ 227 #define SCPE_OPENERR (SCPE_BASE + 6) /* open error */ 228 #define SCPE_MEM (SCPE_BASE + 7) /* alloc error */ 229 #define SCPE_ARG (SCPE_BASE + 8) /* argument error */ 230 #define SCPE_STEP (SCPE_BASE + 9) /* step expired */ 231 #define SCPE_UNK (SCPE_BASE + 10) /* unknown command */ 232 #define SCPE_RO (SCPE_BASE + 11) /* read only */ 233 #define SCPE_INCOMP (SCPE_BASE + 12) /* incomplete */ 234 #define SCPE_STOP (SCPE_BASE + 13) /* sim stopped */ 235 #define SCPE_EXIT (SCPE_BASE + 14) /* sim exit */ 236 #define SCPE_TTIERR (SCPE_BASE + 15) /* console tti err */ 237 #define SCPE_TTOERR (SCPE_BASE + 16) /* console tto err */ 238 #define SCPE_EOF (SCPE_BASE + 17) /* end of file */ 239 #define SCPE_REL (SCPE_BASE + 18) /* relocation error */ 240 #define SCPE_NOPARAM (SCPE_BASE + 19) /* no parameters */ 241 #define SCPE_ALATT (SCPE_BASE + 20) /* already attached */ 242 #define SCPE_TIMER (SCPE_BASE + 21) /* hwre timer err */ 243 #define SCPE_SIGERR (SCPE_BASE + 22) /* signal err */ 244 #define SCPE_TTYERR (SCPE_BASE + 23) /* tty setup err */ 245 #define SCPE_SUB (SCPE_BASE + 24) /* subscript err */ 246 #define SCPE_NOFNC (SCPE_BASE + 25) /* func not imp */ 247 #define SCPE_UDIS (SCPE_BASE + 26) /* unit disabled */ 248 #define SCPE_NORO (SCPE_BASE + 27) /* rd only not ok */ 249 #define SCPE_INVSW (SCPE_BASE + 28) /* invalid switch */ 250 #define SCPE_MISVAL (SCPE_BASE + 29) /* missing value */ 251 #define SCPE_2FARG (SCPE_BASE + 30) /* too few arguments */ 252 #define SCPE_2MARG (SCPE_BASE + 31) /* too many arguments */ 253 #define SCPE_NXDEV (SCPE_BASE + 32) /* nx device */ 254 #define SCPE_NXUN (SCPE_BASE + 33) /* nx unit */ 255 #define SCPE_NXREG (SCPE_BASE + 34) /* nx register */ 256 #define SCPE_NXPAR (SCPE_BASE + 35) /* nx parameter */ 257 #define SCPE_NEST (SCPE_BASE + 36) /* nested DO */ 258 #define SCPE_IERR (SCPE_BASE + 37) /* internal error */ 259 #define SCPE_MTRLNT (SCPE_BASE + 38) /* tape rec lnt error */ 260 #define SCPE_LOST (SCPE_BASE + 39) /* Telnet conn lost */ 261 #define SCPE_TTMO (SCPE_BASE + 40) /* Telnet conn timeout */ 262 #define SCPE_STALL (SCPE_BASE + 41) /* Telnet conn stall */ 263 #define SCPE_AFAIL (SCPE_BASE + 42) /* assert failed */ 264 #define SCPE_KFLAG 0010000 /* tti data flag */ 265 #define SCPE_BREAK 0020000 /* tti break flag */ 266 #define SCPE_DOFAILED 0040000 /* fail in DO, not subproc */ 267 268 #define SCPE_NOMESSAGE 0 /* 4.x compatiblity */ 269 270 /* Print value format codes */ 271 272 #define PV_RZRO 0 /* right, zero fill */ 273 #define PV_RSPC 1 /* right, space fill */ 274 #define PV_LEFT 2 /* left justify */ 275 276 /* Default timing parameters */ 277 278 #define KBD_POLL_WAIT 5000 /* keyboard poll */ 279 #define SERIAL_IN_WAIT 100 /* serial in time */ 280 #define SERIAL_OUT_WAIT 100 /* serial output */ 281 #define NOQUEUE_WAIT 10000 /* min check time */ 282 283 /* Convert switch letter to bit mask */ 284 285 #define SWMASK(x) (1u << (((int) (x)) - ((int) 'A'))) 286 287 /* String match */ 288 289 #define MATCH_CMD(ptr,cmd) strncmp ((ptr), (cmd), strlen (ptr)) 290 291 /* Device data structure */ 292 293 struct sim_device { 294 char *name; /* name */ 295 struct sim_unit *units; /* units */ 296 struct sim_reg *registers; /* registers */ 297 struct sim_mtab *modifiers; /* modifiers */ 298 uint32 numunits; /* #units */ 299 uint32 aradix; /* address radix */ 300 uint32 awidth; /* address width */ 301 uint32 aincr; /* addr increment */ 302 uint32 dradix; /* data radix */ 303 uint32 dwidth; /* data width */ 304 t_stat (*examine)(t_value *v, t_addr a, struct sim_unit *up, 305 int32 sw); /* examine routine */ 306 t_stat (*deposit)(t_value v, t_addr a, struct sim_unit *up, 307 int32 sw); /* deposit routine */ 308 t_stat (*reset)(struct sim_device *dp);/* reset routine */ 309 t_stat (*boot)(int32 u, struct sim_device *dp); 310 /* boot routine */ 311 t_stat (*attach)(struct sim_unit *up, char *cp); 312 /* attach routine */ 313 t_stat (*detach)(struct sim_unit *up); /* detach routine */ 314 void *ctxt; /* context */ 315 uint32 flags; /* flags */ 316 uint32 dctrl; /* debug control */ 317 struct sim_debtab *debflags; /* debug flags */ 318 t_stat (*msize)(struct sim_unit *up, int32 v, char *cp, void *dp); 319 /* mem size routine */ 320 char *lname; /* logical name */ 321 void *help; /* (4.0 dummy) help routine */ 322 void *attach_help; /* (4.0 dummy) help attach routine*/ 323 void *help_context; /* (4.0 dummy) help context */ 324 void *description; /* (4.0 dummy) description */ 325 }; 326 327 /* Device flags */ 328 329 #define DEV_V_DIS 0 /* dev disabled */ 330 #define DEV_V_DISABLE 1 /* dev disable-able */ 331 #define DEV_V_DYNM 2 /* mem size dynamic */ 332 #define DEV_V_NET 3 /* network attach */ 333 #define DEV_V_DEBUG 4 /* debug capability */ 334 #define DEV_V_RAW 5 /* raw supported */ 335 #define DEV_V_RAWONLY 6 /* only raw supported */ 336 #define DEV_V_UF_31 12 /* user flags, V3.1 */ 337 #define DEV_V_UF 16 /* user flags */ 338 #define DEV_V_RSV 31 /* reserved */ 339 340 #define DEV_DIS (1 << DEV_V_DIS) 341 #define DEV_DISABLE (1 << DEV_V_DISABLE) 342 #define DEV_DYNM (1 << DEV_V_DYNM) 343 #define DEV_NET (1 << DEV_V_NET) 344 #define DEV_DEBUG (1 << DEV_V_DEBUG) 345 #define DEV_RAW (1 << DEV_V_RAW) 346 #define DEV_RAWONLY (1 << DEV_V_RAWONLY) 347 348 #define DEV_DISK 0 /* (4.0 dummy) */ 349 #define DEV_TAPE 0 /* (4.0 dummy) */ 350 #define DEV_MUX (DEV_NET) /* (4.0 dummy) */ 351 #define DEV_DISPLAY 0 /* (4.0 dummy) */ 352 #define DEV_ETHER 0 /* (4.0 dummy) */ 353 354 #define DEV_UFMASK_31 (((1u << DEV_V_RSV) - 1) & ~((1u << DEV_V_UF_31) - 1)) 355 #define DEV_UFMASK (((1u << DEV_V_RSV) - 1) & ~((1u << DEV_V_UF) - 1)) 356 #define DEV_RFLAGS (DEV_UFMASK|DEV_DIS) /* restored flags */ 357 358 /* Unit data structure 359 360 Parts of the unit structure are device specific, that is, they are 361 not referenced by the simulator control package and can be freely 362 used by device simulators. Fields starting with 'buf', and flags 363 starting with 'UF', are device specific. The definitions given here 364 are for a typical sequential device. 365 */ 366 367 struct sim_unit { 368 struct sim_unit *next; /* next active */ 369 t_stat (*action)(struct sim_unit *up); /* action routine */ 370 char *filename; /* open file name */ 371 FILE *fileref; /* file reference */ 372 void *filebuf; /* memory buffer */ 373 uint32 hwmark; /* high water mark */ 374 int32 time; /* time out */ 375 uint32 flags; /* flags */ 376 uint32 dynflags; /* dynamic flags */ 377 t_addr capac; /* capacity */ 378 t_addr pos; /* file position */ 379 int32 buf; /* buffer */ 380 int32 wait; /* wait */ 381 int32 u3; /* device specific */ 382 int32 u4; /* device specific */ 383 int32 u5; /* device specific */ 384 int32 u6; /* device specific */ 385 void *up7; /* (4.0 dummy) */ 386 void *up8; /* (4.0 dummy) */ 387 }; 388 389 /* Unit flags */ 390 391 #define UNIT_V_UF_31 12 /* dev spec, V3.1 */ 392 #define UNIT_V_UF 16 /* device specific */ 393 #define UNIT_V_RSV 31 /* reserved!! */ 394 395 #define UNIT_ATTABLE 000001 /* attachable */ 396 #define UNIT_RO 000002 /* read only */ 397 #define UNIT_FIX 000004 /* fixed capacity */ 398 #define UNIT_SEQ 000010 /* sequential */ 399 #define UNIT_ATT 000020 /* attached */ 400 #define UNIT_BINK 000040 /* K = power of 2 */ 401 #define UNIT_BUFABLE 000100 /* bufferable */ 402 #define UNIT_MUSTBUF 000200 /* must buffer */ 403 #define UNIT_BUF 000400 /* buffered */ 404 #define UNIT_ROABLE 001000 /* read only ok */ 405 #define UNIT_DISABLE 002000 /* disable-able */ 406 #define UNIT_DIS 004000 /* disabled */ 407 #define UNIT_RAW 010000 /* raw mode */ 408 #define UNIT_TEXT 020000 /* text mode */ 409 #define UNIT_IDLE 040000 /* idle eligible */ 410 411 #define UNIT_UFMASK_31 (((1u << UNIT_V_RSV) - 1) & ~((1u << UNIT_V_UF_31) - 1)) 412 #define UNIT_UFMASK (((1u << UNIT_V_RSV) - 1) & ~((1u << UNIT_V_UF) - 1)) 413 #define UNIT_RFLAGS (UNIT_UFMASK|UNIT_DIS) /* restored flags */ 414 415 /* Unit dynamic flags (dynflags) (from 4.0) */ 416 417 /* These flags are only set dynamically */ 418 419 #define UNIT_V_DF_TAPE 3 /* Bit offset for Tape Density reservation */ 420 #define UNIT_W_DF_TAPE 3 /* Bits Reserved for Tape Density */ 421 422 /* Register data structure */ 423 424 struct sim_reg { 425 char *name; /* name */ 426 void *loc; /* location */ 427 uint32 radix; /* radix */ 428 uint32 width; /* width */ 429 uint32 offset; /* starting bit */ 430 uint32 depth; /* save depth */ 431 uint32 flags; /* flags */ 432 uint32 qptr; /* circ q ptr */ 433 }; 434 435 /* Register flags */ 436 437 #define REG_FMT 00003 /* see PV_x */ 438 #define REG_RO 00004 /* read only */ 439 #define REG_HIDDEN 00010 /* hidden */ 440 #define REG_NZ 00020 /* must be non-zero */ 441 #define REG_UNIT 00040 /* in unit struct */ 442 #define REG_CIRC 00100 /* circular array */ 443 #define REG_VMIO 00200 /* use VM data print/parse */ 444 #define REG_VMAD 00400 /* use VM addr print/parse */ 445 #define REG_FIT 01000 /* fit access to size */ 446 #define REG_HRO (REG_RO | REG_HIDDEN) /* hidden, read only */ 447 448 #define REG_V_UF 16 /* device specific */ 449 #define REG_UFMASK (~((1u << REG_V_UF) - 1)) /* user flags mask */ 450 #define REG_VMFLAGS (REG_VMIO | REG_UFMASK) /* call VM routine if any of these are set */ 451 452 /* Command tables, base and alternate formats */ 453 454 struct sim_ctab { 455 char *name; /* name */ 456 t_stat (*action)(int32 flag, char *cptr); 457 /* action routine */ 458 int32 arg; /* argument */ 459 char *help; /* help string */ 460 const char *help_base; /* [4.0] structured help base */ 461 void (*message)(const char *unechoed_cmdline, t_stat stat); 462 /* [4.0] message printing routine */ 463 }; 464 465 struct sim_c1tab { 466 char *name; /* name */ 467 t_stat (*action)(struct sim_device *dptr, struct sim_unit *uptr, 468 int32 flag, char *cptr); /* action routine */ 469 int32 arg; /* argument */ 470 char *help; /* help string */ 471 }; 472 473 struct sim_shtab { 474 char *name; /* name */ 475 t_stat (*action)(FILE *st, struct sim_device *dptr, 476 struct sim_unit *uptr, int32 flag, char *cptr); 477 int32 arg; /* argument */ 478 char *help; /* help string */ 479 }; 480 481 /* Modifier table - only extended entries have disp, reg, or flags */ 482 483 struct sim_mtab { 484 uint32 mask; /* mask */ 485 uint32 match; /* match */ 486 char *pstring; /* print string */ 487 char *mstring; /* match string */ 488 t_stat (*valid)(struct sim_unit *up, int32 v, char *cp, void *dp); 489 /* validation routine */ 490 t_stat (*disp)(FILE *st, struct sim_unit *up, int32 v, void *dp); 491 /* display routine */ 492 void *desc; /* value descriptor */ 493 void *help; /* [4.0] help */ 494 }; 495 496 #define MTAB_XTD (1u << UNIT_V_RSV) /* ext entry flag */ 497 #define MTAB_VDV 001 /* valid for dev */ 498 #define MTAB_VUN 002 /* valid for unit */ 499 // #define MTAB_VAL 004 /* REMOVED */ 500 #define MTAB_NMO 010 /* only if named */ 501 #define MTAB_NC 020 /* no UC conversion */ 502 #define MTAB_SHP 040 /* show takes parameter */ 503 504 /* Search table */ 505 506 struct sim_schtab { 507 int32 logic; /* logical operator */ 508 int32 boolop; /* boolean operator */ 509 t_value mask; /* mask for logical */ 510 t_value comp; /* comparison for boolean */ 511 }; 512 513 /* Breakpoint table */ 514 515 struct sim_brktab { 516 t_addr addr; /* address */ 517 int32 typ; /* mask of types */ 518 int32 cnt; /* proceed count */ 519 char *act; /* action string */ 520 }; 521 522 /* Debug table */ 523 524 struct sim_debtab { 525 char *name; /* control name */ 526 uint32 mask; /* control bit */ 527 }; 528 529 #define DEBUG_PRS(d) (sim_deb && d.dctrl) 530 #define DEBUG_PRD(d) (sim_deb && d->dctrl) 531 #define DEBUG_PRI(d,m) (sim_deb && (d.dctrl & (m))) 532 #define DEBUG_PRJ(d,m) (sim_deb && (d->dctrl & (m))) 533 534 /* The following macros define structure contents */ 535 536 #define UDATA(act,fl,cap) NULL,act,NULL,NULL,NULL,0,0,(fl),0,(cap),0,0 537 538 #if defined (__STDC__) || defined (_WIN32) 539 #define ORDATA(nm,loc,wd) #nm, &(loc), 8, (wd), 0, 1 540 #define DRDATA(nm,loc,wd) #nm, &(loc), 10, (wd), 0, 1 541 #define HRDATA(nm,loc,wd) #nm, &(loc), 16, (wd), 0, 1 542 #define FLDATA(nm,loc,pos) #nm, &(loc), 2, 1, (pos), 1 543 #define GRDATA(nm,loc,rdx,wd,pos) #nm, &(loc), (rdx), (wd), (pos), 1 544 #define BRDATA(nm,loc,rdx,wd,dep) #nm, (loc), (rdx), (wd), 0, (dep) 545 #define URDATA(nm,loc,rdx,wd,off,dep,fl) \ 546 #nm, &(loc), (rdx), (wd), (off), (dep), ((fl) | REG_UNIT) 547 #else 548 #define ORDATA(nm,loc,wd) "nm", &(loc), 8, (wd), 0, 1 549 #define DRDATA(nm,loc,wd) "nm", &(loc), 10, (wd), 0, 1 550 #define HRDATA(nm,loc,wd) "nm", &(loc), 16, (wd), 0, 1 551 #define FLDATA(nm,loc,pos) "nm", &(loc), 2, 1, (pos), 1 552 #define GRDATA(nm,loc,rdx,wd,pos) "nm", &(loc), (rdx), (wd), (pos), 1 553 #define BRDATA(nm,loc,rdx,wd,dep) "nm", (loc), (rdx), (wd), 0, (dep) 554 #define URDATA(nm,loc,rdx,wd,off,dep,fl) \ 555 "nm", &(loc), (rdx), (wd), (off), (dep), ((fl) | REG_UNIT) 556 #endif 557 558 /* Typedefs for principal structures */ 559 560 typedef struct sim_device DEVICE; 561 typedef struct sim_unit UNIT; 562 typedef struct sim_reg REG; 563 typedef struct sim_ctab CTAB; 564 typedef struct sim_c1tab C1TAB; 565 typedef struct sim_shtab SHTAB; 566 typedef struct sim_mtab MTAB; 567 typedef struct sim_schtab SCHTAB; 568 typedef struct sim_brktab BRKTAB; 569 typedef struct sim_debtab DEBTAB; 570 571 /* Function prototypes */ 572 573 #include "scp.h" 574 #include "sim_console.h" 575 #include "sim_timer.h" 576 #include "sim_fio.h" 577 #include "sim_sock.h" 578 579 /* V4 compatibility definitions 580 581 The SCP API for version 4.0 introduces a number of "pointer-to-const" 582 parameter qualifiers that were not present in the 3.x versions. To maintain 583 compatibility with the earlier versions, the new qualifiers are expressed as 584 "CONST" rather than "const". This allows macro removal of the qualifiers 585 when compiling for SIMH 3.x. 586 */ 587 588 589 #if defined (__STDC__) || defined (_WIN32) 590 #define ORDATAD(nm,loc,wd,desc) #nm, &(loc), 8, (wd), 0, 1 591 #define DRDATAD(nm,loc,wd,desc) #nm, &(loc), 10, (wd), 0, 1 592 #define HRDATAD(nm,loc,wd,desc) #nm, &(loc), 16, (wd), 0, 1 593 #define FLDATAD(nm,loc,pos,desc) #nm, &(loc), 2, 1, (pos), 1 594 #define GRDATAD(nm,loc,rdx,wd,pos,desc) #nm, &(loc), (rdx), (wd), (pos), 1 595 #define BRDATAD(nm,loc,rdx,wd,dep,desc) #nm, (loc), (rdx), (wd), 0, (dep) 596 #define URDATAD(nm,loc,rdx,wd,off,dep,fl,desc) \ 597 #nm, &(loc), (rdx), (wd), (off), (dep), ((fl) | REG_UNIT) 598 #define ORDATADF(nm,loc,wd,desc) #nm, &(loc), 8, (wd), 0, 1 599 #define DRDATADF(nm,loc,wd,desc) #nm, &(loc), 10, (wd), 0, 1 600 #define HRDATADF(nm,loc,wd,desc) #nm, &(loc), 16, (wd), 0, 1 601 #define FLDATADF(nm,loc,pos,desc) #nm, &(loc), 2, 1, (pos), 1 602 #define GRDATADF(nm,loc,rdx,wd,pos,desc) #nm, &(loc), (rdx), (wd), (pos), 1 603 #define BRDATADF(nm,loc,rdx,wd,dep,desc) #nm, (loc), (rdx), (wd), 0, (dep) 604 #define URDATADF(nm,loc,rdx,wd,off,dep,fl,desc) \ 605 #nm, &(loc), (rdx), (wd), (off), (dep), ((fl) | REG_UNIT) 606 #else 607 #define ORDATAD(nm,loc,wd) "nm", &(loc), 8, (wd), 0, 1 608 #define DRDATAD(nm,loc,wd) "nm", &(loc), 10, (wd), 0, 1 609 #define HRDATAD(nm,loc,wd) "nm", &(loc), 16, (wd), 0, 1 610 #define FLDATAD(nm,loc,pos) "nm", &(loc), 2, 1, (pos), 1 611 #define GRDATAD(nm,loc,rdx,wd,pos) "nm", &(loc), (rdx), (wd), (pos), 1 612 #define BRDATAD(nm,loc,rdx,wd,dep) "nm", (loc), (rdx), (wd), 0, (dep) 613 #define URDATAD(nm,loc,rdx,wd,off,dep,fl) \ 614 "nm", &(loc), (rdx), (wd), (off), (dep), ((fl) | REG_UNIT) 615 #define ORDATADF(nm,loc,wd) "nm", &(loc), 8, (wd), 0, 1 616 #define DRDATADF(nm,loc,wd) "nm", &(loc), 10, (wd), 0, 1 617 #define HRDATADF(nm,loc,wd) "nm", &(loc), 16, (wd), 0, 1 618 #define FLDATADF(nm,loc,pos) "nm", &(loc), 2, 1, (pos), 1 619 #define GRDATADF(nm,loc,rdx,wd,pos) "nm", &(loc), (rdx), (wd), (pos), 1 620 #define BRDATADF(nm,loc,rdx,wd,dep) "nm", (loc), (rdx), (wd), 0, (dep) 621 #define URDATADF(nm,loc,rdx,wd,off,dep,fl) \ 622 "nm", &(loc), (rdx), (wd), (off), (dep), ((fl) | REG_UNIT) 623 #endif 624 625 #ifndef INT64_C 626 #define INT64_C(x) (x##LL) 627 #endif 628 629 #ifdef PF_USER 630 #undef PF_USER 631 #endif /* PF_USER */ 632 #ifdef I_POP 633 #undef I_POP 634 #endif /* I_POP */ 635 #ifdef CONST 636 #undef CONST 637 #endif /* CONST */ 638 #define CONST 639 #ifndef PRIORITY_ABOVE_NORMAL 640 #define PRIORITY_ABOVE_NORMAL 0 641 #endif 642 #define sim_os_set_thread_priority(prio) 643 644 #define BRK_TYP_DYN_STEPOVER 0 645 646 #endif 647