2N/A/*
2N/A * GRUB -- GRand Unified Bootloader
2N/A * Copyright (C) 2010 Free Software Foundation, Inc.
2N/A *
2N/A * GRUB is free software: you can redistribute it and/or modify
2N/A * it under the terms of the GNU General Public License as published by
2N/A * the Free Software Foundation, either version 3 of the License, or
2N/A * (at your option) any later version.
2N/A *
2N/A * GRUB is distributed in the hope that it will be useful,
2N/A * but WITHOUT ANY WARRANTY; without even the implied warranty of
2N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2N/A * GNU General Public License for more details.
2N/A *
2N/A * You should have received a copy of the GNU General Public License
2N/A * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
2N/A */
2N/A
2N/A#define SYSCALL_WRITE 1
2N/A#define SYSCALL_RESET 169
2N/A#define SYSCALL_IOPL 172
2N/A#define SYSCALL_EXIT 60
2N/A
2N/A#define STDOUT 1
2N/A#define SHUTDOWN_MAGIC1 0xfee1dead
2N/A#define SHUTDOWN_MAGIC2 0x28121969
2N/A#define SHUTDOWN_MAGIC3 0x4321fedc
2N/A
2N/A#define SHUTDOWN_PORT 0x8900
2N/A
2N/A .text
2N/A .global start, _start
2N/A_start:
2N/Astart:
2N/A /* write. */
2N/A movq $SYSCALL_WRITE, %rax
2N/A movq $STDOUT, %rdi
2N/A leaq message, %rsi
2N/A movq $(messageend-message), %rdx
2N/A syscall
2N/A
2N/A movq $SYSCALL_IOPL, %rax
2N/A movq $3, %rdi
2N/A syscall
2N/A
2N/A movw $SHUTDOWN_PORT, %dx
2N/A movb $'S', %al
2N/A outb %al, %dx
2N/A movb $'h', %al
2N/A outb %al, %dx
2N/A movb $'u', %al
2N/A outb %al, %dx
2N/A movb $'t', %al
2N/A outb %al, %dx
2N/A movb $'d', %al
2N/A outb %al, %dx
2N/A movb $'o', %al
2N/A outb %al, %dx
2N/A movb $'w', %al
2N/A outb %al, %dx
2N/A movb $'n', %al
2N/A outb %al, %dx
2N/A
2N/A /* shutdown. */
2N/A movq $SYSCALL_RESET, %rax
2N/A movq $SHUTDOWN_MAGIC1, %rdi
2N/A movq $SHUTDOWN_MAGIC2, %rsi
2N/A movq $SHUTDOWN_MAGIC3, %rdx
2N/A syscall
2N/A
2N/A /* exit(1). Shouldn't be reached. */
2N/A movq $SYSCALL_EXIT, %rax
2N/A movq $1, %rdi
2N/A syscall
2N/A .data
2N/Amessage:
2N/A .ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
2N/Amessageend: