size_t sos_write(const void *vData, long int position, size_t count, void *handle) { size_t i; const char *realdata = vData; // send over serial for (i = 0; i < count; i++) L4_KDB_PrintChar(realdata[i]); // send to syscall in chunks of 5 words // so that we use all 6 ARM registers //for (i = position; i < count;) // well looks like this is not what position is for. for (i = 0; i < count;) // i incremented in the loop { L4_Msg_t msg; L4_MsgClear(&msg); L4_Set_MsgLabel(&msg, MAKETAG_SYSLAB(SOS_SYSCALL_SERIAL_SEND)); // add the words to the message for (int j = 0; j < WORDS_SENT_PER_IPC && i < count; j++) { // initialize to 0 so we send 0-chars if the message // is not word-padded L4_Word_t word = 0; // add bytes one by one char* writeTo = (char*) &word; for (int k = 0; k < sizeof(L4_Word_t) && i < count; k++) { *(writeTo++) = realdata[i++]; } L4_MsgAppendWord(&msg, word); } L4_MsgLoad(&msg); L4_MsgTag_t tag = L4_Send(sSystemId); if (L4_IpcFailed(tag)) { // FIXME: actually useful debug message L4_KDB_PrintChar('E'); L4_KDB_PrintChar('S'); L4_KDB_PrintChar('M'); break; } } return i; }
static size_t l4kdb_write(void *data, long int position, size_t count, void *handle /*unused*/) { size_t i; char *realdata = data; for (i = 0; i < count; i++) L4_KDB_PrintChar(realdata[i]); return count; }
int fputc(int c, FILE *stream) { L4_KDB_PrintChar(c); return 0; }
static void l4kdb_cons_write(struct console *co, const char *p, unsigned count) { while (count-- > 0) { L4_KDB_PrintChar(*p++); } }