+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
#define RESET_HALT 0x8
#define RESET_POWEROFF 0x800
-#define SHUTDOWN_PORT 0x8900
-
.section ".init", "ax"
.global start,_start
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
#define RESET_NOSYNC 0x4
#define RESET_HALT 0x8
#define RESET_POWEROFF 0x800
-#define SHUTDOWN_PORT 0x8900
.section ".init", "ax"
.global start,_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
-#define SHUTDOWN_PORT 0x8900
-
.text
.globl _start
_start:
.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
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
#include <multiboot.h>
#endif
-#define SHUTDOWN_PORT 0x8900
-
.text
/* Align 32 bits boundary. */
.align 8
#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:
_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
#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
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
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
#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
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
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
#define SHUTDOWN_MAGIC2 0x28121969
#define SHUTDOWN_MAGIC3 0x4321fedc
-#define SHUTDOWN_PORT 0x8900
-
.text
.global start, _start
_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
#define SHUTDOWN_MAGIC2 0x28121969
#define SHUTDOWN_MAGIC3 0x4321fedc
-#define SHUTDOWN_PORT 0x8900
-
.text
.global start, _start
_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
--- /dev/null
+ 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