-
Notifications
You must be signed in to change notification settings - Fork 362
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
Add native target 64-bit support #3042
Conversation
.code64 | ||
.p2align 4, 0x90 /* align on 16-byte boundary and fill with NOPs */ | ||
|
||
.globl CNAME(os_arch_frame_init_64bit) |
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.
64bit -> x64
*/ | ||
movq %rdi,%rsp | ||
subq $0x0c,%rsp /* make room for sigsetjmp() arguments */ | ||
andq $0xfffffffffffffff0,%rsp /* align %rsp on 16-byte boundary */ |
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.
btrq $0xf,%rsp
should also work (and you don't need to count f
s)
kernel/sim/src/sim_sched_gen.c
Outdated
os_arch_frame_init_64bit(sf); | ||
} else { | ||
printf("Void pointer should be either 4 or 8 bytes. Exiting.\n"); | ||
exit(0); |
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.
#if __SIZEOF_POINTER__ == xxx
and then #error
instead of printf would be better since it gives an error during build
@@ -60,6 +60,7 @@ typedef unsigned int os_stack_t; | |||
/* sim specific */ | |||
struct stack_frame; | |||
void os_arch_frame_init(struct stack_frame *sf); | |||
void os_arch_frame_init_64bit(struct stack_frame *sf); |
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.
probably would be better to have the same prototype regardless of arch and just use preprocessor to check that we build for supported arch (see c384bec#r1265232905)
fwiw it covers all the changes i did in apache/mynewt-nimble#1563 |
176093f
to
637fd95
Compare
637fd95
to
badc6f6
Compare
Thanks to this the type casting code can be compiled on both 32-bit and 64-bit architectures. This also changes some printf functions, so they are also compatible with both types of architectures.
This allows to run unit tests on 64-bit architecture. This also modifies some mbuf tests, so the test pool buf size is no longer hardcoded.
On some architectures va_list is defined as an array, which leads to compilation errors if va_list type is caller argument and callee expects a pointer to it as it's argument. Thanks to this the compilation errors in this situation no longer occur.
On some compilers (for example 64-bit gcc 9.4.0) passing SIZE_MAX/2 to vsnprintf as buffer size was causing an compilation error. INT_MAX/2 should also be enough for buffer size and now it compiles without problems. This also removes force inclusion of "main" symbol.
-Wno-maybe-uninitialized flag is not supported by clang. This suppresses warning related to this.
-m32 flag is removed. Now if the machine on which the code is compiled is capable of running 64-bit code the generated code will be 64-bit.
badc6f6
to
c79ff2a
Compare
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.
LGTM, not tested though
This also requires changes from repositories apache-mynewt-nimble, apache-mynewt-mcumgr and mcuboot, which I commited.