// This function fixes the dummy object allocated by FileDescriptor::allocate() // before the Universe was fully initialized. void JarFileParser::fix_bootstrap() { const int max = MAX_CACHED_PARSERS < MaxCachedJarParsers ? MAX_CACHED_PARSERS : MaxCachedJarParsers; for (int i=0; i<max; i++) { int ref = _cached_parsers[0]; if (ref >= 0) { JarFileParser::Raw parser = ObjectHeap::get_global_ref_object(ref); GUARANTEE(parser.not_null(), "must not be GC'ed yet!"); OopDesc** desc = (OopDesc**)parser().file_descriptor(); OopDesc* n = Universe::file_descriptor_class()->prototypical_near(); // Make it a real FileDescriptor object. oop_write_barrier(desc, n); // This line tests that n is now really a FileDescriptor. FileDescriptor::Raw try_it = parser().file_descriptor(); (void)try_it; } } // We still haven't put the fixed up FileDescriptor into the list of // finalizable objects yet. It's easier just to flush the cache now // and close the FileDescriptors now ... this code is used only in // non-product mode, so there's no need to make it fancy. flush_caches(); }
void cache_hacks(void) { flush_caches(); // lock the caches so nobody replaces our hacks cache_lock(); // prevent the OFW from clearing the caches disable_cache_clearing(); // OFW allocates main heap from addr:0x200000 to addr:0x800000 // we place our hack at the last 128kb (0x20000) of this space, at addr: 0x7E0000 (see hack_relocate()) // the original instruction was: MOV R1, #0x800000 // we change it to: MOV R1, #0x7E0000 (in binary the instruction looks like: 0xE3A0187E) cache_fake(0xFF811318, 0xE3A0187E, TYPE_ICACHE); // hookup to dmProcInit(), so we can enable massive debug and run our hack_pre_init_hook cache_fake(0xFF8111AC, ASM_BL(0xFF8111AC, &hack_dmProcInit), TYPE_ICACHE); // hookup our MainCtrlInit //cache_fake(0xFF8110E4, ASM_BL(0xFF8110E4, &hack_MainCtrlInit), TYPE_ICACHE); #ifdef ENABLE_DEBUG // hookup our GUI_IdleHandler cache_fake(0xFF82A4F0, ASM_BL(0xFF82A4F0, &hack_register_gui_idle_handler), TYPE_ICACHE); #endif // hookup our Intercom cache_fake(0xFFA5D590, ASM_BL(0xFFA5D590, &hack_init_intercom_data), TYPE_ICACHE); // hookup StartConsole, so we can run our hack_post_init_hook cache_fake(0xFF8112E8, ASM_BL(0xFF8112E8, &hack_StartConsole), TYPE_ICACHE); }
/* React on 'smbcontrol winbindd reload-config' in the same way as on SIGHUP*/ static void msg_reload_services(struct messaging_context *msg, void *private_data, uint32_t msg_type, struct server_id server_id, DATA_BLOB *data) { /* Flush various caches */ flush_caches(); reload_services_file((const char *) private_data); }
int JarFileParser::do_next_entries(const JvmPathChar* jar_file_name, const char *suffix, bool should_match, JarFileParser::do_entry_proc f, int entry_id, int max_size JVM_TRAPS) { GUARANTEE(entry_id >= 0 && max_size > 0, "Sanity"); int result = -1; // JAR entry iteration is not compatible with CacheJarEntries. The // easiest way make iteration co-exist with CacheJarEntries (especially // in an MVM environment where other tasks may be loading class files // at the same time) is to flush the JarFileParser caches before and after. #if ENABLE_JAR_ENTRY_CACHE // Make sure we don't have a JarFileParser that has entry caching enabled. flush_caches(); #endif { UsingFastOops fast_oops; JarFileParser::Fast parser = get(jar_file_name, /*enable_entry_cache=*/false JVM_NO_CHECK); if (parser.not_null()) { SuffixMatchFilterData data = { suffix, should_match, &parser, f }; result = parser().filtered_do_next_entries(&JarFileParser::suffix_match_filter, NULL, &data, entry_id, max_size JVM_NO_CHECK); } } #if ENABLE_JAR_ENTRY_CACHE // Make sure we don't leave behind a JarFileParser that has entry caching // disabled. flush_caches(); #endif return result; }
void mmu_setup(void) { setup_mmu_state(); setup_direct_map(); invalidate_tlb(); install_pt_address(); printk("Installed page table address\n"); set_domain_permissions(); printk("Set domain permissions\n"); flush_caches(); enable_mmu(); printk("MMU setup complete.\n"); }
static void winbindd_sig_hup_handler(struct tevent_context *ev, struct tevent_signal *se, int signum, int count, void *siginfo, void *private_data) { const char *file = (const char *)private_data; DEBUG(1,("Reloading services after SIGHUP\n")); flush_caches(); reload_services_file(file); }
// Create or retrieve a JarFileParser for the given JAR file. // As a side effect, it might invalidate any previously obtained // JarFileParser objects by closing their OsFile_handles. ReturnOop JarFileParser::get(const JvmPathChar* jar_file_name1, TypeArray * jar_file_name2, bool enable_entry_cache JVM_TRAPS) { GUARANTEE((jar_file_name1 != NULL && jar_file_name2 == NULL) || (jar_file_name1 == NULL && jar_file_name2 != NULL), "sanity"); UsingFastOops fast_oops; JarFileParser::Fast parser = get_parser_from_cache(jar_file_name1, jar_file_name2); if (parser.not_null()) { return parser; } if (jar_file_name1 && !OsFile_exists(jar_file_name1)) { return NULL; } if (jar_file_name2 && !OsFile_exists((JvmPathChar *)jar_file_name2->byte_base_address())) { return NULL; } parser = Universe::new_mixed_oop(MixedOopDesc::Type_JarFileParser, JarFileParser::allocation_size(), JarFileParser::pointer_count() JVM_CHECK_0); TypeArray::Fast stored_name; if (jar_file_name1 != NULL) { size_t name_bytes = (fn_strlen(jar_file_name1)+1) * sizeof(JvmPathChar); stored_name = Universe::new_byte_array_raw(name_bytes JVM_CHECK_0); JvmPathChar *data = (JvmPathChar *)stored_name().byte_base_address(); jvm_memcpy(data, jar_file_name1, name_bytes); // copy trailing NUL as well. } else { stored_name = jar_file_name2->obj(); } BufferedFile::Fast bf = BufferedFile::allocate(JVM_SINGLE_ARG_CHECK_0); FileDescriptor::Fast desc = FileDescriptor::allocate(JVM_SINGLE_ARG_CHECK_0); OsFile_Handle fh = NULL; for (int pass=0; pass<2; pass++) { if (jar_file_name1) { fh = OsFile_open(jar_file_name1, "rb"); } else { fh = OsFile_open((JvmPathChar *)jar_file_name2->byte_base_address(), "rb"); } if (fh != NULL) { break; } if (pass == 1 && fh == NULL) { // The system is running low on OsFile_Handles. Make sure we flush // the cache, and free all currently cached OsFile_Handles that belong // to other JAR files. flush_caches(); } } if (fh == NULL) { return NULL; } desc().set_handle(fh); bf().set_file_pointer(fh); bf().set_file_size(fh == NULL ? 0 : OsFile_length(fh)); parser().set_file_descriptor(&desc); parser().set_enable_entry_cache(enable_entry_cache); parser().set_pathname(&stored_name); parser().set_buffered_file(&bf); parser().set_timestamp(++_timestamp); if (!parser().find_end_of_central_header()) { // The jar file is corrupted. Stop parsing it. return NULL; } parser().save_parser_in_cache(JVM_SINGLE_ARG_MUST_SUCCEED); return parser; }
/* React on 'smbcontrol winbindd reload-config' in the same way as on SIGHUP*/ static void msg_reload_services(int msg_type, pid_t src, void *buf, size_t len) { /* Flush various caches */ flush_caches(); reload_services_file(); }