Skip to content

Commit

Permalink
Add LoongArch64 support
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaixiaojuan committed Mar 31, 2023
1 parent bb8ed3c commit 67a4e6e
Show file tree
Hide file tree
Showing 10 changed files with 11,129 additions and 3 deletions.
3 changes: 3 additions & 0 deletions gen/ioctl/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,8 @@ qemu-riscv64 -L /usr/riscv64-linux-gnu ./main.exe >> "$out"
s390x-linux-gnu-gcc -Iinclude -c list.c $cflags
s390x-linux-gnu-gcc main.c list.o -o main.exe $cflags
qemu-s390x -L /usr/s390x-linux-gnu ./main.exe >> "$out"
loongarch64-linux-gnu-gcc -Iinclude -c list.c $cflags
loongarch64-linux-gnu-gcc main.c list.o -o main.exe $cflags
./main.exe >> "$out"

rm list.o main.exe
4 changes: 2 additions & 2 deletions gen/ioctl/list.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ struct sockaddr {
#include <linux/joystick.h>
#include <linux/kd.h>
#include <linux/kcov.h>
#if !defined(__arm__) && !defined(__powerpc64__) && !defined(__riscv) // various errors
#if !defined(__arm__) && !defined(__loongarch__) && !defined(__powerpc64__) && !defined(__riscv) // various errors
#include <linux/kvm.h>
#endif
#include <linux/lirc.h>
Expand Down Expand Up @@ -509,7 +509,7 @@ void list(void) {
IOCTL_REQUEST(ENI_SETMULT);
IOCTL_REQUEST(RIO_GET_EVENT_MASK);
IOCTL_REQUEST(LIRC_GET_MAX_TIMEOUT);
#if !defined(__arm__) && !defined(__powerpc64__) && !defined(__riscv)
#if !defined(__arm__) && !defined(__loongarch__) && !defined(__powerpc64__) && !defined(__riscv)
#if 0 // needs `struct kvm_cpuid2`
IOCTL_REQUEST(KVM_GET_SUPPORTED_CPUID);
#endif
Expand Down
2 changes: 2 additions & 0 deletions gen/ioctl/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ int main(void) {
printf("#if defined(__riscv) && __riscv_xlen == 64\n");
#elif defined(__s390x__)
printf("#if defined(__s390x__)\n");
#elif defined(__loongarch__)
printf("#ifdef __loongarch__\n");
#else
#error "unimplemented architecture"
#endif
Expand Down
Loading

0 comments on commit 67a4e6e

Please sign in to comment.