Exemplo n.º 1
0
static void
skip_limbo(void)
#line 1481 "ctangle.w"
{
char c;
while(1){
if(loc> limit&&get_line()==0)return;
*(limit+1)= '@';
while(*loc!='@')loc++;
if(loc++<=limit){
c= *loc++;
if(ccode[(eight_bits)c]==new_section)break;
switch(ccode[(eight_bits)c]){
case translit_code:/*93:*/
#line 1507 "ctangle.w"

while(xisspace(*loc)&&loc<limit)loc++;
loc+= 3;
if(loc> limit||!xisxdigit(*(loc-3))||!xisxdigit(*(loc-2))
||(*(loc-3)>='0'&&*(loc-3)<='7')||!xisspace(*(loc-1)))
err_print("! Improper hex number following @l");

else{
unsigned i;
char*beg;
sscanf(loc-3,"%x",&i);
while(xisspace(*loc)&&loc<limit)loc++;
beg= loc;
while(loc<limit&&(xisalpha(*loc)||xisdigit(*loc)||*loc=='_'))loc++;
if(loc-beg>=translit_length)
err_print("! Replacement string in @l too long");

else{
strncpy(translit[i-0200],beg,loc-beg);
translit[i-0200][loc-beg]= '\0';
}
}

/*:93*/
#line 1491 "ctangle.w"
;break;
case format_code:case'@':break;
case control_text:if(c=='q'||c=='Q'){
while((c= skip_ahead())=='@');
if(*(loc-1)!='>')
err_print("! Double @ should be used in control text");

break;
}
default:err_print("! Double @ should be used in limbo");

}
}
}
}
int vtq_imageconv_init(struct vtq_imageconv_state **vtq_imageconv_out,
		struct vtq_vce *vtq_vce,
		struct module *module,
		struct device *device,
		struct proc_dir_entry *proc_vcedir)
{
	struct vtq_imageconv_state *out;
	int s;

	(void) proc_vcedir;

	out = kmalloc(sizeof(*out), GFP_KERNEL);
	if (out == NULL) {
		err_print("kmalloc failure\n");
		goto err_kmalloc_vtq_imageconv_state;
	}

	out->vtq = vtq_create_context(vtq_vce);
	if (out->vtq == NULL) {
		err_print("failed to create VTQ context\n");
		goto err_vtq_create_context;
	}

	/* Mark that we haven't received the blob (via
	 * request_firmware) yet */
	out->image = NULL;
	out->want_image_via_vtqinit = 0;
	atomic_set(&out->task_get_count, 0);

	out->device = device;
	s = request_firmware_nowait(module, 1,
			"bcmvtq_imageconv", out->device,
			GFP_KERNEL, out, _fw_cont);
	if (s != 0) {
		err_print("request firmware failed\n");
		goto err_request_firmware;
	}

	/* success */
	*vtq_imageconv_out = out;
	return 0;

	/* error exit paths follow */

err_request_firmware:

	vtq_destroy_context(out->vtq);
err_vtq_create_context:

	kfree(out);
err_kmalloc_vtq_imageconv_state:

	return -ENOENT;
}
Exemplo n.º 3
0
void
#line 87 "./cwebdir/comm-w2c.ch"
 prime_the_change_buffer P1H(void)
#line 254 "./cwebdir/common.w"
{
change_limit= change_buffer;
/*13:*/
#line 265 "./cwebdir/common.w"

while(1){
change_line++;
if(!input_ln(change_file))return;
if(limit<buffer+2)continue;
if(buffer[0]!='@')continue;
if(xisupper(buffer[1]))buffer[1]= tolower(buffer[1]);
if(buffer[1]=='x')break;
if(buffer[1]=='y'||buffer[1]=='z'||buffer[1]=='i'){
loc= buffer+2;
err_print("! Missing @x in change file");

}
}

/*:13*/
#line 256 "./cwebdir/common.w"
;
/*14:*/
#line 282 "./cwebdir/common.w"

do{
change_line++;
if(!input_ln(change_file)){
err_print("! Change file ended after @x");

return;
}
}while(limit==buffer);

/*:14*/
#line 257 "./cwebdir/common.w"
;
/*15:*/
#line 292 "./cwebdir/common.w"

{
change_limit= change_buffer+(limit-buffer);
strncpy(change_buffer,buffer,limit-buffer+1);
}

/*:15*/
#line 258 "./cwebdir/common.w"
;
}
Exemplo n.º 4
0
DMPAPI(void) uart_Close(void *vport)
{
	unsigned char lcr;
	SerialPort *port = (SerialPort *)vport;
	if (port == NULL) { err_print((char*)"%s: port is null.\n", __FUNCTION__); return; }
	
	if (port->InUse != 0)
	{
		// restore old IER & MCR
		uart_IntDisable(vport);
		io_DisableINT();
		{
			io_outpb(port->MCR, port->old_mcr); 
		}
		io_RestoreINT();
		irq_Close();
		
		// restore old LSB & MSB
#ifdef _VORTEX86EXC_UART_WORKAROUND
	/* To avoid Vortex86EX(D) write sync. issue. */
	io_DisableINT();
	{
		lcr = io_inpb(port->LCR);  
		io_outpb(port->LCR, 0x80); 
		
		do {
			io_outpb(port->DLLSB, port->old_lsb);
		} while (io_inpb(port->DLLSB) != port->old_lsb);
		
		do {
			io_outpb(port->DLMSB, port->old_msb);
		} while (io_inpb(port->DLMSB) != port->old_msb);
		
		io_inpb(0x80); // do IO delay
		io_outpb(port->LCR, lcr);  
	}
	io_RestoreINT();
#else
		_16550_DLAB_Out(port, port->DLLSB, port->old_lsb);
		_16550_DLAB_Out(port, port->DLMSB, port->old_msb);
#endif
		
		// restore old LCR & timeout
		uart_SetFormat(vport, port->old_lcr);
		uart_SetTimeOut(vport, port->old_TimeOut);
		
		vx86_uart_Close(port->com);
		if (io_Close() == false) err_print((char*)"Close IO lib error!!\n");
	}
	uart_Free(port);
}
Exemplo n.º 5
0
boolean get_control_text(void)
{ char c,* k=id_first=&mod_text[1]; /* points after last recorded character */
  do
    if ((*k++=*loc++)=='@')
      if ((c=*loc++)!='@')
      { if (c!='>')
	  err_print("! Control codes are forbidden in control text");
		     
	return (id_loc=k-1)==id_first;
      }
  while(loc<=limit);
  err_print("! Control text didn't end"); 
  return (id_loc=k)==id_first;
}
Exemplo n.º 6
0
static inline void block_all_sigs(void)
{
	sigset_t set;
	
	if( sigfillset(&set) == -1 ) {
		err_print("sigfillset");
		return;
	}
	
	if( sigprocmask(SIG_BLOCK,&set,NULL) == -1) {
		err_print("sigprocmask");
		return;
	}	
}
Exemplo n.º 7
0
static bool i2csw_Write(int dev, unsigned char val) {
    int i, databit;

    // send data byte
    for(i=0; i<8; i++)
    {
        databit = ((val & 0x80) == 0)? 0 : 1;
        set_pins(dev, 0, databit); timer_DelayMicroseconds(I2CSW_delay[dev]);  // set data bit
        set_pins(dev, 1, databit); timer_DelayMicroseconds(I2CSW_delay[dev]);  // send a clock
        set_pins(dev, 0, databit);
        val = val << 1;
    }
    
    // read ACK
    set_pins(dev, 0, 1); timer_DelayMicroseconds(I2CSW_delay[dev]);  // set SDA as input
    set_pins(dev, 1, 1); timer_DelayMicroseconds(I2CSW_delay[dev]);  // send a clock
    if (read_sda(dev) == 1)
    {
		err_print("receive no ACK after transmitting");
        return false;
    }
    set_pins(dev, 0, 1);
    
    return true;
}
Exemplo n.º 8
0
static int isp_open(struct inode *inode, struct file *filp)
{
	int ret = 0;

	isp_t *dev = kmalloc(sizeof(isp_t), GFP_KERNEL);
	if (!dev)
		return -ENOMEM;

	filp->private_data = dev;
	dev->lock = __SPIN_LOCK_UNLOCKED();
	dev->isp_status.status = 0;

	sema_init(&dev->irq_sem, 0);

	enable_isp_clock();

	ret =
	    request_irq(IRQ_ISP, isp_isr, IRQF_DISABLED | IRQF_SHARED,
			ISP_DEV_NAME, dev);
	if (ret) {
		err_print("request_irq failed ret = %d\n", ret);
		goto err;
	}

	disable_irq(IRQ_ISP);
	return 0;

err:
	if (dev)
		kfree(dev);
	return ret;
}
Exemplo n.º 9
0
void _imageconv_flush(vce_t *user,
		      struct vce *vce)
{
	int s;

