From c049c4d872af18d668bb98094ce4334e44508fbe Mon Sep 17 00:00:00 2001 From: Alexey Brodkin Date: Sat, 14 Feb 2015 15:25:38 +0530 Subject: ARC: add configuration option for MMU page size ARC CPU may have MMU page size of 4/8(default)/16k. uClibc needs to have page size configured accodring to HW it will be run on. Signed-off-by: Alexey Brodkin Signed-off-by: Vineet Gupta Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/arc/bits/uClibc_page.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'libc/sysdeps/linux/arc') diff --git a/libc/sysdeps/linux/arc/bits/uClibc_page.h b/libc/sysdeps/linux/arc/bits/uClibc_page.h index 26cec54c9..b05c57501 100755 --- a/libc/sysdeps/linux/arc/bits/uClibc_page.h +++ b/libc/sysdeps/linux/arc/bits/uClibc_page.h @@ -9,16 +9,25 @@ /* * ARC700/linux supports 4k, 8k, 16k pages (build time). - * We rely on the kernel exported header (aka uapi headers since 3.8) - * for PAGE_SIZE and friends. This avoids hand-editing here when building - * toolchain. * * Although uClibc determines page size dynamically, from kernel's auxv which * ARC Linux does pass, still the generic code needs a fall back * _dl_pagesize = auxvt[AT_PAGESZ].a_un.a_val ? : PAGE_SIZE * */ -#include + +#include + +#if defined(__CONFIG_ARC_PAGE_SIZE_16K__) +#define PAGE_SHIFT 14 +#elif defined(__CONFIG_ARC_PAGE_SIZE_4K__) +#define PAGE_SHIFT 12 +#else +#define PAGE_SHIFT 13 +#endif + +#define PAGE_SIZE (1UL << PAGE_SHIFT) +#define PAGE_MASK (~(PAGE_SIZE-1)) /* TBD: fix this with runtime value for a PAGE_SIZE agnostic uClibc */ #define MMAP2_PAGE_SHIFT PAGE_SHIFT -- cgit v1.2.3 From 7bb51423cccff0b524ba4ddd0679e8c7c1e4a7b1 Mon Sep 17 00:00:00 2001 From: Vineet Gupta Date: Sat, 14 Feb 2015 15:25:40 +0530 Subject: ARC: remove stale TRUNCATE64_HAS_4_ARGS Not relevant anymore since commit e8cc14e59ed3f66b84e, "libc: rename TRUNCATE64_HAS_4_ARGS to SYSCALL_ALIGN_64BIT" Signed-off-by: Vineet Gupta Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/arc/bits/uClibc_arch_features.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'libc/sysdeps/linux/arc') diff --git a/libc/sysdeps/linux/arc/bits/uClibc_arch_features.h b/libc/sysdeps/linux/arc/bits/uClibc_arch_features.h index 9313ee8f2..8af6eca4c 100755 --- a/libc/sysdeps/linux/arc/bits/uClibc_arch_features.h +++ b/libc/sysdeps/linux/arc/bits/uClibc_arch_features.h @@ -17,9 +17,6 @@ /* can your target use syscall6() for mmap ? */ #undef __UCLIBC_MMAP_HAS_6_ARGS__ -/* does your target use syscall4() for truncate64 ? (32bit arches only) */ -#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__ - /* does your target have a broken create_module() ? */ #undef __UCLIBC_BROKEN_CREATE_MODULE__ -- cgit v1.2.3 From 90b115c036d68c4c581ae974cdbf5352ad7daa84 Mon Sep 17 00:00:00 2001 From: Vineet Gupta Date: Sat, 14 Feb 2015 15:25:41 +0530 Subject: ARC: siagction: opencode memcpy Signed-off-by: Vineet Gupta Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/arc/sigaction.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'libc/sysdeps/linux/arc') diff --git a/libc/sysdeps/linux/arc/sigaction.c b/libc/sysdeps/linux/arc/sigaction.c index 73c496d2a..a34c7cf4c 100644 --- a/libc/sysdeps/linux/arc/sigaction.c +++ b/libc/sysdeps/linux/arc/sigaction.c @@ -22,8 +22,9 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) { struct sigaction kact; - /* !act means caller only wants to know @oact - * Hence only otherwise, do SA_RESTORER stuff + /* + * SA_RESTORER is only relevant for act != NULL case + * (!act means caller only wants to know @oact) * * For the normal/default cases (user not providing SA_RESTORER) use * a real sigreturn stub to avoid kernel synthesizing one on user stack @@ -31,9 +32,11 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) * update) and costly cache line flushes for code modification */ if (act && !(act->sa_flags & SA_RESTORER)) { - memcpy(&kact, act, sizeof(kact)); kact.sa_restorer = __default_rt_sa_restorer; - kact.sa_flags |= SA_RESTORER; + kact.sa_flags = act->sa_flags | SA_RESTORER; + + kact.sa_handler = act->sa_handler; + kact.sa_mask = act->sa_mask; act = &kact; } -- cgit v1.2.3 From 65bc357213f1c08e339757923740f5d68212cf76 Mon Sep 17 00:00:00 2001 From: Vineet Gupta Date: Sat, 14 Feb 2015 15:25:43 +0530 Subject: ARC: sigaction: fold default sigrestorer into "C" Signed-off-by: Vineet Gupta Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/arc/Makefile.arch | 3 +-- libc/sysdeps/linux/arc/sigaction.c | 14 +++++++------- libc/sysdeps/linux/arc/sigrestorer.S | 21 --------------------- 3 files changed, 8 insertions(+), 30 deletions(-) delete mode 100644 libc/sysdeps/linux/arc/sigrestorer.S (limited to 'libc/sysdeps/linux/arc') diff --git a/libc/sysdeps/linux/arc/Makefile.arch b/libc/sysdeps/linux/arc/Makefile.arch index 656ea3518..1a52fc9bf 100644 --- a/libc/sysdeps/linux/arc/Makefile.arch +++ b/libc/sysdeps/linux/arc/Makefile.arch @@ -7,5 +7,4 @@ CSRC-y := syscall.c sigaction.c __syscall_error.c cacheflush.c -SSRC-y := sigrestorer.S __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S \ - vfork.S clone.S +SSRC-y := __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S vfork.S clone.S diff --git a/libc/sysdeps/linux/arc/sigaction.c b/libc/sysdeps/linux/arc/sigaction.c index a34c7cf4c..96c9983b1 100644 --- a/libc/sysdeps/linux/arc/sigaction.c +++ b/libc/sysdeps/linux/arc/sigaction.c @@ -10,8 +10,13 @@ #include #include -extern void __default_rt_sa_restorer(void); -//libc_hidden_proto(__default_rt_sa_restorer); +/* + * Default sigretrun stub if user doesn't specify SA_RESTORER + */ +static void __default_rt_sa_restorer(void) +{ + INTERNAL_SYSCALL_NCS(__NR_rt_sigreturn, , 0); +} #define SA_RESTORER 0x04000000 @@ -25,11 +30,6 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) /* * SA_RESTORER is only relevant for act != NULL case * (!act means caller only wants to know @oact) - * - * For the normal/default cases (user not providing SA_RESTORER) use - * a real sigreturn stub to avoid kernel synthesizing one on user stack - * at runtime, which needs PTE permissions update (hence TLB entry - * update) and costly cache line flushes for code modification */ if (act && !(act->sa_flags & SA_RESTORER)) { kact.sa_restorer = __default_rt_sa_restorer; diff --git a/libc/sysdeps/linux/arc/sigrestorer.S b/libc/sysdeps/linux/arc/sigrestorer.S deleted file mode 100644 index 24531d89d..000000000 --- a/libc/sysdeps/linux/arc/sigrestorer.S +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com) - * - * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball. - */ - -#include -#include - -/* - * Provide a real sigreturn stub to avoid kernel synthesizing one - * on user stack at runtime, which needs PTE permissions update - * (hence TLB entry update) and costly cache line flushes for - * code modification - */ - -ENTRY(__default_rt_sa_restorer) - mov r8, __NR_rt_sigreturn - ARC_TRAP_INSN -END(__default_rt_sa_restorer) -libc_hidden_def(__default_rt_sa_restorer) -- cgit v1.2.3 From f74294bd6768af59e33dc14c6fed41f01d0adc5b Mon Sep 17 00:00:00 2001 From: Vineet Gupta Date: Sat, 14 Feb 2015 15:25:42 +0530 Subject: ARC: sigaction: inline syscall trap Signed-off-by: Vineet Gupta Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/arc/sigaction.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libc/sysdeps/linux/arc') diff --git a/libc/sysdeps/linux/arc/sigaction.c b/libc/sysdeps/linux/arc/sigaction.c index 96c9983b1..4a4c9e2d0 100644 --- a/libc/sysdeps/linux/arc/sigaction.c +++ b/libc/sysdeps/linux/arc/sigaction.c @@ -41,7 +41,8 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) act = &kact; } - return __syscall_rt_sigaction(sig, act, oact, sizeof(act->sa_mask)); + return INLINE_SYSCALL(rt_sigaction, 4, + sig, act, oact, sizeof(act->sa_mask)); } #ifndef LIBC_SIGACTION -- cgit v1.2.3 From afab56958f1cbb47b831ee3ebff231dfbae74af2 Mon Sep 17 00:00:00 2001 From: Vineet Gupta Date: Thu, 19 Feb 2015 19:13:59 +0530 Subject: ARCv2 ISA support This is next gen Instruction Set Architecture from Synopsys and basis for the ARC HS family of processors. http://www.synopsys.com/dw/ipdir.php?ds=arc-hs38-processor&elq_mid=5732&elq_cid=458802 http://www.synopsys.com/IP/ProcessorIP/ARCProcessors/arc-hs/Pages/default.aspx Signed-off-by: Vineet Gupta Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/arc/bits/syscalls.h | 10 +++++++++- libc/sysdeps/linux/arc/bits/uClibc_arch_features.h | 7 +++++++ 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'libc/sysdeps/linux/arc') diff --git a/libc/sysdeps/linux/arc/bits/syscalls.h b/libc/sysdeps/linux/arc/bits/syscalls.h index 5da6aadb3..248ef7844 100644 --- a/libc/sysdeps/linux/arc/bits/syscalls.h +++ b/libc/sysdeps/linux/arc/bits/syscalls.h @@ -98,7 +98,11 @@ extern int __syscall_error (int); * for syscall itself. *-------------------------------------------------------------------------*/ -#define ARC_TRAP_INSN "trap0 \n\t" +#ifdef __A7__ +#define ARC_TRAP_INSN "trap0 \n\t" +#elif defined(__HS__) +#define ARC_TRAP_INSN "trap_s 0 \n\t" +#endif #define INTERNAL_SYSCALL_NCS(nm, err, nr_args, args...) \ ({ \ @@ -176,7 +180,11 @@ extern int __syscall_error (int); #else +#ifdef __A7__ #define ARC_TRAP_INSN trap0 +#elif defined(__HS__) +#define ARC_TRAP_INSN trap_s 0 +#endif #endif /* __ASSEMBLER__ */ diff --git a/libc/sysdeps/linux/arc/bits/uClibc_arch_features.h b/libc/sysdeps/linux/arc/bits/uClibc_arch_features.h index 8af6eca4c..451575586 100755 --- a/libc/sysdeps/linux/arc/bits/uClibc_arch_features.h +++ b/libc/sysdeps/linux/arc/bits/uClibc_arch_features.h @@ -47,4 +47,11 @@ /* The default ';' is a comment on ARC. */ #define __UCLIBC_ASM_LINE_SEP__ ` +/* does your target align 64bit values in register pairs ? (32bit arches only) */ +#if defined(__A7__) +#undef __UCLIBC_SYSCALL_ALIGN_64BIT__ +#else +#define __UCLIBC_SYSCALL_ALIGN_64BIT__ +#endif + #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ -- cgit v1.2.3