I/O mit gcc
-
Hallo,
ich würde gerne auf I/O Ports mit gcc zugreifen. Habe das ganze mit Assembler versucht:void test() { __asm__ ("movb 0xEE, %ah\n\t" "movb 0x64, %al\n\t" "out %ah, %al"); }
Ich bekomme aber die Fehlermeldung "suffix or operands invalid for 'out'".
Was ist an dem Code falsch? Gibt es noch andere Möglichkeiten auf I/O Ports zuzugreifen, außer mit Hilfe des Inline Assemblers?
Vielen Dank schonmal
-
Ich habe zwar keine Ahnung von Pentium Assembler, aber wenn ich den Instruction Set richtig interpretiere, ist "out %ah, %al" auch nicht möglich (Es wird ein 16-Bit Register benötigt), siehe:
Opcode Instruction Description E6 ib OUT imm8, AL Output byte in AL to I/O port address imm8 E7 ib OUT imm8, AX Output word in AX to I/O port address imm8 E7 ib OUT imm8, EAX Output doubleword in EAX to I/O port address imm8 EE OUT DX, AL Output byte in AL to I/O port address in DX EF OUT DX, AX Output word in AX to I/O port address in DX EF OUT DX, EAX Output doubleword in EAX to I/O port address in DX
-
inline void outw(uint8_t port, uint16_t word) { __asm__ __volatile__ ("outw %%ax, %%dx"::"d"(port),"a"(word)); }
entsprechend eben für outb und inw/inb.
Folgende Links dürften dich interessieren:
http://www-128.ibm.com/developerworks/library/l-ia.html
http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html
http://www.c-plusplus.net/forum/viewtopic-var-t-is-41479.htmlHTH