Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members

trt.c File Reference

#include <setjmp.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include <time.h>
#include "trt.h"

Go to the source code of this file.

Compounds

struct  call_isa_s
struct  dbg_handler_s

Defines

#define FIFO_READY_LIST   1
#define MIN(a, b)   ((a) < (b) ? (a) : (b))
#define MAX(a, b)   ((a) > (b) ? (a) : (b))
#define TRUE   1
#define FALSE   0
#define current_thread   (get_current_processor()->running_thread)
#define append(list, member, ien)
#define prepend(list, member, ien)
#define unlink(list, member, prev_member)
#define unlink_head(list, head)
#define unlink_tail(list)
#define top_of_scheduler_stack()
#define switch_to_scheduler_stack(fun, arg)
#define SAVE_CONTEXT(context)   setjmp(context)
#define RESTORE_CONTEXT(context)   longjmp(context, TRUE)
#define K(n)   ((n) >> 10)
#define M(n)   ((n) >> 20)
#define atomic_sub_special(var, val, dec_leq0, dec, old_val)

Typedefs

typedef call_isa_s call_isa_t

Enumerations

enum  purpose {
  GENERAL, INPUT, OUTPUT, INPUT_OUTPUT,
  COPROC_CNTL, MAX_PURPOSE
}

Functions

void debug_handler (int key)
int add_to_ready_list (thread_t *thread, int keep_lock, int back)
void scale_spin_counts ()
int trt_is_idle ()
thread_tsteal_thread ()
thread_tselect_thread ()
void schedule_next_thread (void(*block_handler)())
void context_switch (int *unlock_me, int ien, void(*block_handler)())
void empty_handler ()
int addr2isa (void *addr)
void thread_table_add (thread_t *thread)
void thread_table_remove (thread_t *thread)
void call_start_function ()
void set_sp (thread_t *thread, void *sp)
char * isa_name (int isa)
processor_tfind_processor (int isa)
void thr_create (thread_t *new_thread, int(*fun)(int), int arg)
thread_tthr_lookup (int id)
void call_function ()
int thr_isa (thread_t *thread)
char * thr_isa_name (thread_t *thread)
void thr_stack_size (thread_t *thread, int stack_size)
void thr_stack_addr (thread_t *thread, void *addr)
void thr_exit_cont ()
void thr_exit (int exit_status)
void thr_destroy (thread_t *thread)
void thr_atexit (thread_t *thread, void(*fun)(int), int arg)
void thr_atexit_pop (thread_t *thread, int execute)
void thr_onblock (thread_t *thread, void(*fun)(void))
void trt_onidle (void(*handler)(void))
void thr_start (thread_t *thread)
int search_ready_list (processor_t *processor, thread_t *thread)
int search_blocked_list (semaphore_t *semaphore, thread_t *thread)
void thr_suspend (thread_t *thread)
void thr_resume (thread_t *thread)
int thr_suspend_mode (thread_t *thread, int suspension_mode)
void thr_suspend_me ()
void thr_restart (thread_t *thread, int(*fun)(int), int arg)
void thr_stop (thread_t *thread, int status)
void thr_switch ()
void thr_join (thread_t *thread, int *exit_status)
void thr_set_name (thread_t *thread, char *name)
void trt_init_scheduling_domain (domain_t *domain, int isa)
void trt_set_scheduling_domain (int processor_index, domain_t *domain)
domain_ttrt_scheduling_domain (int processor_index)
void thr_migrate_domain (thread_t *thread, domain_t *domain)
int trt_num_tiles ()
void trt_init (int *stack_bot, int *stack_top)
void trt_finalize (int status)
void sem_init (semaphore_t *semaphore, int init, char *name)
void sem_block_me (semaphore_t *semaphore)
void sem_unblock_someone (semaphore_t *semaphore)
int sem_Pn (semaphore_t *semaphore, int n)
void sem_Vn (semaphore_t *semaphore, int n)
void thr_set_cache_ddr_domain (thread_t *thread, int cache_domain, int ddr_domain)
void dump_processor_info (char *dummy)
void dump_thread_info (char *dummy)
void dump_registry_info_R (char *dummy)
void dump_registry_info_r (char *dummy)
void thr_dump_info (thread_t *thread, int header)
void trt_debug_handler (char *name, void(*handler)(char *), char *help)
void panic ()
void trt_panic (char *error_message)
void trt_panic_d (char *error_message, int argument)
void trt_panic_s (char *error_message, char *argument)
void * trt_malloc (unsigned int size)
void trt_free (void *p)
int sym_hash (int isa, char *name)
void sym_register (char *name, void *addr)
void * sym_query (int isa, char *name, int wait)
void sym_dump (int system)
int trt_load ()
int trt_num_procs (int isa)
void schedule_me (processor_t *processor)
void trt_putc (int port, char c)
void trt_putcn (int n, char c)
void serial_out_hex (unsigned int n)
void serial_out_str (char *s, int left, int field)
void serial_out_dec (int n, int is_signed, int left, int field)
void formated_out (char *format, va_list arg_list)
void serial_out (char *format,...)

