(1)
//----------------------------------------------------------
//--- get a copy of all memory slots from uVision/s8051.dll:
pCbFunc (AG_CB_GETSLOTS, (void *) &mslots[0]);
//----------------------------------------------------------
其中pCbFunc是Keil IDE提供的回调函数。
问题:mslots是不是由IDE来管理呀,申请与释放是不是由IDE来做呢?如果是的话,那Sample Code里为什么有这样的一段Code呢?
n = SlotNo (nSeg);
s = &mslots [n];
if (s->mem == NULL) // if not already mapped...
{
s->mem = (UC8 *) calloc (_MSGM, 1); // allocate 64k block
s->atr = (U16 *) calloc (_ASGM, 1); // and associated attributes