	if (user->need_to_wait_for_imageconv) {
		dbg_print("Flushing unfinished imageconversions\n");
		s = vtq_imageconv_await(vce->vtq_imageconv,
				user->last_imageconv_job_id);
		if (s == -ERESTARTSYS) {
			int retried;
			dbg_print("Wait was interrupted by signal, will poll\n")
				;
			/* TODO: might be good to make blocking version of API
			 */
			retried = 0;
			while (s == -ERESTARTSYS && retried++ < 1000) {
				usleep_range(1000, 20000);
				s = vtq_imageconv_await(vce->vtq_imageconv,
						user->last_imageconv_job_id);
			}
			dbg_print("After %d tries, s = %d\n", retried, s);
		}

		if (s != 0)
			err_print("Failed to flush imageconv -- likely FATAL\n")
				;
	}
}
Exemplo n.º 10
0
DMPAPI(bool) usb_SetUSBPins(void *vusb, char port1, char pin1, char port2, char pin2)
{
	USB_Device *usb = (USB_Device *)vusb;
	if (usb == NULL) { err_print((char*)"%s: USB device is null.\n", __FUNCTION__); return false; }
	
	if (set_gpio_config_addr(GPIO_CONFIG_ADDR) == false)
	{
		err_print((char*)"%s: init USB-DEV DETECT and ONOFF pins fail.\n", __FUNCTION__);
		return false;
	}
	set_pin_in(port1, pin1);
	set_pin_out(port2, pin2);
	
	USB_Connect();
	return true;
}
Exemplo n.º 11
0
DMPAPI(void) usb_FlushWFIFO(void *vusb)
{
	USB_Device *usb = (USB_Device *)vusb;
	if (usb == NULL) { err_print((char*)"%s: USB device is null.\n", __FUNCTION__); return; }
	while (usb->xmit->count > 0);
	while (io_inpdw(usb->EP[2].InDLR) & 0x80000000L);
}
Exemplo n.º 12
0
DMPAPI(Line_Coding *) usb_GetLineCoding(void *vusb)
{
	USB_Device *usb = (USB_Device *)vusb;
	if (usb == NULL) { err_print((char*)"%s: USB device is null.\n", __FUNCTION__); return NULL; }
	
	return (Line_Coding*)&(usb->ling_coding);
}
Exemplo n.º 13
0
int
p_expand()
{
	uint64_t delta;
	uint_t nparts;
	struct dk_gpt *efi_label = cur_parts->etoc;

	if (cur_parts->etoc->efi_altern_lba == 1 ||
	    (cur_parts->etoc->efi_altern_lba >=
	    cur_parts->etoc->efi_last_lba)) {
		err_print("Warning: No expanded capacity is found.\n");
		return (0);
	}

	delta = efi_label->efi_last_lba - efi_label->efi_altern_lba;
	nparts = efi_label->efi_nparts;

	enter_critical();
	efi_label->efi_parts[nparts - 1].p_start += delta;
	efi_label->efi_last_u_lba += delta;
	efi_label->efi_altern_lba = cur_parts->etoc->efi_last_lba;
	exit_critical();

	fmt_print("The expanded capacity is added to the unallocated space.\n");
	return (0);
}
Exemplo n.º 14
0
/*
 * Name: init_loging_semaphore
 * Zweck: Initialisieren der Logging Semaphore
 * In-Parameter: -
 * Out-Parameter: -
 * Globale Variablen: sem_t* log_sem
 * Rückgabewert: -
 */
void init_logging_semaphore(void) {
	if ((log_sem = sem_open(SEM_NAME, O_CREAT, S_IRUSR | S_IWUSR, 1))
			== SEM_FAILED) {
		err_print("cannot create named semaphore");
		exit(EXIT_FAILURE); //WARNING / TODO Does not free used memory!
	} /* end if */
} /* end of init_logging_semaphore */
Exemplo n.º 15
0
static int _send_int(SerialPort *port, unsigned char* buf, int bsize)
{
	int i;
	unsigned long pretime;
	
	for (i = 0; i < bsize; i++)
	{
		if (port->TxTimeOut < 0) {
			while (QueueFull(port->xmit));
		} else {
			pretime = timer_NowTime();
			while (QueueFull(port->xmit) && (timer_NowTime() - pretime) < port->TxTimeOut); 
			
			if (QueueFull(port->xmit)) {
				if (UART_TIMEOUT_DEBUG)
					err_print((char*)"%s: COM%d transmit timeout.\n", __FUNCTION__, port->com + 1);
				if (!(port->ier & THREI)) io_outpb(port->IER, port->ier |= THREI);
				return i;
			}
		}
		
		io_DisableINT();
		{
			PushQueue(port->xmit, buf[i]);
			
			if (!(port->ier & THREI) && (i == (bsize - 1) || QueueFull(port->xmit)))
			{
				switch (port->control)
				{
					case NO_CONTROL:
					{
						io_outpb(port->IER, port->ier |= THREI);
					}
					break;
					
					case RTS_CTS:
					{
						if (port->cts == CTS_ON) {
							io_outpb(port->IER, port->ier |= THREI);
						}
					}
					break;
					
					case XON_XOFF:
					{
						if (port->xonxoff_rcvd != XOFF_RCVD) {
							io_outpb(port->IER, port->ier |= THREI);
						}
					}
					break;
					
					default: break;
				};
			}
		}
		io_RestoreINT();
	}
	
	return i;
}
Exemplo n.º 16
0
/*
 * This routine implements the 'verify' command.  It writes the disk
 * by writing unique data for each block; after the write pass, it
 * reads the data and verifies for correctness. Note that the entire
 * disk (or the range of disk) is fully written first and then read.
 * This should eliminate any caching effect on the drives.
 * It is not ok to run this command on any data you want to keep.
 */
int
a_verify()
{
	/*
	 * The current disk must be formatted before disk analysis.
	 */
	if (!(cur_flags & DISK_FORMATTED)) {
		err_print("Current Disk is unformatted.\n");
		return (-1);
	}
	if (scan_random) {
		fmt_print("The verify command does not write random data\n");
		scan_random = 0;
	}
	if (scan_passes < 2 && !scan_loop) {
		scan_passes = 2;
		fmt_print("The verify command runs minimum of 2 passes, one"
		    " for writing and \nanother for reading and verfying."
		    " Resetting the number of passes to 2.\n");
	}

	if (check("Ready to verify (will corrupt data). This takes a long time,"
	    "\nbut is interruptable with CTRL-C. Continue")) {
		return (-1);
	}

	return (do_scan(SCAN_WRITE | SCAN_VERIFY, F_NORMAL));
}
Exemplo n.º 17
0
DMPAPI(bool) i2cmaster_Start(int dev, unsigned char addr, unsigned char rwbit) {
    bool result = true;
    
    if (I2C_action[dev] != I2CACT_IDLE)
    {
        err_print("can't start a transaction because I2C%d isn't idle", dev);
        return false;
    }

    I2C_rsInfo[dev].restart = false;

    if (I2C_swMode[dev] != I2CSW_DISABLE)
        result = i2csw_Start(dev, addr, rwbit, false);
    else
    {

        if (I2C_speedMode[dev] == I2CMODE_HIGHSPEED) 
            result = i2cmaster_Start1(dev, 0x07, I2C_WRITE); //send high-speed master code

        if (result == true) result = i2cmaster_Start1(dev, addr, rwbit);
    }
    
    if (result == true)
    {
        I2C_action[dev]  = (rwbit == I2C_WRITE)? I2CACT_MASTERWRITE : I2CACT_MASTERREAD;
        I2C_curAddr[dev] = addr;
    }
    return result;
}
Exemplo n.º 18
0
/*
 * This routine deletes a partition map from the list of maps for
 * the given disk type.
 */
