Mercurial > hg > Members > kono > Cerium
diff TaskManager/Cell/SpeThreads.cc @ 604:7a41d2cb0a84
fix mail box size
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 07 Nov 2009 14:23:40 +0900 |
parents | b89ba1d96fff |
children | 2cfbb36e221a |
line wrap: on
line diff
--- a/TaskManager/Cell/SpeThreads.cc Sat Nov 07 14:13:29 2009 +0900 +++ b/TaskManager/Cell/SpeThreads.cc Sat Nov 07 14:23:40 2009 +0900 @@ -116,21 +116,29 @@ * @return Received 32-bit mailbox messages * if ([ret] < 0) no data read */ -int +memaddr SpeThreads::get_mail(int speid, int count, unsigned int* ret) { - return spe_out_mbox_read(spe_ctx[speid], ret, count); + memaddr mail = spe_out_mbox_read(spe_ctx[speid], ret, 1); + if (sizeof(memaddr)>4) { + mail += spe_out_mbox_read(spe_ctx[speid], ret, 1)<<4; + } + return mail; } -int +memaddr SpeThreads::check_mail(int speid, int count, unsigned int* ret) { /* * spe_out_mbox_status return only 1, waiting for multiple length * does not work. */ - if (spe_out_mbox_status(spe_ctx[speid]) >= count) { - return spe_out_mbox_read(spe_ctx[speid], ret, count); + if (spe_out_mbox_status(spe_ctx[speid]) >= 1) { + memaddr mail = spe_out_mbox_read(spe_ctx[speid], ret, 1); + if (sizeof(memaddr)>4) { + mail += spe_out_mbox_read(spe_ctx[speid], ret, 1)<<4; + } + return mail; } else { return 0; } @@ -151,9 +159,12 @@ * @param [num] The number of messages */ void -SpeThreads::send_mail(int speid, int num, unsigned int *data) +SpeThreads::send_mail(int speid, int num, memaddr *data) { spe_in_mbox_write(spe_ctx[speid], data, num, SPE_MBOX_ALL_BLOCKING); + if (sizeof(memaddr)>4) { + spe_in_mbox_write(spe_ctx[speid], data>>4, num, SPE_MBOX_ALL_BLOCKING); + } } void @@ -167,3 +178,5 @@ */ } + +/* end */