; public_domain_notice ; ; Copyright (c) 1996 David P. Murphy for Datametrics Systems Corporation --- ; please send all comments and bug reports to murphy@connor.datametrics.com ; ; Permission is granted to any individual or institution to use, copy, or ; redistribute this software so long as all of the original files are included, ; that it is not sold for profit, and that this copyright notice is retained. ; Use at your own risk. Neither Murphy nor Datametrics assumes responsibility. ; Do not taunt Happy Fun Ball. .title BAREMETAL .ident /V1.0/ .library "sys$library:lib.mlb" $jibdef .if defined jib$l_jobtype __ALPHA = 1 .if_false __VAX = 1 .endc ; a macro to declare a global entry point for a function ; .macro ENTRY_POINT, NAME, REGLIST, ARGC=0 .if defined __VAX .entry NAME, ^m .endc .if defined __ALPHA .if equal ARGC NAME:: .call_entry preserve= .if_false NAME:: .call_entry preserve=,max_args=ARGC,home_args=TRUE .endc .endc .endm .psect $code pic,usr,con,rel,lcl,shr,exe,rd,nowrt,novec,long ENTRY_POINT DSC_GetMyFrame ; Point to frame that this frame points to .if defined __VAX movl 12(fp), r0 .endc .if defined __ALPHA movl r29, r0 .endc ret .if defined __VAX ENTRY_POINT DSC_GetMyRegisters, arrayptr = 4 movl r0, @4(ap) ; save r0 real quick, then calculate movl 4(ap), r0 ; a pointer into the caller's array of longs addl2 #4, r0 movl r1, (r0)+ ; store the general purpose registers movl r2, (r0)+ movl r3, (r0)+ movl r4, (r0)+ movl r5, (r0)+ movl r6, (r0)+ movl r7, (r0)+ movl r8, (r0)+ movl r9, (r0)+ movl r10, (r0)+ movl r11, (r0)+ movl fp, r3 ; r3 now points to the current CallFrame addl2 #4, r3 ; skip over the condition handler (will be zero) movl (r3)+, r4 ; save the PSW and entry mask movl (r3)+, (r0)+ ; store the saved AP movl (r3)+, (r0)+ ; store the saved FP ; calculate the SP: movl fp, r6 ; previous SP is based on current FP bbc #29, r4, HERE ; if CALLG, no adjustment is necessary ; because args were not on the stack addl2 #4, r6 ; CALLS pushed the address of the array HERE: addl2 #4, r6 ; account for the "arg count" long extzv #30, #2, r4, r5 ; get the alignment factor, addl2 r5, r6 ; and add it to the SP addl2 #36, r6 ; there are 4 registers saved for this ; function, plus the five longs ; that are ALWAYS in the call frame ; (handler, mask, AP, FP, and PC) movl r6, (r0)+ ; store the calculated SP movl (r3), (r0) ; store the saved PC ret .endc .end