#include #include #include #include #include #include #include #include char* initrd; long initrd_size; void read(void* args) { serdes_state state; start_deserialize(args,&state); deserialize_ptr(&state); size_t size=deserialize_int(&state); int pos=deserialize_int(&state); rpc_deallocate_buf(args,state.sizeorpos); long max_data=initrd_size-pos; if (size>max_data) { serial_print("Reading too much data from initrd\n"); state.buf=NULL; state.sizeorpos=0; serialize_int(0,&state); rpc_return(state.buf,state.sizeorpos); free(state.buf); pthread_exit(NULL); } char* data=malloc(sizeof(char)*size); for (long i=0;i