Back to index

glibc  2.9
Classes | Defines | Functions
68881-sw.h File Reference
#include <sys/cdefs.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


struct  switch_caller


#define JMP   0x4ef9
#define JSR   0x4eb9


void __68881_switch (int __dummy) __THROW

Class Documentation

struct switch_caller

Definition at line 33 of file 68881-sw.h.

Class Members
void * fpu
unsigned short int insn
void * soft
void * target

Define Documentation

#define JMP   0x4ef9

Definition at line 43 of file 68881-sw.h.

#define JSR   0x4eb9

Definition at line 44 of file 68881-sw.h.

Function Documentation

void __68881_switch ( int  __dummy)

Definition at line 47 of file switch.c.

  void **return_address_location = &((void **) &dummy)[-1];
  struct switch_caller *const caller
    = (struct switch_caller *) (((short int *) *return_address_location) - 1);

  if (have_fpu < 0)
      /* Figure out whether or not we have a 68881.  */
      __sighandler_t handler = signal (TRAPSIG, trap);
      if (handler == SIG_ERR)
       /* We can't figure it out, so assume we don't have a 68881.
          This assumption will never cause us any problems other than
          lost performance, while the reverse assumption could cause
          the program to crash.  */
       have_fpu = 0;
         /* We set `have_fpu' to nonzero, and then execute a 68881
            no-op instruction.  If we have a 68881, this will do nothing.
            If we don't have one, this will trap and the signal handler
            will clear `have_fpu'.  */
         have_fpu = 1;
         asm ("fnop");

         /* Restore the old signal handler.  */
         (void) signal (TRAPSIG, handler);

  /* Modify the caller to be a jump to the appropriate address.  */
  caller->insn = JMP;
  caller->target = have_fpu ? caller->fpu : caller->soft;

  /* Make the address we will return to be the target we have chosen.
     Our return will match the `jsr' done by the caller we have
     just modified, and it will be just as if that had instead
     been a `jmp' to the new target.  */
  *return_address_location = caller->target;

Here is the call graph for this function: