blob: 9150dd44d1143fb7814e173247a1e9ae54af1769 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#include <stdint.h>
#include "rv64_emitter.h"
#define EMIT(A) *block = (A); ++block
void CreateJmpNext(void* addr, void* next)
{
uint32_t* block = (uint32_t*)addr;
uintptr_t diff = (intptr_t)next - (intptr_t)addr;
AUIPC(x2, SPLIT20(diff));
#if 1
LD(x2, x2, SPLIT12(diff));
#else
// Probably not usefull, but keeping the code, just in case
ADDI(x2, x2, SPLIT12(diff));
LR_D(x2, x2, 1, 1);
#endif
BR(x2);
}
|