Beispiel #1
0
/*!
 *  ======== InterruptBenelli_intShmMbxStub ========
 */
Void InterruptBenelli_intShmMbxStub(UArg arg)
{
    UInt16 index;
    UInt16 selfIdx;
    UInt16 loopIdx;
    InterruptBenelli_FxnTable *table;

    selfIdx = MultiProc_self();

    for (loopIdx = 0; loopIdx < MultiProc_getNumProcsInCluster(); loopIdx++) {

        if (loopIdx == selfIdx) {
            continue;
        }

        index = MBX_TABLE_IDX(loopIdx, selfIdx);

        if (((REG32(MAILBOX_STATUS(index)) != 0) && 
             (REG32(MAILBOX_IRQENABLE_SET(index)) & 
              MAILBOX_REG_VAL(SUBMBX_IDX(index))))) {
            table = &(InterruptBenelli_module->fxnTable[PROCID(loopIdx)]);
            (table->func)(table->arg);
        }
    }
}
Beispiel #2
0
/*!
 *  ======== InterruptDsp_intUnregister ======== 
 */
Void InterruptDsp_intUnregister(UInt16 remoteProcId, 
                                IInterrupt_IntInfo *intInfo)
{
    Hwi_Handle  hwiHandle;
    Int         index;
    UInt        eventId; 
    InterruptDsp_FxnTable *table;

    Assert_isTrue(((remoteProcId < MultiProc_getNumProcsInCluster()) &&
                   (remoteProcId == MultiProc_self())), ti_sdo_ipc_Ipc_A_internal);

    index = PROCID(remoteProcId);
    
    /* Disable the mailbox interrupt source */
    InterruptDsp_intDisable(remoteProcId, intInfo);

    /* Make sure the interrupt only gets plugged once */
    eventId = InterruptDsp_dspInterruptTable[index];

    InterruptDsp_module->numPlugged--;

    EventCombiner_disableEvent(eventId);

    if (InterruptDsp_module->numPlugged == 0) {
        /* Delete the Hwi */
        hwiHandle = Hwi_getHandle(intInfo->intVectorId);
        Hwi_delete(&hwiHandle);
    }

    table = &(InterruptDsp_module->fxnTable[index]);
    table->func = NULL;        
    table->arg  = NULL;
}
Beispiel #3
0
/*!
 *  ======== InterruptBenelli_intUnregister ========
 */
Void InterruptBenelli_intUnregister(UInt16 remoteProcId,
                                   IInterrupt_IntInfo *intInfo)
{
    UInt                       mbxIdx;
    Int                        index;
    InterruptBenelli_FxnTable *table;
    Hwi_Handle                 hwiHandle;

    mbxIdx = MBX_BASEADDR_IDX(MBX_TABLE_IDX(remoteProcId, MultiProc_self()));

    index = PROCID(remoteProcId);

    /* Disable the mailbox interrupt source */
    InterruptBenelli_intDisable(remoteProcId, intInfo);

    /* Disable the interrupt itself */
    InterruptBenelli_module->numPlugged[mbxIdx]--;
    if (InterruptBenelli_module->numPlugged[mbxIdx] == 0) {
        hwiHandle = Hwi_getHandle(intInfo->localIntId);
        Hwi_delete(&hwiHandle);
    }

    /* Clear the FxnTable entry for the remote processor */
    table = &(InterruptBenelli_module->fxnTable[index]);
    table->func = NULL;
    table->arg  = 0;
}
Beispiel #4
0
/*!
 *  ======== InterruptDsp_intShmStub ======== 
 */
Void InterruptDsp_intShmStub(UArg arg)
{
    UInt16 index;
    UInt16 selfIdx;
    UInt16 loopIdx;
    InterruptDsp_FxnTable *table;    

    selfIdx = MultiProc_self();

    /* 
     * Loop through each Sub-mailbox to determine which one generated 
     * interrupt. 
     */
    for (loopIdx = 0; loopIdx < MultiProc_getNumProcsInCluster(); loopIdx++) {

        if (loopIdx == selfIdx) {
            continue;
        }

        index = MBX_TABLE_IDX(loopIdx, selfIdx);

        if ((REG32(MAILBOX_STATUS(index)) != 0) && 
            (REG32(MAILBOX_IRQENABLE_SET_DSP(index)) & 
             MAILBOX_REG_VAL(SUBMBX_IDX(index)))) {
            table = &(InterruptDsp_module->fxnTable[PROCID(loopIdx)]);    
            (table->func)(table->arg);     
        }
    }
}
Beispiel #5
0
/*!
 *  ======== InterruptArp32_intUnregister ========
 */
Void InterruptArp32_intUnregister(UInt16 remoteProcId,
                                   IInterrupt_IntInfo *intInfo)
{
    UInt16 index;
    UInt   mbxIdx;
    Hwi_Handle  hwiHandle;
    InterruptArp32_FxnTable *table;

    index = PROCID(remoteProcId);

    if ((remoteProcId == DSP0_ID) || (remoteProcId == BENELLI_CORE0_ID)) {
        mbxIdx = 0;
    }
    else if ((remoteProcId == DSP1_ID) || (remoteProcId == BENELLI_CORE1_ID)) {
        mbxIdx = 1;
    }
    else if (remoteProcId < InterruptArp32_NUM_EVES) {
        mbxIdx = 2;
    }

    /* Disable the mailbox interrupt source */
    InterruptArp32_intDisable(remoteProcId, intInfo);

    InterruptArp32_module->numPlugged[mbxIdx]--;
    if (InterruptArp32_module->numPlugged[mbxIdx] == 0) {
        /* Delete the Hwi */
        hwiHandle = Hwi_getHandle(InterruptArp32_eveInterruptTable[index]);
        Hwi_delete(&hwiHandle);
    }

    /* Clear the FxnTable entry for the remote processor */
    table = &(InterruptArp32_module->fxnTable[index]);
    table->func = NULL;
    table->arg  = 0;
}
Beispiel #6
0
CVirtualizedCpu::~CVirtualizedCpu()
{
	if (NULL != m_hvStack)
	{
		KeSetSystemAffinityThread(PROCID(m_cpuCore));
		(reinterpret_cast<CHyperVisor*>(m_hvStack + 1))->~CHyperVisor();
		MmFreeContiguousMemory(m_hvStack);
	}
}
Beispiel #7
0
/*!
 *  ======== InterruptDsp_intRegister ======== 
 */
Void InterruptDsp_intRegister(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
                              Fxn func, UArg arg)
{
    UInt        key;
    UInt        eventId;
    UInt        combinedEventId;
    Int         index; 
    Hwi_Params  params;
    InterruptDsp_FxnTable *table; 

    Assert_isTrue(((remoteProcId < MultiProc_getNumProcsInCluster()) && 
                   (remoteProcId != MultiProc_self())), ti_sdo_ipc_Ipc_A_internal);

    index = PROCID(remoteProcId);
    
    /* Disable global interrupts */
    key = Hwi_disable();

    table = &(InterruptDsp_module->fxnTable[index]);
    table->func = func;
    table->arg  = arg;
    
    InterruptDsp_intClear(remoteProcId, intInfo);
    
    /* Make sure the interrupt only gets plugged once */
    eventId = InterruptDsp_dspInterruptTable[index];
    
    InterruptDsp_module->numPlugged++;
    
    if (InterruptDsp_module->numPlugged == 1) {
        EventCombiner_dispatchPlug(eventId,
            (Hwi_FuncPtr)InterruptDsp_intShmStub, eventId, TRUE);
        Hwi_Params_init(&params);
  
        combinedEventId = eventId / EVENT_GROUP_SIZE;  
            
        params.eventId = combinedEventId;
        params.arg = combinedEventId;
        params.enableInt = TRUE;
        Hwi_create(intInfo->intVectorId, &ti_sysbios_family_c64p_EventCombiner_dispatch,
                   &params, NULL);
        Hwi_enableInterrupt(intInfo->intVectorId);
    }
    else {
        EventCombiner_dispatchPlug(eventId,
                (Hwi_FuncPtr)InterruptDsp_intShmStub, eventId, TRUE);
    }

    /* Enable the mailbox interrupt to the DSP */
    InterruptDsp_intEnable(remoteProcId, intInfo);
    
    /* Restore global interrupts */
    Hwi_restore(key);
}
void CSysCall::PerCoreAction( __in BYTE coreId )
{
	CCRonos::PerCoreAction(coreId);

	if (coreId < sizeof(m_syscalls))
	{
		KeSetSystemAffinityThread(PROCID(coreId));
		m_syscalls[coreId] = (void*)rdmsr(IA64_SYSENTER_EIP);
		HookSyscallMSR(sysenter);
		DbgPrint("Hooked. procid [%x] <=> syscall addr [%p]\n", coreId, m_syscalls[coreId]);
	}
}
Beispiel #9
0
/*!
 *  ======== InterruptBenelli_intRegister ========
 */
Void InterruptBenelli_intRegister(UInt16 remoteProcId,
                                 IInterrupt_IntInfo *intInfo,
                                 Fxn func, UArg arg)
{
    Hwi_Params  hwiAttrs;
    UInt        key;
    UInt        mbxIdx;
    Int         index;
    InterruptBenelli_FxnTable *table;

    Assert_isTrue(remoteProcId < ti_sdo_utils_MultiProc_numProcessors, 
            ti_sdo_ipc_Ipc_A_internal);

    /* Assert that our MultiProc id is set correctly */
    Assert_isTrue((InterruptBenelli_benelliProcId == MultiProc_self()),
                  ti_sdo_ipc_Ipc_A_internal);

    mbxIdx = MBX_BASEADDR_IDX(MBX_TABLE_IDX(remoteProcId, MultiProc_self()));

    index = PROCID(remoteProcId);

    intInfo->localIntId = InterruptBenelli_benelliInterruptTable[index];

    /* Disable global interrupts */
    key = Hwi_disable();

    table = &(InterruptBenelli_module->fxnTable[index]);
    table->func = func;
    table->arg  = arg;

    InterruptBenelli_intClear(remoteProcId, intInfo);

    Hwi_Params_init(&hwiAttrs);
    hwiAttrs.maskSetting = Hwi_MaskingOption_LOWER;

    /* Make sure the interrupt only gets plugged once */
    InterruptBenelli_module->numPlugged[mbxIdx]++;
    if (InterruptBenelli_module->numPlugged[mbxIdx] == 1) {
        Hwi_create(intInfo->localIntId,
                   (Hwi_FuncPtr)InterruptBenelli_intShmMbxStub,
                    &hwiAttrs,
                    NULL);
            
        /* Interrupt_intEnable won't enable the Hwi */
        Hwi_enableInterrupt(intInfo->localIntId);
    }
    
    InterruptBenelli_intEnable(remoteProcId, intInfo);
    
    /* Restore global interrupts */
    Hwi_restore(key);
}
CSysCall::~CSysCall()
{
	BYTE core_id = 0;
	CProcessorWalker cpu_w;
	while (cpu_w.NextCore(&core_id, core_id))
	{
		KeSetSystemAffinityThread(PROCID(core_id));

		HookSyscallMSR(m_syscalls[core_id]);

		DbgPrint("Unhooked. procid [%x] <=> syscall addr [%p]\n", core_id, m_syscalls[core_id]);

		core_id++;//follow with next core
	}
}
Beispiel #11
0
/*!
 *  ======== NotifySetup_attach ========
 *  Initialize interrupt
 */     
Int NotifySetup_attach(UInt16 remoteProcId, Ptr sharedAddr)
{
    NotifyDriverShm_Params notifyShmParams;
    NotifyDriverShm_Handle shmDrvHandle;
    ti_sdo_ipc_Notify_Handle notifyHandle;
    Int status = Notify_S_SUCCESS;
    Error_Block eb;
    
    Error_init(&eb);
    
    NotifyDriverShm_Params_init(&notifyShmParams);
    notifyShmParams.sharedAddr = sharedAddr;
    notifyShmParams.remoteProcId  = remoteProcId;
    
    /* Set the intVectorId if on the DSP */
    if ((MultiProc_self() == NotifySetup_dsp0ProcId) ||
        (MultiProc_self() == NotifySetup_dsp1ProcId)) {
            notifyShmParams.intVectorId = NotifySetup_dspIntVectId;
    }

    /* Set the intVectorId if on the EVE */
    if ((MultiProc_self() == NotifySetup_eve0ProcId) ||
        (MultiProc_self() == NotifySetup_eve1ProcId) ||
        (MultiProc_self() == NotifySetup_eve2ProcId) ||
        (MultiProc_self() == NotifySetup_eve3ProcId)) {
        if (PROCID(remoteProcId) < 4) {
            notifyShmParams.intVectorId = NotifySetup_eveIntVectId_INTC1;
        }
        else {
            notifyShmParams.intVectorId = NotifySetup_eveIntVectId_INTC0;
        }
    }
    
    shmDrvHandle = NotifyDriverShm_create(&notifyShmParams, &eb);
    if (shmDrvHandle == NULL) {
        return (Notify_E_FAIL);
    }
    
    notifyHandle = ti_sdo_ipc_Notify_create(
            NotifyDriverShm_Handle_upCast(shmDrvHandle), remoteProcId, 0, 
            NULL, &eb);
    if (notifyHandle == NULL) {
        NotifyDriverShm_delete(&shmDrvHandle);
        status = Notify_E_FAIL;
    }

    return (status);
}
	__checkReturn bool NextCore(__inout BYTE* coreId, __in_opt BYTE startId = 0)
	{
		ULONG n_cpu = 0;
		if (startId < (sizeof(ULONG) << 3))
		{
			if (PROCID(startId) & m_cpu)
			{
				*coreId = startId;
				return true;
			}

			startId++;
		}

		return false;
	}