void
delete_partition(struct partition_info *parts)
{
	struct	partition_info *pptr;

	/*
	 * If there isn't a current map, it's an error.
	 */
	if (cur_dtype->dtype_plist == NULL) {
		err_print("Error: unexpected null partition list.\n");
		fullabort();
	}
	/*
	 * Remove the map from the list.
	 */
	if (cur_dtype->dtype_plist == parts)
		cur_dtype->dtype_plist = parts->pinfo_next;
	else {
		for (pptr = cur_dtype->dtype_plist; pptr->pinfo_next != parts;
		    pptr = pptr->pinfo_next)
			;
		pptr->pinfo_next = parts->pinfo_next;
	}
	/*
	 * Free the space it was using.
	 */
	destroy_data((char *)parts);
}
Exemplo n.º 19
0
void Epoll::remove(int fd) {
    if (epoll_ctl(epfd_, EPOLL_CTL_DEL, fd, NULL) < 0) {
        err_print("could not remove fd[%d] from epoll\n", fd);
    }

    return;
}
Exemplo n.º 20
0
DMP_INLINE(void) uart_Free(SerialPort *port)
{
	if (port == NULL) { err_print((char*)"%s: port is null.\n", __FUNCTION__); return; }
	DestoryQueue(port->rcvd);
	DestoryQueue(port->xmit);
	ker_Mfree((void*)port);
}
Exemplo n.º 21
0
/* load binary code and data from file to memory image */
int load_binfile(mem_t *m, FILE *f)
{
    int flen;

    clearerr(f);
    flen = fread(m->data, sizeof(byte_t), m->len, f);
    if (ferror(f)) {
        err_print("fread() failed (0x%x)", flen);
        return -1;
    }
    if (!feof(f)) {
        err_print("too large memory footprint (0x%x)", flen);
        return -1;
    }
    return 0;
}
Exemplo n.º 22
0
static bool init_vx86(void) {
    int i;
    
    for (i=0; i<(int)(sizeof(VX86_pciDev)/sizeof(VX86_pciDev[0])); i++) VX86_pciDev[i] = NULL;

    // get North Bridge fun0 & South Bridge fun0 & IDE PCI-CFG
    if ((VX86_pciDev[VX86_NB]  = pci_Alloc(0x00, 0x00, 0x00)) == NULL) goto FAIL_INITVX86;
    if ((VX86_pciDev[VX86_SB]  = pci_Alloc(0x00, 0x07, 0x00)) == NULL) goto FAIL_INITVX86;
    if ((VX86_pciDev[VX86_IDE] = pci_Alloc(0x00, 0x0c, 0x00)) == NULL) goto FAIL_INITVX86;
    
    // now we are allowed to call get_cpuid()
    if ((VX86_cpuID = get_cpuid()) == CPU_UNSUPPORTED) goto FAIL_INITVX86;

    if (vx86_CpuID() != CPU_VORTEX86SX)
    {
        // North Bridge fun1 exists (note NB fun1 isn't a normal PCI device -- its vid & did are 0xffff)
        if ((VX86_pciDev[VX86_NB1]  = pci_Alloc(0x00, 0x00, 0x01)) == NULL) goto FAIL_INITVX86;
    }
    if (vx86_CpuID() == CPU_VORTEX86EX || vx86_CpuID() == CPU_VORTEX86DX2 || vx86_CpuID() == CPU_VORTEX86DX3)
    {
        // South Bridge fun1 exists (note SB fun1 isn't a normal PCI device -- its vid & did are 0xffff)
        if ((VX86_pciDev[VX86_SB1]  = pci_Alloc(0x00, 0x07, 0x01)) == NULL) goto FAIL_INITVX86;
    }
    return true;

FAIL_INITVX86:
    for (i=0; i<(int)(sizeof(VX86_pciDev)/sizeof(VX86_pciDev[0])); i++)
    {
        pci_Free(VX86_pciDev[i]);
        VX86_pciDev[i] = NULL;
    }
    err_print((char*)"%s: fail to setup system PCI devices!\n", __FUNCTION__);
    return false;
}
Exemplo n.º 23
0
DMPAPI(bool) io_Free(void* handle) {
    bool result = true;
	IO_BASE_t* base;

    if ((base = (IO_BASE_t*)handle) == NULL) return false;

    switch (base->iotype)
    {
        case IO_USE_PORTIO:
            // TODO: for WinXP or Linux Kernel Mode, free Port-I/O region here
            break;
        case IO_USE_MMIO:
            #if defined     DMP_DOS_DJGPP
                dpmi_LinMapFree(base->addr);
                dpmi_SelFree(base->mmio_selector);
            #elif defined   USE_WINIO3
                UnmapPhysicalMemory(base->mmio_info);
            #elif defined   USE_PHYMEM
                UnmapPhyMem((void*)base->addr, base->size);
            #else
                // TODO: for WinXP or Linux Kernel Mode, free MMIO region here
            #endif
            break;
        default:
            err_print((char*)"%s: unknown io-type!\n", __FUNCTION__);
            result = false;
            break;
    }
    free_io_base(base);

    return result;
}
Exemplo n.º 24
0
/* processing overhead in offset by malloc*/
unsigned int offset_to_buffer(unsigned int *mgmt_area, int i)
{

	void *mgmt_blk;
	struct ti81xx_mgmt_area mgmt_area_info;
	unsigned int off_st;
	int j;

	memcpy(&mgmt_area_info, mgmt_area, GENERAL_INFO_SIZE);
	debug_print("mgmt blocks are %u\n", mgmt_area_info.no_blk);

	mgmt_blk = (mgmt_area + 6 + 2 * mgmt_area_info.no_blk);

	mgmt_area_info.mgmt_blk = (struct ti81xx_mgmt_blk *)
				malloc(MGMT_BLKS_SIZE(mgmt_area_info.no_blk));
	if (mgmt_area_info.mgmt_blk == NULL) {
		err_print("mgmt_blk malloc failed\n");
		return 0;
	}

	memcpy(mgmt_area_info.mgmt_blk, mgmt_blk,
				MGMT_BLKS_SIZE(mgmt_area_info.no_blk));

	off_st = mgmt_area_info.size + PAGE_SIZE_EP -
				(mgmt_area_info.size) % PAGE_SIZE_EP ;

	for (j = 0 ; j < i; j++)
		off_st += mgmt_area_info.mgmt_blk[j].size;

	return off_st;
}
Exemplo n.º 25
0
/*
 *	Function to handle non-fatal errors not from system calls.
 */
void
warn_msg(const char *fmt,...) {
   va_list ap;

   va_start(ap, fmt);
   err_print(0, fmt, ap);
   va_end(ap);
}
Exemplo n.º 26
0
local mod_pointer mod_name_lookup (char* name, int l)
  /* finds complete module name */
{ mod_pointer p; /* current node of the search tree */
  mod_pointer* loc=&root; /* |p| will come from this location */
  while ((p=*loc)!=NULL)
  { int l0=p->key_length; char* key=name_begin(p);
    switch (mod_name_cmp(name,l,key,l0))
    { case less: loc=&p->llink; break;
      case greater: loc=&p->rlink; break;
      case equal: case extension:
	
	{ enum mod_comparison cmp=
	    mod_name_cmp(name+l0,l-l0,key+l0,(int)strlen(key+l0));
	  switch(cmp)
	  { case less: case greater:
	      err_print("! Incompatible module name"); 
	      print("\nName inconsistently extends <%.*s...>.\n",l0,key);
		     
	      return NULL;
	    case extension: case equal:
	      if (complete_name(p))
		if (cmp==equal) return p;
		else
		{ err_print("! Incompatible module name"); 
		  print("\nPrefix exists: <%s>.\n",key); return NULL;
			 
		}
	      name_begin(p)=store_string(name,l);
	        /* install |name| in place of |key| */
	      
	         free(key-1);
	      return p;
	  }
	}
      case prefix:
	err_print("! Incompatible module name"); 
	print("\nName is a prefix of <%s%s>.\n" 
	     ,key, complete_name(p) ? "" : "...");
      return NULL; /* dummy module name */
    }
  }
  
  { (p=make_mod_node(store_string(name,l)))->key_length=l; /* prepare new node */
    return *loc=p; /* install new node into tree */
  }
}
Exemplo n.º 27
0
/*
 *	Function to handle informational syslog messages
 */
