[PATCH 1/2] Documentation: LoongArch: Document the syscall ABI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: WANG Xuerui <git@xxxxxxxxxx>

Signed-off-by: WANG Xuerui <git@xxxxxxxxxx>
Cc: Huacai Chen <chenhuacai@xxxxxxxxxx>
Cc: Alex Shi <alexs@xxxxxxxxxx>
Cc: Yanteng Si <siyanteng@xxxxxxxxxxx>
Cc: Jonathan Corbet <corbet@xxxxxxx>
Cc: loongarch@xxxxxxxxxxxxxxx
---
 Documentation/loongarch/index.rst       |  1 +
 Documentation/loongarch/syscall-abi.rst | 36 +++++++++++++++++++++++++
 2 files changed, 37 insertions(+)
 create mode 100644 Documentation/loongarch/syscall-abi.rst

diff --git a/Documentation/loongarch/index.rst b/Documentation/loongarch/index.rst
index aaba648db907..5dacd7143d2f 100644
--- a/Documentation/loongarch/index.rst
+++ b/Documentation/loongarch/index.rst
@@ -10,6 +10,7 @@ LoongArch Architecture
 
    introduction
    irq-chip-model
+   syscall-abi
 
    features
 
diff --git a/Documentation/loongarch/syscall-abi.rst b/Documentation/loongarch/syscall-abi.rst
new file mode 100644
index 000000000000..6f63aa3cfc64
--- /dev/null
+++ b/Documentation/loongarch/syscall-abi.rst
@@ -0,0 +1,36 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+===============================
+Linux/LoongArch system call ABI
+===============================
+
+This document describes the system call ABI of Linux/LoongArch.
+As the kernel is 64-bit only for now, the description below assumes an LP64\*
+calling convention.
+
+Syscall numbers and parameters
+==============================
+
+Like with other recent architecture ports, for the most part Linux/LoongArch
+reuses the asm-generic syscall numbers and parameters.
+There are a few points worth mentioning though.
+
+* There is no ``renameat``. Use ``renameat2`` instead.
+* There is no ``getrlimit`` or ``setrlimit``. Use ``prlimit64`` instead.
+* There is no ``fstat`` or ``newfstatat``. Only ``statx`` is provided, and
+  low-level components making their own syscalls are expected to be aware of
+  this (and provide their own shims if necessary).
+
+Invocation
+==========
+
+System calls are currently made with the ``syscall 0`` instruction.
+Although the immediate field in the instruction is not checked at present,
+it is strongly advised to keep it zeroed in case it is to be made meaningful
+in the future.
+
+The system call number is placed in the register ``a7``.
+Parameters, if present, are placed from ``a0`` through ``a6`` as needed,
+as if calling a function with the respective arguments.
+Upon return, ``a0`` contains the return value, and ``t0-t8`` should be
+considered clobbered; all other registers are preserved.
-- 
2.38.0




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux