[Barrelfish-users] Is coremask code correct?
Wang Nan
wangnan0 at huawei.com
Sun Jun 9 05:42:44 CEST 2013
Hi,
in include/barrelfish/types.h:
// MAX_COREID is 255
typedef uint64_t _coremask_word_t;
#define _COREMASK_BITS_PER_WORD (sizeof(_coremask_word_t) * NBBY)
#define _COREMASK_WORDS DIVIDE_ROUND_UP(MAX_COREID, _COREMASK_BITS_PER_WORD)
typedef struct {
_coremask_word_t bits[_COREMASK_WORDS];
} coremask_t;
_COREMASK_WORDS is 4
in lib/barrelfish/coreset.c:
errval_t coreset_to_coremask(struct coreset *set, coremask_t *mask)
{
memset(mask->bits, 0, sizeof(mask->bits));
for (int i = 0; i < MAX_COREID; i++) {
if (coreset_test(set, i)) {
mask->bits[i % _COREMASK_BITS_PER_WORD]
|= (_coremask_word_t)1 << (i / _COREMASK_BITS_PER_WORD);
}
}
return SYS_ERR_OK;
}
if i larger than 4, setting mask->bits causes problem.
should we enlarge coremask_t or fix setting of mask->bits (swap index and value)?
More information about the Barrelfish-users
mailing list