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 4
2N/A#define SYSCALL_RESET 88
2N/A#define SYSCALL_IOPL 110
2N/A#define SYSCALL_EXIT 1
2N/A#define SYSCALL_INT 0x80
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 movl $SYSCALL_WRITE, %eax
2N/A movl $STDOUT, %ebx
2N/A leal message, %ecx
2N/A movl $(messageend-message), %edx
2N/A int $SYSCALL_INT
2N/A
2N/A movl $SYSCALL_IOPL, %eax
2N/A movl $3, %ebx
2N/A int $SYSCALL_INT
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 movl $SYSCALL_RESET, %eax
2N/A movl $SHUTDOWN_MAGIC1, %ebx
2N/A movl $SHUTDOWN_MAGIC2, %ecx
2N/A movl $SHUTDOWN_MAGIC3, %edx
2N/A int $SYSCALL_INT
2N/A
2N/A /* exit (1). Shouldn't be reached. */
2N/A movl $SYSCALL_EXIT, %eax
2N/A movl $1, %ebx
2N/A int $SYSCALL_INT
2N/A .data
2N/Amessage:
2N/A .ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
2N/Amessageend: