void insert_pop_all_registers(dcontext_t *dcontext, clean_call_info_t *cci, instrlist_t *ilist, instr_t *instr, uint alignment) { ASSERT_NOT_IMPLEMENTED(false); /* FIXME i#1569 */ }
void IOV_WriteIovToBuf(struct iovec* entries, // IN int numEntries, // IN uint8* bufOut, // OUT size_t bufSize) // IN { size_t count = 0; int i; ASSERT(entries); ASSERT(bufOut); for (i = 0; i < numEntries; i++) { size_t numBytes; ASSERT(entries[i].iov_base); ASSERT(entries[i].iov_base != LAZY_ALLOC_MAGIC); numBytes = MIN(bufSize - count, entries[i].iov_len); Util_Memcpy(&bufOut[count], entries[i].iov_base, numBytes); count += numBytes; if (count >= bufSize) { return; } ASSERT_NOT_IMPLEMENTED(count <= bufSize); } }
int insert_out_of_line_context_switch(dcontext_t *dcontext, instrlist_t *ilist, instr_t *instr, bool save) { ASSERT_NOT_IMPLEMENTED(false); /* FIXME i#1569 */ return 0; }
void insert_push_immed_arch(dcontext_t *dcontext, instr_t *src_inst, byte *encode_estimate, ptr_int_t val, instrlist_t *ilist, instr_t *instr, instr_t **first, instr_t **second) { ASSERT_NOT_IMPLEMENTED(false); /* FIXME i#1569 */ }
void IOV_WriteBufToIov(const uint8* bufIn, // IN size_t bufSize, // IN struct iovec* entries, // OUT int numEntries) // IN { size_t count = 0; int i; ASSERT(entries); ASSERT_BUG(29009, bufIn); for (i = 0; i < numEntries; i++) { size_t numBytes; ASSERT(entries[i].iov_base); ASSERT(entries[i].iov_base != LAZY_ALLOC_MAGIC); numBytes = MIN(bufSize - count, entries[i].iov_len); Util_Memcpy(entries[i].iov_base, &bufIn[count], numBytes); count += numBytes; if (count >= bufSize) { return; } ASSERT_NOT_IMPLEMENTED(count <= bufSize); } }
bool check_undefined_exceptions(bool pushpop, bool write, app_loc_t *loc, app_pc addr, uint sz, uint *shadow, dr_mcontext_t *mc, uint *idx) { ASSERT_NOT_IMPLEMENTED(); /* FIXME i#1726: NYI */ return false; }
/* XXX i#1286: move to nudge_macos.c once we implement that */ bool send_nudge_signal(process_id_t pid, uint action_mask, client_id_t client_id, uint64 client_arg) { ASSERT_NOT_IMPLEMENTED(false); /* FIXME i#1286: MacOS nudges NYI */ return false; }
byte * remangle_short_rewrite(dcontext_t *dcontext, instr_t *instr, byte *pc, app_pc target) { ASSERT_NOT_IMPLEMENTED(false); /* FIXME i#1569 */ return NULL; }
bool check_undefined_reg_exceptions(void *drcontext, app_loc_t *loc, reg_id_t reg, dr_mcontext_t *mc, instr_t *inst) { ASSERT_NOT_IMPLEMENTED(); /* FIXME i#1726: NYI */ return false; }
DR_API size_t proc_fpstate_save_size(void) { ASSERT_NOT_IMPLEMENTED(false); /* FIXME i#1569 */ return 0; }
void clean_call_opt_init(void) { /* FIXME i#1569: NYI on AArch64 */ ASSERT_NOT_IMPLEMENTED(INTERNAL_OPTION(opt_cleancall) == 0); callee_info_init(&default_callee_info); }
uint insert_parameter_preparation(dcontext_t *dcontext, instrlist_t *ilist, instr_t *instr, bool clean_call, uint num_args, opnd_t *args) { ASSERT_NOT_IMPLEMENTED(false); /* FIXME i#1569 */ return 0; }
void RpcIn_RegisterCallback(RpcIn *in, // IN const char *name, // IN RpcIn_Callback cb, // IN void *clientData) // IN { RpcInCallbackList *p; Debug("Registering callback '%s'\n", name); ASSERT(in); ASSERT(name); ASSERT(cb); ASSERT(RpcInLookupCallback(in, name) == NULL); // not there yet p = (RpcInCallbackList *) malloc(sizeof(RpcInCallbackList)); ASSERT_NOT_IMPLEMENTED(p); p->length = strlen(name); p->name = strdup(name); p->callback = cb; p->clientData = clientData; p->next = in->callbacks; in->callbacks = p; }
DR_API app_pc dr_app_pc_as_load_target(dr_isa_mode_t isa_mode, app_pc pc) { ASSERT_NOT_IMPLEMENTED(false); /* FIXME i#1569 */ return 0; }
DR_API const char * decode_opcode_name(int opcode) { ASSERT_NOT_IMPLEMENTED(false); /* FIXME i#1569 */ return NULL; }
uint insert_push_all_registers(dcontext_t *dcontext, clean_call_info_t *cci, instrlist_t *ilist, instr_t *instr, uint alignment, opnd_t push_pc, reg_id_t scratch/*optional*/) { ASSERT_NOT_IMPLEMENTED(false); /* FIXME i#1569 */ return 0; }
bool insert_reachable_cti(dcontext_t *dcontext, instrlist_t *ilist, instr_t *where, byte *encode_pc, byte *target, bool jmp, bool returns, bool precise, reg_id_t scratch, instr_t **inlined_tgt_instr) { ASSERT_NOT_IMPLEMENTED(false); /* FIXME i#1569 */ return false; }
bool analyze_clean_call(dcontext_t *dcontext, clean_call_info_t *cci, instr_t *where, void *callee, bool save_fpstate, uint num_args, opnd_t *args) { /* FIXME i#1569: NYI on AArch64 */ ASSERT_NOT_IMPLEMENTED(INTERNAL_OPTION(opt_cleancall) == 0); clean_call_info_init(cci, callee, save_fpstate, num_args); return false; }
bool module_read_program_header(app_pc base, uint segment_num, OUT app_pc *segment_base /* relative pc */, OUT app_pc *segment_end /* relative pc */, OUT uint *segment_prot, OUT size_t *segment_align) { ASSERT_NOT_IMPLEMENTED(false); /* FIXME i#58: implement MachO support */ return false; }
Bool CodeSet_Validate(const char *buf, // IN: the string size_t size, // IN: length of string const char *code) // IN: encoding { #if defined(NO_ICU) return CodeSetOld_Validate(buf, size, code); #else UConverter *cv; UErrorCode uerr; // ucnv_toUChars takes 32-bit int size ASSERT_NOT_IMPLEMENTED(size <= (size_t) MAX_INT32); if (size == 0) { return TRUE; } /* * Fallback if necessary. */ if (dontUseIcu) { return CodeSetOld_Validate(buf, size, code); } /* * Calling ucnv_toUChars() this way is the idiom to precompute * the length of the output. (See preflighting in the ICU User Guide.) * So if the error is not U_BUFFER_OVERFLOW_ERROR, then the input * is bad. */ uerr = U_ZERO_ERROR; cv = ucnv_open(code, &uerr); ASSERT_NOT_IMPLEMENTED(uerr == U_ZERO_ERROR); ucnv_setToUCallBack(cv, UCNV_TO_U_CALLBACK_STOP, NULL, NULL, NULL, &uerr); ASSERT_NOT_IMPLEMENTED(uerr == U_ZERO_ERROR); ucnv_toUChars(cv, NULL, 0, buf, size, &uerr); ucnv_close(cv); return uerr == U_BUFFER_OVERFLOW_ERROR; #endif }
static VThreadBaseKeyType VThreadBaseGetKey(void) { VThreadBaseKeyType key = Atomic_Read(&vthreadBaseGlobals.key); if (key == VTHREADBASE_INVALID_KEY) { VThreadBaseKeyType newKey; #if defined _WIN32 newKey = TlsAlloc(); ASSERT_NOT_IMPLEMENTED(newKey != VTHREADBASE_INVALID_KEY); #else Bool success = pthread_key_create(&newKey, &VThreadBaseSafeDeleteTLS) == 0; if (success && newKey == 0) { /* * Leak TLS key 0. System libraries have a habit of destroying * it. See bugs 702818 and 773420. */ success = pthread_key_create(&newKey, &VThreadBaseSafeDeleteTLS) == 0; } ASSERT_NOT_IMPLEMENTED(success); #endif if (Atomic_ReadIfEqualWrite(&vthreadBaseGlobals.key, VTHREADBASE_INVALID_KEY, newKey) != VTHREADBASE_INVALID_KEY) { /* Race: someone else init'd */ #if defined _WIN32 TlsFree(newKey); #else pthread_key_delete(newKey); #endif } key = Atomic_Read(&vthreadBaseGlobals.key); ASSERT(key != VTHREADBASE_INVALID_KEY); } return key; }
/* Assumes it's passed either SEG_FS or SEG_GS. * Sets only the base: does not change the segment selector register. */ bool tls_set_fs_gs_segment_base(tls_type_t tls_type, uint seg, /* For x64 and TLS_TYPE_ARCH_PRCTL, base is used: * else, desc is used. */ byte *base, our_modify_ldt_t *desc) { /* XXX: we may want to refactor os.c + tls.h to not use our_modify_ldt_t on MacOS */ ASSERT_NOT_IMPLEMENTED(false); return false; }
static void VThreadBaseSafeDeleteTLS(void *tlsData) { VThreadBaseData *data = tlsData; if (data != NULL) { if (vthreadBaseGlobals.freeIDFunc != NULL) { VThreadBaseKeyType key = VThreadBaseGetKey(); Bool success; VThreadBaseData tmpData = *data; /* * Cleanup routines (specifically, Log()) need to be called with * valid TLS, so switch to a stack-based TLS slot containing just * enough for the VThreadBase services, clean up, then clear the * TLS slot. */ #if defined _WIN32 success = TlsSetValue(key, &tmpData); #else success = pthread_setspecific(key, &tmpData) == 0; #endif ASSERT_NOT_IMPLEMENTED(success); if (vmx86_debug) { Log("Forgetting VThreadID %d (\"%s\").\n", data->id, data->name); } (*vthreadBaseGlobals.freeIDFunc)(data); #if defined _WIN32 success = TlsSetValue(key, NULL); #else success = pthread_setspecific(key, NULL) == 0; #endif ASSERT_NOT_IMPLEMENTED(success); } Atomic_Dec(&vthreadBaseGlobals.numThreads); } }
void VThreadBase_ForgetSelf(void) { VThreadBaseKeyType key = VThreadBaseGetKey(); VThreadBaseData *data = VThreadBaseRaw(); Bool success; #if defined _WIN32 success = TlsSetValue(key, NULL); #else success = pthread_setspecific(key, NULL) == 0; #endif ASSERT_NOT_IMPLEMENTED(success); VThreadBaseSafeDeleteTLS(data); }
static wchar_t * StrVaswprintf_Internal(size_t *length, // OUT const wchar_t *format, // IN va_list arguments, // IN Bool assertOnFailure) // IN { size_t bufSize; wchar_t *buf = NULL; int retval; bufSize = wcslen(format); do { /* * Initial allocation of wcslen(format) * 2. Should this be tunable? * XXX Yes, this could overflow and spin forever when you get near 2GB * allocations. I don't care. --rrdharan */ wchar_t *newBuf; bufSize *= 2; newBuf = realloc(buf, bufSize*sizeof(wchar_t)); if (!newBuf) { free(buf); buf = NULL; goto exit; } buf = newBuf; retval = Str_Vsnwprintf(buf, bufSize, format, arguments); } while (retval == -1); if (length) { *length = retval; } /* * Try to trim the buffer here to save memory? */ exit: if (assertOnFailure) { ASSERT_NOT_IMPLEMENTED(buf); } return buf; }
static int RpcDebugRun(ToolsAppCtx *ctx, gpointer runMainLoop, gpointer runData, RpcDebugLibData *ldata) { CU_ErrorCode err; CU_Suite *suite; CU_Test *test; ASSERT(runMainLoop != NULL); ASSERT(ldata != NULL); err = CU_initialize_registry(); ASSERT(err == CUE_SUCCESS); suite = CU_add_suite(g_module_name(gPlugin), NULL, NULL); ASSERT(suite != NULL); test = CU_add_test(suite, g_module_name(gPlugin), RpcDebugRunLoop); ASSERT_NOT_IMPLEMENTED(test != NULL); gLibRunData.ctx = ctx; gLibRunData.libData = ldata; gLibRunData.mainLoop = runMainLoop; gLibRunData.loopData = runData; err = CU_basic_run_tests(); /* Clean up internal library / debug plugin state. */ ASSERT(g_atomic_int_get(&gLibRunData.refCount) >= 0); if (gPlugin != NULL) { g_module_close(gPlugin); gPlugin = NULL; } if (CU_get_failure_list() != NULL) { err = 1; } CU_cleanup_registry(); memset(&gLibRunData, 0, sizeof gLibRunData); return (int) err; }
static void VMToolsDllInit(void *lib) { Bool success; WiperInitData wiperData; Atomic_Init(); #if defined(_WIN32) wiperData.resourceModule = lib; success = (NetUtil_LoadIpHlpApiDll() == ERROR_SUCCESS); ASSERT(success); success = Wiper_Init(&wiperData); ASSERT(success); #else (void) wiperData; success = Wiper_Init(NULL); ASSERT_NOT_IMPLEMENTED(success); #endif }
uid_t Id_BeginSuperUser(void) { uid_t uid = Id_GetEUid(); ASSERT_NOT_IMPLEMENTED(uid != (uid_t) -1); if (uid == 0) { uid = (uid_t) -1; // already root; nothing to do } else { #if defined(__APPLE__) syscall(SYS_settid, KAUTH_UID_NONE, KAUTH_GID_NONE /* Ignored. */); #else Id_SetRESUid((uid_t) -1, (uid_t) 0, (uid_t) -1); // effectively root #endif } return uid; }
void TimeUtil_PopulateWithCurrent(Bool local, // IN TimeUtil_Date *d) // OUT { #ifdef _WIN32 SYSTEMTIME currentTime; ASSERT(d); if (local) { GetLocalTime(¤tTime); } else { GetSystemTime(¤tTime); } d->year = currentTime.wYear; d->month = currentTime.wMonth; d->day = currentTime.wDay; d->hour = currentTime.wHour; d->minute = currentTime.wMinute; d->second = currentTime.wSecond; #else struct tm *currentTime; struct tm tmbuf; time_t utcTime; ASSERT(d); utcTime = time(NULL); if (local) { currentTime = localtime_r(&utcTime, &tmbuf); } else { currentTime = gmtime_r(&utcTime, &tmbuf); } ASSERT_NOT_IMPLEMENTED(currentTime); d->year = 1900 + currentTime->tm_year; d->month = currentTime->tm_mon + 1; d->day = currentTime->tm_mday; d->hour = currentTime->tm_hour; d->minute = currentTime->tm_min; d->second = currentTime->tm_sec; #endif // _WIN32 }
/* Assumes it's passed either SEG_FS or SEG_GS. * Returns POINTER_MAX on failure. */ byte * tls_get_fs_gs_segment_base(uint seg) { uint selector; uint index; ldt_t ldt; byte *base; int res; if (seg != SEG_FS && seg != SEG_GS) return (byte *) POINTER_MAX; selector = read_thread_register(seg); index = SELECTOR_INDEX(selector); LOG(THREAD_GET, LOG_THREADS, 4, "%s selector %x index %d ldt %d\n", __FUNCTION__, selector, index, TEST(SELECTOR_IS_LDT, selector)); if (!TEST(SELECTOR_IS_LDT, selector) && selector != 0) { ASSERT_NOT_IMPLEMENTED(false); return (byte *) POINTER_MAX; } /* The man page is confusing, but experimentation shows it takes in the index, * not a selector value. */ res = dynamorio_mach_dep_syscall(SYS_i386_get_ldt, 3, index, &ldt, 1); if (res < 0) { LOG(THREAD_GET, LOG_THREADS, 4, "%s failed with code %d\n", __FUNCTION__, res); ASSERT_NOT_REACHED(); return (byte *) POINTER_MAX; } base = (byte *) (((ptr_uint_t)ldt.data.base24 << 24) | ((ptr_uint_t)ldt.data.base16 << 16) | (ptr_uint_t)ldt.data.base00); LOG(THREAD_GET, LOG_THREADS, 4, "%s => base "PFX"\n", __FUNCTION__, base); return base; }