1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 truncate_stacks:
22 procedure;
23
24
25
26
27
28 declare pds$stacks (0:7) pointer ext;
29 declare pc$truncate_count entry (pointer, fixed bin (18), fixed bin (18));
30 declare lock$lock_ast entry;
31 declare lock$unlock_ast entry;
32 declare get_ptrs_$given_segno entry (fixed bin (18)) returns (pointer);
33 declare ptw_util_$get_add_type entry (ptr, bit (4) unaligned);
34 declare sdw_util_$dissect entry (ptr, ptr);
35
36 declare pageno fixed bin (18);
37 declare n_in_core fixed bin (18);
38 declare stkx fixed bin;
39
40 declare 1 stack_sdw_info aligned like sdw_info;
41
42 declare dseg$ (0:1023) fixed bin (71) aligned ext;
43 declare sst$stk_pages_truncated
44 fixed bin (35) ext;
45 declare sst$stk_pages_truncated_in_core
46 fixed bin (35) ext;
47
48 declare (addr, baseno, bin, divide, null, rel, size)
49 builtin;
50 ^L
51
52 call lock$lock_ast;
53
54 do stkx = 1 to 7;
55 if pds$stacks (stkx) ^= null
56 then call DO (pds$stacks (stkx), "0"b);
57 end;
58
59 call lock$unlock_ast;
60 return;
61
62 DO:
63 procedure (segp, stack_0);
64
65 declare segp pointer;
66 declare stack_0 bit (1) aligned;
67 declare at bit (4);
68 declare ptp pointer;
69
70 call sdw_util_$dissect (addr (dseg$ (bin (baseno (segp)))), addr (stack_sdw_info));
71 if stack_sdw_info.flags.faulted | ^stack_sdw_info.access.read
72 then goto RETURN;
73 astep = get_ptrs_$given_segno (bin (baseno (segp), 18));
74
75 if astep = null
76 then go to RETURN;
77
78 ptp = addrel (astep, size (aste));
79 call ptw_util_$get_add_type (ptp, at);
80 if at ^= add_type.core
81 then go to RETURN;
82
83 if stack_sdw_info.size <= bin (rel (addr (segp -> stack_header.stack_end_ptr))) + 2
84 then goto RETURN;
85
86 pageno = divide (bin (rel (segp -> stack_header.stack_end_ptr)) + 1023, 1024, 19, 0);
87 if stack_0
88 then pageno = pageno + 1;
89
90 sst$stk_pages_truncated = sst$stk_pages_truncated + bin (aste.csl, 9) - pageno + 1;
91
92
93 call pc$truncate_count (astep, pageno, n_in_core);
94
95 sst$stk_pages_truncated_in_core = sst$stk_pages_truncated_in_core + n_in_core;
96
97 RETURN:
98 end DO;
99
100 %include add_type;
101 %include aste;
102 %include dir_entry;
103 %include sdw_info;
104 %include stack_header;
105
106 end truncate_stacks;