process control block
define:
typedef struct atmos_pcb
{
union
{
struct
{
BITS sp; /* system stack pointer */
BITS usp; /* user stack pointer */
} m68k;
struct
{
BITS regs[16]; /* 26-bit ARM registers */
} arm26;struct
{
BITS regs[16]; /* 32-bit ARM registers */
BITS psr; /* PSR register */
} arm32;
} p; /* architecture specific */char name[ATMOS_KSTRINGLEN]; /* process name */
struct atmos_pcb *plink; /* static process link */
struct atmos_pcb *rlink; /* run link */ATMOS_MSGQUEUE mqueue; /* message queue pointer */
ATMOS_MESSAGE *specific; /* awaiting specific message */
BQH qhandle; /* active queue handler */
WORD pri; /* process priority */
BITS state; /* process state */PTR ustack; /* user stack base */
WORD ustacksize; /* user stack size */
BITS ustack_hwm; /* user stack high watermark */PTR sys; /* system use */
PTR lang; /* run-time use */
PTR socket_handler; /* socket library use */
PTR user; /* user use */
int *errnop; /* shared-library errno ptr */
struct _iobuf *openlist; /* open file list */VFP epilogue; /* epilogue routine (or NULL) */
int argc; /* argument count */
char *argv[ATMOS_PCB_MAXARGS]; /* argument pointers */ATMOS_ENV *envptr; /* process/thread environment */
ATMOS_THREAD threads; /* thread control block chain */
ATMOS_THREAD current; /* current thread */
BITS thread_state; /* dying flag */
#ifdef SIMULATOR
void* simulator_id; /* id of process within simulator */
void* scheduler_mutex; /* mutex to control scheduling in simulator */
void* scheduler_condition; /* condition variable to control scheduling in simulator */
int* scheduler_count; /* count for condition variable above */
ATMOS_MESSAGE *thread_message; /* message to be passed by threadswitch */
#endif /* SIMULATOR */
#ifdef HELIUM_FAMILY
U32 processor_id;
#endif#ifdef GDB
void (*gdb)(void *regs); /* Pointer to a running copy of GDB */
#endif#ifdef ATMOS_PTIME_SUPPORT
ATMOS_PTIME_DATA ptime_data; /* Process timing data */
#endif}ATMOS_PCB;
ATMOS_MQID = atmos_pcb*
ATMOS_PCBID = atmos_pcb*
ATMOS_THREAD = atmos_pcb*
ATMOS_THREADPCB = atmos_pcb
API:
ATMOS_MQID atmos_findqueue( const char *name );
eg. ATMOS_MQID p = atmos_findqueue("im_backend");