Variables

processor_t trt_processor_table [TRT_MAX_NUM_PROCESSORS_PER_TILE]
thread_table_t trt_thread_table
int trt_num_processors
int trt_tile_idx
unsigned int trt_next_thread_ID
int trt_serial_lock
processor_tcurrent_processor
int __bit_bucket
volatile int num_tile_rows = 0
volatile int num_tile_cols = 0
volatile int num_tile_rows_cols_valid = FALSE
dbg_handler_s dbg_handler [32]
volatile sym_table_t trt_sym_table


Define Documentation

#define append list,
member,
ien   ) 
 

Value:

{                                                                       \
  thread_t *__m = (member);         \
                  \
  ien = acquire_lock(list ## _lock, TRUE);      \
                  \
        __m->next = NULL;                                           \
                                                                        \
        if(list ## _head == NULL)                                       \
                list ## _head = __m;                                \
        else                                                            \
                list ## _tail->next = __m;                          \
                  \
        list ## _tail = __m;                                        \
}
HANDY MACROS *************************************************************

Definition at line 93 of file trt.c.

Referenced by add_to_ready_list(), sem_block_me(), sem_Pn(), and thr_resume().

#define atomic_sub_special var,
val,
dec_leq0,
dec,
old_val   ) 
 

Value:

{                                                                       \
  int new_val;                                                    \
                  \
  (old_val) = (var);                                              \
  (dec) = ((old_val) <= 0) ? (dec_leq0) : MIN((old_val), (val));  \
  new_val = (old_val) - (dec);          \
  (var) = new_val;            \
}

Definition at line 1147 of file trt.c.

Referenced by sem_Pn().

#define current_thread   (get_current_processor()->running_thread)
 

Definition at line 76 of file trt.c.

Referenced by call_function(), call_start_function(), context_switch(), panic(), schedule_me(), schedule_next_thread(), sem_block_me(), sem_Pn(), thr_exit(), thr_exit_cont(), thr_migrate_domain(), thr_suspend(), thr_suspend_me(), thr_switch(), and trt_init().

#define FALSE   0
 

Definition at line 37 of file trt.c.

Referenced by call_function(), dump_registry_info_r(), sem_init(), sem_unblock_someone(), sem_Vn(), sym_register(), thr_restart(), thr_resume(), thr_start(), and trt_is_idle().

#define FIFO_READY_LIST   1
 

Definition at line 24 of file trt.c.

Referenced by call_function(), sem_unblock_someone(), sem_Vn(), thr_restart(), thr_resume(), and thr_start().

#define K  )     ((n) >> 10)
 

STARTUP ******************************************************************

Definition at line 1041 of file trt.c.

#define M  )     ((n) >> 20)
 

Definition at line 1042 of file trt.c.

#define MAX a,
 )     ((a) > (b) ? (a) : (b))
 

Definition at line 33 of file trt.c.

Referenced by trt_init().

#define MIN a,
 )     ((a) < (b) ? (a) : (b))
 

Definition at line 29 of file trt.c.

Referenced by sem_Vn().

#define prepend list,
member,
ien   ) 
 

Value:

{                                                                       \
        thread_t *__m = (member);                                       \
                                                                        \
        ien = acquire_lock(list ## _lock, TRUE);                        \
                                                                        \
        __m->next = list ## _head;          \
                  \
  if(__m->next == NULL)           \
    list ## _tail = __m;          \
                  \
  list ## _head = __m;            \
}

Definition at line 112 of file trt.c.

Referenced by add_to_ready_list().

#define RESTORE_CONTEXT context   )     longjmp(context, TRUE)
 

Definition at line 397 of file trt.c.

Referenced by schedule_next_thread().

#define SAVE_CONTEXT context   )     setjmp(context)
 

THREAD MANAGEMENT ********************************************************

Definition at line 396 of file trt.c.

Referenced by context_switch(), schedule_me(), thr_create(), and thr_restart().

#define switch_to_scheduler_stack fun,
arg   ) 
 

Value:

(                 \
  fun(arg)              \
)

Definition at line 172 of file trt.c.

Referenced by call_function(), context_switch(), schedule_me(), and thr_exit().

 
#define top_of_scheduler_stack  ) 
 

Value:

(                 \
  &get_current_processor()->scheduler_stack[TRT_SCHEDULER_STACK_SIZE - 1]\
)

Definition at line 167 of file trt.c.

#define TRUE   1
 

Definition at line 36 of file trt.c.

Referenced by dump_registry_info_R(), search_blocked_list(), search_ready_list(), select_thread(), sem_unblock_someone(), sem_Vn(), serial_out(), steal_thread(), sym_query(), sym_register(), thr_lookup(), thr_onblock(), thr_stack_size(), thr_suspend(), thr_switch(), thread_table_add(), thread_table_remove(), trt_is_idle(), and trt_load().

#define unlink list,
member,
prev_member   ) 
 

Value:

{                 \
  if((prev_member))           \
    (prev_member)->next = (member)->next;     \
  else                \
    list ## _head = (member)->next;       \
                  \
  if((member)->next == NULL)          \
    list ## _tail = (prev_member);        \
}

Definition at line 129 of file trt.c.

Referenced by search_blocked_list(), and search_ready_list().

#define unlink_head list,
head   ) 
 

Value:

{                                                                       \
  list ## _head = (head)->next;         \
}

Definition at line 143 of file trt.c.

Referenced by select_thread(), and steal_thread().

#define unlink_tail list   ) 
 

Value:

{                                                                       \
  thread_t *t;              \
                  \
  if(list ## _head->next != NULL)         \
  {               \
    for(t = list ## _head; t->next->next; t = t->next)  \
      ;           \
                  \
    t->next = NULL;           \
    list ## _tail = t;          \
  }               \
  else                \
    list ## _head = NULL;         \
}

Definition at line 151 of file trt.c.

Referenced by steal_thread().


Typedef Documentation

typedef struct call_isa_s call_isa_t
 


Enumeration Type Documentation

enum purpose
 

Enumeration values:
GENERAL 
INPUT 
OUTPUT 
INPUT_OUTPUT 
COPROC_CNTL 
MAX_PURPOSE 

Definition at line 78 of file trt.c.


Function Documentation

int add_to_ready_list thread_t thread,
int  keep_lock,
int  back
[inline, static]
 

LOW LEVEL STUFF **********************************************************

Definition at line 186 of file trt.c.

References append, prepend, thread_s::processor, processor_s::ready_list_lock, and release_lock.

Referenced by call_function(), sem_unblock_someone(), sem_Vn(), thr_restart(), thr_resume(), thr_start(), and thr_switch().

int addr2isa void *  addr  )  [static]
 

Definition at line 470 of file trt.c.

Referenced by thr_create().

void call_function  )  [static]
 

Definition at line 613 of file trt.c.

References add_to_ready_list(), call_isa_s::arg, call_isa_s::block_handler, call_isa_s::context, current_thread, empty_handler(), FALSE, FIFO_READY_LIST, call_isa_s::fun, call_isa_s::processor, call_isa_s::result, schedule_next_thread(), and switch_to_scheduler_stack.

Referenced by trt_init().

void call_start_function  )  [static]
 

Definition at line 513 of file trt.c.

References current_thread, and thr_exit().

Referenced by thr_create(), thr_restart(), and trt_init().

void context_switch int *  unlock_me,
int  ien,
void(*  block_handler)()
[static]
 

Definition at line 455 of file trt.c.

References current_thread, release_lock, SAVE_CONTEXT, schedule_next_thread(), and switch_to_scheduler_stack.

Referenced by sem_block_me(), sem_Pn(), thr_suspend(), thr_suspend_me(), and thr_switch().

void debug_handler int  key  )  [static]
 

void dump_processor_info char *  dummy  )  [static]
 

DEBUG SUPPORT ************************************************************

Definition at line 1231 of file trt.c.

References processor_s::domain, domain_s::isa, isa_name(), thread_s::name, thread_s::next, processor_s::ready_list_head, processor_s::running_thread, processor_s::schedule_me, serial_out(), trt_num_processors, and trt_processor_table.

void dump_registry_info_r char *  dummy  )  [static]
 

Definition at line 1273 of file trt.c.

References FALSE, and sym_dump().

void dump_registry_info_R char *  dummy  )  [static]
 

Definition at line 1268 of file trt.c.

References sym_dump(), and TRUE.

void dump_thread_info char *  dummy  )  [static]
 

Definition at line 1260 of file trt.c.

References thread_table_s::head, thread_s::next_table, thr_dump_info(), and trt_thread_table.

void empty_handler  )  [static]
 

Definition at line 466 of file trt.c.

Referenced by call_function(), schedule_me(), thr_exit(), thr_exit_cont(), thr_switch(), and trt_init().

processor_t* find_processor int  isa  )  [static]
 

Definition at line 540 of file trt.c.

References processor_s::domain, GENERAL, get_current_processor, domain_s::isa, isa_name(), processor_s::purpose, trt_num_processors, trt_panic_s(), and trt_processor_table.

Referenced by thr_create().

void formated_out char *  format,
va_list  arg_list
[static]
 

Definition at line 1616 of file trt.c.

References serial_out_dec(), serial_out_hex(), serial_out_str(), and trt_putc().

Referenced by serial_out().

char* isa_name int  isa  )  [static]
 

Definition at line 530 of file trt.c.

References TRT_ISA_HPPA, TRT_ISA_I386, TRT_ISA_MIPS, and TRT_ISA_SPARC.

Referenced by dump_processor_info(), find_processor(), panic(), sym_dump(), sym_query(), and thr_isa_name().

void panic  )  [static]
 

PANIC ********************************************************************

Definition at line 1327 of file trt.c.

References current_thread, isa_name(), serial_out(), and trt_processor_index().

Referenced by trt_panic(), trt_panic_d(), and trt_panic_s().

void scale_spin_counts  )  [static]
 

Definition at line 207 of file trt.c.

References atomic_srl, processor_s::domain, get_current_processor, trt_num_processors, and trt_processor_table.

Referenced by select_thread(), and steal_thread().

void schedule_me processor_t processor  )  [static]
 

Definition at line 1516 of file trt.c.

References acquire_lock_no_ien, current_thread, empty_handler(), get_current_processor, SAVE_CONTEXT, processor_s::schedule_me, schedule_next_thread(), and switch_to_scheduler_stack.

void schedule_next_thread void(*  block_handler)()  )  [static]
 

Definition at line 438 of file trt.c.

References current_thread, get_current_processor, RESTORE_CONTEXT, and select_thread().

Referenced by call_function(), context_switch(), schedule_me(), and thr_exit_cont().

int search_blocked_list semaphore_t semaphore,
thread_t thread
[static]
 

Definition at line 821 of file trt.c.

References acquire_lock, atomic_addi, atomic_subi, semaphore_s::blocked_head, semaphore_s::blocked_lock, semaphore_s::count, thread_s::next, release_lock, TRUE, and unlink.

Referenced by thr_suspend().

int search_ready_list processor_t processor,
thread_t thread
[static]
 

Definition at line 798 of file trt.c.

References acquire_lock, thread_s::next, processor_s::ready_list_head, processor_s::ready_list_lock, release_lock, TRUE, and unlink.

Referenced by thr_suspend().

thread_t* select_thread  )  [static]
 

Definition at line 318 of file trt.c.

References acquire_lock, atomic_addi, processor_s::domain, force_load, get_current_processor, processor_s::idle_handler, processor_s::idle_spin_count, domain_s::num_thread_migrates, processor_s::ready_list_head, processor_s::ready_list_lock, release_lock, release_lock_no_ien, scale_spin_counts(), processor_s::schedule_me, steal_thread(), trt_is_idle(), TRUE, and unlink_head.

Referenced by schedule_next_thread().

void sem_block_me semaphore_t semaphore  ) 
 

Definition at line 1107 of file trt.c.

References append, thread_s::block_handler, semaphore_s::blocked_lock, thread_s::blocked_on, context_switch(), and current_thread.

Referenced by sem_P().

void sem_init semaphore_t semaphore,
int  init,
char *  name
 

SEMAPHORES ***************************************************************

Definition at line 1098 of file trt.c.

References semaphore_s::blocked_head, semaphore_s::blocked_lock, semaphore_s::blocked_tail, semaphore_s::count, FALSE, init, and semaphore_s::name.

Referenced by cnd_init(), mut_init(), thr_create(), thr_suspend(), and trtSemaphore::trtSemaphore().

int sem_Pn semaphore_t semaphore,
int  n
 

