mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-21 18:22:33 +01:00
aarch64: Correctly implement the null function trap
This commit is contained in:
parent
c1d43aff05
commit
82f97d33d1
@ -110,18 +110,21 @@ static u64 make_null_function(const std::string& name)
|
||||
c.align(AlignMode::kData, 16);
|
||||
#else
|
||||
// AArch64 implementation
|
||||
Label jmp_address = c.newLabel();
|
||||
Label data = c.newLabel();
|
||||
// Force absolute jump to prevent out of bounds PC-rel jmp
|
||||
c.ldr(args[0], arm::ptr(jmp_address));
|
||||
c.br(args[0]);
|
||||
c.align(AlignMode::kCode, 16);
|
||||
Label jump_address = c.newLabel();
|
||||
c.ldr(args[0], arm::ptr(data, 0));
|
||||
c.ldr(a64::x14, arm::ptr(jump_address, 0));
|
||||
c.br(a64::x14);
|
||||
|
||||
// Data frame
|
||||
c.align(AlignMode::kCode, 16);
|
||||
c.bind(jump_address);
|
||||
c.embedUInt64(reinterpret_cast<u64>(&null));
|
||||
|
||||
c.align(AlignMode::kData, 16);
|
||||
c.bind(data);
|
||||
c.embed(name.c_str(), name.size());
|
||||
c.embedUInt8(0U);
|
||||
c.bind(jmp_address);
|
||||
c.embedUInt64(reinterpret_cast<u64>(&null));
|
||||
c.align(AlignMode::kData, 16);
|
||||
#endif
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user