1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 disk_reader: proc (data_ptr, data_lth);
18
19
20
21
22
23
24
25
26 dcl Max_pages fixed bin init (256) static options (constant);
27 dcl addr builtin;
28 dcl addrel builtin;
29 dcl data_lth fixed bin (18) parameter;
30 dcl data_ptr ptr parameter;
31 dcl disk_mst_seg$ external;
32 dcl disk_mst_seg_astep ptr static;
33 dcl disk_mst_seg_sdw fixed bin (71);
34 dcl divide builtin;
35 dcl make_sdw$no_pages entry (fixed bin (15), fixed bin (71), ptr, ptr);
36 dcl min builtin;
37 dcl mst_area_left fixed bin (26) static;
38 dcl next_mst_word fixed bin (26) static;
39 dcl page_table (0:255) bit (36) aligned based (ptp);
40 dcl pc$cleanup entry (ptr);
41 dcl pmut$camp entry;
42 dcl pmut$swap_sdw entry (ptr, ptr);
43 dcl ptp ptr static;
44 dcl ptw_num fixed bin;
45 dcl ptw_util_$make_disk entry (ptr, fixed bin (20));
46 dcl pvt$root_pvtx fixed bin external;
47 dcl segno builtin;
48 dcl start_partition_record fixed bin (20) static;
49 dcl sys_boot_info$bce_part_frec fixed bin (20) external;
50 dcl sys_boot_info$bce_part_nrec fixed bin (20) external;
51 dcl sys_boot_info$mst_past_bce_frec fixed bin (20) external;
52 dcl syserr entry options (variable);
53 dcl user_area (user_area_lth) bit (36) aligned based (user_area_ptr);
54 dcl user_area_lth fixed bin (18);
55 dcl user_area_ptr ptr;
56 dcl user_data_lth fixed bin (18);
57
58 if mst_area_left < data_lth then call syserr (CRASH, "disk_reader: Attempt to read past end of mst area.");
59
60 user_area_ptr = data_ptr;
61 user_data_lth = data_lth;
62 do while (user_data_lth > 0);
63 user_area_lth = min (user_data_lth, Max_pages * 1024 - next_mst_word);
64 user_area = addrel (addr (disk_mst_seg$), next_mst_word) -> user_area;
65 user_data_lth = user_data_lth - user_area_lth;
66 user_area_ptr = addrel (user_area_ptr, user_area_lth);
67 mst_area_left = mst_area_left - user_area_lth;
68 next_mst_word = next_mst_word + user_area_lth;
69 if next_mst_word = Max_pages * 1024 then do;
70 call pc$cleanup (disk_mst_seg_astep);
71 call advance_mst_seg;
72 end;
73 end;
74 return;
75 %page;
76 init: entry;
77
78
79
80 call make_sdw$no_pages (segno (addr (disk_mst_seg$)), disk_mst_seg_sdw, disk_mst_seg_astep, ptp);
81 disk_mst_seg_astep -> aste.pvtx = pvt$root_pvtx;
82 call pmut$swap_sdw (addr (disk_mst_seg$), addr (disk_mst_seg_sdw));
83 start_partition_record = sys_boot_info$mst_past_bce_frec - Max_pages;
84 mst_area_left = (sys_boot_info$bce_part_frec + sys_boot_info$bce_part_nrec - sys_boot_info$mst_past_bce_frec) * 1024;
85 next_mst_word = 0;
86 call advance_mst_seg;
87 return;
88 %page;
89 final: entry;
90
91
92
93 call pc$cleanup (disk_mst_seg_astep);
94 disk_mst_seg_sdw = 0;
95 call pmut$swap_sdw (addr (disk_mst_seg$), addr (disk_mst_seg_sdw));
96 return;
97 %page;
98 advance_mst_seg: proc;
99
100
101
102 start_partition_record = start_partition_record + Max_pages;
103 next_mst_word = 0;
104 do ptw_num = 0 to min (Max_pages, divide (mst_area_left + 1023, 1024, 20)) - 1;
105 call ptw_util_$make_disk (addr (page_table (ptw_num)), start_partition_record + ptw_num);
106 end;
107 call pmut$camp;
108 return;
109 end;
110 %page; %include aste;
111 %page; %include bce_partition_layout;
112 %page; %include syserr_constants;
113 %page;
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133 end;