void hypervisor_call(guest* vm, uint32_t imm16) { rf_elr_hyp_write(rf_elr_hyp_read() - 4); switch(imm16) { //monitor print vm case 0x1: printmi(vm->id, d_hypervisor_call, "hypervisor call, monitor print vm"); monitor_print(&vm->mon); break; //monitor print sys case 0x2: printmi(vm->id, d_hypervisor_call, "hypervisor call, monitor print sys"); monitor_print(&sys_monitor); break; case 0x3: printmi(vm->id, d_hypervisor_call, "hypervisor call, monitor print all"); printm(d_monitor, "================MON_SYS==================="); monitor_print(&sys_monitor); printm(d_monitor, "================MON_VM===================="); monitor_print(&vm->mon); printm(d_monitor, "=========================================="); break; default: printm(d_hypervisor_call, "error hypervisor call, imm = %d", imm16); break; } }
// AVS // load globals to 'globals' // in buf must be a [global] part of input file int TMapLoader::LoadGlobal(string& buf) { char wbuf[128]; while ( buf.length() ) { wbuf[0]=0; if (!getline(buf,wbuf,sizeof(wbuf))) break; if ( wbuf[0]==0 ) break; char* Name = strtok(wbuf, TOKEN_DELIMITERS); if ( stricmp(Name, "[global]")==0 ) continue; char* Value = strtok(NULL, TOKEN_DELIMITERS); if ( Value == NULL ) { // cerr << "[global] -> no value for " << Name << endl; printm(0, FALSE, MSG_KEYNOVAL, Name); continue; }; int val = atoi(Value); if ( val > 0 && val <= 0xff ) { if ( !KeyTrans.AddGlobalDef(val, Name)) return 0; } else { // cerr << "[global] -> bad value for " << Name << endl; printm(0, FALSE, MSG_KEYBADVAL, Name); continue; }; }; return 1; };
int main( int argc, char **argv ) { int ret; if( getuid() ) { printf("You must be root to run the MOL debugger\n"); return 1; } mregs = &sv.mregs; res_manager_init(0, argc, argv ); atexit( res_manager_cleanup ); /* Initialize socket and connect to MOL */ sv.fd = -1; do_connect(); symbols_init(); monitor_init(); cmdline_init(); install_monitor_cmds(); printm("Mac-on-Linux debugger %s, ", MOL_RELEASE); printm("(C) 2001 Samuel Rydh <*****@*****.**>\n"); atexit(exit_hook); for( ;; ) { if( (ret = mon_debugger()) == kDbgExit ) break; send_dgram1( sv.fd, kMDG_debug_action, ret ); } send_dgram( sv.fd, kMDG_disconnect ); return 0; }
int main ( int argc, char *argv[] ) { int N; float *donees; float *sdetail; //Read N from standard input scanf("%d", &N); //Create arrays of size N donees = (float *)malloc(N* sizeof(*donees)); sdetail = (float *)malloc(N* sizeof(*sdetail)); //Fill the values of initial array from stdin for(int i=0; i<N; i++) { scanf("%f", &donees[i]); } printm(donees, N); haar(donees, sdetail, N); printm(sdetail, N); delete donees; delete sdetail; return EXIT_SUCCESS; }
static int __dbg rvec_break( int dummy_rvec, int break_flag ) { switch( break_flag ) { case BREAK_RFI: if( (molcpu.break_flags & BREAK_USER) ) { if( !(mregs->msr & MSR_PR) ) return 0; clear_break_flag( BREAK_USER ); } printm("BREAK-RFI (%08lX)\n", mregs->nip ); break; case BREAK_EA_PAGE: /* breakpoint might not have been written */ printm("ea-break at %08lX\n", mregs->nip ); restore_breakpoints(); setup_breakpoints(); break; case BREAK_SINGLE_STEP: if( molcpu.break_flags & BREAK_SINGLE_STEP_CONT ) { if( !is_stop_breakpoint( mregs->nip ) ) return 0; clear_break_flag( BREAK_SINGLE_STEP_CONT ); } //setup_breakpoints(); break; default: printm("rvec_break: Unknown break flag %d\n", break_flag ); break; } stop_emulation(); clear_break_flag( break_flag ); return 0; }
void cd_scsi_init( void ) { bdev_desc_t *bdev = NULL; if( !get_bool_res("generic_scsi_for_cds") ) { printm(" Generic SCSI for CD/DVDs disabled\n"); return; } if( is_classic_boot() && get_str_res("cdboot") ) { printm(" CD-SCSI disabled (CD-booting)\n"); return; } while( (bdev=bdev_get_next_volume(bdev)) ) { int flags; if( !(bdev->flags & BF_CD_ROM) ) continue; flags = ioctl( bdev->fd, CDROM_GET_CAPABILITY ); if( flags == -1 || !(flags & CDC_GENERIC_PACKET) ) continue; bdev_claim_volume( bdev ); add_device( bdev ); printm(" SCSI %-16s [CDROM/DVD driver]\n", bdev->dev_name ); } x.completion_aev = add_aevent_handler( complete ); }
static int rvec_priv_inst( int dummy_rvec, ulong inst ) { int op, op_ext, b1, b2, b3; /* unhandled privileged instruction in supervisor mode */ /* IMPORTANT: The GPRs are not available here! */ op = OPCODE_PRIM( inst ); op_ext = OPCODE_EXT( inst ); b1 = B1( inst ); /* bit 6-10 */ b2 = B2( inst ); /* bit 11-15 */ b3 = B3( inst ); /* bit 16-20 */ switch( OPCODE(op,op_ext) ) { case OPCODE( 31, 370 ): /* tlbia (opt.) */ /* not implemented on the 601,603,604,G3 (G4?) */ break; case OPCODE( 31, 470 ): /* dcbi rA,rB -- rA=b2 rB=b3 */ printm("dcbi treated as nop\n"); mregs->nip += 4; return 0; default: printm("Unknown privileged instruction, opcode %lX\n", inst); stop_emulation(); break; } mac_exception( 0x700, MOL_BIT(13) ); return 0; }
void adb_poll( void ) { unsigned char buf[32]; adb_device_t *ad; int len; /* printm("adb_poll\n"); */ for( ad=root; ad; ad=ad->next ) { if( /* ad->service_req_enable && */ ad->service_req ){ if( !ad->read_reg_fp ) continue; if( (len = ad->read_reg_fp( ad, 0, buf )) != 0 ) { #if 0 { int i; printm("ADB event packet: "); for(i=0; i< len; i++) printm("%02X",buf[i] ); printm("\n"); } #endif via_cuda_set_reply_buffer( (char *) buf, len ); break; } else { /* this is a programming error in adb device driver */ printm("ADB service request -- BUT NO DATA!\n"); } } } }
IOReturn MolEnet::setPowerState( unsigned long powerStateOrdinal, IOService *whatDevice ) { IOReturn ret = IOPMAckImplied; //printm("MolEnet: setPowerState %d\n", powerStateOrdinal); if( currentPowerState == powerStateOrdinal ) return IOPMAckImplied; switch( powerStateOrdinal ) { case 0: printm("MolEnet: powering off\n"); currentPowerState = powerStateOrdinal; break; case 1: printm("MolEnet: powering on\n"); currentPowerState = powerStateOrdinal; break; default: ret = IOPMNoSuchState; break; } return ret; }
static void kbd_write_reg( adb_device_t *ad, int reg, char *data, int len ) { switch( reg ){ case 0: /* key data (?) */ printm("Keyboard write reg 0\n"); break; case 2: /* led register */ printm("Keyboard write LED register\n"); break; case 3: /* control_register (two bytes data guaranteed) */ if( len != 2 ) return; switch( data[1] ){ #if 0 case 2: /* handler 2, left/right keys same keycodes */ case 3: /* handler 3, left/right leys different keycodes */ ad->handler_id = data[1]; break; #endif default: break; } break; } }
static int vopen( video_desc_t *vm ) { XDGADevice *dev; int mask; if( dga.is_open ) return 1; if( !XDGAOpenFramebuffer( x11.disp, x11.screen ) ) { printm("XDGAOpenFramebuffer failed\n"); return 1; } if( !(dev=XDGASetMode( x11.disp, x11.screen, (int)vm->module_data )) ) { printf("XDGASetMode failure\n"); XDGACloseFramebuffer( x11.disp, x11.screen ); return 1; } printm("%d x %d: %d (%08x/%x)\n", vm->w, vm->h, vm->depth, (int)dev->data, vm->rowbytes ); vm->lvbase = (char *)dev->data; vm->mmu_flags = get_bool_res("use_fb_cache")? MAPPING_FORCE_CACHE : MAPPING_MACOS_CONTROLS_CACHE; vm->map_base = 0; XFree( dev ); dga.is_open = 1; use_hw_cursor(0); mask = KeyPressMask | KeyReleaseMask; if( mouse_activate(1) ) mask |= ButtonPressMask | ButtonReleaseMask | PointerMotionMask; XDGASelectInput( x11.disp, x11.screen, mask ); return 0; }
static int add_netdev( int index, int irq ) { me = malloc( sizeof(mol_enet2_t) ); memset( me, 0, sizeof(mol_enet2_t) ); if( find_packet_driver(index, &me->iface) ) goto bail; me->running = 0; me->irq = irq; me->iface.inject_packet = inject_packet; if( PD.open(&IFACE) ) { printm("Failed to initialize the %s-<%s> device\n", PD.name, IFACE.iface_name ); goto bail; } netif_print_blurb( &me->iface, -1 ); if( (me->rx_async=add_async_handler(IFACE.fd, POLLIN | POLLPRI, rx_packet_handler,0)) < 0 ) printm("add_async_handler failed!\n"); return 0; bail: free( me ); me = NULL; return 1; }
void print_btrace_sym( ulong addr, const char *sym_filename ) { char ch, buf[80]; ulong v, v2=0; int found=0; FILE *f=NULL; if( sym_filename ) f = fopen(sym_filename, "ro"); buf[0]=0; while( f && fscanf(f, "%lx %c ", &v, &ch) == 2 ) { if( v <= addr ) { v2 = v; if(fscanf( f, "%79s\n", buf ) != 1) { printm("Error reading from backtrace symbol\n"); fclose(f); return; } continue; } if( buf[0] ) { printm("%s + 0x%lx\n", buf, addr - v2 ); found=1; } break; } if( !found ) printm("0x%08lx\n", addr ); if( f ) fclose(f); }
static int vopen( video_desc_t *vm ) { struct fb_var_screeninfo var; struct fb_fix_screeninfo fix; if( cv->is_open || !cv->has_console ) return 1; /* Put console in graphics mode and open display */ console_set_gfx_mode(1); var = *(struct fb_var_screeninfo*)vm->module_data; var.activate = FB_ACTIVATE_NOW; if( ioctl(cv->fd, FBIOPUT_VSCREENINFO, &var) < 0 ) { perrorm("Could not set VSCREENINFO\n"); goto bail; } /* is this panning necessary? */ var.xoffset = 0; var.yoffset = 0; ioctl(cv->fd, FBIOPAN_DISPLAY, &var); if( ioctl(cv->fd, FBIOGET_FSCREENINFO, &fix) < 0) { perrorm("Could not get FSCREENINFO!\n"); goto bail; } if( vm->offs != ((ulong)fix.smem_start & 0xfff) ) { printm("Framebuffer offset has changed!\n"); goto bail; } if( vm->rowbytes != fix.line_length ) { printm("Rowbytes has changed (was %d, now %d)!\n", vm->rowbytes, fix.line_length); goto bail; } /* runtime fields */ vm->map_base = (ulong)fix.smem_start & ~0xfff; vm->lvbase = map_phys_mem( NULL, vm->map_base, FBBUF_SIZE(vm), PROT_READ | PROT_WRITE ); vm->mmu_flags = MAPPING_PHYSICAL; if( is_newworld_boot() || is_oldworld_boot() ) vm->mmu_flags |= MAPPING_DBAT; /* Use cache with write through bit set */ vm->mmu_flags |= cv->use_cache? MAPPING_FORCE_CACHE : MAPPING_MACOS_CONTROLS_CACHE; use_hw_cursor(0); /* no hw-cursor for now */ cv->is_open = 1; cv->vmode = *vm; return 0; bail: console_set_gfx_mode(0); return 1; }
int minitialize() //initialize the winsock server { // Initialize Winsock iResult = WSAStartup(MAKEWORD(2,2), &wsaData); if (iResult != 0) { printm("WSAStartup failed with error: %d\n", iResult); return 1; } ZeroMemory(&hints, sizeof(hints)); hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP; hints.ai_flags = AI_PASSIVE; // Resolve the server address and port iResult = getaddrinfo(NULL, DEFAULT_PORT, &hints, &result); if ( iResult != 0 ) { printm("getaddrinfo failed with error: %d\n", iResult); WSACleanup(); return 1; } // Create a SOCKET for connecting to server ListenSocket = socket(result->ai_family, result->ai_socktype, result->ai_protocol); if (ListenSocket == INVALID_SOCKET) { printm("socket failed with error: %ld\n", WSAGetLastError()); freeaddrinfo(result); WSACleanup(); return 1; } // Setup the TCP listening socket iResult = bind( ListenSocket, result->ai_addr, (int)result->ai_addrlen); if (iResult == SOCKET_ERROR) { printm("bind failed with error: %d\n", WSAGetLastError()); freeaddrinfo(result); closesocket(ListenSocket); WSACleanup(); return 1; } freeaddrinfo(result); iResult = listen(ListenSocket, SOMAXCONN); if (iResult == SOCKET_ERROR) { printm("listen failed with error: %d\n", WSAGetLastError()); closesocket(ListenSocket); WSACleanup(); return 1; } unsigned long b=1; ioctlsocket(ClientSocket,FIONBIO,&b); }
void mainloop_start( void ) { int err; _spr_changed(); struct timespec tv; tv.tv_sec = 0; tv.tv_nsec = 10000000; /* must be called once before the mainloop is entered */ molcpu_mainloop_prep(); __stop = (get_bool_res("debug_stop") == 1); while( __stop != kQuit ) { switch( __stop ) { case kGo: set_print_guard( print_guard ); molcpu_mainloop(); set_print_guard( NULL ); assert( __stop ); break; #ifdef CONFIG_DEBUGGER case kStop: { FREEZE_TIMERS; refresh_debugger(); while( __stop == kStop ) { debugger_nub_poll(); nanosleep(&tv, NULL); } RETUNE_TIMERS; break; } #endif case kSaveSession: printm("Saving the session...\n"); if( !(err = save_session_now()) ) { printm("The session was saved successfully\n"); __stop = kQuit; } else if( err == 1 ) { static int tries=0; __stop = kGo; if( ++tries < 200 ) { schedule_save_session(1000); } else { printm("Did not reach a state where the session could be saved\n"); tries=0; } } else { __stop = kGo; } break; } } }
void HMM::print_parameters() { std::cout << "initial distribution:" << std::endl; printv(hs, nu); std::cout << "transition distribution:" << std::endl; printm(hs, hs, Q); std::cout << "emission distribution:" << std::endl; printm(hs, os, g); }
static int rc_nop( ulong args[], ulong ret[] ) { int i; printm(">>> Unimplemented RTAS '%08lx' (%d/%d)\n", s_rtas_token, s_rtas_nargs, s_rtas_nret ); for( i=0; i<s_rtas_nargs; i++ ) printm(" %08lX ", args[i] ); printm("\n"); return 0; /* -1 might be better... */ }
static void dump_cmd_name( scsi_ureq_t *u ) { int i; for( i=0; i<sizeof(cmd_names)/sizeof(cmd_names[0]); i++ ) { if( u->cdb[0] == cmd_names[i].cmd ) { printm( C_GREEN "%-20s"C_NORMAL, cmd_names[i].name ); return; } } printm(C_RED "Unknown SCSI command %02x" C_NORMAL, u->cdb[0] ); }
static int fbdev_init( video_module_t *m ) { char *name; memset( cv, 0, sizeof(cv[0]) ); if( !get_bool_res("enable_console_video") ) return 1; if( !(name=get_str_res("fbdev")) ) name = "/dev/fb0"; if( (cv->fd=open(name, O_RDWR)) < 0 ) { printm("Error opening frame buffer device '%s'\n",name ); return 1; } fcntl( cv->fd, F_SETFD, FD_CLOEXEC ); cv->startup_mode_ok = !ioctl( cv->fd, FBIOGET_VSCREENINFO, &cv->startup_var ) && !ioctl( cv->fd, FBIOGET_FSCREENINFO, &cv->startup_fix ); if( !cv->startup_mode_ok ) printm("Warning: Startup video mode query failed\n"); if( !console_init() ) { close( cv->fd ); return 1; } if( setup_video_modes() ) { printm("No usable console video modes were found\n"); close( cv->fd ); return 1; } cv->cmap.start = 0; cv->cmap.len = 256; cv->color_table = (short*)malloc( cv->cmap.len * sizeof(short) * 3 ); cv->cmap.red = (unsigned short *) cv->color_table; cv->cmap.green = (unsigned short *) (cv->color_table + 256); cv->cmap.blue = (unsigned short *) (cv->color_table + 512); cv->cmap.transp = NULL; setup_gamma(); cv->blank = 0; /* VESA mode; assume power is initially on */ if( (cv->use_cache = (get_bool_res("use_fb_cache") != 0)) ) printm("Cache enabled for console-video\n"); cv->initialized = 1; add_key_actions( console_keys, sizeof(console_keys) ); return 0; }
static int __dcmd cmd_ks( int argc, char **argv ) { int i,j; for( j=0; j<=2; j++ ) { for( i=0; i<96; i++ ) printm("-"); printm("\n"); if( j<2 ) print_one_line( j ); } return 0; }
static void dump_sense( int sense ) { int i; for( i=0; i<sizeof(sense_tab)/sizeof(sense_tab[0]); i++ ) { if( sense_tab[i].sense == sense ) { printm("%s%s\n" C_NORMAL, sense_tab[i].critical ? C_RED : C_NORMAL, sense_tab[i].error ); return; } } printm( C_RED "Sense %x\n" C_NORMAL, sense ); }
/* Tries to read the bus frequency from /proc/device-tree/cpus/<CPU>@0/bus-frequency * Returns the frequency or 0 on error */ ulong get_bus_frequency( void ) { static ulong busf = 0; int name_len; char buf[80] = "/proc/device-tree/cpus/"; FILE *f; DIR *d; struct dirent *procdir; if( !busf ) { /* Open /proc/device-tree/cpus */ d = opendir(buf); if ( d == NULL ) { printm ("Warning: Unable to open %s\n",buf); return 0; } /* Each directory is a cpu, find @0 */ while ( (procdir = readdir(d)) != NULL ) { name_len = strlen(procdir->d_name); if ( name_len > 2 && (procdir->d_name)[name_len - 1] == '0' && (procdir->d_name)[name_len - 2] == '@') break; } closedir(d); /* Open bus-frequency in that directory */ if (procdir != NULL) { strncat(buf, procdir->d_name, 79); strncat(buf, "/bus-frequency", 79); f = fopen(buf, "r"); if ( f == NULL) { printm ("Warning: Couldn't open the cpu device tree node!\n"); return 0; } if (fread(&busf, 4, 1, f) != 1) { printm ("Warning: Couldn't read from the cpu device tree node!\n"); fclose(f); return 0; } fclose(f); } else { printm ("Warning: Couldn't find cpu in device tree!\n"); return 0; } } return busf; }
UInt32 MolEnet::outputPacket( struct mbuf *pkt, void *param ) { struct IOPhysicalSegment segVector[2]; int n; assert( pkt && netifEnabled ); //printm("outputPacket %d\n", tx_tail ); if( tx_ring[tx_tail].psize ) { /* Ring full. The txIRQ should call transmitQueue->service to unstall * the queue. At the moment we transmit each packet synchronously * to the linux side. Thus the ring will never be full... */ printm("output stalled\n"); return kIOReturnOutputStall; } n = txMBufCursor->getPhysicalSegmentsWithCoalesce( pkt, segVector ); if( n < 0 || n > 2 ) { printm("getPhysicalSegments returned an error (%d)\n", n ); freePacket(pkt); return kIOReturnOutputDropped; } tx_ring[tx_tail].flags = 0; if( n == 2 ) { tx_of_ring[tx_tail].buf = segVector[1].location; tx_of_ring[tx_tail].bsize = segVector[1].length; tx_of_ring[tx_tail].psize = segVector[1].length; tx_of_ring[tx_tail].flags = 0; tx_ring[tx_tail].flags = kEnet2SplitBufferFlag; } tx_ring[tx_tail].buf = segVector[0].location; tx_ring[tx_tail].bsize = segVector[0].length; eieio(); // gcc scheduling barrier tx_ring[tx_tail].psize = segVector[0].length; // Increase tail marker tx_tail = (tx_tail + 1) & TX_MASK; if( OSI_Enet2Kick() ) printm("transmission error\n"); freePacket( pkt ); return kIOReturnOutputSuccess; }
/* read register by GDB */ void ARMV5::regRead(uint32_t* data, uint16_t index) { if (index <= FPS) { rfRead(data, index, CPSR_MODE(rf.cpsr)); if (index == PC) { *data -= 4; } } else { switch (index) { case PID: *data = cp15.c13_context; break; case SYS: *data = cp15.c1_sys; break; case TTBR: *data = cp15.c2_ttbr; break; // case DFSR: *data = cp15.c5_dfsr; break; // case IFSR: *data = cp15.c5_ifsr; break; // case FAR: *data = cp15.c6_far; break; case DOM: *data = 0; for (int i = 0; i < 16; i++) { *data |= (cp15.c3_domain[i] << (i * 2)); } break; //case INST: *data = inst_arm; break; //case CYCLE: *data = cycle_total; break; case INST: *data = 0; printm(core_id, d_armv5, "gdb INST not implemented yet"); break; case CYCLE: *data = 0; printm(core_id, d_armv5, "gdb CYCLE not implemented yet"); break; default: *data = 0; printm(core_id, d_armv5, "no such register"); break; } } }
static int __dcmd cmd_rvecs( int argc, char **argv ) { #ifdef COLLECT_RVEC_STATISTICS priv_rvec_entry_t *p = gRVECtable; int i; for( i=0; i<NUM_RVECS; i++, p++ ) if( p->rvec != rvec_bad_vector ) printm("RVEC %02d %-26s: %d\n", i, p->name ? p->name : "----", p->dbg_count ); #else printm("Statistics is not collected\n"); #endif return 0; }
int main() { int M[N][N] = {{1, 2, -1, -4, -20}, {-8, -3, 4, 2, 1}, {3, 8, 10, 1, 3}, {-4, -1, 1, 7, -6}, {1, 3, 4, 2, 6}}; printm(M); printf("\n\n\n"); rotateLayers(M); printm(M); return 0; }
static int get_device_guid(char *name, int name_size, char *actual_name, int actual_name_size) { HKEY control_net_key; DWORD len; int i, found = -1; char enum_name[256]; char connection_string[256]; HKEY connection_key; char name_data[256]; DWORD name_type; const char name_string[] = "Name"; if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, NETWORK_CONNECTIONS_KEY, 0, KEY_READ, &control_net_key) != ERROR_SUCCESS) { printm("Error opening registry key: %s\n", NETWORK_CONNECTIONS_KEY); return -1; } for(i = 0; found < 0; i++) { len = sizeof(enum_name); if(RegEnumKeyEx(control_net_key, i, enum_name, &len, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) { printm("Error enumerating registry subkeys of key: %s\n", NETWORK_CONNECTIONS_KEY); break; } snprintf(connection_string, sizeof(connection_string), "%s\\%s\\Connection", NETWORK_CONNECTIONS_KEY, enum_name); if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, connection_string, 0, KEY_READ, &connection_key) != ERROR_SUCCESS) continue; len = sizeof(name_data); if(!(RegQueryValueEx(connection_key, name_string, NULL, &name_type, (BYTE *)name_data, &len) != ERROR_SUCCESS || name_type != REG_SZ || is_tap_win32_dev(enum_name) != 0)) { printm("Found TAP device named '%s'\n", name_data); snprintf(name, name_size, "%s", enum_name); if(actual_name) snprintf(actual_name, actual_name_size, "\"%s\"", name_data); found = i; } RegCloseKey(connection_key); } RegCloseKey(control_net_key); return(found < 0 ? -1 : 0); }
// AVS // load [charmap ...] part to xlat int TMapLoader::LoadCharMap(string buf) { char wbuf[128]; char charmapname[128]; charmapname[0] = 0; // xlat.init(); now it done by KeyTranslator::Load() while ( buf.length() ) { wbuf[0]=0; if (!getline(buf,wbuf,sizeof(wbuf))) break; if ( wbuf[0]==0 ) break; if ( strnicmp(wbuf,"[charmap",8)==0 ) { strcpy(charmapname,wbuf); continue; }; char * host = strtok(wbuf, " "); char * console = strtok(NULL, " "); int bHost; int bConsole; if ( host == NULL || console == NULL ) { // cerr << charmapname << " -> Bad structure" << endl; printm(0, FALSE, MSG_KEYBADSTRUCT, charmapname); return 0; }; if ( strlen(host) > 1 && host[0] == '\\' ) bHost = getbyte(host+1); else bHost = (unsigned char)host[0]; if ( strlen(console) > 1 && console[0] == '\\' ) bConsole = getbyte(console+1); else bConsole = (unsigned char)console[0]; if ( bHost <= 0 || bConsole <= 0 ) { // cerr << charmapname << " -> Bad chars? " // << host << " -> " << console << endl; printm(0, FALSE, MSG_KEYBADCHARS, charmapname, host, console); return 0; }; // xlat.table[bHost] = bConsole; Charmap.modmap(bHost, 'B', bConsole); }; return (Charmap.enabled = 1); return 1; };
/* osip_enet2_ring_setup( int ring, int ring_mphys, int n_el ) */ static int osip_enet2_ring_setup( int sel, int *params ) { enet2_ring_t *r = transl_mphys( params[1] ); if( me->running ) { printm("enet2 busy!\n"); return -1; } if( !r ) return -1; switch( params[0] ) { case kEnet2SetupRXRing: me->rx_ring = r; me->rx_tail = 0; me->rx_mask = params[2] - 1; break; case kEnet2SetupTXRing: me->tx_ring = r; me->tx_head = 0; me->tx_mask = params[2] - 1; break; case kEnet2SetupRXOverflowRing: me->rx_of_ring = r; break; case kEnet2SetupTXOverflowRing: me->tx_of_ring = r; break; } return 0; }