void info_syslog(const char *fmt, ...)
{
	va_list ap;

	va_start(ap, fmt);
	err_print(0, LOG_INFO, fmt, ap);
	va_end(ap);
}
Exemplo n.º 28
0
__attribute__ ((noreturn)) void rexec(void)
{
	dbg_print("execv(path:\'%s\')",cmd.path);
	execv(cmd.path, cmd.args);
	
	err_print("execv");
	terminate();
};
Exemplo n.º 29
0
static bool init_iosystem(void) {
    int i;

    for (i=0; i<IO_NUM_BASEPOOL; i++)
        IO_basePool[i].iotype = IO_USE_NULLIO;

    // TODO: IO_defaultBase shouldn't be used in WinXP or Linux Kernel Modes
    // #if defined(DMP_OS_KERNEL)
    //    IO_defaultBase.iotype = IO_USE_NULLIO;
    // #else
    IO_defaultBase.iotype = IO_USE_PORTIO;
    IO_defaultBase.addr   = 0L;
    IO_defaultBase.size   = 0x10000L;

    #if defined(DMP_DOS_DJGPP) || defined(DMP_DOS_WATCOM) || defined(DMP_DOS_BC)
        return true;
    #elif defined(USE_WINIO2) || defined(USE_WINIO3)
        if (!InitializeWinIo())
        {
            err_print((char*)"%s: fail to initialize WinIO!\n", __FUNCTION__);
            return false;
        }
        return true;
    #elif defined(USE_PCIDEBUG)
        if (getdllstatus() != DLLSTATUS_NOERROR)
        {
            err_print((char*)"%s: fail to initialize PCIDEBUG!\n", __FUNCTION__);
            return false;
        }
        return true;
    #elif defined(USE_PHYMEM)
        if (LoadPhyMemDriver() == FALSE)
        {
            err_print((char*)"%s: fail to initialize PHYMEM!\n", __FUNCTION__);
            return false;
        }
        return true;
    #elif defined(DMP_LINUX)
        if (iopl(3) != 0)
		{
            err_print((char*)"%s: fail to set iopl(3)!\n", __FUNCTION__);
            return false;
        }
        return true;
    #endif
}
Exemplo n.º 30
0
void fork_exec(char *cmd)
{
	int ret;		

	switch(fork()) {
	case -1:
		err_print("fork");
		return;
	case 0:
		ret = system(cmd);		
		if(ret == -1) {
			err_print("system");
			terminate();
		}
		exit(EXIT_SUCCESS);
	}
}