home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name utcodptr -- Return the physical address of a function
- *
- * Synopsis absval = utcodptr(ptr,pads);
- *
- * unsigned long absval
- * The 20-bit physical address of the
- * specified function.
- * void (*ptr)() Pointer to the function whose address
- * is to be computed.
- * ADS *pads An ADS structure containing the offset
- * and segment components of the physical
- * address of the function.
- *
- * Description This function returns the physical address of the
- * function pointed to by ptr. The result is computed in
- * two forms: (1) as a 20-bit integer returned as an
- * unsigned long; (2) as the split segment and offset in an
- * ADS structure.
- *
- * Returns absval The 20-bit physical address of the
- * specified function.
- * *pads The offset and segment components of
- * the physical address of the function.
- *
- * Version 3.0 (C)Copyright Blaise Computing Inc. 1986
- *
- * Version 3.02 March 31, 1987
- * Corrected calculation of return value.
- * Rewrote to use makepv() in Lattice case.
- *
- **/
-
- #include <butility.h>
-
- #include <dos.h> /* For FP_SEG, FP_OFF, and */
- /* makepv(). */
-
- unsigned long utcodptr(ptr,pads)
- int (*ptr)();
- ADS *pads;
- {
- #if LAT300
- makepv(ptr,&pads->r,&pads->s);
- #endif
-
- #if MSC300
- #if LPROG
- pads->s = FP_SEG(ptr);
- pads->r = FP_OFF(ptr);
- #else /* Small code */
- unsigned cs,ss,ds,es;
-
- utsreg(&cs,&ss,&ds,&es);
- pads->s = cs;
- pads->r = (unsigned) ptr;
- #endif
- #endif
-
- return 0x0fffffL &
- ((((unsigned long) pads->s) << 4) + (unsigned long) pads->r);
- }