recipes: Preserve warnings flags appending the C flags in some (specific) recipes
[dragora.git] / patches / libaio / 0004-Fix-and-improve-MIPS-support.patch
blob47b0bf5ceb1d9127797fed6c89ba8609d85bd2ec
1 From f9c8695989fea731c93d99c684482df5744b385c Mon Sep 17 00:00:00 2001
2 From: Guillem Jover <guillem@hadrons.org>
3 Date: Wed, 14 Aug 2019 03:18:50 +0200
4 Subject: [PATCH libaio 04/11] Fix and improve MIPS support
6 Fix structure padding for MIPS 64, add syscall definitions, and the
7 kernel R/W pointer.
9 Signed-off-by: Guillem Jover <guillem@hadrons.org>
10 ---
11 harness/main.c | 2 +-
12 src/libaio.h | 6 +++++-
13 src/syscall-mips.h | 54 ++++++++++++++++++++++++++++++++++++++++++++++
14 src/syscall.h | 2 ++
15 4 files changed, 62 insertions(+), 2 deletions(-)
16 create mode 100644 src/syscall-mips.h
18 diff --git a/harness/main.c b/harness/main.c
19 index 0eed7bd..33d8e46 100644
20 --- a/harness/main.c
21 +++ b/harness/main.c
22 @@ -12,7 +12,7 @@
23 #include <libaio.h>
25 #if __LP64__ == 0
26 -#if defined(__i386__) || defined(__powerpc__)
27 +#if defined(__i386__) || defined(__powerpc__) || defined(__mips__)
28 #define KERNEL_RW_POINTER ((void *)0xc0010000)
29 #elif defined(__arm__) || defined(__s390__)
30 #define KERNEL_RW_POINTER ((void *)0x00010000)
31 diff --git a/src/libaio.h b/src/libaio.h
32 index 8b33382..26b07f9 100644
33 --- a/src/libaio.h
34 +++ b/src/libaio.h
35 @@ -52,7 +52,9 @@ typedef enum io_iocb_cmd {
37 /* little endian, 32 bits */
38 #if defined(__i386__) || (defined(__arm__) && !defined(__ARMEB__)) || \
39 - defined(__sh__) || defined(__bfin__) || defined(__MIPSEL__) || \
40 + defined(__sh__) || \
41 + defined(__bfin__) || \
42 + (defined(__MIPSEL__) && !defined(__mips64)) || \
43 defined(__cris__) || (defined(__riscv) && __riscv_xlen == 32) || \
44 (defined(__GNUC__) && defined(__BYTE_ORDER__) && \
45 __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && __SIZEOF_LONG__ == 4)
46 @@ -62,6 +64,7 @@ typedef enum io_iocb_cmd {
48 /* little endian, 64 bits */
49 #elif defined(__ia64__) || defined(__x86_64__) || defined(__alpha__) || \
50 + (defined(__mips64) && defined(__MIPSEL__)) || \
51 (defined(__aarch64__) && defined(__AARCH64EL__)) || \
52 (defined(__riscv) && __riscv_xlen == 64) || \
53 (defined(__GNUC__) && defined(__BYTE_ORDER__) && \
54 @@ -73,6 +76,7 @@ typedef enum io_iocb_cmd {
55 /* big endian, 64 bits */
56 #elif defined(__powerpc64__) || defined(__s390x__) || \
57 (defined(__sparc__) && defined(__arch64__)) || \
58 + (defined(__mips64) && defined(__MIPSEB__)) || \
59 (defined(__aarch64__) && defined(__AARCH64EB__)) || \
60 (defined(__GNUC__) && defined(__BYTE_ORDER__) && \
61 __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ && __SIZEOF_LONG__ == 8)
62 diff --git a/src/syscall-mips.h b/src/syscall-mips.h
63 new file mode 100644
64 index 0000000..2c4245e
65 --- /dev/null
66 +++ b/src/syscall-mips.h
67 @@ -0,0 +1,54 @@
68 +/*
69 + * This file is subject to the terms and conditions of the GNU General Public
70 + * License. See the file "COPYING" in the main directory of this archive
71 + * for more details.
72 + *
73 + * Copyright (C) 1995, 96, 97, 98, 99, 2000 by Ralf Baechle
74 + * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
75 + */
77 +#ifndef _MIPS_SIM_ABI32
78 +#define _MIPS_SIM_ABI32 1
79 +#define _MIPS_SIM_NABI32 2
80 +#define _MIPS_SIM_ABI64 3
81 +#endif
83 +#if _MIPS_SIM == _MIPS_SIM_ABI32
85 +/*
86 + * Linux o32 style syscalls are in the range from 4000 to 4999.
87 + */
88 +#define __NR_Linux 4000
89 +#define __NR_io_setup (__NR_Linux + 241)
90 +#define __NR_io_destroy (__NR_Linux + 242)
91 +#define __NR_io_getevents (__NR_Linux + 243)
92 +#define __NR_io_submit (__NR_Linux + 244)
93 +#define __NR_io_cancel (__NR_Linux + 245)
95 +#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
97 +#if _MIPS_SIM == _MIPS_SIM_ABI64
99 +/*
100 + * Linux 64-bit syscalls are in the range from 5000 to 5999.
101 + */
102 +#define __NR_Linux 5000
103 +#define __NR_io_setup (__NR_Linux + 200)
104 +#define __NR_io_destroy (__NR_Linux + 201)
105 +#define __NR_io_getevents (__NR_Linux + 202)
106 +#define __NR_io_submit (__NR_Linux + 203)
107 +#define __NR_io_cancel (__NR_Linux + 204)
108 +#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
110 +#if _MIPS_SIM == _MIPS_SIM_NABI32
113 + * Linux N32 syscalls are in the range from 6000 to 6999.
114 + */
115 +#define __NR_Linux 6000
116 +#define __NR_io_setup (__NR_Linux + 200)
117 +#define __NR_io_destroy (__NR_Linux + 201)
118 +#define __NR_io_getevents (__NR_Linux + 202)
119 +#define __NR_io_submit (__NR_Linux + 203)
120 +#define __NR_io_cancel (__NR_Linux + 204)
121 +#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
122 diff --git a/src/syscall.h b/src/syscall.h
123 index b53da4c..db78e28 100644
124 --- a/src/syscall.h
125 +++ b/src/syscall.h
126 @@ -27,6 +27,8 @@
127 #include "syscall-arm.h"
128 #elif defined(__sparc__)
129 #include "syscall-sparc.h"
130 +#elif defined(__mips__)
131 +#include "syscall-mips.h"
132 #elif defined(__aarch64__) || defined(__riscv)
133 #include "syscall-generic.h"
134 #else
136 2.26.0.292.g33ef6b2f38