static void large_request_handler(void *token, void *buf, size_t nbytes, int arg) { uint32_t *recvdbuf = (uint32_t *)buf; #if VERBOSE printf("%i: large_request_handler(). starting...\n", myproc); fflush(stdout); #endif assert(arg == 666); assert(buf == ((uint8_t *)VMseg) + 100); assert(nbytes == AM_MaxLong()); /* verify the result */ { int i; for (i = 0; i < AM_MaxLong()/4; i++) { if (recvdbuf[i] != (uint32_t)((count << 16) + i)) AMX_FatalErr("%i: ERROR: mismatched data recvdbuf[%i]=%i\n", myproc, i, (int)recvdbuf[i]); } count++; for (i = 0; i < AM_MaxLong()/4; i++) { recvdbuf[i] = (uint32_t)((count << 16) + i); } if (numprocs > 1) count++; } #if VERBOSE printf("%i: large_request_handler(). sending reply...\n", myproc); fflush(stdout); #endif AM_Safe(AM_ReplyXfer1(token, 100, LARGE_REP_HANDLER, buf, nbytes, 666)); done++; }
static void bulk_request_handler(void *token, void *buf, int nbytes, int arg) { #if DEBUG uint32_t *recvdbuf = (uint32_t *)buf; #endif #if VERBOSE printf("%i: bulk_request_handler(). starting...\n", myproc); fflush(stdout); #endif assert(arg == 666); assert(nbytes == size % AM_MaxLong() || nbytes == AM_MaxLong()); assert(buf == ((uint8_t *)VMseg) + 100); /* assert(done < 2*nummsgs); */ #if DEBUG /* verify the result */ { int i; for (i = 0; i < nbytes/4; i++) { if (recvdbuf[i] != (uint32_t)i) AMX_FatalErr("%i: ERROR: mismatched data recvdbuf[%i]=%i\n", myproc, i, (int)recvdbuf[i]); } } #endif #if VERBOSE printf("%i: bulk_request_handler(). sending reply...\n", myproc); fflush(stdout); #endif AM_Safe(AM_Reply0(token, BULK_REP_HANDLER)); done++; }
static void large_reply_handler(void *token, void *buf, size_t nbytes, int arg) { uint32_t *recvdbuf = (uint32_t *)buf; /* assert(done < 2*nummsgs); */ #if VERBOSE printf("%i: bulk_reply_handler()\n", myproc); fflush(stdout); #endif assert(arg == 666); assert(buf == ((uint8_t *)VMseg) + 100); assert(nbytes == AM_MaxLong()); if (numprocs > 1) count++; /* verify the result */ { int i; for (i = 0; i < AM_MaxLong()/4; i++) { if (recvdbuf[i] != (uint32_t)((count << 16) + i)) AMX_FatalErr("%i: ERROR: mismatched data recvdbuf[%i]=%i\n", myproc, i, (int)recvdbuf[i]); } } count++; done = 1; }