Use ACPI shutdown intests as traditional port was removed.

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2013-04-11 21:09:43 +02:00
parent f4b1fa4f3c
commit 93cd84df63
10 changed files with 56 additions and 163 deletions

View file

@ -1,3 +1,7 @@
2013-04-11 Vladimir Serbinenko <phcoder@gmail.com>
Use ACPI shutdown intests as traditional port was removed.
2013-04-11 Andrey Borzenkov <arvidjaar@gmail.com>
* util/grub.d/30_os-prober.in: Add onstr to entries for visual

View file

@ -37,8 +37,6 @@
#define RESET_HALT 0x8
#define RESET_POWEROFF 0x800
#define SHUTDOWN_PORT 0x8900
.section ".init", "ax"
.global start,_start
start:
@ -72,23 +70,7 @@ _start:
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
#include "qemu-shutdown-x86.S"
/* shutdown. */
movl $SYSCALL_RESET, %eax

View file

@ -35,7 +35,6 @@
#define RESET_NOSYNC 0x4
#define RESET_HALT 0x8
#define RESET_POWEROFF 0x800
#define SHUTDOWN_PORT 0x8900
.section ".init", "ax"
.global start,_start
@ -61,23 +60,7 @@ _start:
leaq iopl_arg, %rsi
syscall
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
#include "qemu-shutdown-x86.S"
/* shutdown. */
movq $SYSCALL_RESET, %rax

View file

@ -1,6 +1,4 @@
#define SHUTDOWN_PORT 0x8900
.text
.globl _start
_start:
@ -8,18 +6,6 @@ base:
.code16
jmp cont
portmsg:
xorw %ax, %ax
1:
movb 0(%si), %al
test %ax, %ax
jz 1f
outb %al, %dx
incw %si
jmp 1b
1:
ret
serialmsg:
1:
movb 0(%si), %bl
@ -50,17 +36,12 @@ cont:
movw %ax, %ds
lea message, %si
call serialmsg
lea shutdown, %si
movw $SHUTDOWN_PORT, %dx
call portmsg
#include "qemu-shutdown-x86.S"
1:
hlt
jmp 1b
shutdown:
.ascii "Shutdown"
.byte 0
message:
.ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
.byte 0

View file

@ -5,8 +5,6 @@
#include <multiboot.h>
#endif
#define SHUTDOWN_PORT 0x8900
.text
/* Align 32 bits boundary. */
.align 8
@ -38,17 +36,6 @@ multiboot_header:
#endif
.global start
portmsg:
xorl %eax, %eax
1:
movb 0(%esi), %al
test %eax, %eax
jz 1f
outb %al, %dx
incl %esi
jmp 1b
1:
ret
serialmsg:
1:
@ -73,17 +60,13 @@ serialmsg:
_start:
lea message, %esi
call serialmsg
lea shutdown, %esi
movw $SHUTDOWN_PORT, %dx
call portmsg
#include "qemu-shutdown-x86.S"
1:
hlt
jmp 1b
shutdown:
.ascii "Shutdown"
.byte 0
message:
.ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
.byte 0

View file

@ -24,13 +24,12 @@
#define SYSCALL_FSYNC 95
#define SYSCALL_ARCH 165
#define SYSCALL_EXIT 1
#define SYSCALL_ARCH_IOPL 4
#define SYSCALL_ARCH_IOPERM 4
#define SYSCALL_INT 0x80
#define RESET_NOSYNC 0x4
#define RESET_HALT 0x8
#define RESET_POWEROFF 0x4000
#define SHUTDOWN_PORT 0x8900
.section ".init", "ax"
.global start,_start
@ -64,31 +63,23 @@ _start:
int $SYSCALL_INT
addl $8, %esp
/* IOPL. */
/* IOPERM. */
movl $SYSCALL_ARCH, %eax
pushl $iopl_arg
pushl $SYSCALL_ARCH_IOPL
pushl $iopl_arg1
pushl $SYSCALL_ARCH_IOPERM
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
/* IOPERM. */
movl $SYSCALL_ARCH, %eax
pushl $iopl_arg2
pushl $SYSCALL_ARCH_IOPERM
pushl $0
int $SYSCALL_INT
addl $12, %esp
#include "qemu-shutdown-x86.S"
/* shutdown. */
movl $SYSCALL_RESET, %eax
@ -108,7 +99,11 @@ device:
message:
.ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
messageend:
iopl_arg:
.long SHUTDOWN_PORT
ioperm_arg1:
.long 0xcf8
.long 8
.long 1
ioperm_arg2:
.long 0x1000
.long 8
.long 1

View file

@ -23,13 +23,12 @@
#define SYSCALL_WRITE 4
#define SYSCALL_RESET 55
#define SYSCALL_EXIT 1
#define SYSCALL_ARCH_IOPL 4
#define SYSCALL_ARCH_IOPERM 4
#define SYSCALL_FSYNC 95
#define RESET_NOSYNC 0x4
#define RESET_HALT 0x8
#define RESET_POWEROFF 0x4000
#define SHUTDOWN_PORT 0x8900
.section ".init", "ax"
.global start,_start
@ -53,29 +52,18 @@ _start:
movq $SYSCALL_FSYNC, %rax
syscall
/* IOPL. */
/* IOPERM. */
movq $SYSCALL_ARCH, %rax
movq $SYSCALL_ARCH_IOPL, %rdi
leaq iopl_arg, %rsi
movq $SYSCALL_ARCH_IOPERM, %rdi
leaq ioperm_arg1, %rsi
syscall
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
movq $SYSCALL_ARCH, %rax
movq $SYSCALL_ARCH_IOPERM, %rdi
leaq ioperm_arg2, %rsi
syscall
#include "qemu-shutdown-x86.S"
/* shutdown. */
movq $SYSCALL_RESET, %rax
@ -92,7 +80,11 @@ device:
message:
.ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
messageend:
iopl_arg:
.long SHUTDOWN_PORT
ioperm_arg1:
.long 0xcf8
.long 8
.long 1
ioperm_arg2:
.long 0x1000
.long 8
.long 1

View file

@ -27,8 +27,6 @@
#define SHUTDOWN_MAGIC2 0x28121969
#define SHUTDOWN_MAGIC3 0x4321fedc
#define SHUTDOWN_PORT 0x8900
.text
.global start, _start
_start:
@ -44,23 +42,7 @@ start:
movl $3, %ebx
int $SYSCALL_INT
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
#include "qemu-shutdown-x86.S"
/* shutdown. */
movl $SYSCALL_RESET, %eax

View file

@ -26,8 +26,6 @@
#define SHUTDOWN_MAGIC2 0x28121969
#define SHUTDOWN_MAGIC3 0x4321fedc
#define SHUTDOWN_PORT 0x8900
.text
.global start, _start
_start:
@ -43,23 +41,7 @@ start:
movq $3, %rdi
syscall
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
#include "qemu-shutdown-x86.S"
/* shutdown. */
movq $SYSCALL_RESET, %rax

View file

@ -0,0 +1,9 @@
movl $0x80000b40, %eax
movw $0xcf8, %dx
outl %eax, %dx
movl $0x1001, %eax
movw $0xcfc, %dx
outl %eax, %dx
movw $0x2000, %ax
movw $0x1004, %dx
outw %ax, %dx