String Descriptor Validation 4-FEB-2004 11:02:03 BLISS-32I T1.1-053 Page 1 19-MAR-2002 10:33:17 [LASTOVICA.XPORT.VMSGEN]SVALID.BLI;2 0 1 MODULE SVALID ( IDENT = 'X00.05' %TITLE 'String Descriptor Validation' 0 2 %BLISS32( ,ADDRESSING_MODE( EXTERNAL=LONG_RELATIVE ) ) 0 3 %BLISS36( ,ENTRY( XST$VALIDATE ),OTS='' ) 0 4 ) = 0 5 BEGIN 1 6 1 7 ! 1 8 ! COPYRIGHT (c) 1980 BY 1 9 ! DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. 1 10 ! 1 11 ! THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED 1 12 ! ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE 1 13 ! INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER 1 14 ! COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY 1 15 ! OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY 1 16 ! TRANSFERRED. 1 17 ! 1 18 ! THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE 1 19 ! AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT 1 20 ! CORPORATION. 1 21 ! 1 22 ! DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS 1 23 ! SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL. 1 24 ! 1 25 1 26 !++ 1 27 ! 1 28 ! FACILITY: BLISS Library 1 29 ! 1 30 ! ABSTRACT: 1 31 ! 1 32 ! This module is the XPORT String Descriptor validator. 1 33 ! 1 34 ! ENVIRONMENT: User mode - multiple host operating/file systems 1 35 ! 1 36 ! AUTHOR: Ward Clark, CREATION DATE: 15-Feb-80 1 37 ! 1 38 !-- SVALID String Descriptor Validation 4-FEB-2004 11:02:03 BLISS-32I T1.1-053 Page 2 X00.05 19-MAR-2002 10:33:17 [LASTOVICA.XPORT.VMSGEN]SVALID.BLI;2 1 40 ! 1 41 ! TABLE OF CONTENTS: 1 42 ! 1 43 1 44 FORWARD ROUTINE 1 45 XST$VALIDATE; ! String descriptor validation routine 1 46 1 47 ! 1 48 ! INCLUDE FILES: 1 49 ! 1 50 1 51 LIBRARY 'XPORT' ; ! Public XPORT control block and macro definitions 1 53 LIBRARY 'XPOSYS' ; ! Internal XPORT macro definitions 1 55 1 56 $XPO_SYS_TEST( $TOPS10, $TOPS20, $VMS, $11M, $IAS, $RSTS, $RT11 ) ; %PRINT: This module was compiled for VAX/VMS ; %PRINT: XPORT V1.3-51 XPOSYS V1.3-16 XPO$K_VERSION = 1 XPO$K_LEVEL = 3 1 57 1 58 ! 1 59 ! MACROS: 1 60 ! 1 61 1 62 ! 1 63 ! EQUATED SYMBOLS: 1 64 ! 1 65 1 66 ! 1 67 ! PSECT DECLARATIONS: 1 68 ! 1 69 1 70 $XPO_PSECTS ! Declare XPORT PSECT names and attributes 1 71 1 72 ! 1 73 ! OWN STORAGE: 1 74 ! 1 75 1 76 %IF $VMS %THEN 1 77 OWN 1 78 psl_mode : BYTE INITIAL( 0 ), ! PROBE indicator to use PSL mode 1 79 1 80 fixed_size : ! Length in bytes of a FIXED/DYNAMIC descriptor 1 81 WORD INITIAL( STR$K_F_BLN * %UPVAL ), 1 82 1 83 bounded_size : ! Length in bytes of a BOUNDED/DYNAMIC_BOUNDED descriptor 1 84 WORD INITIAL( STR$K_B_BLN * %UPVAL ); 1 85 %FI 1 86 1 87 ! 1 88 ! EXTERNAL REFERENCES: 1 89 ! SVALID XST$VALIDATE - String Descripto 4-FEB-2004 11:02:03 BLISS-32I T1.1-053 Page 3 X00.05 19-MAR-2002 10:33:17 [LASTOVICA.XPORT.VMSGEN]SVALID.BLI;2 1 91 %TITLE 'XST$VALIDATE - String Descriptor Validation' 1 92 1 93 GLOBAL ROUTINE XST$VALIDATE( string ) = 1 94 1 95 !++ 1 96 ! 1 97 ! FUNCTIONAL DESCRIPTION: 1 98 ! 1 99 ! This routine verifies that all fields of a string descriptor are 1 100 ! valid and consistant. 1 101 ! 1 102 ! FORMAL PARAMETERS: 1 103 ! 1 104 ! string - address of a string descriptor 1 105 ! 1 106 ! IMPLICIT INPUTS: 1 107 ! 1 108 ! None 1 109 ! 1 110 ! IMPLICIT OUTPUTS: 1 111 ! 1 112 ! None 1 113 ! 1 114 ! COMPLETION CODES: 1 115 ! 1 116 ! STR$_NORMAL - the string descriptor is valid 1 117 ! 1 118 ! STR$_BAD_CLASS - invalid string descriptor class 1 119 ! STR$_BAD_DTYPE - invalid string data type 1 120 ! STR$_BAD_MAXLEN - invalid maximum string length 1 121 ! STR$_BAD_PTR - invalid string pointer 1 122 ! STR$_NO_STRING - no string specified 1 123 ! XPO$_BAD_ADDR - descriptor in read-protected memory (VMS only) 1 124 ! or 1 125 ! failure completion code from $STR_ASCII, $STR_CONCAT or $STR_FORMAT 1 126 ! 1 127 ! SIDE EFFECTS: 1 128 ! 1 129 ! None 1 130 ! 1 131 !-- 1 132 1 133 BEGIN 2 134 2 135 MAP 2 136 string : REF $STR_DESCRIPTOR( CLASS = BOUNDED ); 2 137 2 138 ! 2 139 ! Test for a non-existant string descriptor. 2 140 ! 2 141 2 142 IF .string EQL 0 2 143 THEN 2 144 RETURN STR$_NO_STRING; 2 145 2 146 ! 2 147 ! Verify that the descriptor can be read. SVALID XST$VALIDATE - String Descripto 4-FEB-2004 11:02:03 BLISS-32I T1.1-053 Page 4 X00.05 19-MAR-2002 10:33:17 [LASTOVICA.XPORT.VMSGEN]SVALID.BLI;2 2 148 ! 2 149 2 150 ! 2 151 ! Base the specific tests on the string data type. 2 152 ! 2 153 2 154 SELECTONE .string[STR$B_DTYPE] OF 2 155 SET 2 156 2 157 ! 2 158 ! First validate the string descriptor class. 2 159 ! 2 160 2 161 [ STR$K_DTYPE_T ] : ! Standard ASCII string: 2 162 SELECTONE .string[STR$B_CLASS] OF ! 2 163 SET ! 2 164 [ STR$K_CLASS_F, ! FIXED 2 165 STR$K_CLASS_D, ! DYNAMIC 2 166 STR$K_CLASS_B, ! BOUNDED 2 167 STR$K_CLASS_DB, ! DYNAMIC_BOUNDED 2 168 STR$K_CLASS_XT ] : ! XPORT_TEMPORARY 2 169 STR$_NORMAL; 2 170 2 171 [ OTHERWISE ] : 2 172 RETURN STR$_BAD_CLASS; 2 173 TES; 2 174 2 175 [ STR$K_DTYPE_XXX ] : ! Erroneous XPORT temporary string: 2 176 SELECTONE .string[STR$B_CLASS] OF ! 2 177 SET ! 2 178 [ STR$K_CLASS_F, ! FIXED 2 179 STR$K_CLASS_XT ] : ! XPORT_TEMPORARY 2 180 2 181 RETURN .string[STR$A_POINTER]; ! Return the $STR_ASCII, $STR_CONCAT or $STR_FORMAT er 2 181 ror code. 2 182 2 183 [ OTHERWISE ] : 2 184 RETURN STR$_BAD_DTYPE; 2 185 TES; 2 186 2 187 [ OTHERWISE ] : ! Invalid string data type 2 188 RETURN STR$_BAD_DTYPE; 2 189 TES; 2 190 2 191 ! 2 192 ! Validate the string text/buffer. 2 193 ! 2 194 2 195 SELECTONE .string[STR$B_CLASS] OF ! Base the test(s) on the descriptor class. 2 196 SET 2 197 2 198 [ STR$K_CLASS_F, STR$K_CLASS_D ] : ! FIXED or DYNAMIC descriptor: 2 199 IF .string[STR$H_LENGTH] NEQ 0 AND ! If string exists, 2 200 .string[STR$A_POINTER] EQL 0 ! make sure a pointer exists. 2 201 THEN 2 202 RETURN STR$_BAD_PTR; 2 203 SVALID XST$VALIDATE - String Descripto 4-FEB-2004 11:02:03 BLISS-32I T1.1-053 Page 5 X00.05 19-MAR-2002 10:33:17 [LASTOVICA.XPORT.VMSGEN]SVALID.BLI;2 2 204 [ STR$K_CLASS_B, STR$K_CLASS_DB ] : ! BOUNDED or DYNAMIC_BOUNDED descriptor: 2 205 BEGIN 3 206 IF ( .string[STR$B_CLASS] EQL STR$K_CLASS_B OR 4 207 .string[STR$B_CLASS] EQL STR$K_CLASS_DB ) AND 3 208 .string[STR$H_MAXLEN] LSS 3 209 .string[STR$H_LENGTH] + .string[STR$H_PFXLEN] 3 210 THEN 3 211 RETURN STR$_BAD_MAXLEN; 3 212 3 213 IF .string[STR$H_MAXLEN] NEQ 0 AND ! If string exists, 3 214 .string[STR$A_POINTER] EQL 0 ! make sure a pointer exists. 3 215 THEN 3 216 RETURN STR$_BAD_PTR; 3 217 END; 2 218 2 219 TES; 2 220 2 221 ! 2 222 ! Return to the caller after successful string descriptor validation. 2 223 ! 2 224 2 225 RETURN STR$_NORMAL 2 226 2 227 END; 1 228 END 1 229 ELUDOM SVALID Machine Code Listing 4-FEB-2004 11:02:03 BLISS-32I T1.1-053 Page 6 X00.05 19-MAR-2002 10:33:17 [LASTOVICA.XPORT.VMSGEN]SVALID.BLI;2 .psect _XPO$CODE, CON, LCL, SHR, EXE, NOWRT, NOVEC .proc XST$VALIDATE .align 32 .global XST$VALIDATE XST$VALIDATE: // 000093 { .mib 002C00204840 0000 alloc r33 = rspfs, 1, 1, 0, 0 01C432000000 0001 cmp4.eq pr0, pr6 = r0, STRING // pr0, pr6 = r0, r32 // 000142 008600006006 0002 (pr6) br.cond.dpnt.few L$2 } { .mlx 000008000000 0010 nop.m 0 000000000000 0011 movl r8 = 2402426 // 000144 0195025E84 } { .mfb 000008000000 0020 nop.m 0 000008000000 0021 nop.f 0 00800005A000 0022 br.sptk.few L$4 ;; } 0030 L$2: // 000142 { .mii 000008000000 0030 nop.m 0 0000B2000800 0031 sxt4 r32 = STRING ;; // r32 = r32 // 000154 010802004800 0032 adds r32 = 2, r32 ;; } { .mmi 00B00A0FC0C0 0040 ld1 r3 = [r32], -2 ;; 01CC4031C000 0041 cmp4.eq pr0, pr8 = 14, r3 000008000000 0042 nop.i 0 } { .mfb 000008000000 0050 nop.m 0 000008000000 0051 nop.f 0 008600042008 0052 (pr8) br.cond.dpnt.few L$7 } { .mmi 010802006800 0060 adds r32 = 3, r32 ;; // 000162 00B00A0FA240 0061 ld1 r9 = [r32], -3 000008000000 0062 nop.i 0 ;; } { .mii 0119F09862C0 0070 adds r11 = -189, r9 0119F89FE280 0071 adds r10 = -1, r9 ;; 01AC60B02000 0072 cmp4.ltu pr0, pr12 = 1, r11 } { .mmi 01AC50A042C0 0080 cmp4.ltu pr11, pr10 = 2, r10 ;; 01C20000028C 0081 (pr12) cmp.eq.or.andcm pr10, pr0 = r0, r0 000008000000 0082 nop.i 0 } { .mfb 000008000000 0090 nop.m 0 000008000000 0091 nop.f 0 00860000600A 0092 (pr10) br.cond.dpnt.few L$9 } { .mlx SVALID Machine Code Listing 4-FEB-2004 11:02:03 BLISS-32I T1.1-053 Page 7 X00.05 XST$VALIDATE 19-MAR-2002 10:33:17 [LASTOVICA.XPORT.VMSGEN]SVALID.BLI;2 000008000000 00A0 nop.m 0 000000000000 00A1 movl r8 = 2402314 // 000172 0195024284 } { .mfb 000008000000 00B0 nop.m 0 000008000000 00B1 nop.f 0 008000048000 00B2 br.sptk.few L$4 ;; } 00C0 L$9: // 000154 { .mfb 01AC00A023C0 00C0 cmp4.ltu pr15, pr0 = 1, r10 // 000195 000008000000 00C1 nop.f 0 00860001000F 00C2 (pr15) br.cond.dpnt.few L$14 } { .mmi 008042000440 00D0 ld2 r17 = [r32] ;; // 000199 01C4311001C0 00D1 cmp4.eq pr7, pr6 = r0, r17 000008000000 00D2 nop.i 0 } { .mfb 000008000000 00E0 nop.m 0 000008000000 00E1 nop.f 0 008600006007 00E2 (pr7) br.cond.dpnt.few L$15 } { .mmi 010802008800 00F0 adds r32 = 4, r32 ;; // 000200 00B08A0F8480 00F1 ld4 r18 = [r32], -4 000008000000 00F2 nop.i 0 ;; } { .mmi 01C448024200 0100 cmp4.eq pr8, pr9 = r18, r0 ;; 01C0000011C9 0101 (pr9) cmp.eq.unc pr7, pr0 = r0, r0 // 000199 01C000001188 0102 (pr8) cmp.eq.unc pr6, pr0 = r0, r0 } 0110 L$15: { .mlx 0120000024C0 0110 mov r19 = 1 // 000202 000000000000 0111 movl r20 = 2402362 ;; 0195024E8A } { .mmi 010801300207 0120 (pr7) mov r8 = r19 ;; 010801400206 0121 (pr6) mov r8 = r20 000008000000 0122 nop.i 0 ;; } { .mib 000008000000 0130 nop.m 0 0000B0800200 0131 sxt4 r8 = r8 008000038000 0132 br.sptk.few L$4 ;; } 0140 L$14: // 000195 { .mii 01200807C540 0140 mov r21 = 190 01CC68906300 0141 cmp4.eq pr12, pr13 = 3, r9 ;; 01C4015122C0 0142 cmp4.eq pr11, pr0 = r9, r21 ;; } SVALID Machine Code Listing 4-FEB-2004 11:02:03 BLISS-32I T1.1-053 Page 8 X00.05 XST$VALIDATE 19-MAR-2002 10:33:17 [LASTOVICA.XPORT.VMSGEN]SVALID.BLI;2 { .mfb 01C26800000B 0150 (pr11) cmp.eq.or.andcm pr0, pr13 = r0, r0 000008000000 0151 nop.f 0 00860002000D 0152 (pr13) br.cond.dpnt.few L$16 } { .mii 01C401512200 0160 cmp4.eq pr8, pr0 = r9, r21 // 000207 01CC78906380 0161 cmp4.eq pr14, pr15 = 3, r9 ;; // 000206 01C278000388 0162 (pr8) cmp.eq.or.andcm pr14, pr15 = r0, r0 } { .mfb 000008000000 0170 nop.m 0 000008000000 0171 nop.f 0 00860000800F 0172 (pr15) br.cond.dpnt.few L$18 // 000207 } { .mmi 00A042014580 0180 ld2 r22 = [r32], 10 ;; // 000209 00B04A0FC5C0 0181 ld2 r23 = [r32], -2 000008000000 0182 nop.i 0 ;; } { .mii 00B04A0F0600 0190 ld2 r24 = [r32], -8 // 000208 01000172C580 0191 add r22 = r22, r23 ;; // 000209 018439630180 0192 cmp4.lt pr6, pr7 = r24, r22 ;; // 000208 } { .mii 01C0000013C7 01A0 (pr7) cmp.eq.unc pr15, pr0 = r0, r0 // 000207 01C000001386 01A1 (pr6) cmp.eq.unc pr14, pr0 = r0, r0 000008000000 01A2 nop.i 0 } 01B0 L$18: { .bbb 00860000200E 01B0 (pr14) br.cond.dpnt.few L$19 // 000206 004000000000 01B1 nop.b 0 00860000600F 01B2 (pr15) br.cond.dpnt.few L$20 } 01C0 L$19: { .mlx 000008000000 01C0 nop.m 0 000000000000 01C1 movl r8 = 2402346 // 000211 0195024A84 } { .mfb 000008000000 01D0 nop.m 0 000008000000 01D1 nop.f 0 008000024000 01D2 br.sptk.few L$4 ;; } 01E0 L$20: // 000206 { .mmi 010802010800 01E0 adds r32 = 8, r32 ;; // 000213 00B04A0F0640 01E1 ld2 r25 = [r32], -8 000008000000 01E2 nop.i 0 ;; } { .mfb 01C4519002C0 01F0 cmp4.eq pr11, pr10 = r0, r25 000008000000 01F1 nop.f 0 00860000600B 01F2 (pr11) br.cond.dpnt.few L$21 SVALID Machine Code Listing 4-FEB-2004 11:02:03 BLISS-32I T1.1-053 Page 9 X00.05 XST$VALIDATE 19-MAR-2002 10:33:17 [LASTOVICA.XPORT.VMSGEN]SVALID.BLI;2 } { .mmi 010802008800 0200 adds r32 = 4, r32 ;; // 000214 00B08A0F8680 0201 ld4 r26 = [r32], -4 000008000000 0202 nop.i 0 ;; } { .mmi 01C468034300 0210 cmp4.eq pr12, pr13 = r26, r0 ;; 01C0000012CD 0211 (pr13) cmp.eq.unc pr11, pr0 = r0, r0 // 000213 01C00000128C 0212 (pr12) cmp.eq.unc pr10, pr0 = r0, r0 } 0220 L$21: { .mlx 0120000026C0 0220 mov r27 = 1 // 000216 000000000000 0221 movl r28 = 2402362 ;; 0195024E8E } { .mmi 010801B0020B 0230 (pr11) mov r8 = r27 ;; 010801C0020A 0231 (pr10) mov r8 = r28 000008000000 0232 nop.i 0 ;; } { .mib 000008000000 0240 nop.m 0 0000B0800200 0241 sxt4 r8 = r8 008000016000 0242 br.sptk.few L$4 ;; } 0250 L$16: // 000195 { .mfb 012000002200 0250 mov r8 = 1 // 000225 000008000000 0251 nop.f 0 008000014000 0252 br.sptk.few L$4 ;; } 0260 L$7: // 000154 { .mfb 01C448300000 0260 cmp4.eq pr0, pr9 = r0, r3 000008000000 0261 nop.f 0 008600010009 0262 (pr9) br.cond.dpnt.few L$22 } { .mii 010802006800 0270 adds r32 = 3, r32 // 000176 01200807A780 0271 mov r30 = 189 000008000000 0272 nop.i 0 ;; } { .mmi 00B00A0FA740 0280 ld1 r29 = [r32], -3 ;; 01C401E3A3C0 0281 cmp4.eq pr15, pr0 = r29, r30 01CC31D021C0 0282 cmp4.eq pr7, pr6 = 1, r29 ;; } { .mfb 01C23000000F 0290 (pr15) cmp.eq.or.andcm pr0, pr6 = r0, r0 000008000000 0291 nop.f 0 008600006006 0292 (pr6) br.cond.dpnt.few L$24 } { .mmi 010802008800 02A0 adds r32 = 4, r32 ;; // 000181 008082000200 02A1 ld4 r8 = [r32] SVALID Machine Code Listing 4-FEB-2004 11:02:03 BLISS-32I T1.1-053 Page 10 X00.05 XST$VALIDATE 19-MAR-2002 10:33:17 [LASTOVICA.XPORT.VMSGEN]SVALID.BLI;2 000008000000 02A2 nop.i 0 ;; } { .mib 000008000000 02B0 nop.m 0 0000B0800200 02B1 sxt4 r8 = r8 008000008000 02B2 br.sptk.few L$4 ;; } 02C0 L$24: // 000176 { .mlx 000008000000 02C0 nop.m 0 000000000000 02C1 movl r8 = 2402330 ;; 0195024684 } { .mib 000008000000 02D0 nop.m 0 0000B0800200 02D1 sxt4 r8 = r8 008000004000 02D2 br.sptk.few L$4 ;; } 02E0 L$22: // 000154 { .mlx 000008000000 02E0 nop.m 0 000000000000 02E1 movl r8 = 2402330 // 000188 0195024684 } 02F0 L$4: { .mib 000008000000 02F0 nop.m 0 000154042000 02F1 mov.i rspfs = r33 004000000000 02F2 nop.b 0 } { .mfi 000008000000 0300 nop.m 0 000008000000 0301 nop.f 0 000008000000 0302 nop.i 0 ;; } { .mfb 000008000000 0310 nop.m 0 000008000000 0311 nop.f 0 000108001100 0312 br.ret.sptk.many br0 ;; } .endp XST$VALIDATE Routine Size: 800 bytes, Routine Base: _XPO$CODE + 0000 .psect _XPO$DATA, CON, LCL, NOSHR, NOEXE, WRT, NOVEC .lcomm PSL_MODE, 1, 1 .lcomm fill$$1, 1, 1 .lcomm FIXED_SIZE, 2, 2 .lcomm BOUNDED_SIZE, 2, 2 .psect _XPO$DATA, CON, LCL, NOSHR, NOEXE, WRT, NOVEC PSL_MODE: 00 0000 data1 0x0 // data1 0 FIXED_SIZE: 0008 0002 data2 0x8 // data2 8 BOUNDED_SIZE: 000C 0004 data2 0xC // data2 12 Source Listing 4-FEB-2004 11:02:03 BLISS-32I T1.1-053 Page 11 19-MAR-2002 10:33:17 [LASTOVICA.XPORT.VMSGEN]SVALID.BLI;2 ; Library Statistics ; ; -------- Symbols -------- Pages ; File Total Loaded Percent Mapped ; ; DISK$NORMS_OWN:[LASTOVICA.XPORT.VMSGEN]XPORT.L32;14 ; 590 30 5 270 ; DISK$NORMS_OWN:[LASTOVICA.XPORT.VMSGEN]XPOSYS.L32;14 ; 91 10 10 27 Source Listing 4-FEB-2004 11:02:03 BLISS-32I T1.1-053 Page 12 Source Listing 19-MAR-2002 10:33:17 [LASTOVICA.XPORT.VMSGEN]SVALID.BLI;2 COMMAND LINE: BLISSSVALID/VARIANT=3/LIST/DEBUG