#define SYSCALL_OPEN 5
#define SYSCALL_WRITE 4
#define SYSCALL_RESET 55
+#define SYSCALL_FSYNC 95
+#define SYSCALL_ARCH 165
#define SYSCALL_EXIT 1
+#define SYSCALL_ARCH_IOPL 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
pushl $0
int $SYSCALL_INT
addl $16, %esp
+
+ /* fsync. */
+ movl $SYSCALL_FSYNC, %eax
+ pushl %ecx
+ pushl $0
+ int $SYSCALL_INT
+ addl $8, %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
message:
.ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
messageend:
-
\ No newline at end of file
+iopl_arg:
+ .long SHUTDOWN_PORT
+ .long 1
+ .long 1
#define MODE_RDRW 2
#define FLAGS_NONE 0
+#define SYSCALL_ARCH 165
#define SYSCALL_OPEN 5
#define SYSCALL_WRITE 4
#define SYSCALL_RESET 55
#define SYSCALL_EXIT 1
+#define SYSCALL_ARCH_IOPL 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 %rax, %rdi
/* write. */
- movq $SYSCALL_WRITE, %rax
leaq message, %rsi
- movq $(messageend-message), %rdx
+ movq $SYSCALL_WRITE, %rax
+ movq $(messageend - message), %rdx
+ syscall
+
+ /* fsync. */
+ movq $SYSCALL_FSYNC, %rax
syscall
+
+ /* IOPL. */
+ movq $SYSCALL_ARCH, %rax
+ movq $SYSCALL_ARCH_IOPL, %rdi
+ 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
/* shutdown. */
movq $SYSCALL_RESET, %rax
message:
.ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
messageend:
+iopl_arg:
+ .long SHUTDOWN_PORT
+ .long 1
+ .long 1
\ No newline at end of file
#define SYSCALL_RESET 208
#define SYSCALL_EXIT 1
#define SYSCALL_MKNOD 14
+#define SYSCALL_ARCH 165
#define SYSCALL_MOUNT 410
#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
leaq message, %rsi
syscall
+ /* IOPL. */
+ movq $SYSCALL_ARCH, %rax
+ movq $SYSCALL_ARCH_IOPL, %rdi
+ 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
+
/* shutdown. */
movq $SYSCALL_RESET, %rax
movq $(RESET_POWEROFF|RESET_HALT|RESET_NOSYNC), %rdi
.long 0777
/* Alignment long. */
.long 0
-tmpfs_args_end:
\ No newline at end of file
+tmpfs_args_end:
+iopl_arg:
+ .long 3
\ No newline at end of file
#define SYSCALL_WRITE 4
#define SYSCALL_RESET 88
+#define SYSCALL_IOPL 110
#define SYSCALL_EXIT 1
#define SYSCALL_INT 0x80
#define SHUTDOWN_MAGIC2 0x28121969
#define SHUTDOWN_MAGIC3 0x4321fedc
+#define SHUTDOWN_PORT 0x8900
+
.text
.global start, _start
_start:
movl $(messageend-message), %edx
int $SYSCALL_INT
+ movl $SYSCALL_IOPL, %eax
+ 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
+
/* shutdown. */
movl $SYSCALL_RESET, %eax
movl $SHUTDOWN_MAGIC1, %ebx