Skip to content

Commit 7de303a

Browse files
committed
Add m68k architecture support
1 parent 9892a86 commit 7de303a

File tree

6 files changed

+14
-5
lines changed

6 files changed

+14
-5
lines changed

gen/ioctl/generate.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,10 @@ cat loongarch-ioctls.txt >> "$out"
105105
# qemu-csky -L /usr/csky-linux-gnuabiv2 ./main.exe >> "$out"
106106
cat csky-ioctls.txt >> "$out"
107107

108+
install_headers m68k
109+
m68k-linux-gnu-gcc "${includes[@]}" -c list.c $cflags
110+
m68k-linux-gnu-gcc main.c list.o -o main.exe $cflags
111+
qemu-m68k -L /usr/m68k-linux-gnu ./main.exe >> "$out"
112+
108113
# Add any extra custom definitions at the end.
109114
echo "#include \"ioctl-addendum.h\"" >> "$out"

gen/ioctl/list.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ struct sockaddr {
100100
#include <linux/joystick.h>
101101
#include <linux/kd.h>
102102
#include <linux/kcov.h>
103-
#if !defined(__arm__) && !defined(__loongarch__) && !defined(__powerpc64__) && !defined(__riscv) && !defined(__csky__)// various errors
103+
#if !defined(__arm__) && !defined(__loongarch__) && !defined(__powerpc64__) && !defined(__riscv) && !defined(__csky__) && !defined(__m68k__) // various errors
104104
#include <linux/kvm.h>
105105
#endif
106106
#include <linux/lirc.h>

gen/ioctl/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ int main(void) {
4949
printf("#ifdef __loongarch__\n");
5050
#elif defined(__csky__)
5151
printf("#ifdef __csky__\n");
52+
#elif defined(__m68k__)
53+
printf("#ifdef __m68k__\n");
5254
#else
5355
#error "unimplemented architecture"
5456
#endif

gen/modules/general.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ struct user_desc {
229229
// that its fourth argument be the size of the kernel's internal `sigset_t`
230230
// type. So we define our own.
231231

232-
#if defined(__i386__) || defined(__x86_64__) || defined(__s390x__) || defined(__arm__) || defined(__loongarch__)
232+
#if defined(__i386__) || defined(__x86_64__) || defined(__s390x__) || defined(__arm__) || defined(__loongarch__) || defined(__m68k__)
233233
#define _NSIG 64
234234
#endif
235235

gen/src/main.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,15 +291,16 @@ fn rust_arches(linux_arch: &str) -> &[&str] {
291291
"csky" => &["csky"],
292292
"hexagon" => &["hexagon"],
293293
"loongarch" => &["loongarch64"],
294+
"m68k" => &["m68k"],
294295
"mips" => &["mips", "mips64", "mips32r6", "mips64r6"],
295296
"powerpc" => &["powerpc", "powerpc64"],
296297
"riscv" => &["riscv32", "riscv64"],
297298
"s390" => &["s390x"],
298299
"sparc" => &["sparc", "sparc64"],
299300
"x86" => &["x86", "x86_64", "x32"],
300-
"alpha" | "cris" | "h8300" | "m68k" | "microblaze" | "mn10300" | "score" | "blackfin"
301-
| "frv" | "ia64" | "m32r" | "m68knommu" | "parisc" | "sh" | "um" | "xtensa"
302-
| "unicore32" | "c6x" | "nios2" | "openrisc" | "arc" | "nds32" | "metag" | "tile" => &[],
301+
"alpha" | "cris" | "h8300" | "microblaze" | "mn10300" | "score" | "blackfin" | "frv"
302+
| "ia64" | "m32r" | "m68knommu" | "parisc" | "sh" | "um" | "xtensa" | "unicore32"
303+
| "c6x" | "nios2" | "openrisc" | "arc" | "nds32" | "metag" | "tile" => &[],
303304
_ => panic!("unrecognized arch: {}", linux_arch),
304305
}
305306
}

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ pub mod ctypes {
2727
pub type c_char = c_uchar;
2828
#[cfg(any(
2929
target_arch = "loongarch64",
30+
target_arch = "m68k",
3031
target_arch = "mips",
3132
target_arch = "mips64",
3233
target_arch = "mips32r6",

0 commit comments

Comments
 (0)