Thread (122 messages) 122 messages, 8 authors, 2016-02-03

Re: [PATCH v5 8/9] virtio: add 1.0 support

From: Yuanhan Liu <hidden>
Date: 2016-01-27 03:49:06

On Thu, Jan 21, 2016 at 12:37:42PM +0100, Thomas Monjalon wrote:
2016-01-19 16:12, Yuanhan Liu:
quoted
+#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.
quoted
+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?
Okay, I will unfold them.

	--yliu
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help