Example #1
0
void pvm_backtrace_current_thread(void)
{
    errno_t e = ENOENT;
    int tid = get_current_tid();
    if( tid < 0 ) goto nope;

    void *owner;
    if( 0 != (e=t_get_owner( tid, &owner )) )
        goto nope;

    if( 0 == owner )
        goto nope;

    pvm_object_storage_t *_ow = owner;

    struct data_area_4_thread *tda = (struct data_area_4_thread *)&_ow->da;

    if( _ow->_class.data != pvm_get_thread_class().data )
    {
        printf("pvm_backtrace - not thread in owner!\n");
        return;
    }

    if(tda->tid != tid)
    {
        printf("pvm_backtrace VM thread TID doesn't match!\n");
        return;
    }

    pvm_backtrace(tda);
    return;

    nope:
        printf("Unable to print backtrace, e=%d\n", e);
}
Example #2
0
void pvm_check_is_thread( struct pvm_object new_thread )
{
    struct pvm_object_storage	* d = new_thread.data;

    if( d->_flags != (PHANTOM_OBJECT_STORAGE_FLAG_IS_INTERNAL|PHANTOM_OBJECT_STORAGE_FLAG_IS_THREAD) )
        panic("Thread object has no INTERNAL flag");

    if( !pvm_object_class_exactly_is( new_thread, pvm_get_thread_class() ) )
        panic("Thread object class is not .internal.thread");
}
Example #3
0
struct pvm_object     pvm_create_thread_object(struct pvm_object start_cf )
{
	struct pvm_object ret = pvm_object_create_fixed( pvm_get_thread_class() );
	struct data_area_4_thread *da = (struct data_area_4_thread *)ret.data->da;

	da->call_frame = start_cf;
	da->stack_depth = 1;

	pvm_exec_load_fast_acc(da);

	// add to system threads list
	pvm_append_array(pvm_root.threads_list.data, ret);
	ref_inc_o(ret);

	// not for each and every one
	//phantom_activate_thread(ret);

	return ret;
}