-
Notifications
You must be signed in to change notification settings - Fork 19
arm: adapt to being built as multilib #409
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # | ||
| # Makefile for libphoenix/arch/arm/multilib | ||
| # | ||
| # Copyright 2025 Phoenix Systems | ||
| # | ||
| # %LICENSE% | ||
| # | ||
|
|
||
| OBJS += $(addprefix $(PREFIX_O)arch/arm/multilib/, syscalls.o reboot.o) | ||
|
|
||
| OBJS += $(addprefix $(PREFIX_O)arch/arm/multilib/, jmp.o signal.o string.o) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| /* | ||
| * Phoenix-RTOS | ||
| * | ||
| * libphoenix | ||
| * | ||
| * | ||
| * _setjmp, _longjmp, setjmp, sigsetjmp | ||
| * | ||
| * Copyright 2025 Phoenix Systems | ||
| * Author: Hubert Badocha | ||
| * | ||
| * This file is part of Phoenix-RTOS. | ||
| * | ||
| * %LICENSE% | ||
| */ | ||
|
|
||
| #include <setjmp.h> | ||
| #include <stdlib.h> | ||
|
|
||
|
|
||
| int _setjmp(jmp_buf var) | ||
| { | ||
| abort(); | ||
| } | ||
|
|
||
|
|
||
| __attribute__((__noreturn__)) void _longjmp(jmp_buf var, int m) | ||
| { | ||
| abort(); | ||
| } | ||
|
|
||
|
|
||
| int setjmp(jmp_buf var) | ||
| { | ||
| abort(); | ||
| } | ||
|
|
||
|
|
||
| int sigsetjmp(sigjmp_buf env, int savesigs) | ||
| { | ||
| abort(); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /* | ||
| * Phoenix-RTOS | ||
| * | ||
| * libphoenix | ||
| * | ||
| * reboot.c | ||
| * | ||
| * Copyright 2025 Phoenix Systems | ||
| * Author: Hubert Badocha | ||
| * | ||
| * This file is part of Phoenix-RTOS. | ||
| * | ||
| * %LICENSE% | ||
| */ | ||
|
|
||
| #include <sys/reboot.h> | ||
| #include <sys/platform.h> | ||
|
|
||
|
|
||
| int reboot(int magic) | ||
| { | ||
| return -1; | ||
| } | ||
|
|
||
|
|
||
| int reboot_reason(uint32_t *val) | ||
| { | ||
| *val = 0u; | ||
|
|
||
| return 0; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| /* | ||
| * Phoenix-RTOS | ||
| * | ||
| * libphoenix | ||
| * | ||
| * Signal trampoline (arm) | ||
| * | ||
| * Copyright 2025 Phoenix Systems | ||
| * Author: Hubert Badocha | ||
| * | ||
| * This file is part of Phoenix-RTOS. | ||
| * | ||
| * %LICENSE% | ||
| */ | ||
|
|
||
| #define __ASSEMBLY__ | ||
|
|
||
| .text | ||
|
|
||
| .globl _signal_trampoline | ||
| .type _signal_trampoline, %function | ||
| _signal_trampoline: | ||
| bl abort | ||
| .size _signal_trampoline, .-_signal_trampoline | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| /* | ||
| * Phoenix-RTOS | ||
| * | ||
| * libphoenix | ||
| * | ||
| * arch/arm/multilib/string | ||
| * | ||
| * Copyright 2025 Phoenix Systems | ||
| * Author: Hubert Badocha | ||
| * | ||
| * This file is part of Phoenix-RTOS. | ||
| * | ||
| * %LICENSE% | ||
| */ | ||
|
|
||
|
|
||
| #include <stddef.h> | ||
|
|
||
|
|
||
| void *memmove(void *dest, const void *src, size_t n) | ||
| { | ||
| for (size_t i = 0; i < n; i++) { | ||
| ((char *)dest)[i] = ((const char *)src)[i]; | ||
| } | ||
| return dest; | ||
| } | ||
|
|
||
|
|
||
| int memcmp(const void *ptr1, const void *ptr2, size_t n) | ||
| { | ||
| for (size_t i = 0; i < n; i++) { | ||
| int diff = ((int)(((const unsigned char *)ptr1)[i])) - ((int)(((const unsigned char *)ptr2)[i])); | ||
| if (diff != 0) { | ||
| return diff; | ||
| } | ||
| } | ||
| return 0; | ||
| } | ||
|
|
||
|
|
||
| size_t strlen(const char *s) | ||
| { | ||
| size_t len = 0; | ||
| while (s[len] != '\0') { | ||
| len++; | ||
| } | ||
| return len; | ||
| } | ||
|
|
||
|
|
||
| size_t strnlen(const char *s, size_t maxlen) | ||
| { | ||
| size_t len = 0; | ||
| while ((s[len] != '\0') && (len < maxlen)) { | ||
| len++; | ||
| } | ||
| return len; | ||
| } | ||
|
|
||
|
|
||
| int strcmp(const char *s1, const char *s2) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. invalid - |
||
| { | ||
| for (size_t i = 0; (s1[i] != '\0') || (s2[i] != '\0'); i++) { | ||
| int diff = ((int)(((const unsigned char *)s1)[i])) - ((int)(((const unsigned char *)s2)[i])); | ||
| if (diff != 0) { | ||
| return diff; | ||
| } | ||
| } | ||
| return 0; | ||
| } | ||
|
|
||
|
|
||
| int strncmp(const char *s1, const char *s2, size_t count) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. invalid - |
||
| { | ||
| for (size_t i = 0; ((i < count) && ((s1[i] != '\0') || (s2[i] != '\0'))); i++) { | ||
| int diff = ((int)(((const unsigned char *)s1)[i])) - ((int)(((const unsigned char *)s2)[i])); | ||
| if (diff != 0) { | ||
| return diff; | ||
| } | ||
| } | ||
| return 0; | ||
| } | ||
|
|
||
|
|
||
| char *strcpy(char *dest, const char *src) | ||
| { | ||
| size_t i = 0; | ||
| while ((src[i] != '\0')) { | ||
| dest[i] = src[i]; | ||
| i++; | ||
| } | ||
| dest[i] = '\0'; | ||
| return dest; | ||
| } | ||
|
|
||
|
|
||
| char *strncpy(char *dest, const char *src, size_t n) | ||
| { | ||
| size_t i = 0; | ||
| while (((i < n) && (src[i] != '\0'))) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is not a valid implementation of |
||
| dest[i] = src[i]; | ||
| i++; | ||
| } | ||
| while (i < n) { | ||
| dest[i] = '\0'; | ||
| i++; | ||
| } | ||
| return dest; | ||
| } | ||
|
|
||
|
|
||
| void *memcpy(void *dest, const void *src, size_t n) | ||
| { | ||
| for (size_t i = 0; i < n; i++) { | ||
| ((char *)dest)[i] = ((const char *)src)[i]; | ||
| } | ||
| return dest; | ||
| } | ||
|
|
||
|
|
||
| void *memset(void *dest, int value, size_t n) | ||
| { | ||
| for (size_t i = 0; i < n; i++) { | ||
| ((unsigned char *)dest)[i] = (unsigned char)value; | ||
| } | ||
| return dest; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| /* | ||
| * Phoenix-RTOS | ||
| * | ||
| * libphoenix | ||
| * | ||
| * syscalls (arm-multilib) | ||
| * | ||
| * Copyright 2025 Phoenix Systems | ||
| * Author: Hubert Badocha | ||
| * | ||
| * This file is part of Phoenix-RTOS. | ||
| * | ||
| * %LICENSE% | ||
| */ | ||
|
|
||
| #define __ASSEMBLY__ | ||
| #include <phoenix/syscalls.h> | ||
|
|
||
| .text | ||
|
|
||
|
|
||
| #define SYSCALLDEF(sym, sn) \ | ||
| .globl sym; \ | ||
| .type sym, %function; \ | ||
| sym: \ | ||
| bl abort; \ | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| .size sym, .-sym | ||
|
|
||
|
|
||
| .globl vfork; | ||
| .type vfork, %function; | ||
| vfork: | ||
| b vforksvc | ||
| .size vfork, .-vfork | ||
|
|
||
|
|
||
| #define SYSCALLS_LIBC(name) \ | ||
| SYSCALLDEF(name, __COUNTER__); | ||
|
|
||
|
|
||
| SYSCALLS(SYSCALLS_LIBC) | ||
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.
blasbmay have to short range