2
* GRUB -- GRand Unified Bootloader
3
* Copyright (C) 2010 Free Software Foundation, Inc.
5
* GRUB is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* (at your option) any later version.
10
* GRUB is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
21
#define SYSCALL_OPEN 5
22
#define SYSCALL_WRITE 4
24
#define SYSCALL_RESET 208
25
#elif defined (TARGET_OPENBSD)
26
#define SYSCALL_RESET 55
30
#define SYSCALL_EXIT 1
31
#define SYSCALL_ARCH 165
32
#define SYSCALL_INT 0x80
33
#define SYSCALL_ARCH_IOPL 2
35
#define RESET_NOSYNC 0x4
36
#define RESET_HALT 0x8
37
#define RESET_POWEROFF 0x800
38
#define SHUTDOWN_PORT 0x8900
40
.section ".init", "ax"
45
movq $SYSCALL_OPEN, %rax
48
movq $FLAGS_NONE, %rdx
53
movq $SYSCALL_WRITE, %rax
54
movq $(messageend-message), %rdx
59
movq $SYSCALL_ARCH, %rax
60
movq $SYSCALL_ARCH_IOPL, %rdi
64
movw $SHUTDOWN_PORT, %dx
83
movq $SYSCALL_RESET, %rax
84
movq $(RESET_POWEROFF|RESET_HALT|RESET_NOSYNC), %rdi
88
/* exit (1). Shouldn't be reached. */
89
movq $SYSCALL_EXIT, %rax
92
.section ".fini", "ax"
94
.section ".text", "ax"
96
/* This section is needed for NetBSD to identify the binary. */
97
.section ".note.netbsd.ident", "a"
105
.ascii "/dev/console"
108
.ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"