github.com/jspc/eggos@v0.5.1-0.20221028160421-556c75c878a5/kernel/sys/sys_386.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-5
    12  	MOVW port+0(FP), DX
    13  	XORW AX, AX
    14  	INB
    15  	MOVB AX, ret+4(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-8
    27  	MOVW port+0(FP), DX
    28  	INL
    29  	MOVL AX, ret+4(FP)
    30  	RET
    31  
    32  // SetAX(val uint32)
    33  TEXT ·SetAX(SB), NOSPLIT, $0-4
    34  	MOVL val+0(FP), AX
    35  	RET
    36  
    37  // uint32 Flags()
    38  TEXT ·Flags(SB), NOSPLIT, $0-4
    39  	PUSHFL
    40  	POPL AX
    41  	MOVL AX, ret+0(FP)
    42  	RET
    43  
    44  // uint32 Cr2()
    45  TEXT ·Cr2(SB), NOSPLIT, $0-4
    46  	MOVL CR2, AX
    47  	MOVL AX, ret+0(FP)
    48  	RET
    49  
    50  // Fxsave(addr uint32)
    51  TEXT ·Fxsave(SB), NOSPLIT, $0-4
    52  	MOVL   addr+0(FP), AX
    53  	FXSAVE (AX)
    54  	RET