-
Notifications
You must be signed in to change notification settings - Fork 677
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
Support setjmp / longjmp in jerry-libc #194
Conversation
5e2f177
to
8339488
Compare
Could you please add support for ARMv7 softfp too? It'd be need soon. |
@@ -28,6 +28,8 @@ | |||
#include "jrt.h" | |||
#include "fdlibm-math.h" | |||
|
|||
#include <stdlib.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<stdlib.h>
-> "jrt-libc-includes.h"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
Of course. I'll add. |
8ed30b1
to
b92c943
Compare
@egavrin, I've added support for softfp. |
Good to me. |
\ | ||
svc #0; \ | ||
\ | ||
pop {r4-r12, pc}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Syscalls require to save all registers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't they? I would be grateful, if you would point to some accepted specification that describes system call-related requirements for saving register values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have any documentation. But other libc implementations don't save them. The syscall implementation in the following link says: no registers are clobbered. I suspect the reason is avoid leaking information in registers for crackers.
https://chromium.googlesource.com/chromiumos/third_party/glibc-ports/+/factory-2460.B/sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S
I also checked the SWI implementation in the kernel. It starts with saving registers r0-r12
http://lxr.free-electrons.com/source/arch/arm/kernel/entry-common.S#L123
I seriously doubt that duplicating libc is a good idea. Systems with 1M ram does not run kernel, and we rely on their BSP. Systems with 16M ram has libc, and other applications (e.g. iot.js) will map it into the memory regardless of Jerry. So using libc is free from our perspective. Ultimately our duplicated libc just increase binary size. Maintenance is also difficult, and we cannot use optimizations (like register save skipping), because we want to be on the safe side. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and we cannot use optimizations (like register save skipping), because we want to be on the safe side.
In the case, we would oppose spending of several CPU cycles on each system call to possible reduce in code quality. As system call is relatively heavy operation, it seems to me that the optimization wouldn't somehow improve performance.
I seriously doubt that duplicating libc is a good idea. Systems with 1M ram does not run kernel, and we rely on their BSP. Systems with 16M ram has libc, and other applications (e.g. iot.js) will map it into the memory regardless of Jerry. So using libc is free from our perspective. Ultimately our duplicated libc just increase binary size. Maintenance is also difficult, and we cannot use optimizations (like register save skipping), because we want to be on the safe side. What do you think?
@zherczeg, thank you for sharing your view point. I think, it is better to continue the discussion in a 'discussion' issue, as it needs measurements and analysis for different platforms / configurations.
What is the motivation of this work? Why don't we simply use the libc? We just duplicate existing code, and introduce high maintenance risk. Derivative works like iot.js obviously use libc. |
Motivation of this work is to support
May be. For me it seems that the questions are out of scope of this pull request. Isn't it better to open a 'discussion' issue about them to list advantages / disadvantages of both approaches? |
lgtm |
|
…h folder. JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan [email protected]
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan [email protected]
…the logic with call to rand in Math.random. JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan [email protected]
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan [email protected]
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan [email protected]
…ARMv7 implementation to handle the softfloat-mode properly. JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan [email protected]
b92c943
to
de7b72d
Compare
Commit pack contains the following:
Related issue: #54