Esempio n. 1
0
/**
 * Do given Native Feature, if it is supported
 * and set 'retval' accordingly.
 * 
 * Return true if caller is to proceed normally,
 * false if there was an exception.
 */
bool NatFeat_Call(Uint32 stack, bool super, Uint32 *retval)
{
	Uint32 subid = STMemory_ReadLong(stack);
	unsigned int idx = MASTERID2IDX(subid);
	subid = MASKOUTMASTERID(subid);

	if (idx >= ARRAYSIZE(features)) {
		Dprintf(("ERROR: invalid NF ID %d requested\n", idx));
		return true; /* undefined */
	}
	if (features[idx].super && !super) {
		Dprintf(("ERROR: NF function %d called without supervisor mode\n", idx));
		Exception(8, 0, M68000_EXC_SRC_CPU);
		return false;
	}
	stack += SIZE_LONG;
	return features[idx].cb(stack, subid, retval);
}
Esempio n. 2
0
int32 nf_call(memptr stack, bool inSuper)
{
	uint32 fncode = ReadInt32(stack);
	unsigned int idx = MASTERID2IDX(fncode);
	if (idx >= nf_objs_cnt) {
		D(bug("nf_call: wrong ID %d", idx));
		return 0;	/* returning an undefined value */
	}

	fncode = MASKOUTMASTERID(fncode);
	context = stack + 4;	/* parameters follow on the stack */

	NF_Base *obj = nf_objects[idx];
	D(bug("nf_call(%s, %d)", obj->name(), fncode));

	if (obj->isSuperOnly() && !inSuper) {
		THROW(8);	// privilege exception
	}

	return obj->dispatch(fncode);
}
Esempio n. 3
0
/**
 * Do given Native Feature, if it is supported
 * and set 'retval' accordingly.
 *
 * Return true if caller is to proceed normally,
 * false if there was an exception.
 */
bool NatFeat_Call(Uint32 stack, bool super, Uint32 *retval)
{
    Uint32 subid = STMemory_ReadLong(stack);
    unsigned int idx = MASTERID2IDX(subid);
    subid = MASKOUTMASTERID(subid);

    if (idx >= ARRAYSIZE(features)) {
        LOG_TRACE(TRACE_NATFEATS, "ERROR: invalid NF ID %d requested\n", idx);
        return true; /* undefined */
    }
    if (features[idx].super && !super) {
        LOG_TRACE(TRACE_NATFEATS, "ERROR: NF function %d called without supervisor mode\n", idx);
#ifndef WINUAE_FOR_HATARI
        M68000_Exception(8, M68000_EXC_SRC_CPU);
#else
        M68000_Exception(8, M68000_EXC_SRC_CPU);
#endif
        return false;
    }
    stack += SIZE_LONG;
    return features[idx].cb(stack, subid, retval);
}