|
@@ -66,7 +66,7 @@ enum
|
|
|
|
|
|
typedef word_t port_t;
|
|
|
|
|
|
-#define IO_PORT_FUNCTIONS(type) \
|
|
|
+#define IO_PORT_FUNCTIONS(type, prefix) \
|
|
|
static inline type##_t cpu_read_port_##type(port_t port) \
|
|
|
{ \
|
|
|
type##_t value; \
|
|
@@ -82,7 +82,7 @@ typedef word_t port_t;
|
|
|
static inline void cpu_read_port_buffer_##type(port_t port, type##_t *buffer, size_t size) \
|
|
|
{ \
|
|
|
__asm__ volatile("cld\n" \
|
|
|
- "rep; ins\n" \
|
|
|
+ "rep; ins" prefix "\n" \
|
|
|
:"+D"(buffer), "+c"(size) \
|
|
|
: "d"(port) \
|
|
|
: "cc"); \
|
|
@@ -91,15 +91,15 @@ typedef word_t port_t;
|
|
|
static inline void cpu_write_port_buffer_##type(port_t port, const type##_t *buffer, size_t size) \
|
|
|
{ \
|
|
|
__asm__ volatile("cld\n" \
|
|
|
- "rep; outs\n" \
|
|
|
- : "+S"(buffer), "+c"(size) \
|
|
|
- : "d"(port) \
|
|
|
- : "cc"); \
|
|
|
+ "rep; outs " prefix "\n" \
|
|
|
+ : "+S"(buffer), "+c"(size) \
|
|
|
+ : "d"(port) \
|
|
|
+ : "cc"); \
|
|
|
}
|
|
|
|
|
|
-IO_PORT_FUNCTIONS(byte)
|
|
|
-IO_PORT_FUNCTIONS(word)
|
|
|
-IO_PORT_FUNCTIONS(dword)
|
|
|
+IO_PORT_FUNCTIONS(byte, "b")
|
|
|
+IO_PORT_FUNCTIONS(word, "w")
|
|
|
+IO_PORT_FUNCTIONS(dword, "l")
|
|
|
|
|
|
static inline uintptr_t cpu_read_master_control_register(void)
|
|
|
{
|