kOpenBSD bootcheck

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-08-28 14:51:54 +02:00
parent dcc953eecb
commit 0f6a963e9b
4 changed files with 59 additions and 6 deletions

View file

@ -16,18 +16,29 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef TARGET_NETBSD
#define SYSCALL_RESET 208
#elif defined (TARGET_OPENBSD)
#define SYSCALL_RESET 55
#else
#error unknown target
#endif
#define MODE_RDRW 2
#define FLAGS_NONE 0
#define SYSCALL_OPEN 5
#define SYSCALL_WRITE 4
#define SYSCALL_RESET 208
#define SYSCALL_EXIT 1
#define SYSCALL_ARCH 165
#define SYSCALL_INT 0x80
#define SYSCALL_ARCH_IOPL 2
#define RESET_NOSYNC 0x4
#define RESET_HALT 0x8
#define RESET_POWEROFF 0x800
#define SHUTDOWN_PORT 0x8900
.section ".init", "ax"
.global start,_start
start:
@ -53,6 +64,32 @@ _start:
int $SYSCALL_INT
addl $16, %esp
/* IOPL. */
movl $SYSCALL_ARCH, %eax
pushl $iopl_arg
pushl $SYSCALL_ARCH_IOPL
pushl $0
int $SYSCALL_INT
addl $12, %esp
movw $SHUTDOWN_PORT, %dx
movb $'S', %al
outb %al, %dx
movb $'h', %al
outb %al, %dx
movb $'u', %al
outb %al, %dx
movb $'t', %al
outb %al, %dx
movb $'d', %al
outb %al, %dx
movb $'o', %al
outb %al, %dx
movb $'w', %al
outb %al, %dx
movb $'n', %al
outb %al, %dx
/* shutdown. */
movl $SYSCALL_RESET, %eax
pushl $0
@ -84,3 +121,5 @@ device:
message:
.ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
messageend:
iopl_arg:
.long 3

View file

@ -0,0 +1,5 @@
kopenbsd /kopenbsd -h
kopenbsd_ramdisk /ramdisk
boot
# Shouln't happen
halt

View file

@ -0,0 +1,3 @@
# size offset fstype [fsize bsize bps/cpg]
a: 256 0 4.2BSD 0 0 1
c: 256 0 unused 0 0 # "raw" part, don't edit