Someone from Intel please answer this:
Im trying to write a wrapper for the ioctl commands to mimic the
kernel level API for the uDbg library. The function Im working w/ is
int uDbg_SetNumUword(uDbg_Handle_T dbgH, unsigned int uEngMask,
unsigned int uWordAddr, unsigned short numWords, unsigned int *uWord)
Inside SA1_CoreLibs/ue/main.c where the ioctl is actually handled, we find
this code:
case UENG_SETNUMUWORD: {
uEng_setNumUword_T d;
if (copy_from_user(&d, (void *)arg, sizeof(d))) return -EFAULT;
size = d.numWords * sizeof(unsigned int);
buf = kmalloc(size, GFP_KERNEL);
if (buf == NULL) return -ENOMEM;
if (copy_from_user(buf, (void *)d.uWord, size)) {
kfree(buf);
return -EFAULT;
}
if (uEng_setNumUword(d.uEng, d.uAddr, d.numWords, &d.uWord)) {
printk("ue: UENG_SETNUMUWORD failed\n");
kfree(buf);
return -EFAULT;
}
kfree(buf);
break;
}
and SA1_CoreLibs/debug_1200/debug_1200.hxx defines Debug_SetNumUword_T to
be
typedef struct Debug_SetNumUword_S{
unsigned int uEngMask;
unsigned int uWordAddr;
unsigned short numWords;
unsigned int uWord;
} Debug_SetNumUword_T;
But this cant be right---isnt the purpose of buf to copy the data
from the POINTER uWord (whereas now its not a pointer, its just and int)
AND
shouldn't buf be passed to uEng_setNumUword instead of &d.uWord
inside the case statement?
Let me know if Im an idiot or if this has been fixed in a newer
version...
Austen McDonald
austen(a)cc.gatech.edu
God does not care about our mathematical difficulties.
He integrates empirically.
-- Albert Einstein