        .Title  Alias   Set UIC and privilege fields
        .Ident  /V1.00/

        $SSDef          ; System error codes
        $PCBdef

        .PSect  Alias_Data,Wrt,NoExe,NoPIC,NoSHR,Long

OwnUIC::        .Long   ^x00020003      ; Default to [2,3]
OwnPriv::       .Long   -1,-1           ; Default to all!

        .PSect  Alias_Code,NoWrt,Exe,PIC,Shr,Word

; %integerfn self
; Reset the process's privilege and UIC

        .Entry  Self,^M<>
        $CMKrnl_S KSelf,(AP)            ; Do the change
        Ret

KSelf:  .Word   ^M<>
        MovL    @#Sch$GL_CurPCB,R0              ; Get current PCB
        MovL    OwnUIC,PCB$L_UIC(R0)            ; Reset UIC
        MovQ    OwnPriv,PCB$Q_Priv(R0)          ; Reset privilege mask
        MovZWL  #SS$_Normal,R0                  ; Success
        Ret

; %integerfn alias(%integer UIC, %record(quad fm)%name privilege)
; Set the UIC and privileges to those specified (which must include
; CMKRNL privilege (for obvious reasons)).

NewUIC  = 4
NewPriv = 8

        .Entry  Alias,^M<>
        TstL    NewUIC(AP)              ; Probe new UIC
        MovQ    @NewPriv(AP),R0         ; Probe new privilege mask
        $CMKrnl_S KAlias,(AP)           ; Do the change
        Ret

KAlias: .Word   ^M<>
        MovL    @#Sch$GL_CurPCB,R0              ; Get current PCB
        MovL    PCB$L_UIC(R0),OwnUIC            ; Preserve own UIC
        MovQ    PCB$Q_Priv(R0),OwnPriv          ; Preserve own privileges
        MovL    NewUIC(AP),PCB$L_UIC(R0)        ; Set new UIC
        MovQ    @NewPriv(AP),PCB$Q_Priv(R0)     ; Set new privileges
        MovZWL  #SS$_Normal,R0                  ; Success
        Ret

        .End
