我正在尝试将一些开源代码移植到一个新平台(特别是 gpsp 从这个源到 rockbox fuze+ 目标)。
现在我只是想让它编译,我会努力让它稍后运行。在修复了许多错误和警告后,我留下了这个错误:
/home/username/rockbox/apps/plugins/rockgba/gpsp/arm/warm.c: In function ‘warm_cache_op_range’:
/home/username/rockbox/apps/plugins/rockgba/gpsp/arm/warm.c:65:2: error: unknown register name ‘r3’ in ‘asm’
__asm__("mov r0, %0 ;"
^
/home/username/rockbox/apps/plugins/rockgba/gpsp/arm/warm.c:65:2: error: unknown register name ‘r2’ in ‘asm’
/home/username/rockbox/apps/plugins/rockgba/gpsp/arm/warm.c:65:2: error: unknown register name ‘r1’ in ‘asm’
/home/username/rockbox/apps/plugins/rockgba/gpsp/arm/warm.c:65:2: error: unknown register name ‘r0’ in ‘asm’
相关代码来自warm.c
:
static void sys_cacheflush(void *start, void *end)
{
#ifdef __ARM_EABI__
/* EABI version */
int num = __ARM_NR_cacheflush;
__asm__("mov r0, %0 ;"
"mov r1, %1 ;"
"mov r2, #0 ;"
"mov r7, %2 ;"
"swi 0" : : "r" (start), "r" (end), "r" (num)
: "r0", "r1", "r2", "r3", "r7");
#else //line 63
/* OABI */ //line 64
__asm__("mov r0, %0 ;" //line 65
"mov r1, %1 ;" //line 66
"mov r2, #0 ;"
"swi %2" : : "r" (start), "r" (end), "i" __ARM_NR_cacheflush
: "r0", "r1", "r2", "r3");
#endif
}
我没有组装经验,绝对没有 ARM,所以我不知道如何完成这项工作。
我需要包含一些头文件吗?还是需要设置一些构建标志?是否需要代码?