add lbr_restore and lbr_restore_by_filter functions

This commit is contained in:
sina 2026-05-24 23:51:12 +02:00
parent 1a63f6e737
commit 02ab868dc7
14 changed files with 980 additions and 847 deletions

View file

@ -2089,3 +2089,43 @@ ScriptEngineFunctionLbrCheck()
#endif // SCRIPT_ENGINE_KERNEL_MODE
}
/**
* @brief Implementation of lbr_restore function
*
* @return BOOLEAN
*/
BOOLEAN
ScriptEngineFunctionLbrRestore()
{
#ifdef SCRIPT_ENGINE_USER_MODE
ShowMessages("err, it's not possible to call lbr_restore function in the user-mode\n");
return FALSE;
#endif // SCRIPT_ENGINE_USER_MODE
#ifdef SCRIPT_ENGINE_KERNEL_MODE
return HyperTraceLbrRestore();
#endif // SCRIPT_ENGINE_KERNEL_MODE
}
/**
* @brief Implementation of lbr_restore_by_filter function
*
* @return BOOLEAN
*/
BOOLEAN
ScriptEngineFunctionLbrRestoreByFilter(UINT64 FilterOptions)
{
#ifdef SCRIPT_ENGINE_USER_MODE
ShowMessages("err, it's not possible to call lbr_restore_by_filter function in the user-mode\n");
return FALSE;
#endif // SCRIPT_ENGINE_USER_MODE
#ifdef SCRIPT_ENGINE_KERNEL_MODE
return HyperTraceLbrRestoreByFilter(FilterOptions);
#endif // SCRIPT_ENGINE_KERNEL_MODE
}

View file

@ -736,6 +736,13 @@ ScriptEngineExecute(PGUEST_REGS GuestRegs,
GuestRegs);
break;
case FUNC_LBR_CHECK:
//
// To be implemented!
//
break;
case FUNC_LBR_SAVE:
Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
@ -759,6 +766,36 @@ ScriptEngineExecute(PGUEST_REGS GuestRegs,
SetValue(GuestRegs, ScriptGeneralRegisters, Des, DesVal);
break;
case FUNC_LBR_RESTORE:
Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
(unsigned long long)(*Indx * sizeof(SYMBOL)));
*Indx = *Indx + 1;
DesVal = ScriptEngineFunctionLbrRestore();
SetValue(GuestRegs, ScriptGeneralRegisters, Des, DesVal);
break;
case FUNC_LBR_RESTORE_BY_FILTER:
Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
(unsigned long long)(*Indx * sizeof(SYMBOL)));
*Indx = *Indx + 1;
SrcVal0 =
GetValue(GuestRegs, ActionDetail, ScriptGeneralRegisters, Src0, FALSE);
Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
(unsigned long long)(*Indx * sizeof(SYMBOL)));
*Indx = *Indx + 1;
DesVal = ScriptEngineFunctionLbrRestoreByFilter((unsigned long long)SrcVal0);
SetValue(GuestRegs, ScriptGeneralRegisters, Des, DesVal);
break;
case FUNC_FLUSH:
ScriptEngineFunctionFlush();