Definition at line 1157 of file trt.c.

References append, atomic_sub_special, thread_s::block_handler, semaphore_s::blocked_lock, thread_s::blocked_on, context_switch(), semaphore_s::count, and current_thread.

void sem_unblock_someone semaphore_t semaphore  ) 
 

Definition at line 1119 of file trt.c.

References acquire_lock, add_to_ready_list(), semaphore_s::blocked_head, semaphore_s::blocked_lock, thread_s::blocked_on, FALSE, FIFO_READY_LIST, force_load, thread_s::next, release_lock, and TRUE.

Referenced by sem_V(), and sem_Vn_priv().

void sem_Vn semaphore_t semaphore,
int  n
 

Definition at line 1181 of file trt.c.

References acquire_lock, add_to_ready_list(), atomic_add, semaphore_s::blocked_head, semaphore_s::blocked_lock, thread_s::blocked_on, semaphore_s::count, FALSE, FIFO_READY_LIST, force_load, MIN, thread_s::next, release_lock, and TRUE.

Referenced by thr_destroy(), and thr_exit_cont().

void serial_out char *  format,
... 
 

Definition at line 1672 of file trt.c.

References acquire_lock, formated_out(), release_lock, trt_serial_lock, and TRUE.

Referenced by dump_processor_info(), panic(), sym_dump(), sym_query(), thr_dump_info(), trt_panic(), trt_panic_d(), and trt_panic_s().

void serial_out_dec int  n,
int  is_signed,
int  left,
int  field
[static]
 

Definition at line 1586 of file trt.c.

References serial_out_str().

Referenced by formated_out().

void serial_out_hex unsigned int  n  )  [static]
 

Definition at line 1544 of file trt.c.

References trt_putc().

Referenced by formated_out().

void serial_out_str char *  s,
int  left,
int  field
[static]
 

Definition at line 1559 of file trt.c.

References len, trt_putc(), and trt_putcn().

Referenced by formated_out(), and serial_out_dec().

void set_sp thread_t thread,
void *  sp
[static]
 

Definition at line 525 of file trt.c.

References context_s::context, and thread_s::context.

Referenced by thr_restart(), thr_stack_addr(), and thr_stack_size().

thread_t* steal_thread  )  [static]
 

Definition at line 251 of file trt.c.

References acquire_lock, atomic_sll, processor_s::domain, get_current_processor, processor_s::idle_spin_count, thread_s::processor, processor_s::ready_list_head, processor_s::ready_list_lock, processor_s::ready_list_tail, release_lock, processor_s::running_thread, scale_spin_counts(), trt_num_processors, trt_processor_table, TRUE, unlink_head, and unlink_tail.

Referenced by select_thread().

void sym_dump int  system  ) 
 

Definition at line 1450 of file trt.c.

References sym_s::addr, sym_s::isa, isa_name(), sym_table_s::list, sym_s::name, sym_s::next, serial_out(), and trt_sym_table.

int sym_hash int  isa,
char *  name
[static]
 

Definition at line 1384 of file trt.c.

Referenced by sym_query(), and sym_register().

void* sym_query int  isa,
char *  name,
int  wait
 

Definition at line 1420 of file trt.c.

References sym_s::addr, count(), sym_s::hash, sym_s::isa, isa_name(), sym_table_s::list, sym_s::name, sym_s::next, serial_out(), sym_hash(), thr_switch(), trt_sym_table, and TRUE.

Referenced by sym_register(), and thr_onblock().

void sym_register char *  name,
void *  addr
 

Definition at line 1394 of file trt.c.

References acquire_lock, FALSE, sym_table_s::list, sym_table_s::lock, release_lock, sym_hash(), sym_query(), trt_malloc(), trt_sym_table, and TRUE.

Referenced by trt_init().

void thr_atexit thread_t thread,
void(*  fun)(int),
int  arg
 

Definition at line 746 of file trt.c.

References atexit_s::arg, thread_s::atexit, atexit_s::count, and atexit_s::fun.

void thr_atexit_pop thread_t thread,
int  execute
 

Definition at line 756 of file trt.c.

References atexit_s::arg, thread_s::atexit, atexit_s::count, and atexit_s::fun.

void thr_create thread_t new_thread,
int(*  fun)(int),
int  arg
 

Definition at line 561 of file trt.c.

References addr2isa(), atomic_add, call_start_function(), thread_s::context, context_s::context, thread_s::exit, find_processor(), thread_s::id, thread_s::name, thread_s::processor, SAVE_CONTEXT, sem_init(), thread_s::start_arg, thread_s::start_fun, thr_onblock(), thr_set_cache_ddr_domain(), thread_table_add(), trt_init(), trt_next_thread_ID, and trt_num_processors.

Referenced by trtTask::start().

void thr_destroy thread_t thread  ) 
 

Definition at line 725 of file trt.c.

References thread_s::atexit, thread_s::exit, atexit_s::free_desc, atexit_s::free_stack, sem_Vn(), thread_s::stack, thread_table_remove(), and trt_free().

Referenced by trtTask::kill().

void thr_dump_info thread_t thread,
int  header
 

Definition at line 1278 of file trt.c.

References thread_s::blocked_on, semaphore_s::count, thread_s::exit, processor_s::index, semaphore_s::name, thread_s::name, thread_s::processor, serial_out(), thread_s::stack_magic, and thr_isa_name().

Referenced by dump_thread_info().

void thr_exit int  exit_status  ) 
 

Definition at line 705 of file trt.c.

References atexit_s::arg, atexit_s::count, current_thread, empty_handler(), atexit_s::fun, switch_to_scheduler_stack, thr_exit_cont(), thread_table_remove(), trt_panic_s(), and TRT_STACK_OVERFLOW_MAGIC.

Referenced by call_start_function(), trtTask::exit(), and thr_stop().

void thr_exit_cont  )  [static]
 

Definition at line 682 of file trt.c.

References thread_s::atexit, current_thread, empty_handler(), thread_s::exit, atexit_s::free_desc, atexit_s::free_stack, schedule_next_thread(), sem_Vn(), thread_s::stack, and trt_free().

Referenced by thr_exit().

int thr_isa thread_t thread  ) 
 

Definition at line 631 of file trt.c.

Referenced by thr_isa_name().

char* thr_isa_name thread_t thread  ) 
 

Definition at line 636 of file trt.c.

References isa_name(), and thr_isa().

Referenced by thr_dump_info().

void thr_join thread_t thread,
int *  exit_status
 

Definition at line 963 of file trt.c.

References thread_s::exit, thread_s::exit_status, and sem_P().

Referenced by trtTask::join().

thread_t* thr_lookup int  id  ) 
 

Definition at line 587 of file trt.c.

References acquire_lock, thread_table_s::head, thread_s::id, id(), thread_table_s::lock, thread_s::next_table, release_lock, trt_thread_table, and TRUE.

void thr_migrate_domain thread_t thread,
domain_t domain
 

Definition at line 997 of file trt.c.

References current_thread, processor_s::domain, domain_s::isa, domain_s::num_thread_migrates, thread_s::processor, thr_switch(), trt_num_processors, and trt_processor_table.

void thr_onblock thread_t thread,
void(*  fun)(void)
 

Definition at line 764 of file trt.c.

References thread_s::block_handler, processor_s::domain, domain_s::isa, thread_s::processor, sym_query(), and TRUE.

Referenced by thr_create().

void thr_restart thread_t thread,
int(*  fun)(int),
int  arg
 

Definition at line 927 of file trt.c.

References add_to_ready_list(), thread_s::blocked_on, call_start_function(), thread_s::context, context_s::context, FALSE, FIFO_READY_LIST, SAVE_CONTEXT, set_sp(), thread_s::stack_init_sp, thread_s::start_arg, and thread_s::start_fun.

Referenced by thr_stop().

void thr_resume thread_t thread  ) 
 

Definition at line 892 of file trt.c.

References add_to_ready_list(), append, atomic_subi, semaphore_s::blocked_lock, thread_s::blocked_on, semaphore_s::count, FALSE, FIFO_READY_LIST, and release_lock.

void thr_set_cache_ddr_domain thread_t thread,
int  cache_domain,
int  ddr_domain
 

Definition at line 1221 of file trt.c.

References thread_s::id, and thread_s::task_id.

Referenced by thr_create(), and trt_init().

void thr_set_name thread_t thread,
char *  name
 

Definition at line 971 of file trt.c.

References thread_s::name.

Referenced by trtTask::start().

void thr_stack_addr thread_t thread,
void *  addr
 

Definition at line 672 of file trt.c.

References set_sp(), thread_s::stack_init_sp, thread_s::stack_magic, and TRT_STACK_OVERFLOW_MAGIC.

void thr_stack_size thread_t thread,
int  stack_size
 

Definition at line 641 of file trt.c.

References thread_s::atexit, atexit_s::free_stack, set_sp(), thread_s::stack, thread_s::stack_init_sp, thread_s::stack_magic, trt_config_stack_size, trt_free(), trt_malloc(), TRT_STACK_OVERFLOW_MAGIC, and TRUE.

Referenced by trtTask::start(), and thr_start().

void thr_start thread_t thread  ) 
 

Definition at line 790 of file trt.c.

References add_to_ready_list(), FALSE, FIFO_READY_LIST, thread_s::stack, thr_stack_size(), and trt_config_stack_size.

Referenced by trtTask::start().

void thr_stop thread_t thread,
int  status
 

Definition at line 947 of file trt.c.

References thread_s::stack, thr_exit(), and thr_restart().

void thr_suspend thread_t thread  ) 
 

Definition at line 848 of file trt.c.

References thread_s::blocked_on, context_switch(), current_thread, thread_s::processor, search_blocked_list(), search_ready_list(), sem_init(), sem_P(), SUSPEND_DISABLE, thread_s::suspend_point_sem, thread_s::suspension_mode, thr_switch(), and TRUE.

Referenced by trtTask::kill().

void thr_suspend_me  ) 
 

Definition at line 920 of file trt.c.

References context_switch(), current_thread, and sem_V().

Referenced by thr_suspend_point().

int thr_suspend_mode thread_t thread,
int  suspension_mode
 

Definition at line 911 of file trt.c.

References thread_s::suspension_mode.

void thr_switch  ) 
 

Definition at line 953 of file trt.c.

References add_to_ready_list(), context_switch(), current_thread, empty_handler(), lock, and TRUE.

Referenced by sym_query(), thr_migrate_domain(), and thr_suspend().

void thread_table_add thread_t thread  )  [static]
 

Definition at line 475 of file trt.c.

References acquire_lock, thread_table_s::head, thread_table_s::lock, thread_s::next_table, thread_s::prev_table, release_lock, thread_table_s::tail, trt_thread_table, and TRUE.

Referenced by thr_create(), and trt_init().

void thread_table_remove thread_t thread  )  [static]
 

Definition at line 494 of file trt.c.

References acquire_lock, thread_table_s::head, thread_table_s::lock, thread_s::next_table, thread_s::prev_table, release_lock, thread_table_s::tail, trt_thread_table, and TRUE.

Referenced by thr_destroy(), and thr_exit().

void trt_debug_handler char *  name,
void(*  handler)(char *),
char *  help
 

Definition at line 1304 of file trt.c.

References dbg_handler, dbg_handler_s::handler, dbg_handler_s::help, dbg_handler_s::name, and trt_panic_s().

void trt_finalize int  status  ) 
 

Definition at line 1092 of file trt.c.

void trt_free void *  p  ) 
 

Definition at line 1375 of file trt.c.

Referenced by thr_destroy(), thr_exit_cont(), and thr_stack_size().

void trt_init int *  stack_bot,
int *  stack_top
 

Definition at line 1044 of file trt.c.

References atomic_add, atomic_addi, call_function(), call_start_function(), processor_s::crt0_thread, current_thread, processor_s::domain, empty_handler(), GENERAL, processor_s::index, MAX, num_tile_cols, num_tile_rows, processor_s::purpose, set_current_processor, sym_register(), thr_set_cache_ddr_domain(), thread_table_add(), TRT_MAX_NUM_PROCESSORS_PER_TILE, trt_next_thread_ID, trt_num_processors, trt_processor_table, and TRT_STACK_OVERFLOW_MAGIC.

Referenced by thr_create(), and trtOs::trtOs().

void trt_init_scheduling_domain domain_t domain,
int  isa
 

Definition at line 976 of file trt.c.

References domain_s::isa, domain_s::num_context_switches, and domain_s::num_thread_migrates.

int trt_is_idle  ) 
 

Definition at line 227 of file trt.c.

References FALSE, GENERAL, processor_s::purpose, processor_s::ready_list_head, processor_s::running_thread, processor_s::schedule_me, trt_num_processors, trt_processor_table, and TRUE.

Referenced by select_thread().

int trt_load  ) 
 

MISCELANIOUS STUFF *******************************************************

Definition at line 1470 of file trt.c.

References acquire_lock, count(), GENERAL, thread_s::next, processor_s::purpose, processor_s::ready_list_head, processor_s::ready_list_lock, release_lock, processor_s::running_thread, processor_s::schedule_me, trt_num_processors, trt_processor_table, and TRUE.

void* trt_malloc unsigned int  size  ) 
 

OUR OWN MALLOC ***********************************************************

Definition at line 1365 of file trt.c.

References size, and trt_panic().

Referenced by sym_register(), and thr_stack_size().

int trt_num_procs int  isa  ) 
 

Definition at line 1500 of file trt.c.

References count(), processor_s::domain, GENERAL, domain_s::isa, processor_s::purpose, trt_num_processors, and trt_processor_table.

int trt_num_tiles  ) 
 

Definition at line 1034 of file trt.c.

References num_tile_cols, and num_tile_rows.

void trt_onidle void(*  handler)(void)  ) 
 

Definition at line 776 of file trt.c.

References processor_s::domain, processor_s::idle_handler, domain_s::isa, trt_num_processors, and trt_processor_table.

Referenced by trtOs::trtOs().

void trt_panic char *  error_message  ) 
 

Definition at line 1342 of file trt.c.

References panic(), and serial_out().

Referenced by trt_malloc().

void trt_panic_d char *  error_message,
int  argument
 

Definition at line 1349 of file trt.c.

References panic(), and serial_out().

void trt_panic_s char *  error_message,
char *  argument
 

Definition at line 1356 of file trt.c.

References panic(), and serial_out().

Referenced by find_processor(), thr_exit(), and trt_debug_handler().

void trt_putc int  port,
char  c
 

SERIAL OUTPUT ************************************************************

Definition at line 1533 of file trt.c.

Referenced by formated_out(), serial_out_hex(), serial_out_str(), and trt_putcn().

void trt_putcn int  n,
char  c
[static]
 

Definition at line 1538 of file trt.c.

References trt_putc().

Referenced by serial_out_str().

domain_t* trt_scheduling_domain int  processor_index  ) 
 

Definition at line 992 of file trt.c.

References processor_s::domain, and trt_processor_table.

void trt_set_scheduling_domain int  processor_index,
domain_t domain
 

Definition at line 983 of file trt.c.

References processor_s::domain, domain_s::isa, and trt_processor_table.


Variable Documentation

int __bit_bucket
 

EXCEPTION HANDLING *******************************************************

Definition at line 179 of file trt.c.

processor_t* current_processor
 

Definition at line 74 of file trt.c.

struct dbg_handler_s dbg_handler[32] [static]
 

Referenced by trt_debug_handler().

volatile int num_tile_cols = 0 [static]
 

Definition at line 1031 of file trt.c.

Referenced by trt_init(), and trt_num_tiles().

volatile int num_tile_rows = 0 [static]
 

INTER-TILE COMMUNICATION *************************************************

Definition at line 1030 of file trt.c.

Referenced by trt_init(), and trt_num_tiles().

volatile int num_tile_rows_cols_valid = FALSE [static]
 

Definition at line 1032 of file trt.c.

unsigned int trt_next_thread_ID
 

Definition at line 64 of file trt.c.

Referenced by thr_create(), and trt_init().

int trt_num_processors
 

Definition at line 54 of file trt.c.

Referenced by dump_processor_info(), find_processor(), scale_spin_counts(), steal_thread(), thr_create(), thr_migrate_domain(), trt_init(), trt_is_idle(), trt_load(), trt_num_procs(), and trt_onidle().

processor_t trt_processor_table[TRT_MAX_NUM_PROCESSORS_PER_TILE]
 

GLOBALS ******************************************************************

Definition at line 44 of file trt.c.

Referenced by dump_processor_info(), find_processor(), scale_spin_counts(), steal_thread(), thr_migrate_domain(), trt_init(), trt_is_idle(), trt_load(), trt_num_procs(), trt_onidle(), trt_scheduling_domain(), and trt_set_scheduling_domain().

int trt_serial_lock
 

Definition at line 69 of file trt.c.

Referenced by serial_out().

volatile sym_table_t trt_sym_table
 

SYMBOL TABLE STUFF *******************************************************

Definition at line 1382 of file trt.c.

Referenced by sym_dump(), sym_query(), and sym_register().

thread_table_t trt_thread_table
 

Definition at line 49 of file trt.c.

Referenced by dump_thread_info(), thr_lookup(), thread_table_add(), and thread_table_remove().

int trt_tile_idx
 

Definition at line 59 of file trt.c.


Generated on Wed Feb 15 14:52:40 2006 for yapi by doxygen 1.3.2