/* this app won't print in release mode */ void __arch_putchar(int c) { #ifdef CONFIG_DEBUG_BUILD seL4_DebugPutChar(c); #endif }
static size_t sos_debug_print(const void *vData, long int position, size_t count, void *handle) { size_t i; const char *realdata = vData; for (i = 0; i < count; i++) seL4_DebugPutChar(realdata[i]); return count; }
/** * Output ch to a "terminal" */ void seL4_PutChar(const char ch) { #ifdef DEBUG seL4_DebugPutChar(ch); #else // TODO: we need seL4_PutChar ???? #endif }
static void debug_error(int sysnum) { char buf[100]; int i; sprintf(buf, "libsel4muslcsys: Error attempting syscall %d\n", sysnum); for (i = 0; buf[i]; i++) { seL4_DebugPutChar(buf[i]); } }
static size_t refos_seL4_debug_override_writev(void *data, size_t count) { #if defined(SEL4_DEBUG_KERNEL) for (int i = 0; i < count; i++) { seL4_DebugPutChar(((char*)data)[i]); } #endif return count; }
int main(int argc, char **argv) { // init(); sel4_print("client-os:sel4 print\n"); int ta_num = start_ta(TA_NAME); char arr[32] = "be2d8a571e03ac9c9eb76fac45af8e51"; //String to be encrypted char res[32]; arr[32] = '\0'; //first call sel4_print("client-os: Calling TA to encrypt string "); sel4_print(arr); sel4_print("\n"); call_func_ta(ta_num,CMD_TA_ENC,10,arr,sizeof(char) *32,res); res[32] = '\0'; sel4_print("client-os: String encrypted to "); sel4_print(res); sel4_print("\n\n"); char res_2[32] = {0}; //second call sel4_print("client-os: Calling TA to decrypt string "); sel4_print(res); sel4_print("\n"); call_func_ta(ta_num,CMD_TA_DEC,10,res,sizeof(char) *32,res_2); res_2[32] = '\0'; sel4_print("client-os: String decrypted to "); sel4_print(res_2); sel4_print("\n\n"); //third call sel4_print("client-os: Calling TA to increment number \n"); int res_val = call_func_ta(ta_num,CMD_TA_INC,5,arr,sizeof(char) *12,NULL); sel4_print("client-os: Number incremented from ");seL4_DebugPutChar(5+'0'); sel4_print(" to "); seL4_DebugPutChar('0'+res_val); while(1){ } return 0; }
static size_t sys_platform_stdout_write(void *data, size_t count) { char *cdata = data; #if defined(SEL4_DEBUG_KERNEL) && defined(CONFIG_REFOS_SYS_FORCE_DEBUGPUTCHAR) for (size_t i = 0; i < count; i++) { seL4_DebugPutChar(cdata[i]); } #else if (refosIOState.stdioWriteOverride != NULL) { /* Use overridden write function. */ return refosIOState.stdioWriteOverride(data, count); } /* Use serial dataspace on Console server. */ if (refosIOState.stdioDataspace && refosIOState.stdioSession.serverSession) { refosio_internal_save_IPC_buffer(); for (size_t i = 0; i < count;) { int c = MIN(REFOS_DEFAULT_DSPACE_IPC_MAXLEN, count - i); int n = data_write(refosIOState.stdioSession.serverSession, refosIOState.stdioDataspace, 0, &cdata[i], c); if (!n) { /* An error occured. */ refosio_internal_restore_IPC_buffer(); return i; } i += n; } refosio_internal_restore_IPC_buffer(); } #endif return count; }
void sel4_print(char* str){ while((str != NULL)&&(*str != 0)){ seL4_DebugPutChar(*str); str++; } }
int fputc(int c, FILE *stream) { seL4_DebugPutChar(c); return 0; }