diff options
Diffstat (limited to 'pcilib')
-rw-r--r-- | pcilib/kmem.c | 6 | ||||
-rw-r--r-- | pcilib/kmem.h | 6 | ||||
-rw-r--r-- | pcilib/locking.c | 6 |
3 files changed, 9 insertions, 9 deletions
diff --git a/pcilib/kmem.c b/pcilib/kmem.c index b103126..e1d60c5 100644 --- a/pcilib/kmem.c +++ b/pcilib/kmem.c @@ -29,7 +29,7 @@ int pcilib_clean_kernel_memory(pcilib_t *ctx, pcilib_kmem_use_t use, pcilib_kmem static int pcilib_free_kernel_buffer(pcilib_t *ctx, pcilib_kmem_list_t *kbuf, size_t i, pcilib_kmem_flags_t flags) { kmem_handle_t kh = {0}; - if (kbuf->buf.blocks[i].ua) munmap(kbuf->buf.blocks[i].ua, kbuf->buf.blocks[i].size + kbuf->buf.blocks[i].alignment_offset); + if (kbuf->buf.blocks[i].ua) munmap((void*)kbuf->buf.blocks[i].ua, kbuf->buf.blocks[i].size + kbuf->buf.blocks[i].alignment_offset); kh.handle_id = kbuf->buf.blocks[i].handle_id; kh.pa = kbuf->buf.blocks[i].pa; kh.flags = flags; @@ -361,7 +361,7 @@ int pcilib_kmem_sync_block(pcilib_t *ctx, pcilib_kmem_handle_t *k, pcilib_kmem_s return 0; } -void* volatile pcilib_kmem_get_ua(pcilib_t *ctx, pcilib_kmem_handle_t *k) { +volatile void *pcilib_kmem_get_ua(pcilib_t *ctx, pcilib_kmem_handle_t *k) { pcilib_kmem_list_t *kbuf = (pcilib_kmem_list_t*)k; return kbuf->buf.addr.ua + kbuf->buf.addr.alignment_offset + kbuf->buf.addr.mmap_offset; } @@ -380,7 +380,7 @@ uintptr_t pcilib_kmem_get_ba(pcilib_t *ctx, pcilib_kmem_handle_t *k) { return 0; } -void* volatile pcilib_kmem_get_block_ua(pcilib_t *ctx, pcilib_kmem_handle_t *k, size_t block) { +volatile void *pcilib_kmem_get_block_ua(pcilib_t *ctx, pcilib_kmem_handle_t *k, size_t block) { pcilib_kmem_list_t *kbuf = (pcilib_kmem_list_t*)k; return kbuf->buf.blocks[block].ua + kbuf->buf.blocks[block].alignment_offset + kbuf->buf.blocks[block].mmap_offset; } diff --git a/pcilib/kmem.h b/pcilib/kmem.h index 1d63e3b..e8d2827 100644 --- a/pcilib/kmem.h +++ b/pcilib/kmem.h @@ -68,7 +68,7 @@ typedef struct { uintptr_t pa; /**< physical address of buffer */ uintptr_t ba; /**< bus address of buffer (if it is mapped for DMA operations) */ - void* volatile ua; /**< pointer to buffer in the process address space */ + volatile void *ua; /**< pointer to buffer in the process address space */ size_t size; /**< size of the buffer in bytes */ size_t alignment_offset; /**< we may request alignment of allocated buffers. To enusre proper alignment the larger buffer will be allocated and the offset will specify the first position in the buffer fullfilling alignment request */ @@ -205,7 +205,7 @@ int pcilib_kmem_sync_block(pcilib_t *ctx, pcilib_kmem_handle_t *k, pcilib_kmem_s * @param[in] k - kernel memory handle returned from pcilib_alloc_kernel_memory() call * @return - user-space pointer */ -void* volatile pcilib_kmem_get_ua(pcilib_t *ctx, pcilib_kmem_handle_t *k); +volatile void *pcilib_kmem_get_ua(pcilib_t *ctx, pcilib_kmem_handle_t *k); /** * Get a physical address of a single-buffer kernel memory @@ -233,7 +233,7 @@ uintptr_t pcilib_kmem_get_ba(pcilib_t *ctx, pcilib_kmem_handle_t *k); * @param[in] block - specifies the buffer within the kernel memory (buffers are numbered from 0) * @return - user-space pointer */ -void* volatile pcilib_kmem_get_block_ua(pcilib_t *ctx, pcilib_kmem_handle_t *k, size_t block); +volatile void *pcilib_kmem_get_block_ua(pcilib_t *ctx, pcilib_kmem_handle_t *k, size_t block); /** * Get a physical address of the specified kernel memory buffer diff --git a/pcilib/locking.c b/pcilib/locking.c index 71f204e..6ae4365 100644 --- a/pcilib/locking.c +++ b/pcilib/locking.c @@ -43,7 +43,7 @@ int pcilib_init_locking(pcilib_t* ctx) { if ((reused & PCILIB_KMEM_REUSE_REUSED) == 0) { for (i = 0; i < PCILIB_LOCK_PAGES; i++) { - void *addr = pcilib_kmem_get_block_ua(ctx, ctx->locks.kmem, i); + void *addr = (void*)pcilib_kmem_get_block_ua(ctx, ctx->locks.kmem, i); memset(addr, 0, PCILIB_KMEM_PAGE_SIZE); } } @@ -95,7 +95,7 @@ void pcilib_unlock_global(pcilib_t *ctx) { pcilib_lock_t *pcilib_get_lock_by_id(pcilib_t *ctx, pcilib_lock_id_t id) { int page = id / PCILIB_LOCKS_PER_PAGE; int offset = id - page * PCILIB_LOCKS_PER_PAGE; - void *addr = pcilib_kmem_get_block_ua(ctx, ctx->locks.kmem, page); + volatile void *addr = pcilib_kmem_get_block_ua(ctx, ctx->locks.kmem, page); pcilib_lock_t *lock = (pcilib_lock_t*)(addr + offset * PCILIB_LOCK_SIZE); return lock; @@ -308,7 +308,7 @@ int pcilib_destroy_all_locks(pcilib_t *ctx, int force) { } for (i = 0; i < PCILIB_LOCK_PAGES; i++) { - void *addr = pcilib_kmem_get_block_ua(ctx, ctx->locks.kmem, i); + void *addr = (void*)pcilib_kmem_get_block_ua(ctx, ctx->locks.kmem, i); memset(addr, 0, PCILIB_KMEM_PAGE_SIZE); } |