Imported Upstream version 1.2.16rel
[debian/mtx] / vms / ldrutil.mar
1         .title  LDRUTIL - Obtain ucb for assigned channel
2         .ident  /LDRUTIL V1.0/
3 ; LDRUTIL - VMS UCB LDR bit utility library
4 ;
5 ; TECSys Development, Inc., April 1998
6 ;
7 ; This file may be copied under the terms and conditions of version 2
8 ; of the GNU General Public License, as published by the Free
9 ; Software Foundation (Cambridge, Massachusetts).
10 ;
11 ; This program is distributed in the hope that it will be useful,
12 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 ; GNU General Public License for more details.
15 ;
16 ; You should have received a copy of the GNU General Public License
17 ; along with this program; if not, write to the Free Software
18 ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
19 ;
20 ;
21         .link   "sys$system:sys.stb"/selective_search
22         .library /sys$share:lib/
23
24         .NTYPE  ...IS_IT_ALPHA,R22              ;Get the type of R22
25         ...IS_IT_ALPHA = <...IS_IT_ALPHA@-4&^XF>-5
26         .IIF EQ,...IS_IT_ALPHA, ALPHA=1
27
28         $ssdef
29         $ucbdef
30         $ccbdef
31         $chfdef
32         $dcdef
33         $devdef
34         $pcbdef
35
36         .psect  $$code,exe,rd,nowrt,shr
37 .IF NDF,ALPHA
38 .entry  finducb,^m<r2,r3,r4,r5,r6,r7,r8,r9>     ;Find UCB address from channel
39 .IFF
40 .call_entry,    2,home_args=TRUE,-
41                 preserve=<r2,r3,r4,r5,r6,r7,r8,r9,r10,r11>,-
42                 output=<r0,r1>,-
43                 label=finducb
44 .endc
45         movzwl  4(AP),r0                        ;prep to find UCB
46         jsb     g^IOC$VERIFYCHAN                ;callable from user mode!
47         blbc    r0,20$
48         movl    CCB$L_UCB(r1),@8(AP)            ;save UCB address
49         movzbl  #1,r0
50 20$:    ret
51
52 .IF NDF,ALPHA
53 .entry  __setldr,^m<r2,r3,r4,r5,r6,r7,r8,r9>    ;Find UCB address from channel
54 .IFF
55 .call_entry,    2,home_args=TRUE,-
56                 preserve=<r2,r3,r4,r5,r6,r7,r8,r9,r10,r11>,-
57                 output=<r0,r1>,-
58                 label=__setldr
59 .endc
60         movl    4(AP),r1
61         bisl    #DEV$M_LDR,UCB$L_DEVCHAR2(r1)
62         movzbl  #1,r0
63         ret
64
65 .IF NDF,ALPHA
66 .entry  _setldr,^m<r2,r3,r4,r5,r6,r7,r8,r9>     ;Find UCB address from channel
67 .IFF
68 .call_entry,    2,home_args=TRUE,-
69                 preserve=<r2,r3,r4,r5,r6,r7,r8,r9,r10,r11>,-
70                 output=<r0,r1>,-
71                 label=_setldr
72 .endc
73         $cmkrnl_s       -
74                 routin  =       __setldr,-
75                 arglst  =       (AP)
76         ret
77
78 .IF NDF,ALPHA
79 .entry  __clrldr,^m<r2,r3,r4,r5,r6,r7,r8,r9>    ;Find UCB address from channel
80 .IFF
81 .call_entry,    2,home_args=TRUE,-
82                 preserve=<r2,r3,r4,r5,r6,r7,r8,r9,r10,r11>,-
83                 output=<r0,r1>,-
84                 label=__clrldr
85 .endc
86         movl    4(AP),r1
87         bicl    #DEV$M_LDR,UCB$L_DEVCHAR2(r1)
88         movzbl  #1,r0
89         ret
90
91 .IF NDF,ALPHA
92 .entry  _clrldr,^m<r2,r3,r4,r5,r6,r7,r8,r9>     ;Find UCB address from channel
93 .IFF
94 .call_entry,    2,home_args=TRUE,-
95                 preserve=<r2,r3,r4,r5,r6,r7,r8,r9,r10,r11>,-
96                 output=<r0,r1>,-
97                 label=_clrldr
98 .endc
99         $cmkrnl_s       -
100                 routin  =       __clrldr,-
101                 arglst  =       (AP)
102         ret
103
104         .end