.include "../include/machine10-run.inc" .section .text .code64 .global _start _start: cld movabsq $M10_ABI_MAGIC, %rax movq %rax, M10_ABI_MAGIC_OFFSET(%r8) movl $M10_ABI_VERSION, M10_ABI_VERSION_OFFSET(%r8) movq %rdx, M10_ABI_RESPONSE_ADDRESS(%r8) movq %rcx, M10_ABI_RESPONSE_CAPACITY(%r8) movq $0, M10_ABI_COMPLETION_SEQUENCE(%r8) movl $M10_METHOD_POST, M10_ABI_METHOD_OFFSET(%r8) movq $1, M10_ABI_REQUEST_ID_OFFSET(%r8) leaq append_target(%rip), %rax movq %rax, M10_ABI_TARGET_ADDRESS(%r8) movq $(append_target_end-append_target), M10_ABI_TARGET_LENGTH(%r8) movq %rdi, M10_ABI_BODY_ADDRESS(%r8) movq %rsi, M10_ABI_BODY_LENGTH(%r8) call issue cmpl $201, M10_ABI_HTTP_STATUS(%r8) jne failed movl $M10_METHOD_GET, M10_ABI_METHOD_OFFSET(%r8) movq $2, M10_ABI_REQUEST_ID_OFFSET(%r8) leaq read_target(%rip), %rax movq %rax, M10_ABI_TARGET_ADDRESS(%r8) movq $(read_target_end-read_target), M10_ABI_TARGET_LENGTH(%r8) movq $0, M10_ABI_BODY_ADDRESS(%r8) movq $0, M10_ABI_BODY_LENGTH(%r8) call issue cmpl $200, M10_ABI_HTTP_STATUS(%r8) jne failed movw $M10_DOORBELL_PORT, %dx movl $M10_OP_RESPOND, %eax outl %eax, %dx cli hlt issue: movq $0, M10_ABI_RESPONSE_LENGTH(%r8) movl $0, M10_ABI_HTTP_STATUS(%r8) movl $0, M10_ABI_ERROR(%r8) movw $M10_DOORBELL_PORT, %dx movl $M10_OP_HTTP_CALL, %eax outl %eax, %dx cmpl $M10_ERROR_NONE, M10_ABI_ERROR(%r8) jne failed ret failed: movw $M10_DOORBELL_PORT, %dx movl $M10_OP_EXIT, %eax outl %eax, %dx cli hlt .section .rodata append_target: .ascii "/api/q10/n/machine-run-now" append_target_end: read_target: .ascii "/api/q10/n/machine-run-now?since=0&limit=10" read_target_end: