HUSTOJ 是一款流行的OJ系统,跨平台、易安装、有题库、二次开发门槛低。具有多个分支,我参与移植的是 zhblue/hustoj 张老师维护的分支。

大概记录一下移植的过程。目前该 PR 已经合并到了 master 上,当前实测是支持 C/C++ 判题,后续根据上游支持情况继续适配其他语言。

参考了 [原]给HUSTOJ用户提供的源码阅读与修改建议 中关于 judge_client 的代码解读,大概把握了判题机的处理思路。

1、关于 LoongArch64 的系统调用寄存器的位置信息。参考了nolibc/arch-loongarch.h

1
2
3
4
5
6
7
8
9
10
11
// https://github.com/torvalds/linux/blob/master/tools/include/nolibc/arch-loongarch.h
/* Syscalls for LoongArch :
* - stack is 16-byte aligned
* - syscall number is passed in a7
* - arguments are in a0, a1, a2, a3, a4, a5
* - the system call is performed by calling "syscall 0"
* - syscall return comes in a0
* - the arguments are cast to long and assigned into the target
* registers which are then simply passed as registers to the asm code,
* so that we don't have to experience issues with register constraints.
*/

这段注释很明确的描述了 LoongArch64 的系统调用寄存器的位置信息。

2、关于 LoongArch64 系统调用号的描述。参考了 hrw/syscalls-table 这个项目,这个项目描述了各个平台的系统调用号信息,并将其组织成了表格。

Link:https://gpages.juszkiewicz.com.pl/syscalls-table/syscalls.html

3、判题测试(3C6000/S + 128G 内存):

20250303224203

提交 2280,AWT 106.38s

20250303224029

国产加油!信创加油~