void ob_init_iommu(uint64_t base) { struct iommu_regs *regs; regs = iommu_init(&ciommu, base); push_str("/iommu"); fword("find-device"); PUSH((unsigned long)regs); fword("encode-int"); push_str("address"); fword("property"); PUSH(base >> 32); fword("encode-int"); PUSH(base & 0xffffffff); fword("encode-int"); fword("encode+"); PUSH(IOMMU_REGS); fword("encode-int"); fword("encode+"); push_str("reg"); fword("property"); bind_func("map-in", ob_iommu_map_in); bind_func("map-out", ob_iommu_map_out); }
void do_test_erf(const T& data, const char* type_name, const char* test_name) { typedef typename T::value_type row_type; typedef typename row_type::value_type value_type; typedef value_type (*pg)(value_type); #if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS) pg funcp = boost::math::erf<value_type>; #else pg funcp = boost::math::erf; #endif boost::math::tools::test_result<value_type> result; std::cout << "Testing " << test_name << " with type " << type_name << "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; // // test erf against data: // result = boost::math::tools::test( data, bind_func(funcp, 0), extract_result(1)); handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::erf", test_name); #ifdef TEST_OTHER if(::boost::is_floating_point<value_type>::value){ funcp = other::erf; result = boost::math::tools::test( data, bind_func(funcp, 0), extract_result(1)); print_test_result(result, data[result.worst()], result.worst(), type_name, "other::erf"); } #endif // // test erfc against data: // #if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS) funcp = boost::math::erfc<value_type>; #else funcp = boost::math::erfc; #endif result = boost::math::tools::test( data, bind_func(funcp, 0), extract_result(2)); handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::erfc", test_name); #ifdef TEST_OTHER if(::boost::is_floating_point<value_type>::value){ funcp = other::erfc; result = boost::math::tools::test( data, bind(funcp, 0), extract_result(2)); print_test_result(result, data[result.worst()], result.worst(), type_name, "other::erfc"); } #endif std::cout << std::endl; }
static void arch_init( void ) { openbios_init(); modules_init(); #ifdef CONFIG_DRIVER_PCI arch = &default_pci_host; ob_pci_init(); #endif #ifdef CONFIG_DRIVER_IDE setup_timers(); ob_ide_init("/pci/isa", 0x1f0, 0x3f4, 0x170, 0x374); #endif #ifdef CONFIG_DRIVER_FLOPPY ob_floppy_init("/isa", "floppy0", 0x3f0, 0); #endif #ifdef CONFIG_XBOX setup_video(0x3C00000, phys_to_virt(0x3C00000)); /* Force video to 32-bit depth */ VIDEO_DICT_VALUE(video.depth) = 32; init_video(); node_methods_init(); #endif device_end(); bind_func("platform-boot", boot ); bind_func("(go)", go ); }
void do_test_erf_inv(const T& data, const char* type_name, const char* test_name) { typedef typename T::value_type row_type; typedef typename row_type::value_type value_type; typedef value_type (*pg)(value_type); boost::math::tools::test_result<value_type> result; std::cout << "Testing " << test_name << " with type " << type_name << "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; // // test erf_inv against data: // #if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS) pg funcp = boost::math::erf_inv<value_type>; #else pg funcp = boost::math::erf_inv; #endif result = boost::math::tools::test( data, bind_func(funcp, 0), extract_result(1)); handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::erf_inv", test_name); std::cout << std::endl; }
void do_test_cbrt(const T& data, const char* type_name, const char* test_name) { typedef typename T::value_type row_type; typedef typename row_type::value_type value_type; typedef value_type (*pg)(value_type); #if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS) pg funcp = boost::math::cbrt<value_type>; #else pg funcp = boost::math::cbrt; #endif boost::math::tools::test_result<value_type> result; std::cout << "Testing " << test_name << " with type " << type_name << "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; // // test cbrt against data: // result = boost::math::tools::test( data, bind_func(funcp, 1), extract_result(0)); result += boost::math::tools::test( data, negative_cbrt(), negate(extract_result(0))); handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::cbrt", test_name); std::cout << std::endl; }
void do_test_tgamma_delta_ratio(const T& data, const char* type_name, const char* test_name) { typedef typename T::value_type row_type; typedef typename row_type::value_type value_type; typedef value_type (*pg)(value_type, value_type); #if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS) pg funcp = boost::math::tgamma_delta_ratio<value_type, value_type>; #else pg funcp = boost::math::tgamma_delta_ratio; #endif boost::math::tools::test_result<value_type> result; std::cout << "Testing " << test_name << " with type " << type_name << "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; // // test tgamma_delta_ratio against data: // result = boost::math::tools::test( data, bind_func(funcp, 0, 1), extract_result(2)); handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma_delta_ratio(a, delta)", test_name); result = boost::math::tools::test( data, negative_tgamma_ratio(), extract_result(3)); handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma_delta_ratio(a -delta)", test_name); }
void do_test_cyl_bessel_j_int(const T& data, const char* type_name, const char* test_name) { typedef typename T::value_type row_type; typedef typename row_type::value_type value_type; typedef value_type (*pg)(value_type, value_type); #if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS) pg funcp = cyl_bessel_j_int_wrapper<value_type>; #else pg funcp = cyl_bessel_j_int_wrapper; #endif boost::math::tools::test_result<value_type> result; std::cout << "Testing " << test_name << " with type " << type_name << "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; // // test cyl_bessel_j against data: // result = boost::math::tools::test( data, bind_func(funcp, 0, 1), extract_result(2)); handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::cyl_bessel_j", test_name); std::cout << std::endl; }
void do_test_cyl_neumann_y(const T& data, const char* type_name, const char* test_name) { typedef typename T::value_type row_type; typedef typename row_type::value_type value_type; typedef value_type (*pg)(value_type, value_type); #if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS) pg funcp = boost::math::cyl_neumann<value_type, value_type>; #else pg funcp = boost::math::cyl_neumann; #endif boost::math::tools::test_result<value_type> result; std::cout << "Testing " << test_name << " with type " << type_name << "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; // // test cyl_neumann against data: // result = boost::math::tools::test( data, bind_func(funcp, 0, 1), extract_result(2)); handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::cyl_neumann", test_name); std::cout << std::endl; #ifdef TEST_OTHER if(boost::is_floating_point<value_type>::value) { funcp = other::cyl_neumann; // // test other::cyl_neumann against data: // result = boost::math::tools::test( data, bind_func(funcp, 0, 1), extract_result(2)); handle_test_result(result, data[result.worst()], result.worst(), type_name, "other::cyl_neumann", test_name); std::cout << std::endl; } #endif }
static void arch_init( void ) { void setup_timers(void); openbios_init(); modules_init(); #ifdef CONFIG_DRIVER_IDE setup_timers(); ob_ide_init("/pci/pci-ata", 0x1f0, 0x3f4, 0x170, 0x374); #endif device_end(); bind_func("platform-boot", boot ); }
void arch_of_init( void ) { #if USE_RTAS phandle_t ph; #endif int autoboot; devtree_init(); node_methods_init(); modules_init(); setup_timers(); #ifdef CONFIG_DRIVER_PCI ob_pci_init(); #endif #if USE_RTAS if( !(ph=find_dev("/rtas")) ) printk("Warning: No /rtas node\n"); else { ulong size = 0x1000; while( size < (ulong)of_rtas_end - (ulong)of_rtas_start ) size *= 2; set_property( ph, "rtas-size", (char*)&size, sizeof(size) ); } #endif #if 0 /* tweak boot settings */ autoboot = !!get_bool_res("autoboot"); #endif autoboot = 0; if( !autoboot ) printk("Autobooting disabled - dropping into OpenFirmware\n"); setenv("auto-boot?", autoboot ? "true" : "false" ); setenv("boot-command", "briqboot"); #if 0 if( get_bool_res("tty-interface") == 1 ) #endif fword("activate-tty-interface"); /* hack */ device_end(); bind_func("briqboot", boot ); }
void nvconf_init( void ) { int once=0; /* initialize nvram structure completely */ nvram.config = NULL; nvram.config_size = 0; nvram.size = arch_nvram_size(); nvram.data = malloc( nvram.size ); arch_nvram_get( nvram.data ); bind_func( "update-nvram", update_nvram ); for( ;; ) { nvpart_t *p = NULL; int err; while( (err=next_nvpart(&p)) > 0 ) { if( nvpart_checksum(p) != p->checksum ) { err = -1; break; } if( p->signature == NV_SIG_SYSTEM ) { nvram.config = p; nvram.config_size = nvpart_size(p) - 0x10; if( !once++ ) { PUSH( pointer2cell(p->data) ); PUSH( nvram.config_size ); fword("nvram-load-configs"); } } } if( err || !nvram.config ) { printk("nvram error detected, zapping pram\n"); zap_nvram(); if( !once++ ) fword("set-defaults"); continue; } break; } }
int create_lisfd(void) { int lisfd = -1; /* socket */ lisfd = socket_func(AF_INET, SOCK_STREAM, IPPROTO_TCP); /* set address listen reuse */ int opt = 1; setsockopt_func(lisfd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)); /* bind */ struct sockaddr_in saddr; saddr.sin_family = AF_INET; saddr.sin_port = htons(8000); inet_pton_func(AF_INET, "127.0.0.1", &saddr.sin_addr); bind_func(lisfd, (struct sockaddr *)&saddr, sizeof(saddr)); /* listen */ listen(lisfd, 10); return lisfd; }
void do_test_ellint_e1(T& data, const char* type_name, const char* test) { typedef typename T::value_type row_type; typedef typename row_type::value_type value_type; boost::math::tools::test_result<value_type> result; std::cout << "Testing: " << test << std::endl; #if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS) value_type (*fp1)(value_type) = boost::math::ellint_2<value_type>; #else value_type (*fp1)(value_type) = boost::math::ellint_2; #endif result = boost::math::tools::test( data, bind_func(fp1, 0), extract_result(1)); handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::ellint_2", test); std::cout << std::endl; }
cuda_t *cuda_init (const char *path, phys_addr_t base) { cuda_t *cuda; char buf[64]; phandle_t aliases; base += IO_CUDA_OFFSET; CUDA_DPRINTF(" base=" FMT_plx "\n", base); cuda = malloc(sizeof(cuda_t)); if (cuda == NULL) return NULL; snprintf(buf, sizeof(buf), "%s/via-cuda", path); REGISTER_NAMED_NODE(ob_cuda, buf); aliases = find_dev("/aliases"); set_property(aliases, "via-cuda", buf, strlen(buf) + 1); cuda->base = base; cuda_writeb(cuda, B, cuda_readb(cuda, B) | TREQ | TIP); #ifdef CONFIG_DRIVER_ADB cuda->adb_bus = adb_bus_new(cuda, &cuda_adb_req); if (cuda->adb_bus == NULL) { free(cuda); return NULL; } adb_bus_init(buf, cuda->adb_bus); #endif rtc_init(buf); powermgt_init(buf); main_cuda = cuda; device_end(); bind_func("poweroff", ppc32_poweroff); return cuda; }
void arch_of_init( void ) { mol_phandle_t ph; int autoboot; devtree_init(); node_methods_init(); nvram_init("/pci/mac-io/nvram"); openbios_init(); modules_init(); pseudodisk_init(); osiblk_init(); osiscsi_init(); init_video(); if( (ph=prom_find_device("/rtas")) == -1 ) printk("Warning: No /rtas node\n"); else { unsigned long size = 0x1000; while( size < (unsigned long)of_rtas_end - (unsigned long)of_rtas_start ) size *= 2; prom_set_prop( ph, "rtas-size", (char*)&size, sizeof(size) ); } /* tweak boot settings */ autoboot = !!get_bool_res("autoboot"); if( !autoboot ) printk("Autobooting disabled - dropping into OpenFirmware\n"); setenv("auto-boot?", autoboot ? "true" : "false" ); setenv("boot-command", "molboot"); if( get_bool_res("tty-interface") == 1 ) fword("activate-tty-interface"); /* hack */ device_end(); bind_func("molboot", boot ); }
static void ob_cuda_initialize (int *idx) { phandle_t ph=get_cur_dev(); int props[2]; push_str("via-cuda"); fword("device-type"); set_int_property(ph, "#address-cells", 1); set_int_property(ph, "#size-cells", 0); set_property(ph, "compatible", "cuda", 5); props[0] = __cpu_to_be32(IO_CUDA_OFFSET); props[1] = __cpu_to_be32(IO_CUDA_SIZE); set_property(ph, "reg", (char *)&props, sizeof(props)); /* on newworld machines the cuda is on interrupt 0x19 */ props[0] = 0x19; props[1] = 0; NEWWORLD(set_property(ph, "interrupts", (char *)props, sizeof(props))); NEWWORLD(set_int_property(ph, "#interrupt-cells", 2)); /* we emulate an oldworld hardware, so we must use * non-standard oldworld property (needed by linux 2.6.18) */ OLDWORLD(set_int_property(ph, "AAPL,interrupts", 0x12)); bind_func("ppc32-reset-all", ppc32_reset_all); push_str("' ppc32-reset-all to reset-all"); fword("eval"); }
void evangelionbios_init( void ) { // Bind the saved program state context into Forth PUSH(pointer2cell((void *)&__context)); feval("['] __context cell+ !"); #if defined(CONFIG_DRIVER_FW_CFG) // Bind the Forth fw_cfg file interface bind_func("fw-cfg-read-file", forth_fw_cfg_read_file); #endif // Bind the C implementation of (init-program) into Forth bind_func("(init-program)", init_program); // Bind the C implementation of (go) into Forth bind_func("(go)", go); // Bind the LE access words bind_func("le-w!", lewstore); bind_func("le-l!", lelstore); bind_func("le-w@", lewfetch); bind_func("le-l@", lelfetch); }
#include "stdafx.h" #include "SysCalls.h" #include "Modules.h" #include "SC_FUNC.h" void default_syscall(); static func_caller *null_func = bind_func(default_syscall); static func_caller* sc_table[1024] = { null_func, bind_func(sys_process_getpid), null_func, bind_func(sys_process_exit), null_func, //4 null_func, null_func, null_func, null_func, null_func, //9 null_func, null_func, null_func, null_func, null_func, //14 null_func, null_func, null_func, null_func, null_func, //19 null_func, null_func, bind_func(sys_process_exit), null_func, null_func, //24 null_func, null_func, null_func, null_func, null_func, //29 null_func, null_func, null_func, null_func, null_func, //34 null_func, null_func, null_func, null_func, null_func, //39 null_func, bind_func(sys_ppu_thread_exit), null_func, bind_func(sys_ppu_thread_yield), bind_func(sys_ppu_thread_join), //44 bind_func(sys_ppu_thread_detach), bind_func(sys_ppu_thread_get_join_state), bind_func(sys_ppu_thread_set_priority), bind_func(sys_ppu_thread_get_priority), bind_func(sys_ppu_thread_get_stack_information), //49 bind_func(sys_ppu_thread_stop), bind_func(sys_ppu_thread_restart), bind_func(sys_ppu_thread_create), null_func, null_func, //54 null_func, null_func, null_func, null_func, null_func, //59 null_func, null_func, null_func, null_func, null_func, //64 null_func, null_func, null_func, null_func, null_func, //69 null_func, null_func, null_func, null_func, null_func, //74 null_func, null_func, null_func, null_func, null_func, //49 null_func, null_func, null_func, null_func, null_func, //84 null_func, null_func, null_func, null_func, null_func, //89 bind_func(sys_semaphore_create), bind_func(sys_semaphore_destroy), bind_func(sys_semaphore_wait), bind_func(sys_semaphore_trywait), bind_func(sys_semaphore_post), //94 bind_func(sys_lwmutex_create), bind_func(sys_lwmutex_destroy), bind_func(sys_lwmutex_lock), bind_func(sys_lwmutex_trylock), bind_func(sys_lwmutex_unlock), //99 bind_func(sys_mutex_create), bind_func(sys_mutex_destroy), bind_func(sys_mutex_lock), bind_func(sys_mutex_trylock), bind_func(sys_mutex_unlock), //104
#include "stdafx.h" #include "SysCalls.h" #include "Modules.h" #include "SC_FUNC.h" namespace detail{ template<> bool CheckId(u32 id, ID*& _id,const std::string &name) { return Emu.GetIdManager().CheckID(id) && (_id = &Emu.GetIdManager().GetID(id))->m_name == name; } } void default_syscall(); static func_caller *null_func = bind_func(default_syscall); static func_caller* sc_table[1024] = { null_func, bind_func(sys_process_getpid), //1 (0x001) null_func,//bind_func(sys_process_wait_for_child), //2 (0x002) ROOT bind_func(sys_process_exit), //3 (0x003) null_func,//bind_func(sys_process_get_status), //4 (0x004) DBG null_func,//bind_func(sys_process_detach_child), //5 (0x005) DBG // Unused: 6-11 null_func, null_func, null_func, null_func, null_func, null_func, bind_func(sys_process_get_number_of_object), //12 (0x00B) bind_func(sys_process_get_id), //13 (0x00C) null_func,//bind_func(sys_process_is_spu_lock_line_reservation_address), //14 (0x00D)
#include "stdafx.h" #include "SysCalls.h" #include "Modules.h" #include "SC_FUNC.h" void default_syscall(); static func_caller *null_func = bind_func(default_syscall); static func_caller* sc_table[1024] = { null_func, bind_func(sys_process_getpid), null_func, bind_func(sys_process_exit), null_func, //4 null_func, null_func, null_func, null_func, null_func, //9 null_func, null_func, bind_func(sys_process_get_number_of_object), bind_func(sys_process_get_id), null_func, //14 null_func, null_func, null_func, bind_func(sys_process_getppid), null_func, //19 null_func, null_func, bind_func(sys_process_exit), null_func, null_func, //24 null_func, null_func, null_func, null_func, null_func, //29 bind_func(sys_process_get_paramsfo), null_func, null_func, null_func, null_func, //34 null_func, null_func, null_func, null_func, null_func, //39 null_func, //40 (0x028) bind_func(sys_ppu_thread_exit), //41 (0x029) null_func, //42 (0x02A) bind_func(sys_ppu_thread_yield), //43 (0x02B) bind_func(sys_ppu_thread_join), //44 (0x02C) bind_func(sys_ppu_thread_detach), //45 (0x02D) bind_func(sys_ppu_thread_get_join_state), //46 (0x02E) bind_func(sys_ppu_thread_set_priority), //47 (0x02F) bind_func(sys_ppu_thread_get_priority), //48 (0x030) bind_func(sys_ppu_thread_get_stack_information), //49 (0x031) bind_func(sys_ppu_thread_stop), //50 (0x032) bind_func(sys_ppu_thread_restart), //51 (0x033) bind_func(sys_ppu_thread_create), //52 (0x034)
return true; } } return false; } bool Module::UnLoad(u32 id) { return UnloadFunc(id); } static func_caller* sc_table[1024] = { null_func, bind_func(sys_process_getpid), null_func, bind_func(sys_process_exit), null_func, //4 null_func, null_func, null_func, null_func, null_func, //9 null_func, null_func, null_func, null_func, null_func, //14 null_func, null_func, null_func, null_func, null_func, //19 null_func, null_func, bind_func(sys_process_exit), null_func, null_func, //24 null_func, null_func, null_func, null_func, null_func, //29 null_func, null_func, null_func, null_func, null_func, //34 null_func, null_func, null_func, null_func, null_func, //39 null_func, bind_func(sys_ppu_thread_exit), null_func, bind_func(sys_ppu_thread_yield), bind_func(sys_ppu_thread_join), //44 bind_func(sys_ppu_thread_detach), bind_func(sys_ppu_thread_detach), bind_func(sys_ppu_thread_get_join_state), bind_func(sys_ppu_thread_set_priority), bind_func(sys_ppu_thread_get_priority), //49 bind_func(sys_ppu_thread_stop), bind_func(sys_ppu_thread_restart), bind_func(sys_ppu_thread_create), null_func, null_func, //54 null_func, null_func, null_func, null_func, null_func, //59 null_func, null_func, null_func, null_func, null_func, //64 null_func, null_func, null_func, null_func, null_func, //69 null_func, null_func, null_func, null_func, null_func, //74 null_func, null_func, null_func, null_func, null_func, //49
_sys_fs_init() { sys_fs.AddFunc(0x718bf5f8, bind_func(cellFsOpen)); sys_fs.AddFunc(0x4d5ff8e2, bind_func(cellFsRead)); sys_fs.AddFunc(0xecdcf2ab, bind_func(cellFsWrite)); sys_fs.AddFunc(0x2cb51f0d, bind_func(cellFsClose)); sys_fs.AddFunc(0x3f61245c, bind_func(cellFsOpendir)); sys_fs.AddFunc(0x5c74903d, bind_func(cellFsReaddir)); sys_fs.AddFunc(0xff42dcc3, bind_func(cellFsClosedir)); sys_fs.AddFunc(0x7de6dced, bind_func(cellFsStat)); sys_fs.AddFunc(0xef3efa34, bind_func(cellFsFstat)); sys_fs.AddFunc(0xba901fe6, bind_func(cellFsMkdir)); sys_fs.AddFunc(0xf12eecc8, bind_func(cellFsRename)); sys_fs.AddFunc(0x2796fdf3, bind_func(cellFsRmdir)); sys_fs.AddFunc(0x7f4677a8, bind_func(cellFsUnlink)); sys_fs.AddFunc(0xa397d042, bind_func(cellFsLseek)); }