Open ghost opened 3 years ago
The function seems only be used in micropython. So you can modify it to return 0, and running python script will cause segmentation fault but the other parts could works well.
#include <ion.h>
#include <setjmp.h>
namespace Ion {
/* Forbid inlining to ensure dummy to be at the top of the stack. Otherwise,
* LTO inlining can make regs lower on the stack than some just-allocated
* pointers. */
__attribute__((noinline))uintptr_t collectRegisters(jmp_buf buf) {
/* TODO: we use setjmp to get the registers values to look for python heap
* root. However, the 'setjmp' does not guarantee that it gets all registers
* values. We should check our setjmp implementation for the device and
* ensure that it also works for other platforms. */
setjmp(buf);
int dummy;
return (uintptr_t)&dummy;
}
}
Copy the content of ion/src/simulator/collect_registers.cpp to ion/src/simulator/shared/collect_registers.cpp And inside ion/src/simulator/linux/Makefile, delete the "collect_registers_x86_64.s \" That works fine on my x64 pc.
@happyme531 Thank you for your research ^^
This isn't fixed in epsilon : this should be re opened
Thanks @luoniisan for pointing that out. The assembly version for collecting registers in ARM64 is indeed missing - or at least a default setjmp
implementation. However, we should not modify the file ion/src/simulator/shared/collect_registers_x86_64.s
(we want to maintain the linux x86_64 platform as well) but add a ARM64 assembly implementation. The Makefile
would have to smartly choose the right file to compile.
#include <ion.h> #include <setjmp.h> namespace Ion { /* Forbid inlining to ensure dummy to be at the top of the stack. Otherwise, * LTO inlining can make regs lower on the stack than some just-allocated * pointers. */ __attribute__((noinline))uintptr_t collectRegisters(jmp_buf buf) { /* TODO: we use setjmp to get the registers values to look for python heap * root. However, the 'setjmp' does not guarantee that it gets all registers * values. We should check our setjmp implementation for the device and * ensure that it also works for other platforms. */ setjmp(buf); int dummy; return (uintptr_t)&dummy; } }
Copy the content of ion/src/simulator/collect_registers.cpp to ion/src/simulator/shared/collect_registers.cpp And inside ion/src/simulator/linux/Makefile, delete the "collect_registers_x86_64.s " That works fine on my x64 pc.
That doesn't work on my Allwinner R8(ARM Cortex A8) based computer. Running python script will cause segmentation fault.
echo "#include <ion.h>
#include <setjmp.h>
namespace Ion {
/* Forbid inlining to ensure dummy to be at the top of the stack. Otherwise,
* LTO inlining can make regs lower on the stack than some just-allocated
* pointers. */
__attribute__((noinline))uintptr_t collectRegisters(jmp_buf buf) {
/* TODO: we use setjmp to get the registers values to look for python heap
* root. However, the 'setjmp' does not guarantee that it gets all registers
* values. We should check our setjmp implementation for the device and
* ensure that it also works for other platforms. */
setjmp(buf);
int dummy;
return (uintptr_t)&dummy;
}
}" > /epsilon/ion/src/simulator/shared/collect_registers.cpp
sed -i "s/collect_registers_x86_64.s//g" /epsilon/ion/src/simulator/linux/Makefile
it works for me: 3 (but indeed the python crashes sometime)
it works for me: 3 (but indeed the python crashes sometime)
It works to compile and run, but Python crashes very often, e.g. mandelbrot(20) crashes directly. This is on a Raspberry Pi 4 B 8GB RAM with Raspberry Pi OS Buster (similar to Debian 10).
#include <ion.h> #include <setjmp.h> namespace Ion { /* Forbid inlining to ensure dummy to be at the top of the stack. Otherwise, * LTO inlining can make regs lower on the stack than some just-allocated * pointers. */ __attribute__((noinline))uintptr_t collectRegisters(jmp_buf buf) { /* TODO: we use setjmp to get the registers values to look for python heap * root. However, the 'setjmp' does not guarantee that it gets all registers * values. We should check our setjmp implementation for the device and * ensure that it also works for other platforms. */ setjmp(buf); int dummy; return (uintptr_t)&dummy; } }
Copy the content of ion/src/simulator/collect_registers.cpp to ion/src/simulator/shared/collect_registers.cpp And inside ion/src/simulator/linux/Makefile, delete the "collect_registers_x86_64.s " That works fine on my x64 pc.
That doesn't work on my Allwinner R8(ARM Cortex A8) based computer. Running python script will cause segmentation fault.
@happyme531 judging by your words, it seems that you've already compiled a binary for chip. How did you compile it?
@aisuneko This should be as easy as compile on a normal Debian system. Just following the offical guide, except replacing this inline asm.
If you cant find needed package consider update to debian strech or newer version.
OS: Debian GNU/Linux 10 (buster) aarch64
root@anonymous:/epsilon# make PLATFORM=simulator
https://cdn.discordapp.com/attachments/696835551038275686/741059495475544225/2020-08-07-002539_2117x1237_scrot.png
test on x86_64 linux desktop by:
I have a phone based on aarch64 GNU / LINUX it would be very appreciated if the port of linux arm is implemented especially if it is enough to add a single Asm x86_64 file from sintax AT&T containing only very basic instructions of registers and memory stack game (in addition GNU / GAS ARM approaches the syntax of nasm (intel syntax) more understandable in my opinion)
would it be enough to modify this file as I deduced without further research or it will be more complicated for you?