system/ramblock: Move RAMBlock helpers out of "system/ram_addr.h"
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Acked-by: Peter Xu <peterx@redhat.com> Message-Id: <20251002032812.26069-6-philmd@linaro.org>
This commit is contained in:
parent
fe11c4957b
commit
6feb119d32
2 changed files with 11 additions and 11 deletions
|
|
@ -80,17 +80,6 @@ static inline bool clear_bmap_test_and_clear(RAMBlock *rb, uint64_t page)
|
|||
return bitmap_test_and_clear(rb->clear_bmap, page >> shift, 1);
|
||||
}
|
||||
|
||||
static inline bool offset_in_ramblock(RAMBlock *b, ram_addr_t offset)
|
||||
{
|
||||
return (b && b->host && offset < b->used_length) ? true : false;
|
||||
}
|
||||
|
||||
static inline void *ramblock_ptr(RAMBlock *block, ram_addr_t offset)
|
||||
{
|
||||
assert(offset_in_ramblock(block, offset));
|
||||
return (char *)block->host + offset;
|
||||
}
|
||||
|
||||
static inline unsigned long int ramblock_recv_bitmap_offset(void *host_addr,
|
||||
RAMBlock *rb)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -119,4 +119,15 @@ int ram_block_attributes_state_change(RamBlockAttributes *attr, uint64_t offset,
|
|||
*/
|
||||
bool ram_block_is_pmem(RAMBlock *rb);
|
||||
|
||||
static inline bool offset_in_ramblock(RAMBlock *b, ram_addr_t offset)
|
||||
{
|
||||
return b && b->host && (offset < b->used_length);
|
||||
}
|
||||
|
||||
static inline void *ramblock_ptr(RAMBlock *block, ram_addr_t offset)
|
||||
{
|
||||
assert(offset_in_ramblock(block, offset));
|
||||
return (char *)block->host + offset;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue