Re: [PATCH v5 8/9] virtio: add 1.0 support
From: Thomas Monjalon <hidden>
Date: 2016-01-21 11:38:52
2016-01-19 16:12, Yuanhan Liu:
+#define IO_READ_DEF(nr_bits, type) \
+static inline type \
+io_read##nr_bits(type *addr) \
+{ \
+ return *(volatile type *)addr; \
+}
+
+#define IO_WRITE_DEF(nr_bits, type) \
+static inline void \
+io_write##nr_bits(type val, type *addr) \
+{ \
+ *(volatile type *)addr = val; \
+}
+
+IO_READ_DEF (8, uint8_t)
+IO_WRITE_DEF(8, uint8_t)
+
+IO_READ_DEF (16, uint16_t)
+IO_WRITE_DEF(16, uint16_t)
+
+IO_READ_DEF (32, uint32_t)
+IO_WRITE_DEF(32, uint32_t)Yes you can do this. But not sure you should.
+static inline void
+io_write64_twopart(uint64_t val, uint32_t *lo, uint32_t *hi)
+{
+ io_write32(val & ((1ULL << 32) - 1), lo);
+ io_write32(val >> 32, hi);
+}When debugging this code, how GDB behave? How to find the definition of io_write32() with grep or simple editors?