You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
list_head*core_list_init(ee_u32blksize, list_head*memblock, ee_s16seed) {
/* calculated pointers for the list */ee_u32per_item=16+sizeof(structlist_data_s);
ee_u32size=(blksize/per_item)-2; /* to accomodate systems with 64b pointers, and make sure same code is executed, set max list elements */list_head*memblock_end=memblock+size;
list_data*datablock=(list_data*)(memblock_end);
list_data*datablock_end=datablock+size;
IIUC, per_item is calculated as 16B for list_head + sizeof struct list_data_s. size = capacity - 2 to provide space for head and tail; However, the value of size being used to compute memblock_end means we can only store capacity-2 elements even including head and tail; This also means the last 2 loop iterations of the code below would silently discard the data since we would be past memblock_end when inserting
/* create a fake items for the list head and tail */list->next=NULL;
list->info=datablock;
list->info->idx=0x0000;
list->info->data16=(ee_s16)0x8080;
memblock++;
datablock++;
info.idx=0x7fff;
info.data16=(ee_s16)0xffff;
core_list_insert_new(list,&info,&memblock,&datablock,memblock_end,datablock_end);
/* then insert size items */for (i=0; i<size; i++) {
ee_u16datpat=((ee_u16)(seed^i) &0xf);
ee_u16dat=(datpat<<3) | (i&0x7); /* alternate between algorithms */info.data16=(dat<<8) | dat; /* fill the data with actual data and upper bits with rebuild value */core_list_insert_new(list,&info,&memblock,&datablock,memblock_end,datablock_end);
}
This isn't a functional bug since core_list_insert_new is robust to the two drops and we don't use the pointer returned by that function in list_init.
I don't understand if this is actually intentional. However, I thought I should bring it up just in case my understanding was incorrect.
The text was updated successfully, but these errors were encountered:
ScriptDevil
changed the title
Coremark use 2 fewer list items than we can
Coremark use 2 fewer list items than it can
Jan 27, 2020
In
core_list_init
, we useIIUC, per_item is calculated as 16B for list_head + sizeof struct list_data_s. size = capacity - 2 to provide space for head and tail; However, the value of size being used to compute
memblock_end
means we can only store capacity-2 elements even including head and tail; This also means the last 2 loop iterations of the code below would silently discard the data since we would be pastmemblock_end
when insertingThis isn't a functional bug since
core_list_insert_new
is robust to the two drops and we don't use the pointer returned by that function inlist_init
.I don't understand if this is actually intentional. However, I thought I should bring it up just in case my understanding was incorrect.
The text was updated successfully, but these errors were encountered: