Skip to content

Commit

Permalink
Add LoongArch64 support
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaixiaojuan committed Jan 18, 2023
1 parent 3092b39 commit 5cf9f8e
Show file tree
Hide file tree
Showing 11 changed files with 11,123 additions and 5 deletions.
4 changes: 3 additions & 1 deletion gen/ioctl/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ i686-linux-gnu-gcc main.c list.o -o main.exe $cflags
x86_64-linux-gnu-gcc -Iinclude -c list.c $cflags
x86_64-linux-gnu-gcc main.c list.o -o main.exe $cflags
./main.exe >> "$out"
loongarch64-unknown-linux-gnu-gcc -Iinclude -c list.c $cflags
loongarch64-unknown-linux-gnu-gcc main.c list.o -o main.exe $cflags
./main.exe >> "$out"
aarch64-linux-gnu-gcc -Iinclude -c list.c $cflags
aarch64-linux-gnu-gcc main.c list.o -o main.exe $cflags
qemu-aarch64 -L /usr/aarch64-linux-gnu ./main.exe >> "$out"
Expand All @@ -41,5 +44,4 @@ qemu-mipsel -L /usr/mipsel-linux-gnu ./main.exe >> "$out"
riscv64-linux-gnu-gcc -Iinclude -c list.c $cflags
riscv64-linux-gnu-gcc main.c list.o -o main.exe $cflags
qemu-riscv64 -L /usr/riscv64-linux-gnu ./main.exe >> "$out"

rm list.o main.exe
2 changes: 1 addition & 1 deletion gen/ioctl/generated.txt
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,6 @@ UDF_GETEASIZE
NVME_IOCTL_ADMIN64_CMD
VHOST_SET_OWNER
RIO_ALLOC_DMA
F2FS_IOC_ABORT_VOLATILE_WRITE
RIO_CM_CHAN_ACCEPT
I2OHRTGET
ATM_SETCIRANGE
Expand Down Expand Up @@ -1426,6 +1425,7 @@ HIDIOCGREPORTINFO
WDIOC_GETBOOTSTATUS
VDUSE_VQ_GET_INFO
ACRN_IOCTL_ASSIGN_PCIDEV
BLKGETDISKSEQ
ACRN_IOCTL_PM_GET_CPU_STATE
ACRN_IOCTL_DESTROY_VM
ACRN_IOCTL_SET_PTDEV_INTR
Expand Down
6 changes: 4 additions & 2 deletions gen/ioctl/list.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,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(__loongarch64) && !defined(__powerpc64__) && !defined(__riscv) // various errors
#include <linux/kvm.h>
#endif
#include <linux/lirc.h>
Expand Down Expand Up @@ -493,7 +493,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(__loongarch64) && !defined(__powerpc64__) && !defined(__riscv)
#if 0 // needs `struct kvm_cpuid2`
IOCTL_REQUEST(KVM_GET_SUPPORTED_CPUID);
#endif
Expand Down Expand Up @@ -1037,7 +1037,9 @@ void list(void) {
IOCTL_REQUEST(NVME_IOCTL_ADMIN64_CMD);
IOCTL_REQUEST(VHOST_SET_OWNER);
IOCTL_REQUEST(RIO_ALLOC_DMA);
#if !defined(__loongarch64)
IOCTL_REQUEST(F2FS_IOC_ABORT_VOLATILE_WRITE);
#endif
IOCTL_REQUEST(RIO_CM_CHAN_ACCEPT);
IOCTL_REQUEST(I2OHRTGET);
IOCTL_REQUEST(ATM_SETCIRANGE);
Expand Down
2 changes: 2 additions & 0 deletions gen/ioctl/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ int main(void) {
printf("#if __mips == 64\n");
#elif defined(__riscv) && __riscv_xlen == 64
printf("#if defined(__riscv) && __riscv_xlen == 64\n");
#elif defined(__loongarch64)
printf("#ifdef __loongarch64\n");
#else
#error "unimplemented architecture"
#endif
Expand Down
Loading

0 comments on commit 5cf9f8e

Please sign in to comment.