Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tlib/include/exec-all.h:186:2: error: #error tb_set_jmp_target1 is missing #8

Open
NicolasLoosen opened this issue Feb 3, 2022 · 2 comments

Comments

@NicolasLoosen
Copy link

I'm trying to run a docker renode image with ubuntu:20.04.
After i installed all dependencies and pulled the renode repository i keep getting the error after running the ./build.sh:

/home/renode/src/Infrastructure/src/Emulator/Cores/translate.cproj: error : In file included from tlib/arch/xtensa/cpu.h:761:0,
                 from tlib/exports.c:21:
tlib/include/exec-all.h:186:2: error: #error tb_set_jmp_target1 is missing
 #error tb_set_jmp_target1 is missing
  ^

On Windows this doesn't seem to be a problem at all but on my new MacBook (M1 Chip) its not possible to get the renode-docker image running.

@NicolasLoosen
Copy link
Author

NicolasLoosen commented Feb 3, 2022

The following part of the tlib/include/exec-all.h tries to set an jump-function dependent on the system architecture.
So i wrote a little script and added #elif defined(__arm64__) and #elif defined(__aarch64__) to check further.
When i executed to script on my MacM1 i got a printf(arm64) and as i executed it on my ubuntu docker image i got printf(aarch64).
So i think this Code might not runnable on aarch64/arm64 since there's no definition for it.

#if defined(CONFIG_TCG_INTERPRETER)
static inline void tb_set_jmp_target1(uintptr_t jmp_addr, uintptr_t addr)
{
/* patch the branch destination */
*(uint32_t )jmp_addr = addr - (jmp_addr + 4);
/
no need to flush icache explicitly /
}
#elif defined(_ARCH_PPC)
void ppc_tb_set_jmp_target(unsigned long jmp_addr, unsigned long addr);
#define tb_set_jmp_target1 ppc_tb_set_jmp_target
#elif defined(i386) || defined(x86_64)
static inline void tb_set_jmp_target1(uintptr_t jmp_addr, uintptr_t addr)
{
/
patch the branch destination */
*(uint32_t )jmp_addr = addr - (jmp_addr + 4);
/
no need to flush icache explicitly /
}
#elif defined(arm)
static inline void tb_set_jmp_target1(uintptr_t jmp_addr, uintptr_t addr)
{
#if !QEMU_GNUC_PREREQ(4, 1)
register unsigned long _beg __asm ("a1");
register unsigned long _end __asm ("a2");
register unsigned long _flg __asm ("a3");
#endif
/
we could use a ldr pc, [pc, #-4] kind of branch and avoid the flush */
*(uint32_t )jmp_addr =
(
(uint32_t *)jmp_addr & ~0xffffff)
| (((addr - (jmp_addr + 8)) >> 2) & 0xffffff);
#if QEMU_GNUC_PREREQ(4, 1)
__builtin___clear_cache((char *) jmp_addr, (char ) jmp_addr + 4);
#else
/
flush icache */
_beg = jmp_addr;
_end = jmp_addr + 4;
_flg = 0;
__asm volatile ("swi 0x9f0002" : : "r" (_beg), "r" (_end), "r" (_flg));
#endif
}
#elif defined(sparc)
void tb_set_jmp_target1(uintptr_t jmp_addr, uintptr_t addr);
#else
#error tb_set_jmp_target1 is missing
#endif

@PiotrZierhoffer
Copy link
Member

Hi @NicolasLoosen , Renode does not support ARM hosts yet. One thing is the regular infrastructure, like organizing execution blocks etc (the part that you stumbled upon), but the more complex thing is the code generator which would have to translate guest code to native aarch64. This is not yet implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants