switch off manually on linux x86_64
This commit is contained in:
parent
3bd6968e56
commit
6406a79dff
1 changed files with 25 additions and 0 deletions
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
#define SYSCALL_WRITE 1
|
#define SYSCALL_WRITE 1
|
||||||
#define SYSCALL_RESET 169
|
#define SYSCALL_RESET 169
|
||||||
|
#define SYSCALL_IOPL 172
|
||||||
#define SYSCALL_EXIT 60
|
#define SYSCALL_EXIT 60
|
||||||
|
|
||||||
#define STDOUT 1
|
#define STDOUT 1
|
||||||
|
@ -25,6 +26,8 @@
|
||||||
#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:
|
||||||
|
@ -36,6 +39,28 @@ start:
|
||||||
movq $(messageend-message), %rdx
|
movq $(messageend-message), %rdx
|
||||||
syscall
|
syscall
|
||||||
|
|
||||||
|
movq $SYSCALL_IOPL, %rax
|
||||||
|
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
|
||||||
|
|
||||||
/* shutdown. */
|
/* shutdown. */
|
||||||
movq $SYSCALL_RESET, %rax
|
movq $SYSCALL_RESET, %rax
|
||||||
movq $SHUTDOWN_MAGIC1, %rdi
|
movq $SHUTDOWN_MAGIC1, %rdi
|
||||||
|
|
Loading…
Add table
Reference in a new issue