Beispiel #13
0
CVirtualizedCpu::CVirtualizedCpu( 
	__in BYTE cpuCore, 
	__in_opt const VMTrap traps[MAX_CALLBACK], 
	__in_opt ULONG_PTR exceptionMask,
	__in_opt const VMCallback callback,
	__in_opt const VOID* param 
	) : m_vmx(PROCID(cpuCore), exceptionMask), 
		m_cpuCore(cpuCore)
{	
	LARGE_INTEGER HighestAcceptableAddress;
	HighestAcceptableAddress.HighPart = -1;
	m_hvStack = reinterpret_cast<ULONG_PTR*>(MmAllocateContiguousMemory(HYPERVISOR_STACK_PAGE, HighestAcceptableAddress));

	if (NULL == m_hvStack)
		return;

	RtlZeroMemory(m_hvStack, HYPERVISOR_STACK_PAGE);

	m_hvStack[0] = kStackMark;
	m_hvStack[1] = (ULONG_PTR)param;
	::new(m_hvStack + 2) CHyperVisor(cpuCore, traps, callback);
}
Beispiel #14
0
/*!
 *  ======== InterruptArp32_intRegister ========
 */
Void InterruptArp32_intRegister(UInt16 remoteProcId,
                                 IInterrupt_IntInfo *intInfo,
                                 Fxn func, UArg arg)
{
    UInt        key;
    UInt16      index;
    UInt        mbxIdx;
    Hwi_Params  hwiAttrs;
    Error_Block eb;
    InterruptArp32_FxnTable *table;

    Assert_isTrue(remoteProcId < ti_sdo_utils_MultiProc_numProcessors, 
           ti_sdo_ipc_Ipc_A_internal);

    /* Assert that our MultiProc id is set correctly */
    Assert_isTrue((InterruptArp32_eve0ProcId == MultiProc_self()) ||
                  (InterruptArp32_eve1ProcId == MultiProc_self()) ||
                  (InterruptArp32_eve2ProcId == MultiProc_self()) ||
                  (InterruptArp32_eve3ProcId == MultiProc_self()), 
                   ti_sdo_ipc_Ipc_A_internal);

    /* init error block */
    Error_init(&eb);

    index = PROCID(remoteProcId);

    /* Disable global interrupts */
    key = Hwi_disable();

    table = &(InterruptArp32_module->fxnTable[index]);
    table->func = func;
    table->arg  = arg;

    InterruptArp32_intClear(remoteProcId, intInfo);

    if ((index == DSP0_ID) || (index == BENELLI_CORE0_ID)) {
        mbxIdx = 0;
    }
    else if ((index == DSP1_ID) || (index == BENELLI_CORE1_ID)) {
        mbxIdx = 1;
    }
    else if (index < InterruptArp32_NUM_EVES) {
        mbxIdx = 2;
    }
 
    /* Make sure the interrupt only gets plugged once */
    InterruptArp32_module->numPlugged[mbxIdx]++;
    if (InterruptArp32_module->numPlugged[mbxIdx] == 1) { 
        /* Register interrupt to remote processor */
        Hwi_Params_init(&hwiAttrs);
        hwiAttrs.arg = arg;
        hwiAttrs.vectorNum = intInfo->intVectorId;

        Hwi_create(InterruptArp32_eveInterruptTable[index],
                  (Hwi_FuncPtr)InterruptArp32_intShmStub,
                   &hwiAttrs,
                   &eb);
        Hwi_enableInterrupt(InterruptArp32_eveInterruptTable[index]);
    }

    /* enable the mailbox and Hwi */
    InterruptArp32_intEnable(remoteProcId, intInfo);
    
    /* Restore global interrupts */
    Hwi_restore(key);
}