Mercurial > hg > Members > kono > Cerium
changeset 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 | 42c94f85c779 |
children | 90c61fe2b109 |
files | TaskManager/Cell/SpeThreads.cc TaskManager/Cell/SpeThreads.h TaskManager/Cell/spe/CellDmaManager.cc TaskManager/include/types.h |
diffstat | 4 files changed, 35 insertions(+), 16 deletions(-) [+] |
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 */
--- a/TaskManager/Cell/SpeThreads.h Sat Nov 07 14:13:29 2009 +0900 +++ b/TaskManager/Cell/SpeThreads.h Sat Nov 07 14:23:40 2009 +0900 @@ -19,9 +19,9 @@ /* functions */ void init(void); - int get_mail(int speid, int count, unsigned int* ret); // BLOCKING - int check_mail(int speid, int count, unsigned int* ret); // NONBLOCK - void send_mail(int speid, int num, unsigned int *data); // BLOCKING + memaddr get_mail(int speid, int count, unsigned int* ret); // BLOCKING + memaddr check_mail(int speid, int count, unsigned int* ret); // NONBLOCK + void send_mail(int speid, int num, memaddr *data); // BLOCKING static void *spe_thread_run(void *arg); static void *frontend_thread_run(void *arg); void add_output_tasklist(int command, unsigned int buff, int alloc_size);
--- a/TaskManager/Cell/spe/CellDmaManager.cc Sat Nov 07 14:13:29 2009 +0900 +++ b/TaskManager/Cell/spe/CellDmaManager.cc Sat Nov 07 14:23:40 2009 +0900 @@ -78,15 +78,19 @@ } void -CellDmaManager::mail_write(uint32 data) +CellDmaManager::mail_write(memaddr data) { - spu_write_out_mbox(data); + spu_write_out_mbox((uint32)data); + if (sizeof(memaddr)>4) + spu_write_out_mbox(data>>4); } -unsigned int -CellDmaManager::mail_read(void) +memaddr +CellDmaManager::mail_read() { - unsigned int mail = spu_read_in_mbox(); + memaddr mail = spu_read_in_mbox(); + if (sizeof(memaddr)>4) + mail += (spu_read_in_mbox()<<4); return mail; } @@ -103,3 +107,5 @@ mfc_putl(buff, 0, list->element, sizeof(mfc_list_element_t)*list->length, mask, 0, 0); } + +/* end */
--- a/TaskManager/include/types.h Sat Nov 07 14:13:29 2009 +0900 +++ b/TaskManager/include/types.h Sat Nov 07 14:23:40 2009 +0900 @@ -13,8 +13,8 @@ #ifdef MODE64 typedef uint64_t memaddr; #else -// In LP64, sizeof(long)==8 -typedef long memaddr; +// In LP64, sizeof(unsigned long)==8 +typedef unsigned long memaddr; #endif #endif