1 " ***********************************************************
 2 " *                                                         *
 3 " * Copyright, (C) Honeywell Bull Inc., 1987                *
 4 " *                                                         *
 5 " * Copyright, (C) Honeywell Information Systems Inc., 1982 *
 6 " *                                                         *
 7 " * Copyright (c) 1972 by Massachusetts Institute of        *
 8 " * Technology and Honeywell Information Systems, Inc.      *
 9 " *                                                         *
10 " ***********************************************************
11 
12 " " " " " " " " " " " " " " " " " " " " " " " " "
13 "
14 "         getuid -- Procedure to return a unique identifier as a 36 bit
15 "         quantity.
16 "         The call is:
17 "
18 "         call getuid(bit36)
19 "
20 "         The init entry point is called during initialization and does
21 "         an initial clock reading.
22 "
23 " " " " " " " " " " " " " " " " " " " " " " " " " " "
24 
25 "         Converted for the follow-on 645 by Craig Jensen on 7/14/72.
26 "         Modified to make the uids more random by Keith Loepere on 11/25/84.
27 
28           name      getuid
29           entry     getuid
30           entry     init
31 
32 
33           include   stack_header
34 
35 
36 " " " " " " " " " " " " " " " " " " " " " " " " " " " "
37 "
38 "         init
39 "
40 " " " " " " " " " " " " " " " " " " " " " " " " " " " "
41 
42 init:
43           eax1      15
44           rccl      <sys_info>|[clock_],* read the clock
45           lrs       15                  Set resolution to 32 milleseconds
46 init_loop:
47           stq       <tc_data>|[uid_array],x1      Store it in tc_data
48           adq       1,dl
49           eax1      -1,x1
50           tpl       init_loop
51           stq       <tc_data>|[id]      Store it in tc_data
52           short_return
53 
54 " ^L
55 " " " " " " " " " " " " " " " " " " " " " " " " " " ""
56 "
57 "         getuid
58 "
59 " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
60 "
61 " getuid works by keeping an array of uids handy.  A request for a uid
62 " takes one at random from this array.  However, the taker must put a new
63 " value into this empty place in the array - so, we must first generate a
64 " new unique value (tc_data$id).
65 
66 getuid:
67           rccl      <sys_info>|[clock_],* read the clock
68           lrs       15                  Set resolution
69           cmpq      <tc_data>|[id]      Have we gone past?
70           tze       getuid              Repeat until acceptible
71 
72 id_loop:
73           ldq       <tc_data>|[id]      get id value to use
74           stq       sb|stack_header.stack_end_ptr,*
75           lda       sb|stack_header.stack_end_ptr,*
76           adla      1,dl                generate new id
77           stacq     <tc_data>|[id]      store it away if hasn't changed
78           tnz       id_loop             try again if someone beat us
79 "                                       it is a loop lock.
80 " stack end holds the value of id we generated.  We need to place this
81 " in a random spot in the uid_array and grab the value that is there.
82 "
83           rccl      <sys_info>|[clock_],*
84           qls       32
85           qrl       32                  low 4 clock bits => uid_array index
86           eax1      0,ql
87           lda       sb|stack_header.stack_end_ptr,*
88 array_loop:
89           ldq       <tc_data>|[uid_array],x1
90           stacq     <tc_data>|[uid_array],x1
91           tnz       array_loop          someone already got this slot
92           stq       ap|2,*
93 
94           short_return
95 
96           end