-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathhstructs.h
1974 lines (1762 loc) · 107 KB
/
hstructs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* HSTRUCTS.H (c) Copyright Roger Bowler, 1999-2012 */
/* (c) Copyright TurboHercules, SAS 2011 */
/* Hercules Structure Definitions */
/* */
/* Released under "The Q Public License Version 1" */
/* (http://www.hercules-390.org/herclic.html) as modifications to */
/* Hercules. */
// This header auto-#included by 'hercules.h'...
//
// The <config.h> header and other required headers are
// presumed to have already been #included ahead of it...
#ifndef _HSTRUCTS_H
#define _HSTRUCTS_H
#include "hercules.h"
#include "opcode.h"
#include "telnet.h" // Need telnet_t
/*-------------------------------------------------------------------*/
/* Typedefs for CPU bitmap fields */
/* */
/* A CPU bitmap contains one bit for each processing engine. */
/* The width of the bitmap depends on the maximum number of */
/* processing engines which was selected at build time. */
/*-------------------------------------------------------------------*/
#if MAX_CPU_ENGINES <= 32
typedef U32 CPU_BITMAP;
#define F_CPU_BITMAP "%8.8"PRIX32
#elif MAX_CPU_ENGINES <= 64
typedef U64 CPU_BITMAP;
#define F_CPU_BITMAP "%16.16"PRIX64
#elif MAX_CPU_ENGINES <= 128
#if SIZEOF_SIZE_T == 4
#error MAX_CPU_ENGINES > 64 only supported on 64 bit platforms
#endif
#if defined(_MSVC_)
WARNING( "MAX_CPU_ENGINES in Windows is 64" )
typedef U64 CPU_BITMAP;
#define F_CPU_BITMAP "%16.16"PRIX64
#undef MAX_CPU_ENGINES
#define MAX_CPU_ENGINES 64
#else
typedef __uint128_t CPU_BITMAP;
// ZZ FIXME: No printf format support for __uint128_t yet, so we will incorrectly display...
#define F_CPU_BITMAP "%16.16"PRIX64
#endif
#else
#error MAX_CPU_ENGINES cannot exceed 128
#endif
/*-------------------------------------------------------------------*/
/* Structure definition for CPU register context */
/* */
/* Note: REGS is very susceptable to performance problems due to */
/* key fields either crossing or split across cache line */
/* boundaries. In addition, if allocated in the stack, the */
/* allocation unit is frequently on an 8-byte boundary rather */
/* than on a cache-line boundary. Consequently, extreme */
/* attention is paid to the cache line boundaries in the REGS */
/* structure to ensure that fields don't cross 64-byte */
/* boundaries and as much attention as possible to ensure */
/* 32-byte boundaries are not crossed. */
/* */
/*-------------------------------------------------------------------*/
struct REGS { /* Processor registers */
#define HDL_NAME_REGS "REGS" /* Eye-Catch NAME */
#define HDL_VERS_REGS "4.00" /* Internal Version Number */
#define HDL_SIZE_REGS sizeof(REGS)
/*000*/ BLOCK_HEADER; /* Name of block REGS_CP00 */
/*030*/ U64 cpuid; /* Formatted CPU ID */
/*038*/ U32 cpuserial; /* CPU serial number */
/*03C*/ U16 cpumodel; /* CPU model number */
/*03E*/ U8 cpuversion; /* CPU version code */
/*03F*/ U8 _cpu_reserved; /* Reserved for future use */
/* --- 64-byte cache line -- */
/*040*/ SYSBLK *sysblk; /* Pointer to sysblk */
ALIGN_8
/*048*/ U32 ints_state; /* CPU Interrupts Status */
/*04C*/ U32 ints_mask; /* Respective Interrupts Mask*/
/*050*/ CPU_BITMAP cpubit; /* Only this CPU's bit is 1 */
ALIGN_16
/*060*/ BYTE cpustate; /* CPU stopped/started state */
/*061*/ BYTE _cpu_reserved2; /* Available... */
/*062*/ U16 extccpu; /* CPU causing external call */
/*064*/ int arch_mode; /* Architectural mode */
/*068*/ BYTE *ip; /* Mainstor inst address */
/*070*/ DW px; /* Prefix register */
/* --- 64-byte cache line -- */
/*080*/ PSW psw; /* Program status word */
/*0E8-0FF*/ /* Available... */
ALIGN_128 /* --- 64-byte cache line -- */
/*100*/ BYTE malfcpu /* Malfuction alert flags */
[MAX_CPU_ENGINES]; /* for each CPU (1=pending) */
ALIGN_128
/*180*/ BYTE emercpu /* Emergency signal flags */
[MAX_CPU_ENGINES]; /* for each CPU (1=pending) */
/* AIA - Instruction fetch accelerator */
/*200*/ ALIGN_128
BYTE *aip; /* Mainstor page address */
/*208*/ ALIGN_8
uintptr_t aim; /* Mainstor xor address */
/*210*/ ALIGN_8
BYTE *aie; /* Mainstor page end address */
/*218*/ DW aiv; /* Virtual page address */
/*220*/ U64 bear; /* Breaking event address reg*/
/*228*/ BYTE *bear_ip; /* Breaking event inst ptr */
/*230-27F*/ /* Available... */
/*280*/ ALIGN_128
DW gr[16]; /* General registers */
/*300*/ U32 ar[16]; /* Access registers */
/*340*/ U32 fpr[32]; /* Floating point registers */
/*380*/ U32 fpc; /* IEEE Floating Point
Control Register */
/*384*/ BYTE __reserved_space[52]; /* Available... */
#define CR_ASD_REAL -1
#define CR_ALB_OFFSET 16
#ifndef NOCHECK_AEA_ARRAY_BOUNDS
/*3B8*/ DW cr_struct[1+16+16];
#define XR(_crn) cr_struct[1+(_crn)]
#else
#define XR(_crn) cr[(_crn)]
/*3B8*/ DW cr_special[1]; /* Negative Index into cr */
/*3C0*/ DW cr[16]; /* Control registers */
/*440*/ DW alb[16]; /* Accesslist Lookaside cr */
#endif
/*4C0*/ U32 dxc; /* Data exception code */
/*4C4*/ /* Available... */
/*4C8*/ DW mc; /* Monitor Code */
/*4D0*/ DW ea; /* Exception address */
/*4D8*/ DW et; /* Execute Target address */
unsigned int /* Flags (cpu thread only) */
execflag:1, /* 1=EXecuted instruction */
exrl:1, /* 1=EXRL, 0=EX instruction */
permode:1, /* 1=PER active */
instinvalid:1, /* 1=Inst field is invalid */
opinterv:1, /* 1=Operator intervening */
checkstop:1, /* 1=CPU is checkstop-ed */
hostint:1, /* 1=Host generated interrupt*/
host:1, /* REGS are hostregs */
guest:1; /* REGS are guestregs */
unsigned int /* Flags (intlock serialized)*/
dummy:1, /* 1=Dummy regs structure */
configured:1, /* 1=CPU is online */
loadstate:1, /* 1=CPU is in load state */
ghostregs:1, /* 1=Ghost registers (panel) */
invalidate:1, /* 1=Do AIA/AEA invalidation */
tracing:1, /* 1=Trace is active */
stepwait:1, /* 1=Wait in inst stepping */
sigpreset:1, /* 1=SIGP cpu reset received */
sigpireset:1; /* 1=SIGP initial cpu reset */
CACHE_ALIGN /* --- 64-byte cache line -- */
S64 tod_epoch; /* TOD epoch for this CPU */
TOD clkc; /* 0-7=Clock comparator epoch,
8-63=Comparator bits 0-55 */
S64 cpu_timer; /* CPU timer */
U32 todpr; /* TOD programmable register */
S64 int_timer; /* S/370 Interval timer */
S64 ecps_vtimer; /* ECPS Virtual Int. timer */
S32 old_timer; /* S/370 Interval timer int */
S32 ecps_oldtmr; /* ECPS Virtual Int. tmr int */
/* --- 64-byte cache line -- */
BYTE *ecps_vtmrpt; /* Pointer to VTMR or zero */
U64 rcputime; /* Real CPU time used (us) */
U64 bcputime; /* Base (reset) CPU time (us)*/
U64 prevcount; /* Previous instruction count*/
U32 instcount; /* Instruction counter */
U32 mipsrate; /* Instructions per second */
U32 siocount; /* SIO/SSCH counter */
U32 siosrate; /* IOs per second */
U64 siototal; /* Total SIO/SSCH count */
/* --- 64-byte cache line -- */
int cpupct; /* Percent CPU busy */
U64 waittod; /* Time of day last wait */
U64 waittime; /* Wait time in interval */
U64 waittime_accumulated; /* Wait time accumulated */
CACHE_ALIGN /* --- 64-byte cache line -- */
DAT dat; /* Fields for DAT use */
#define GR_G(_r) gr[(_r)].D
#define GR_H(_r) gr[(_r)].F.H.F /* Fullword bits 0-31 */
#define GR_HHH(_r) gr[(_r)].F.H.H.H.H /* Halfword bits 0-15 */
#define GR_HHL(_r) gr[(_r)].F.H.H.L.H /* Halfword low, bits 16-31 */
#define GR_HHLCL(_r) gr[(_r)].F.H.H.L.B.L /* Character, bits 24-31 */
#define GR_L(_r) gr[(_r)].F.L.F /* Fullword low, bits 32-63 */
#define GR_LHH(_r) gr[(_r)].F.L.H.H.H /* Halfword bits 32-47 */
#define GR_LHL(_r) gr[(_r)].F.L.H.L.H /* Halfword low, bits 48-63 */
#define GR_LHHCH(_r) gr[(_r)].F.L.H.H.B.H /* Character, bits 32-39 */
#define GR_LA24(_r) gr[(_r)].F.L.A.A /* 24 bit addr, bits 40-63 */
#define GR_LA8(_r) gr[(_r)].F.L.A.B /* 24 bit addr, unused bits */
#define GR_LHLCL(_r) gr[(_r)].F.L.H.L.B.L /* Character, bits 56-63 */
#define GR_LHLCH(_r) gr[(_r)].F.L.H.L.B.H /* Character, bits 48-55 */
#define CR_G(_r) XR((_r)).D /* Bits 0-63 */
#define CR_H(_r) XR((_r)).F.H.F /* Fullword bits 0-31 */
#define CR_HHH(_r) XR((_r)).F.H.H.H.H /* Halfword bits 0-15 */
#define CR_HHL(_r) XR((_r)).F.H.H.L.H /* Halfword low, bits 16-31 */
#define CR_L(_r) XR((_r)).F.L.F /* Fullword low, bits 32-63 */
#define CR_LHH(_r) XR((_r)).F.L.H.H.H /* Halfword bits 32-47 */
#define CR_LHHCH(_r) XR((_r)).F.L.H.H.B.H /* Character, bits 32-39 */
#define CR_LHL(_r) XR((_r)).F.L.H.L.H /* Halfword low, bits 48-63 */
#define MC_G mc.D
#define MC_L mc.F.L.F
#define EA_G ea.D
#define EA_L ea.F.L.F
#define ET_G et.D
#define ET_L et.F.L.F
#define PX_G px.D
#define PX_L px.F.L.F
#define AIV_G aiv.D
#define AIV_L aiv.F.L.F
#define AR(_r) ar[(_r)]
U16 chanset; /* Connected channel set */
U16 monclass; /* Monitor event class */
U16 cpuad; /* CPU address for STAP */
BYTE excarid; /* Exception access register */
BYTE opndrid; /* Operand access register */
BYTE exinst[8]; /* Target of Execute (EX) */
BYTE *mainstor; /* -> Main storage */
BYTE *storkeys; /* -> Main storage key array */
RADR mainlim; /* Central Storage limit or */
/* guest storage limit (SIE) */
union
{
PSA_3XX *psa; /* -> PSA for this CPU 370 and ESA */
PSA_900 *zpsa; /* -> PSA for this CPU when in z arch */
};
/*
* The fields hostregs and guestregs have been move outside the
* scope of _FEATURE_SIE to reduce conditional code.
*
* sysblk.regs[i] always points to the host regs
* flag `host' is always 1 for the host regs
* flag `guest' is always 1 for the guest regs
* `hostregs' is always equal to sysblk.regs[i] (in both
* hostregs and guestregs)
* `guestregs' is always equal to sysblk.regs[i]->guestregs
* (in both hostregs and guestregs).
* sysblk.regs[i]->guestregs is NULL until the first SIE
* instruction is executed on that CPU.
* `sie_active' is 1 in hostregs if SIE is executing
* and the current register context is `guestregs'
* `sie_mode' is 1 in guestregs always
* `sie_state' has the real address of the SIEBK
* `siebk' has the mainstor address of the SIEBK
*/
REGS *hostregs; /* Pointer to the hypervisor
register context */
REGS *guestregs; /* Pointer to the guest
register context */
#if defined(_FEATURE_SIE)
CACHE_ALIGN /* --- 64-byte cache line -- */
RADR sie_state; /* Address of the SIE state
descriptor block or 0 when
not running under SIE */
SIEBK *siebk; /* Sie State Desc structure */
RADR sie_px; /* Host address of guest px */
RADR sie_mso; /* Main Storage Origin */
RADR sie_xso; /* eXpanded Storage Origin */
RADR sie_xsl; /* eXpanded Storage Limit */
RADR sie_rcpo; /* Ref and Change Preserv. */
RADR sie_scao; /* System Contol Area */
S64 sie_epoch; /* TOD offset in state desc. */
#endif /*defined(_FEATURE_SIE)*/
unsigned int
sie_active:1, /* SIE active (host only) */
sie_mode:1, /* Running under SIE (guest) */
sie_pref:1; /* Preferred-storage mode */
// #if defined(FEATURE_PER)
ALIGN_16
U16 perc; /* PER code */
RADR peradr; /* PER address */
BYTE peraid; /* PER access id */
// #endif /*defined(FEATURE_PER)*/
/*
* Making the following flags 'stand-alone' (instead of bit-
* flags like they were) addresses a compiler bit-flag serial-
* ization issue that occurs with the 'SYNCHRONIZE_CPUS' macro
* used during synchronize broadcast (cpu<->cpu communication)
*/
ALIGN_8
int intwait; /* 1=Waiting on intlock */
#ifdef OPTION_SYNCIO
int syncio; /* 1=Synchronous i/o active */
#endif // OPTION_SYNCIO
BYTE inst[8]; /* Fetched instruction when
instruction crosses a page
boundary */
BYTE *invalidate_main; /* Mainstor addr to invalidat*/
CACHE_ALIGN /* --- 64-byte cache line -- */
PSW captured_zpsw; /* Captured-z/Arch PSW reg */
#if defined(_FEATURE_VECTOR_FACILITY)
CACHE_ALIGN
VFREGS *vf; /* Vector Facility */
#endif /*defined(_FEATURE_VECTOR_FACILITY)*/
CACHE_ALIGN
jmp_buf progjmp; /* longjmp destination for
program check return */
jmp_buf archjmp; /* longjmp destination to
switch architecture mode */
jmp_buf exitjmp; /* longjmp destination for
CPU thread exit */
COND intcond; /* CPU interrupt condition */
LOCK *cpulock; /* CPU lock for this CPU */
/* Mainstor address lookup accelerator */
BYTE aea_mode; /* aea addressing mode */
#ifndef NOCHECK_AEA_ARRAY_BOUNDS
int aea_ar_struct[5+16];
#define AEA_AR(_arn) aea_ar_struct[5+(_arn)]
#else
#define AEA_AR(_arn) aea_ar[(_arn)]
int aea_ar_special[5]; /* Negative index into ar */
int aea_ar[16]; /* arn to cr number */
#endif
#ifndef NOCHECK_AEA_ARRAY_BOUNDS
BYTE aea_common_struct[1+16+16];
#define AEA_COMMON(_asd) aea_common_struct[1+(_asd)]
#else
#define AEA_COMMON(_asd) aea_common[(_asd)]
BYTE aea_common_special[1]; /* real asd */
BYTE aea_common[16]; /* 1=asd is not private */
BYTE aea_common_alb[16]; /* alb pseudo registers */
#endif
BYTE aea_aleprot[16]; /* ale protected */
/* Function pointers */
pi_func program_interrupt;
func trace_br;
/* Active Facility List */
BYTE facility_list[STFL_HBYTESIZE];
/* ------------------------------------------------------------ */
U64 regs_copy_end; /* Copy regs to here */
/* ------------------------------------------------------------ */
/* Runtime opcode tables, use replace_opcode to modify */
const zz_func *s370_runtime_opcode_xxxx,
*s370_runtime_opcode_e3________xx,
*s370_runtime_opcode_eb________xx,
*s370_runtime_opcode_ec________xx,
*s370_runtime_opcode_ed________xx;
const zz_func *s390_runtime_opcode_xxxx,
*s390_runtime_opcode_e3________xx,
*s390_runtime_opcode_eb________xx,
*s390_runtime_opcode_ec________xx,
*s390_runtime_opcode_ed________xx;
const zz_func *z900_runtime_opcode_xxxx,
*z900_runtime_opcode_e3________xx,
*z900_runtime_opcode_eb________xx,
*z900_runtime_opcode_ec________xx,
*z900_runtime_opcode_ed________xx;
#ifdef OPTION_OPTINST
const zz_func
*s370_runtime_opcode_e3_0______xx,
*s390_runtime_opcode_e3_0______xx,
*z900_runtime_opcode_e3_0______xx;
#endif /* #ifdef OPTION_OPTINST */
/* TLB - Translation lookaside buffer */
unsigned int tlbID; /* Validation identifier */
TLB tlb; /* Translation lookaside buf */
BLOCK_TRAILER; /* Name of block END */
};
/*-------------------------------------------------------------------*/
/* Structure definition for the Vector Facility */
/*-------------------------------------------------------------------*/
#if defined(_FEATURE_VECTOR_FACILITY)
struct VFREGS { /* Vector Facility Registers*/
unsigned int
online:1; /* 1=VF is online */
U64 vsr; /* Vector Status Register */
U64 vac; /* Vector Activity Count */
BYTE vmr[VECTOR_SECTION_SIZE/8]; /* Vector Mask Register */
U32 vr[16][VECTOR_SECTION_SIZE]; /* Vector Registers */
};
#endif /*defined(_FEATURE_VECTOR_FACILITY)*/
// #if defined(FEATURE_REGION_RELOCATE)
/*-------------------------------------------------------------------*/
/* Zone Parameter Block */
/*-------------------------------------------------------------------*/
struct ZPBLK {
RADR mso; /* Main Storage Origin */
RADR msl; /* Main Storage Length */
RADR eso; /* Expanded Storage Origin */
RADR esl; /* Expanded Storage Length */
RADR mbo; /* Measurement block origin */
BYTE mbk; /* Measurement block key */
int mbm; /* Measurement block mode */
int mbd; /* Device connect time mode */
};
// #endif /*defined(FEATURE_REGION_RELOCATE)*/
/*-------------------------------------------------------------------*/
/* Guest System Information block EBCDIC DATA */
/*-------------------------------------------------------------------*/
struct GSYSINFO {
BYTE loadparm[8];
BYTE lparname[8];
BYTE manufact[16];
BYTE plant[4];
BYTE model[16];
BYTE modelcapa[16];
BYTE modelperm[16];
BYTE modeltemp[16];
BYTE systype[8];
BYTE sysname[8];
BYTE sysplex[8];
BYTE cpid[16];
BYTE vmid[8];
};
/*-------------------------------------------------------------------*/
/* Operation Modes */
/*-------------------------------------------------------------------*/
enum OPERATION_MODE
{
om_basic = 0, /* lparmode = 0 */
om_mif = 1, /* lparmode = 1; cpuidfmt = 0; partitions 1-16 */
om_emif = 2 /* lparmode = 1; cpuidfmt = 1; partitions 0-255 */
};
/*-------------------------------------------------------------------*/
/* System configuration block */
/*-------------------------------------------------------------------*/
struct SYSBLK {
#define HDL_NAME_SYSBLK "SYSBLK"
#define HDL_VERS_SYSBLK "4.00" /* Internal Version Number */
#define HDL_SIZE_SYSBLK sizeof(SYSBLK)
BLOCK_HEADER; /* Name of block - SYSBLK */
char *hercules_pgmname; /* Starting program name */
char *hercules_pgmpath; /* Starting pgm path name */
char *hercules_cmdline; /* Hercules Command line */
pid_t hercules_pid; /* Process Id of Hercules */
time_t impltime; /* TOD system was IMPL'ed */
LOCK config; /* (Re)Configuration Lock */
int arch_mode; /* Architecturual mode */
/* 0 == S/370 (ARCH_370) */
/* 1 == ESA/390 (ARCH_390) */
/* 2 == ESAME (ARCH_900) */
RADR mainsize; /* Main storage size (bytes) */
BYTE *mainstor; /* -> Main storage */
BYTE *storkeys; /* -> Main storage key array */
u_int lock_mainstor:1; /* Request mainstor to lock */
u_int mainstor_locked:1; /* Main storage locked */
U32 xpndsize; /* Expanded size in 4K pages */
BYTE *xpndstor; /* -> Expanded storage */
u_int lock_xpndstor:1; /* Request xpndstor to lock */
u_int xpndstor_locked:1; /* Expanded storage locked */
U64 todstart; /* Time of initialisation */
U64 cpuid; /* CPU identifier for STIDP */
U32 cpuserial; /* CPU serial number */
U16 cpumodel; /* CPU model number */
BYTE cpuversion; /* CPU version code */
BYTE cpuidfmt; /* STIDP format 0|1 */
TID impltid; /* Thread-id for main progr. */
TID wdtid; /* Thread-id for watchdog */
enum OPERATION_MODE operation_mode; /* CPU operation mode */
u_int lparmode:1; /* LPAR mode active */
U16 lparnum; /* LPAR identification number*/
U16 ipldev; /* IPL device */
int iplcpu; /* IPL cpu */
int ipllcss; /* IPL lcss */
int numvec; /* Number vector processors */
int maxcpu; /* Max number of CPUs */
int cpus; /* Number CPUs configured */
int hicpu; /* Hi cpu + 1 configured */
int topology; /* Configuration topology... */
#define TOPOLOGY_HORIZ 0 /* ...horizontal polarization*/
#define TOPOLOGY_VERT 1 /* ...vertical polarization */
int topchnge; /* 1 = Topology Change Report
pending (CPU cfg on/off) */
U32 cpmcr; /* Dynamic CP model rating */
U32 cpmpcr; /* ... Permanent */
U32 cpmtcr; /* ... Temporary */
U32 cpncr; /* Dynamic CP nominal rating */
U32 cpnpcr; /* ... Permanent */
U32 cpntcr; /* ... Temporary */
U32 cpmcap; /* Dynamic CP model capacity */
U32 cpncap; /* Dynamic CP nominal cap. */
U32 cpscap; /* Dynamic CP secondary cap. */
U32 cpacap; /* Dynamic CP alternate cap. */
U8 cpccr; /* Dynamic CP change reason */
U8 cpcai; /* Dynamic CP capacity adj. */
COND cpucond; /* CPU config/deconfig cond */
LOCK cpulock[MAX_CPU_ENGINES]; /* CPU lock */
TOD cpucreateTOD[MAX_CPU_ENGINES]; /* CPU creation time */
TID cputid[MAX_CPU_ENGINES]; /* CPU thread identifiers */
clockid_t /* CPU clock @PJJ */
cpuclockid[MAX_CPU_ENGINES]; /* identifiers @PJJ */
BYTE ptyp[MAX_CPU_ENGINES]; /* SCCB ptyp for each engine */
LOCK todlock; /* TOD clock update lock */
TID todtid; /* Thread-id for TOD update */
REGS *regs[MAX_CPU_ENGINES+1]; /* Registers for each CPU */
LOCK caplock[MAX_CPU_ENGINES]; /* CP capping locks */
int caplocked[MAX_CPU_ENGINES]; /* Indication locked */
TID captid; /* TID capping manager */
U32 capvalue; /* Capping value in mips */
/* Active Facility List */
BYTE facility_list[GEN_MAXARCH][STFL_HBYTESIZE];
/* CPU Measurement Counter facility
CPU Measurement Sampling facility
Load Program Parameter facility */
U64 program_parameter; /* Program Parameter Register*/
#ifdef _FEATURE_MESSAGE_SECURITY_ASSIST_EXTENSION_3
RWLOCK wklock; /* Update lock */
BYTE wkaes_reg[32]; /* Wrapping-key registers */
BYTE wkdea_reg[24];
BYTE wkvpaes_reg[32]; /* Wrapping-key Verification */
BYTE wkvpdea_reg[24]; /* Pattern registers */
#endif /* FEATURE_MESSAGE_SECURITY_ASSIST_EXTENSION_3 */
#if defined(_FEATURE_CMPSC_ENHANCEMENT_FACILITY)
BYTE zpbits; /* Zeropad alignment bits */
#define MIN_CMPSC_ZP_BITS 1 /* align to half word bndry */
#define DEF_CMPSC_ZP_BITS 8 /* align to 256 byte bndry */
#define MAX_CMPSC_ZP_BITS 12 /* align to 4096 page bndry */
#define CMPSC_ZP_BITS ((U8)sysblk.zpbits)
#define CMPSC_ZP_BYTES ((U16)1 << CMPSC_ZP_BITS)
#define CMPSC_ZP_MASK (((U64)-1) >> (64 - CMPSC_ZP_BITS))
#endif /* defined(_FEATURE_CMPSC_ENHANCEMENT_FACILITY) */
#if defined(_FEATURE_VECTOR_FACILITY)
VFREGS vf[MAX_CPU_ENGINES]; /* Vector Facility */
#endif /*defined(_FEATURE_VECTOR_FACILITY)*/
#if defined(_FEATURE_SIE)
ZPBLK zpb[FEATURE_SIE_MAXZONES]; /* SIE Zone Parameter Blk*/
#endif /*defined(_FEATURE_SIE)*/
#if defined(OPTION_FOOTPRINT_BUFFER)
REGS footprregs[MAX_CPU_ENGINES][OPTION_FOOTPRINT_BUFFER];
U32 footprptr[MAX_CPU_ENGINES];
#endif
#define LOCK_OWNER_NONE 0xFFFF
#define LOCK_OWNER_OTHER 0xFFFE
U16 mainowner; /* Mainlock owner */
U16 intowner; /* Intlock owner */
LOCK mainlock; /* Main storage lock */
LOCK intlock; /* Interrupt lock */
LOCK iointqlk; /* I/O Interrupt Queue lock */
LOCK sigplock; /* Signal processor lock */
ATTR detattr; /* Detached thread attribute */
ATTR joinattr; /* Joinable thread attribute */
#define DETACHED &sysblk.detattr /* (helper macro) */
#define JOINABLE &sysblk.joinattr /* (helper macro) */
TID cnsltid; /* Thread-id for console */
TID socktid; /* Thread-id for sockdev */
/* 3270 Console keepalive: */
int kaidle; /* keepalive idle seconds */
int kaintv; /* keepalive probe interval */
int kacnt; /* keepalive probe count */
LOCK cnslpipe_lock; /* signaled flag access lock */
int cnslpipe_flag; /* 1 == already signaled */
int cnslwpipe; /* fd for sending signal */
int cnslrpipe; /* fd for receiving signal */
LOCK sockpipe_lock; /* signaled flag access lock */
int sockpipe_flag; /* 1 == already signaled */
int sockwpipe; /* Sockdev signaling pipe Wr */
int sockrpipe; /* Sockdev signaling pipe Rd */
RADR mbo; /* Measurement block origin */
BYTE mbk; /* Measurement block key */
int mbm; /* Measurement block mode */
int mbd; /* Device connect time mode */
LOCK scrlock; /* Script processing lock */
COND scrcond; /* Test script condition */
int scrtest; /* 1 == test mode active */
double scrfactor; /* Testing timeout factor */
TID cmdtid; /* Active command thread */
char *cmdsep; /* Single Char cmd Sep */
BYTE sysgroup; /* Panel Command grouping */
#define SYSGROUP_SYSOPER 0x01 /* Computer operator group */
#define SYSGROUP_SYSMAINT 0x02 /* System Maintainer group */
#define SYSGROUP_SYSPROG 0x04 /* System Programmer group */
#define SYSGROUP_SYSNONE 0x08 /* Command valid w/no group */
#define SYSGROUP_SYSCONFIG 0x10 /* System Configuration group*/
#define SYSGROUP_SYSDEVEL 0x20 /* Hercules Developer group */
#define SYSGROUP_SYSDEBUG 0x40 /* Internal Debug group */
#define SYSGROUP_SYSNDIAG 0x80 /* Not supported by DIAG008 */
#define SYSGROUP_SYSALL 0x7F /* All groups but no DIAG008 */
#define SYSGROUP_PROGDEVELDEBUG ( SYSGROUP_SYSPROG | \
SYSGROUP_SYSDEVEL | \
SYSGROUP_SYSDEBUG )
#if defined(_DEBUG) || defined(DEBUG)
#define DEFAULT_SYSGROUP SYSGROUP_SYSALL
#else
#define DEFAULT_SYSGROUP (0 \
| SYSGROUP_SYSOPER \
| SYSGROUP_SYSMAINT \
| SYSGROUP_SYSPROG \
| SYSGROUP_SYSNONE \
| SYSGROUP_SYSCONFIG \
)
#endif
BYTE diag8cmd; /* Allow diagnose 8 commands */
#define DIAG8CMD_ENABLE 0x01 /* Enable DIAG8 interface */
#define DIAG8CMD_RUNNING 0x40 /* Indicate DIAG8 in process */
#define DIAG8CMD_ECHO 0x80 /* Echo command to console */
BYTE shcmdopt; /* 'sh'ell command option */
#define SHCMDOPT_ENABLE 0x01 /* Globally enable 'sh' cmd */
#define SHCMDOPT_DIAG8 0x80 /* Allow DIAG8 'sh' also */
int panrate; /* Panel refresh rate */
int timerint; /* microsecs timer interval */
char *pantitle; /* Alt console panel title */
#if defined( OPTION_SCSI_TAPE )
/* Access to all SCSI fields controlled by sysblk.stape_lock */
LOCK stape_lock; /* LOCK for all SCSI fields */
int auto_scsi_mount_secs; /* scsimount frequency: #of */
/* seconds; 0 == disabled */
#define DEF_SCSIMOUNT_SECS (5) /* Default scsimount value */
TID stape_getstat_tid; /* Tape-status worker thread */
TID stape_mountmon_tid; /* Tape-mount worker thread */
COND stape_getstat_cond; /* Tape-status thread COND */
u_int stape_getstat_busy:1; /* 1=Status thread is busy */
LIST_ENTRY stape_status_link; /* get status request chain */
LIST_ENTRY stape_mount_link; /* scsimount request chain */
struct timeval
stape_query_status_tod; /* TOD of last status query */
#endif // defined( OPTION_SCSI_TAPE )
/*-----------------------------------------------------------*/
/* Control Units */
/*-----------------------------------------------------------*/
U16 cuhigh; /* Highest used CU number */
CHAINBLK cuchain; /* -> CU chain */
/*-----------------------------------------------------------*/
/* Devices */
/*-----------------------------------------------------------*/
DEVBLK *firstdev; /* -> First device block */
DEVBLK *sysgdev; /* -> devblk for SYSG console*/
DEVBLK ***devnum_fl; /* 1st level table for fast */
/* devnum lookup */
DEVBLK ***subchan_fl; /* Subchannel table fast */
/* lookup table */
int highsubchan[FEATURE_LCSS_MAX]; /* Highest subchan+1 */
CHPBLK *firstchp; /* -> First channel path */
u_int dasdcache:1; /* 0 = system cache off
1 = system cache on */
/*-----------------------------------------------------------*/
/* I/O Management */
/*-----------------------------------------------------------*/
int mss; /* Multiple CSS enabled */
int lcssmax; /* Maximum Subchannel-Set Id */
LOCK crwlock; /* CRW queue lock */
U32 *crwarray; /* CRW queue */
U32 crwalloc; /* #of entries allocated */
U32 crwcount; /* #of entries queued */
U32 crwindex; /* CRW queue index */
IOINT *iointq; /* I/O interrupt queue */
DEVBLK *ioq; /* I/O queue */
LOCK ioqlock; /* I/O queue lock */
COND ioqcond; /* I/O queue condition */
int devtwait; /* Device threads waiting */
int devtnbr; /* Number of device threads */
int devtmax; /* Max device threads */
int devthwm; /* High water mark */
int devtunavail; /* Count thread unavailable */
RADR addrlimval; /* Address limit value (SAL) */
#if defined(_FEATURE_VM_BLOCKIO)
U16 servcode; /* External interrupt code */
BYTE biosubcd; /* Block I/O sub int. code */
BYTE biostat; /* Block I/O status */
U64 bioparm; /* Block I/O interrupt parm */
DEVBLK *biodev; /* Block I/O device */
/* Note: biodev is only used to detect BIO interrupt tracing */
#endif /* defined(FEATURE_VM_BLOCKIO) */
TAMDIR *tamdir; /* Acc/Rej AUTOMOUNT dir ctl */
char *defdir; /* Default AUTOMOUNT dir */
U32 servparm; /* Service signal parameter */
unsigned int /* Flags */
sys_reset:1, /* 1 = system in reset state */
ipled:1, /* 1 = guest has been IPL'ed */
daemon_mode:1, /* Daemon mode active */
panel_init:1, /* Panel display initialized */
npquiet:1, /* New Panel quiet indicator */
#if defined(_FEATURE_SYSTEM_CONSOLE)
scpecho:1, /* scp echo mode indicator */
scpimply:1, /* scp imply mode indicator */
#endif
sigintreq:1, /* 1 = SIGINT request pending*/
insttrace:1, /* 1 = Instruction trace */
inststep:1, /* 1 = Instruction step */
shutdown:1, /* 1 = shutdown requested */
shutfini:1, /* 1 = shutdown complete */
shutimmed:1, /* 1 = shutdown req immed */
main_clear:1, /* 1 = mainstor is cleared */
xpnd_clear:1, /* 1 = xpndstor is cleared */
showregsfirst:1, /* 1 = show regs before inst */
showregsnone:1, /* 1 = show no registers */
nomountedtapereinit:1, /* 1 = disallow tape devinit
if tape already mounted */
noautoinit:1, /* 1=AUTOINIT disabled */
legacysenseid:1, /* ena/disa senseid on */
/* legacy devices */
haveiplparm:1, /* IPL PARM a la VM */
logoptnotime:1, /* 1 = don't timestamp log */
showdvol1:2, /* Show dasd VOL1 in devlist */
nolrasoe:1; /* 1 = No trace LRA Special */
/* Operation Exceptions */
#define SHOWDVOL1_NO 0 /* Do not show vol1 at all */
#define SHOWDVOL1_YES 1 /* Show vol1 AND filename */
#define SHOWDVOL1_ONLY 2 /* Show vol1 NOT filename */
U32 ints_state; /* Common Interrupts Status */
CPU_BITMAP config_mask; /* Configured CPUs */
CPU_BITMAP started_mask; /* Started CPUs */
CPU_BITMAP waiting_mask; /* Waiting CPUs */
U64 traceaddr[2]; /* Tracing address range */
U64 stepaddr[2]; /* Stepping address range */
BYTE iplparmstring[64]; /* 64 bytes loadable at IPL */
#ifdef _FEATURE_ECPSVM
//
/* ECPS:VM */
struct {
u_int level:16;
u_int debug:1;
u_int available:1;
u_int enabletrap:1;
u_int freetrap:1;
} ecpsvm; /* ECPS:VM structure */
//
#endif
U64 pgminttr; /* Program int trace mask */
int pcpu; /* Tgt CPU panel cmd & displ */
int hercprio; /* Hercules process priority */
int todprio; /* TOD Clock thread priority */
int cpuprio; /* CPU thread priority */
int devprio; /* Device thread priority */
int srvprio; /* Listeners thread priority */
TID httptid; /* HTTP listener thread id */
/* Fields used by SYNCHRONIZE_CPUS */
int syncing; /* 1=Sync in progress */
CPU_BITMAP sync_mask; /* CPU mask for syncing CPUs */
COND sync_cond; /* COND for syncing CPU */
COND sync_bc_cond; /* COND for other CPUs */
#if defined(OPTION_SHARED_DEVICES)
TID shrdtid; /* Shared device listener */
U16 shrdport; /* Shared device server port */
U32 shrdcount; /* IO count */
SHRD_TRACE *shrdtrace; /* Internal trace table */
SHRD_TRACE *shrdtracep; /* Current pointer */
SHRD_TRACE *shrdtracex; /* End of trace table */
int shrdtracen; /* Number of entries */
#endif
#ifdef OPTION_IODELAY_KLUDGE
int iodelay; /* I/O delay kludge for linux*/
#endif /*OPTION_IODELAY_KLUDGE*/
#if !defined(NO_SETUID)
uid_t ruid, euid, suid;
gid_t rgid, egid, sgid;
#endif /*!defined(NO_SETUID)*/
#if defined(OPTION_COUNTING)
S64 count[OPTION_COUNTING];
#define COUNT(n) sysblk.count[(n)]++
#else
#define COUNT(n)
#endif
#if defined(OPTION_INSTRUCTION_COUNTING)
#define IMAP_FIRST sysblk.imap01
U64 imap01[256];
U64 imapa4[256];
U64 imapa5[16];
U64 imapa6[256];
U64 imapa7[16];
U64 imapb2[256];
U64 imapb3[256];
U64 imapb9[256];
U64 imapc0[16];
U64 imapc2[16]; /*@Z9*/
U64 imapc4[16]; /*208*/
U64 imapc6[16]; /*208*/
U64 imapc8[16];
U64 imape3[256];
U64 imape4[256];
U64 imape5[256];
U64 imapeb[256];
U64 imapec[256];
U64 imaped[256];
U64 imapxx[256];
#define IMAP_SIZE \
( sizeof(sysblk.imap01) \
+ sizeof(sysblk.imapa4) \
+ sizeof(sysblk.imapa5) \
+ sizeof(sysblk.imapa6) \
+ sizeof(sysblk.imapa7) \
+ sizeof(sysblk.imapb2) \
+ sizeof(sysblk.imapb3) \
+ sizeof(sysblk.imapb9) \
+ sizeof(sysblk.imapc0) \
+ sizeof(sysblk.imapc2) /*@Z9*/ \
+ sizeof(sysblk.imapc4) /*208*/ \
+ sizeof(sysblk.imapc6) /*208*/ \
+ sizeof(sysblk.imapc8) \
+ sizeof(sysblk.imape3) \
+ sizeof(sysblk.imape4) \
+ sizeof(sysblk.imape5) \
+ sizeof(sysblk.imapeb) \
+ sizeof(sysblk.imapec) \
+ sizeof(sysblk.imaped) \
+ sizeof(sysblk.imapxx) )
#endif
char *cnslport; /* console port string */
char **herclogo; /* Constructed logo screen */
char *logofile; /* File name of logo file */
size_t logolines; /* Logo file number of lines */
#if defined(OPTION_MIPS_COUNTING)
/* Merged Counters for all CPUs */
U64 instcount; /* Instruction counter */
U32 mipsrate; /* Instructions per second */
U32 siosrate; /* IOs per second */
#endif /*defined(OPTION_MIPS_COUNTING)*/
int regs_copy_len; /* Length to copy for REGS */
REGS dummyregs; /* Regs for unconfigured CPU */
unsigned int msglvl; /* Message level */
#define MLVL_VERBOSE 0x80000000 /* Show cfg file messages */
#define MLVL_DEBUG 0x40000000 /* Prefix w/filename(line#) */
#define MLVL_EMSGLOC 0x20000000 /* Show location of err msgs */
#if defined(_DEBUG) || defined(DEBUG)
#define DEFAULT_MLVL (MLVL_VERBOSE | MLVL_DEBUG)
#else
#define DEFAULT_MLVL (MLVL_VERBOSE)
#endif
LOCK mntlock; /* tape mount lock */
#if defined( OPTION_SHUTDOWN_CONFIRMATION )
#define QUITTIME_PERIOD 10
int quitmout; /* Current timeout value */
time_t shutquittime; /* Quit requested time */
time_t SSD_time; /* SSD requested time */
#endif // defined( OPTION_SHUTDOWN_CONFIRMATION )
BLOCK_TRAILER; /* eye-end */
};
/*-------------------------------------------------------------------*/
/* I/O interrupt queue entry */
/*-------------------------------------------------------------------*/
struct IOINT { /* I/O interrupt queue entry */
IOINT *next; /* -> next interrupt entry */
DEVBLK *dev; /* -> Device block */
int priority; /* Device priority */
unsigned int
pending:1, /* 1=Normal interrupt */
pcipending:1, /* 1=PCI interrupt */
attnpending:1; /* 1=ATTN interrupt */
};
/*-------------------------------------------------------------------*/
/* SCSI support threads request structures... (i.e. work items) */
/*-------------------------------------------------------------------*/
#if defined(OPTION_SCSI_TAPE)
struct STSTATRQ /* Status Update Request */
{
LIST_ENTRY link; /* just a link in the chain */
DEVBLK* dev; /* ptr to device block */
};
typedef struct STSTATRQ STSTATRQ;
struct STMNTDRQ /* Automatic Mount Request */
{
LIST_ENTRY link; /* just a link in the chain */
DEVBLK* dev; /* ptr to device block */
};
typedef struct STMNTDRQ STMNTDRQ;
#endif // defined( OPTION_SCSI_TAPE )
/*-------------------------------------------------------------------*/
/* Control Unit configuration block */
/*-------------------------------------------------------------------*/
typedef struct _CUBLK { /* CU configuration block */
CHAIN chain; /* Block chain */
U16 cunum; /* CU number */
void *cudesc; /* CU descriptor */
U8 maxssid; /* Maximum number of SSIDs */
U8 ssidcount; /* Number of associated SSID */
CHAINBLK sschain; /* Associated SSIDs */
U16 maxdev; /* Maximum associated dev */
U16 devcount; /* Number of associated dev */
} CUBLK;
/*-------------------------------------------------------------------*/
/* tdparms loader types (ACL mode) */
/*-------------------------------------------------------------------*/
enum type_loader { LDR_MANUAL, /* No automation */
LDR_AUTO, /* Automatic Mode */
LDR_SILO, /* Use LOAD DISPLAY */
LDR_QUEUE /* Like AUTO */
};
/*-------------------------------------------------------------------*/
/* Subsystem ID configuration block */
/*-------------------------------------------------------------------*/
typedef struct _SSBLK { /* Subsystem ID block */
CHAIN chain; /* Block chain */
CUBLK *cu; /* Owning CU */
U16 ssid; /* Subsystem ID (if present) */
LOCK lock; /* Update lock */
void *cudesc; /* CU descriptor */
U16 maxdev; /* Maximum associated dev */
U8 devcount; /* Number of associated dev */
DEVBLK *dev[256]; /* Associated devblocks */
void *stats; /* Associated statistics */
} SSBLK;
/*-------------------------------------------------------------------*/
/* Channel Path config block */
/*-------------------------------------------------------------------*/
struct CHPBLK {
#define HDL_NAME_CHPBLK "DEVBLK"
#define HDL_VERS_CHPBLK "3.08"
#define HDL_SIZE_CHPBLK sizeof(CHPBLK)
CHPBLK *nextchp;
BYTE css;
BYTE chpid;
BYTE chptype;
};
/*-------------------------------------------------------------------*/
/* Telnet Control Block */
/*-------------------------------------------------------------------*/
#define TTYPE_LEN TELNET_MAX_TTYPE_LEN /* (just a shorter name) */
struct TELNET {
char ttype[TTYPE_LEN+1]; /* Client terminal type */
char tgroup[16]; /* Terminal group name */
char clientid[32]; /* Client Id string */
int csock; /* Client socket */
telnet_t *ctl; /* Ptr to libtelnet control */
DEVBLK *dev; /* Device Block ptr or NULL */
U16 devnum; /* Requested device number, */
/* or FFFF=any device number */
BYTE devclass; /* 'D' = 3270 Display, */
/* 'K' = Keyboard console, */
/* 'P' = 3287 Printer */
BYTE model; /* 3270 model (2,3,4,5,X) */
/* ----- Boolean flags ----- */