1/*
2 * Copyright (c) 2009 Corey Tabaka
3 *
4 * Use of this source code is governed by a MIT-style
5 * license that can be found in the LICENSE file or at
6 * https://opensource.org/licenses/MIT
7 */
8#include <lk/asm.h>
9
10.text
11
12/* This follows the x86-64 ABI, the parameters are stored in registers in the following order*/
13/*
14%rdi used to pass 1st argument
15%rsi used to pass 2nd argument
16%rdx used to pass 3rd argument and 2nd return register
17%rcx used to pass 4th argument
18%r8 used to pass 5th argument
19%r9 used to pass 6th argument
20%rax 1st return register
21*/
22
23/* void arch_idle(); */
24FUNCTION(arch_idle)
25    pushf
26    popq %rax
27    andq $0x200, %rax
28    test %rax, %rax
29    je 1f                   /* don't halt if local interrupts are disabled */
30    hlt
311:
32    ret
33
34