mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1240583 - Odin: add MacroAssembler::repatchThunk (r=bbouvier)
MozReview-Commit-ID: Blj499Wb0Hb
This commit is contained in:
parent
c8f3af3386
commit
44cd16281c
@ -41,6 +41,8 @@ reAfterArg = "(?=[,)])"
|
|||||||
reMatchArg = re.compile(reBeforeArg + reArgType + reArgName + reArgDefault + reAfterArg)
|
reMatchArg = re.compile(reBeforeArg + reArgType + reArgName + reArgDefault + reAfterArg)
|
||||||
|
|
||||||
def get_normalized_signatures(signature, fileAnnot = None):
|
def get_normalized_signatures(signature, fileAnnot = None):
|
||||||
|
# Remove static
|
||||||
|
signature = signature.replace('static', '')
|
||||||
# Remove semicolon.
|
# Remove semicolon.
|
||||||
signature = signature.replace(';', ' ')
|
signature = signature.replace(';', ' ')
|
||||||
# Normalize spaces.
|
# Normalize spaces.
|
||||||
|
@ -509,6 +509,7 @@ class MacroAssembler : public MacroAssemblerSpecific
|
|||||||
// CodeOffset instead of a CodeOffsetJump).
|
// CodeOffset instead of a CodeOffsetJump).
|
||||||
CodeOffset thunkWithPatch() PER_SHARED_ARCH;
|
CodeOffset thunkWithPatch() PER_SHARED_ARCH;
|
||||||
void patchThunk(uint32_t thunkOffset, uint32_t targetOffset) PER_SHARED_ARCH;
|
void patchThunk(uint32_t thunkOffset, uint32_t targetOffset) PER_SHARED_ARCH;
|
||||||
|
static void repatchThunk(uint8_t* code, uint32_t thunkOffset, uint32_t targetOffset) PER_SHARED_ARCH;
|
||||||
|
|
||||||
// Push the return address and make a call. On platforms where this function
|
// Push the return address and make a call. On platforms where this function
|
||||||
// is not defined, push the link register (pushReturnAddress) at the entry
|
// is not defined, push the link register (pushReturnAddress) at the entry
|
||||||
|
@ -4996,6 +4996,17 @@ MacroAssembler::patchThunk(uint32_t u32Offset, uint32_t targetOffset)
|
|||||||
*u32 = (targetOffset - addOffset) - 8;
|
*u32 = (targetOffset - addOffset) - 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MacroAssembler::repatchThunk(uint8_t* code, uint32_t u32Offset, uint32_t targetOffset)
|
||||||
|
{
|
||||||
|
uint32_t* u32 = reinterpret_cast<uint32_t*>(code + u32Offset);
|
||||||
|
|
||||||
|
uint32_t addOffset = u32Offset - 4;
|
||||||
|
MOZ_ASSERT(reinterpret_cast<Instruction*>(code + addOffset)->is<InstALU>());
|
||||||
|
|
||||||
|
*u32 = (targetOffset - addOffset) - 8;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MacroAssembler::pushReturnAddress()
|
MacroAssembler::pushReturnAddress()
|
||||||
{
|
{
|
||||||
|
@ -578,6 +578,12 @@ MacroAssembler::patchThunk(uint32_t thunkOffset, uint32_t targetOffset)
|
|||||||
MOZ_CRASH("NYI");
|
MOZ_CRASH("NYI");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MacroAssembler::repatchThunk(uint8_t* code, uint32_t thunkOffset, uint32_t targetOffset)
|
||||||
|
{
|
||||||
|
MOZ_CRASH("NYI");
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MacroAssembler::pushReturnAddress()
|
MacroAssembler::pushReturnAddress()
|
||||||
{
|
{
|
||||||
|
@ -1168,6 +1168,12 @@ MacroAssembler::patchThunk(uint32_t callerOffset, uint32_t calleeOffset)
|
|||||||
MOZ_CRASH("NYI");
|
MOZ_CRASH("NYI");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MacroAssembler::repatchThunk(uint8_t* code, uint32_t callerOffset, uint32_t calleeOffset)
|
||||||
|
{
|
||||||
|
MOZ_CRASH("NYI");
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MacroAssembler::call(wasm::SymbolicAddress target)
|
MacroAssembler::call(wasm::SymbolicAddress target)
|
||||||
{
|
{
|
||||||
|
@ -1028,9 +1028,12 @@ class AssemblerX86Shared : public AssemblerShared
|
|||||||
CodeOffset thunkWithPatch() {
|
CodeOffset thunkWithPatch() {
|
||||||
return CodeOffset(masm.jmp().offset());
|
return CodeOffset(masm.jmp().offset());
|
||||||
}
|
}
|
||||||
void patchThunk(uint32_t jumpOffset, uint32_t targetOffset) {
|
void patchThunk(uint32_t thunkOffset, uint32_t targetOffset) {
|
||||||
unsigned char* code = masm.data();
|
unsigned char* code = masm.data();
|
||||||
X86Encoding::SetRel32(code + jumpOffset, code + targetOffset);
|
X86Encoding::SetRel32(code + thunkOffset, code + targetOffset);
|
||||||
|
}
|
||||||
|
static void repatchThunk(uint8_t* code, uint32_t thunkOffset, uint32_t targetOffset) {
|
||||||
|
X86Encoding::SetRel32(code + thunkOffset, code + targetOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void breakpoint() {
|
void breakpoint() {
|
||||||
|
@ -551,9 +551,15 @@ MacroAssembler::thunkWithPatch()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MacroAssembler::patchThunk(uint32_t jumpOffset, uint32_t targetOffset)
|
MacroAssembler::patchThunk(uint32_t thunkOffset, uint32_t targetOffset)
|
||||||
{
|
{
|
||||||
Assembler::patchThunk(jumpOffset, targetOffset);
|
Assembler::patchThunk(thunkOffset, targetOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MacroAssembler::repatchThunk(uint8_t* code, uint32_t thunkOffset, uint32_t targetOffset)
|
||||||
|
{
|
||||||
|
Assembler::repatchThunk(code, thunkOffset, targetOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user