Back to index

glibc  2.9
Defines | Functions
thread_state.h File Reference
#include <mach/thread_status.h>
#include <string.h>
#include <mach/mach_interface.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define MACHINE_THREAD_STATE_SET_PC(ts, pc)   ((ts)->PC = (unsigned long int) (pc))
#define MACHINE_THREAD_STATE_SET_SP(ts, stack, size)   ((ts)->SP = (unsigned long int) (stack) + (size))

Functions

static int machine_get_state (thread_t thread, struct machine_thread_all_state *state, int flavor, void *stateptr, void *scpptr, size_t size)
static int machine_get_basic_state (thread_t thread, struct machine_thread_all_state *state)

Define Documentation

#define MACHINE_THREAD_STATE_SET_PC (   ts,
  pc 
)    ((ts)->PC = (unsigned long int) (pc))

Definition at line 29 of file thread_state.h.

#define MACHINE_THREAD_STATE_SET_SP (   ts,
  stack,
  size 
)    ((ts)->SP = (unsigned long int) (stack) + (size))

Definition at line 37 of file thread_state.h.


Function Documentation

static int machine_get_basic_state ( thread_t  thread,
struct machine_thread_all_state state 
) [inline, static]

Definition at line 69 of file thread_state.h.

{
  mach_msg_type_number_t count;

  if (state->set & (1 << MACHINE_THREAD_STATE_FLAVOR))
    return 1;

  count = MACHINE_THREAD_STATE_COUNT;
  if (__thread_get_state (thread, MACHINE_THREAD_STATE_FLAVOR,
                       (natural_t *) &state->basic,
                       &count) != KERN_SUCCESS ||
      count != MACHINE_THREAD_STATE_COUNT)
    /* What kind of thread?? */
    return 0;               /* XXX */

  state->set |= 1 << MACHINE_THREAD_STATE_FLAVOR;
  return 1;
}

Here is the caller graph for this function:

static int machine_get_state ( thread_t  thread,
struct machine_thread_all_state state,
int  flavor,
void *  stateptr,
void *  scpptr,
size_t  size 
) [inline, static]

Definition at line 49 of file thread_state.h.

{
  if (state->set & (1 << flavor))
    {
      /* Copy the saved state.  */
      memcpy (scpptr, stateptr, size);
      return 1;
    }
  else
    {
      /* No one asked about this flavor of state before; fetch the state
        directly from the kernel into the sigcontext.  */
      mach_msg_type_number_t got = (size / sizeof (int));
      return (! __thread_get_state (thread, flavor, scpptr, &got)
             && got == (size / sizeof (int)));
    }
}

Here is the caller graph for this function: