Skip to content

Commit

Permalink
Add initial syscall support for mips64 32-bit ABI
Browse files Browse the repository at this point in the history
This applies patch by Adhemerval Zanella from
gperftools#845.

Only malloc (i.e. tcmalloc_minimal) was tested to work so far.
  • Loading branch information
alk committed Jul 8, 2017
1 parent a3bf61c commit 208c26c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/base/linux_syscall_support.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ struct kernel_sigaction {

/* include/asm-{arm,i386,mips,ppc,s390}/stat.h */
#ifdef __mips__
#if _MIPS_SIM == _MIPS_SIM_ABI64
#if (_MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32)
struct kernel_stat {
#else
struct kernel_stat64 {
Expand Down Expand Up @@ -449,7 +449,8 @@ struct kernel_stat {
unsigned long __unused5;
unsigned long __unused6;
};
#elif (defined(__mips__) && _MIPS_SIM != _MIPS_SIM_ABI64)
#elif defined(__mips__) \
&& !(_MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32)
struct kernel_stat {
unsigned st_dev;
int st_pad1[3];
Expand Down Expand Up @@ -682,7 +683,7 @@ struct kernel_stat {
#define __NR_getcpu (__NR_Linux + 312)
#endif
/* End of MIPS (old 32bit API) definitions */
#elif _MIPS_SIM == _MIPS_SIM_ABI64
#elif (_MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32)
#ifndef __NR_gettid
#define __NR_gettid (__NR_Linux + 178)
#endif
Expand Down Expand Up @@ -2559,7 +2560,8 @@ struct kernel_stat {
}
#endif
#if (defined(__aarch64__)) || \
(defined(__mips__) && (_MIPS_ISA == _MIPS_ISA_MIPS64))
(defined(__mips__) \
&& (_MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32))
LSS_INLINE int LSS_NAME(sigaction)(int signum,
const struct kernel_sigaction *act,
struct kernel_sigaction *oldact) {
Expand Down
6 changes: 5 additions & 1 deletion src/malloc_hook_mmap_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@

// I test for 64-bit first so I don't have to do things like
// '#if (defined(__mips__) && !defined(__MIPS64__))' as a mips32 check.
#if defined(__x86_64__) || defined(__PPC64__) || defined(__aarch64__) || (defined(_MIPS_SIM) && _MIPS_SIM == _ABI64) || defined(__s390__)
#if defined(__x86_64__) \
|| defined(__PPC64__) \
|| defined(__aarch64__) \
|| (defined(_MIPS_SIM) && (_MIPS_SIM == _ABI64 || _MIPS_SIM == _ABIN32)) \
|| defined(__s390__)

static inline void* do_mmap64(void *start, size_t length,
int prot, int flags,
Expand Down

0 comments on commit 208c26c

Please sign in to comment.