@@ -1,3 +1,11 @@
+/*
+ * #!/bin/sh
+ * mount -t 9p -o trans=virtio,version=9p2000.L hostfs /host
+ * /virt/init $*
+ */
+
+#include <asm/unistd.h>
+
.data
.m_dev:
@@ -16,7 +24,7 @@
.globl _start
_start:
- mov $165, %rax # __NR_mount
+ mov $__NR_mount, %rax
mov $.m_dev, %rdi
mov $.m_dir, %rsi
mov $.m_typ, %rdx
@@ -24,7 +32,7 @@ _start:
mov $.m_opt, %r8
syscall
- mov $59, %rax # __NR_execve
+ mov $__NR_execve, %rax
mov $.e_nam, %rdi
lea 8(%rsp), %rsi # argv[]
mov %rdi, (%rsi) # change argv[0]
@@ -33,6 +41,6 @@ _start:
lea (%rsi,%rcx,8), %rdx # envp[]
syscall
- mov $60, %rax # __NR_exit
+ mov $__NR_exit, %rax
mov $1, %rdi
syscall # panic
Instead of hardcoding the syscall numbers and providing the symbol in the comments, just include <asm/unistd.h> and use the symbol directly. Signed-off-by: Andre Przywara <andre.przywara@arm.com> --- x86/init64.S | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)