github.com/jspc/eggos@v0.5.1-0.20221028160421-556c75c878a5/kernel/sys/sys_amd64.s (about)

     1  #include "textflag.h"
     2  
     3  // Outb(port uint16, data byte)
     4  TEXT ·Outb(SB), NOSPLIT, $0-3
     5  	MOVW port+0(FP), DX
     6  	MOVB data+2(FP), AX
     7  	OUTB
     8  	RET
     9  
    10  // byte Inb(port uint16)
    11  TEXT ·Inb(SB), NOSPLIT, $0-9
    12  	MOVW port+0(FP), DX
    13  	XORW AX, AX
    14  	INB
    15  	MOVB AX, ret+8(FP)
    16  	RET
    17  
    18  // Outl(port uint16, data uint32)
    19  TEXT ·Outl(SB), NOSPLIT, $0-8
    20  	MOVW port+0(FP), DX
    21  	MOVL data+4(FP), AX
    22  	OUTL
    23  	RET
    24  
    25  // uint32 Inl(port uint16)
    26  TEXT ·Inl(SB), NOSPLIT, $0-12
    27  	MOVW port+0(FP), DX
    28  	INL
    29  	MOVL AX, ret+8(FP)
    30  	RET
    31  
    32  // SetAX(val uint64)
    33  TEXT ·SetAX(SB), NOSPLIT, $0-8
    34  	MOVQ val+0(FP), AX
    35  	RET
    36  
    37  // uint64 Flags()
    38  TEXT ·Flags(SB), NOSPLIT, $0-8
    39  	PUSHFQ
    40  	POPQ AX
    41  	MOVQ AX, ret+0(FP)
    42  	RET
    43  
    44  // uint64 Cr2()
    45  TEXT ·Cr2(SB), NOSPLIT, $0-8
    46  	MOVQ CR2, AX
    47  	MOVQ AX, ret+0(FP)
    48  	RET
    49  
    50  // uint64 CS()
    51  TEXT ·CS(SB), NOSPLIT, $0-8
    52  	XORQ AX, AX
    53  	MOVW CS, AX
    54  	MOVQ AX, ret+0(FP)
    55  	RET
    56  
    57  // Fxsave(addr uint64)
    58  TEXT ·Fxsave(SB), NOSPLIT, $0-8
    59  	MOVQ   addr+0(FP), AX
    60  	FXSAVE (AX)
    61  	RET