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> 2013-04-11 Andrey Borzenkov <arvidjaar@gmail.com>
* util/grub.d/30_os-prober.in: Add onstr to entries for visual * 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_HALT 0x8
#define RESET_POWEROFF 0x800 #define RESET_POWEROFF 0x800
#define SHUTDOWN_PORT 0x8900
.section ".init", "ax" .section ".init", "ax"
.global start,_start .global start,_start
start: start:
@ -72,23 +70,7 @@ _start:
int $SYSCALL_INT int $SYSCALL_INT
addl $12, %esp addl $12, %esp
movw $SHUTDOWN_PORT, %dx #include "qemu-shutdown-x86.S"
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. */ /* shutdown. */
movl $SYSCALL_RESET, %eax movl $SYSCALL_RESET, %eax

View File

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

View File

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

View File

@ -5,8 +5,6 @@
#include <multiboot.h> #include <multiboot.h>
#endif #endif
#define SHUTDOWN_PORT 0x8900
.text .text
/* Align 32 bits boundary. */ /* Align 32 bits boundary. */
.align 8 .align 8
@ -38,17 +36,6 @@ multiboot_header:
#endif #endif
.global start .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: serialmsg:
1: 1:
@ -73,17 +60,13 @@ serialmsg:
_start: _start:
lea message, %esi lea message, %esi
call serialmsg call serialmsg
lea shutdown, %esi
movw $SHUTDOWN_PORT, %dx #include "qemu-shutdown-x86.S"
call portmsg
1: 1:
hlt hlt
jmp 1b jmp 1b
shutdown:
.ascii "Shutdown"
.byte 0
message: message:
.ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n" .ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
.byte 0 .byte 0

View File

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

View File

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

View File

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

View File

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