“out”的操作数类型不匹配,'in'

operand type mismatch for `out', 'in'

我有这个功能:

uint8_t getcmosflpd(void)
{
    uint8_t c;
    outb(0x70, 0x10);
    c = inb(0x70);
    return c;
}

当我编译它时,我得到这个错误:

/tmp/ccMmuD7U.s:28: Error: operand type mismatch for `out'
/tmp/ccMmuD7U.s:39: Error: operand type mismatch for `in'

这是我的 outb 和 inb 函数:

static inline void outb(uint16_t port, uint8_t val)
{
    asm volatile ("outb %0, %1" : : "a"(val), "Nd"(port));
}

static inline uint8_t inb(uint16_t port)
{
    uint8_t ret;
    asm volatile ("inb %1, %0"
                   : "=a"(ret)
                   : "Nd"(port));
    return ret;
}

怎么了?

我正在使用 -masm=intel 进行编译。始终检查您的编译器标志!