@@ -63,13 +63,13 @@ static void hint_free(rt_mm_va_hint_t hint)
63
63
64
64
static void on_page_fault (struct rt_varea * varea , struct rt_aspace_fault_msg * msg )
65
65
{
66
- void * init_start = (void * )init_mpr_align_start ;
67
- void * init_end = (void * )init_mpr_align_end ;
68
- if (msg -> fault_vaddr < init_end && msg -> fault_vaddr >= init_start )
66
+ char * init_start = (void * )init_mpr_align_start ;
67
+ char * init_end = (void * )init_mpr_align_end ;
68
+ if (( char * ) msg -> fault_vaddr < init_end && ( char * ) msg -> fault_vaddr >= init_start )
69
69
{
70
- rt_size_t offset = msg -> fault_vaddr - init_start ;
70
+ rt_size_t offset = ( char * ) msg -> fault_vaddr - init_start ;
71
71
msg -> response .status = MM_FAULT_STATUS_OK ;
72
- msg -> response .vaddr = init_mpr_cont_start + offset ;
72
+ msg -> response .vaddr = ( char * ) init_mpr_cont_start + offset ;
73
73
msg -> response .size = ARCH_PAGE_SIZE ;
74
74
}
75
75
else
@@ -194,13 +194,13 @@ static void _trace_free(rt_page_t page, void *caller, size_t size_bits)
194
194
195
195
static inline void * page_to_addr (rt_page_t page )
196
196
{
197
- return (void * )((page - page_start ) << ARCH_PAGE_SHIFT ) - PV_OFFSET ;
197
+ return (void * )((( page - page_start ) << ARCH_PAGE_SHIFT ) - PV_OFFSET ) ;
198
198
}
199
199
200
200
static inline rt_page_t addr_to_page (rt_page_t pg_start , void * addr )
201
201
{
202
- addr += PV_OFFSET ;
203
- return & pg_start [((uintptr_t )addr >> ARCH_PAGE_SHIFT )];
202
+ addr = ( char * ) addr + PV_OFFSET ;
203
+ return & pg_start [((rt_ubase_t )addr >> ARCH_PAGE_SHIFT )];
204
204
}
205
205
206
206
#define FLOOR (val , align ) (((rt_size_t)(val) + (align)-1) & ~((align)-1))
@@ -301,7 +301,7 @@ static void _pages_ref_inc(struct rt_page *p, rt_uint32_t size_bits)
301
301
idx = idx & ~((1UL << size_bits ) - 1 );
302
302
303
303
page_head = page_start + idx ;
304
- page_head = (void * )page_head + early_offset ;
304
+ page_head = (void * )(( char * ) page_head + early_offset ) ;
305
305
page_head -> ref_cnt ++ ;
306
306
}
307
307
@@ -324,7 +324,7 @@ static int _pages_free(rt_page_t page_list[], struct rt_page *p, rt_uint32_t siz
324
324
struct rt_page * buddy ;
325
325
326
326
RT_ASSERT (p >= page_start );
327
- RT_ASSERT ((void * )p < rt_mpr_start + rt_mpr_size );
327
+ RT_ASSERT ((char * )p < ( char * ) rt_mpr_start + rt_mpr_size );
328
328
RT_ASSERT (rt_kmem_v2p (p ));
329
329
RT_ASSERT (p -> ref_cnt > 0 );
330
330
RT_ASSERT (p -> size_bits == ARCH_ADDRESS_WIDTH_BITS );
@@ -395,10 +395,10 @@ static struct rt_page *_pages_alloc(rt_page_t page_list[], rt_uint32_t size_bits
395
395
396
396
static void _early_page_remove (rt_page_t page_list [], rt_page_t page , rt_uint32_t size_bits )
397
397
{
398
- rt_page_t page_cont = (void * )page + early_offset ;
398
+ rt_page_t page_cont = (rt_page_t )(( char * )page + early_offset ) ;
399
399
if (page_cont -> pre )
400
400
{
401
- rt_page_t pre_cont = (void * )page_cont -> pre + early_offset ;
401
+ rt_page_t pre_cont = (rt_page_t )(( char * )page_cont -> pre + early_offset ) ;
402
402
pre_cont -> next = page_cont -> next ;
403
403
}
404
404
else
@@ -408,7 +408,7 @@ static void _early_page_remove(rt_page_t page_list[], rt_page_t page, rt_uint32_
408
408
409
409
if (page_cont -> next )
410
410
{
411
- rt_page_t next_cont = (void * )page_cont -> next + early_offset ;
411
+ rt_page_t next_cont = (rt_page_t )(( char * )page_cont -> next + early_offset ) ;
412
412
next_cont -> pre = page_cont -> pre ;
413
413
}
414
414
@@ -418,13 +418,13 @@ static void _early_page_remove(rt_page_t page_list[], rt_page_t page, rt_uint32_
418
418
static void _early_page_insert (rt_page_t page_list [], rt_page_t page , int size_bits )
419
419
{
420
420
RT_ASSERT ((void * )page >= rt_mpr_start &&
421
- (void * )page - rt_mpr_start < + rt_mpr_size );
422
- rt_page_t page_cont = (void * )page + early_offset ;
421
+ (( char * )page - ( char * ) rt_mpr_start ) < rt_mpr_size );
422
+ rt_page_t page_cont = (rt_page_t )(( char * )page + early_offset ) ;
423
423
424
424
page_cont -> next = page_list [size_bits ];
425
425
if (page_cont -> next )
426
426
{
427
- rt_page_t next_cont = (void * )page_cont -> next + early_offset ;
427
+ rt_page_t next_cont = (rt_page_t )(( char * )page_cont -> next + early_offset ) ;
428
428
next_cont -> pre = page ;
429
429
}
430
430
page_cont -> pre = 0 ;
@@ -466,7 +466,7 @@ static struct rt_page *_early_pages_alloc(rt_page_t page_list[], rt_uint32_t siz
466
466
level -- ;
467
467
}
468
468
}
469
- rt_page_t page_cont = (void * )p + early_offset ;
469
+ rt_page_t page_cont = (rt_page_t )(( char * )p + early_offset ) ;
470
470
page_cont -> size_bits = ARCH_ADDRESS_WIDTH_BITS ;
471
471
page_cont -> ref_cnt = 1 ;
472
472
return p ;
@@ -723,7 +723,7 @@ static void _install_page(rt_page_t mpr_head, rt_region_t region, void *insert_h
723
723
724
724
/* insert to list */
725
725
rt_page_t * page_list = _get_page_list ((void * )region .start );
726
- insert (page_list , (void * )p - early_offset , size_bits - ARCH_PAGE_SHIFT );
726
+ insert (page_list , (rt_page_t )(( char * )p - early_offset ) , size_bits - ARCH_PAGE_SHIFT );
727
727
region .start += (1UL << size_bits );
728
728
}
729
729
}
@@ -778,9 +778,9 @@ void rt_page_init(rt_region_t reg)
778
778
rt_size_t init_mpr_npage = init_mpr_size >> ARCH_PAGE_SHIFT ;
779
779
780
780
init_mpr_cont_start = (void * )reg .start ;
781
- void * init_mpr_cont_end = init_mpr_cont_start + init_mpr_size ;
782
- early_offset = init_mpr_cont_start - ( void * ) init_mpr_align_start ;
783
- rt_page_t mpr_cont = rt_mpr_start + early_offset ;
781
+ rt_size_t init_mpr_cont_end = ( rt_size_t ) init_mpr_cont_start + init_mpr_size ;
782
+ early_offset = ( rt_size_t ) init_mpr_cont_start - init_mpr_align_start ;
783
+ rt_page_t mpr_cont = ( void * )(( char * ) rt_mpr_start + early_offset ) ;
784
784
785
785
/* mark init mpr pages as illegal */
786
786
rt_page_t head_cont = addr_to_page (mpr_cont , (void * )reg .start );
@@ -790,7 +790,7 @@ void rt_page_init(rt_region_t reg)
790
790
iter -> size_bits = ARCH_ADDRESS_WIDTH_BITS ;
791
791
}
792
792
793
- reg .start = ( rt_size_t ) init_mpr_cont_end ;
793
+ reg .start = init_mpr_cont_end ;
794
794
_install_page (mpr_cont , reg , _early_page_insert );
795
795
796
796
pages_alloc_handler = _early_pages_alloc ;
@@ -808,7 +808,7 @@ void rt_page_init(rt_region_t reg)
808
808
static int _load_mpr_area (void * head , void * tail )
809
809
{
810
810
int err = 0 ;
811
- void * iter = (void * )((uintptr_t )head & ~ARCH_PAGE_MASK );
811
+ char * iter = (char * )((rt_ubase_t )head & ~ARCH_PAGE_MASK );
812
812
tail = (void * )FLOOR (tail , ARCH_PAGE_SIZE );
813
813
814
814
while (iter != tail )
0 commit comments