Example #1
0
Code make_print_fprint(Operator op, char *format)
{
    Code code;

    code = makecode(op);
    code.head->args[0].sval = format;
    return(code);
}
Example #2
0
Code makecode1(Operator op, Value arg)
{
    Code code;

    code = makecode(op);
    code.head->args[0] = arg;
    return code;
}
Example #3
0
Code make_sattr(char *s)
{
    Code code;

    code = makecode(T_SATTR);
    code.head->args[0].sval = s;
    return(code);
}
Example #4
0
Code make_ldstr(char *s)
{
    Code code;

    code = makecode(T_LDSTR);
    code.head->args[0].sval = s;
    return(code);
}
Example #5
0
Code make_ldint(int i)
{
    Code code;

    code = makecode(T_LDINT);
    code.head->args[0].ival = i;
    return(code);
}
Example #6
0
Code makecode1(Operator op, int arg)
{
    Code code;

    code = makecode(op);
    code.head->args[0].ival = arg;
    return(code);
}
Example #7
0
Code program(Pnode root)
{
  Code body = stat_list(root->child);
  
  Value v1; v1.ival = body.size + 2;
  return concode(makecode1(T_TCODE, v1),
         body,
         makecode(T_HALT),
         endcode());
}
Example #8
0
Code make_print_fprint(Operator op, char *format)
{
    Code code;

    code = makecode(op);
    Value v;
    v.sval = format;
    code.head->args[0] = v;
    return code;
}
Example #9
0
Code make_sattr(char *s)
{
    Code code;

    code = makecode(T_SATTR);
    Value v;
    v.sval = s;
    code.head->args[0] = v;
    return code;
}
Example #10
0
Code make_ldstr(char *s)
{
    Code code;

    code = makecode(T_LDSTR);
    Value v;
    v.sval = s;
    code.head->args[0] = v;
    return code;
}
Example #11
0
Code make_ldint(int i)
{
    Code code;

    code = makecode(T_LDINT);
    Value v;
    v.ival = i;
    code.head->args[0] = v;
    return code;
}
Example #12
0
void combo_ropmaker2(void)
{
  int i = 0;
  int flag = 0;
  Elf32_Addr addr;
  t_makecode *list_ins = NULL;

  /* check combo 1 if possible */
  while (tab_combo_ropsh2[i].instruction)
    {
      if (search_instruction(tab_combo_ropsh2[i].instruction) == 0)
        {
          flag = 1;
          break;
        }
      i++;
    }

  if (flag == 0)
    fprintf(stdout, "[%s+%s] Combo 1 was found - Possible with the following gadgets. (execve)\n", GREEN, ENDC);
  else
    fprintf(stderr, "[%s-%s] Combo 1 was not found, missing instruction(s).\n", RED, ENDC);

  i = 0;
  while (tab_combo_ropsh2[i].instruction)
    {
      addr = search_instruction(tab_combo_ropsh2[i].instruction);
      if (addr)
        {
          fprintf(stdout, "\t- %s0x%.8x%s => %s%s%s\n", GREEN, addr, ENDC, GREEN, get_gadget_since_addr(addr), ENDC);
          if (!flag)
            list_ins = add_element(list_ins, get_gadget_since_addr_att(addr), addr);
        }
      else
        fprintf(stdout, "\t- %s..........%s => %s%s%s\n", RED, ENDC, RED, tab_combo_ropsh2[i].instruction, ENDC);
      i++;
    }
  fprintf(stdout, "\t- %s0x%.8x%s => %s.data Addr%s\n", GREEN, Addr_sData, ENDC, GREEN, ENDC);

  /* build a python code */
  if (!flag)
    makecode(list_ins);
}
Example #13
0
/*Genera il codice per il nodo program*/
Code program(Pnode root){
	Code body = stat_list(root->child);
	//Prende body, gli mette TCODE prima e THALT dopo.	  
	return concode(makecode1(T_TCODE, body.size + 2), body, makecode(T_HALT), endcode());
}
Example #14
0
void tc2550_intr(int irq, void *dev_id, struct pt_regs *regs)
{
	void (*my_done) (Scsi_Cmnd *) = NULL;

	int val, id, map = 0, tmap, mbx_out_ptr;
	u8 loc = 0;
	PRISC_SRB rsrb;
	DevHdr *dev;
	char *ptr0;
	PAdapter padapter;
/* 
   int i ;
   unsigned long flags ;
 */
	unsigned int memsize;
	Scsi_Cmnd *SCtmp;
	unsigned devstat = 0;
	unsigned scsistat = 0;
	long start_time;

#ifdef DEBUG
	printk("interrupt registered \n");
#endif

/*
   save_flags(flags);
   cli();
 */

	/* multiple HA? not supported now! */
	HANumber = 0;
	padapter = (PAdapter) & HostAdapter[HANumber];
	Get_Base(padapter);

/* disable interrupts */
	val = inw(STATUS_INT_REG);

	udelay(10);

	val |= 0x20;		/* clear interrupt pending */
	outw(val, STATUS_INT_REG);

	udelay(10);

	val |= 0x22;		/* disable interrupt */

	outw(val, STATUS_INT_REG);
	/*               
	   // if RISC is in halt state then find out why ?
	 */
	tmap = inw(STATUS_INT_REG);
/* The following code needs to be added when we intro sync /wide nego */
/*
   if(tmap & RISC_HALT) {
   tmap= risc_halt_check();
   if(tmap) return(0xff);
   };
 */


	mbx_out_ptr = padapter->mbx_out_ptr;

	val = *(u16 *) (mbx_out_base + mbx_out_ptr);

	while (val & 0x80)
	{
		loc = (char) (val & 0x7f);
		id = val & 0xff00;
		id >>= 8;
		TargetID = id;
		dev = (DevHdr *) (devhdr_base + TargetID * sizeof(DevHdr));
		/*(u16  *)(mbx_out_base+ mbx_out_ptr)= (val& 0xff7f); */
		rsrb = (PRISC_SRB) (taskq_base + (id * 16 + loc) * sizeof(RISC_SRB));
		Index = loc;
		devstat = rsrb->DEV_Status;
		scsistat = rsrb->ScsiStatus;

/*      (*padapter->dev[TargetID].task[loc].complete)(rsrb); */

		*(u16 *) (mbx_out_base + mbx_out_ptr) = (val & 0xff7f);

		padapter->dev[TargetID].task[loc].CmdInProcess = 0;
		mbx_out_ptr += 2;
		if (mbx_out_ptr == 32)
			mbx_out_ptr = 0;
		padapter->mbx_out_ptr = mbx_out_ptr;
		/*
		 *	Clear init bimap if no more tasks are waiting
		 */
		map = 1;
		dev->Updatedmap = (dev->Updatedmap ^ (map << loc));
		if ((dev->Updatedmap & 0x0000ffff) == 0)
		{
			ptr0 = (char *) mbx_in_base;
			for (map = 0; map < 16; map++)
				if ((*ptr0 & 0xf) == (char) id)
				{
					*ptr0 = (*ptr0 & 0xef);
					break;
				} else
					ptr0++;
		}
		val = *(u16 *) (mbx_out_base + mbx_out_ptr);

		rsrb->SRB_flag = SRB_DONE;	/* mark done */
	}

	/* stop RISC if mailbox is empty  */

	ptr0 = (char *) mbx_in_base;
	for (map = 0; map < 16; map++)
		if (*ptr0 & 0x10)
			break;
	if (map == 16)
	{
		tmap = inw(CONTROL_REG);
		outw((tmap | HALT_RISC), CONTROL_REG);

/*Ravi modified to introduce sanity check&time out dec 16 1998 */

		start_time = jiffies;
		
		do
		{
			if ((start_time - jiffies) > 5 * HZ)
			{
				printk(KERN_ERR "tc2550: TC-2550x Controller Failure\n");
				return;
			}
			tmap = inw(STATUS_INT_REG);
		}
		while((tmap & RISC_HALT) == 0);
	}
	SCtmp = (Scsi_Cmnd *) padapter->dev[TargetID].task[loc].REQ_Header;

	if (!SCtmp || !SCtmp->scsi_done)
	{
		printk(KERN_ERR "tc2550: Tripace_Intr_Handle: Unexpected Interrupt\n");
		return;
	}
	memsize = 255 * sizeof(struct _ScatGath) + 4;
	my_done = SCtmp->scsi_done;
	/*if (SCtmp->host_scribble)
	   scsi_free(SCtmp->host_scribble,4096); */


	padapter->dev[TargetID].task[loc].REQ_Header = NULL;
	SCtmp->result = makecode(devstat, scsistat);
/*enable chip interrupt signal */
	val = inw(STATUS_INT_REG);
	udelay(25);		/* delay for 25 micros */

	val &= 0xfd;		/* enable interrupt-bit1=0 in status-int reg */
	outw(val, STATUS_INT_REG);

	my_done(SCtmp);		/* inform mid layer that scsi command is over */
/*
   restore_flags(flags);
 */

}
Example #15
0
static irqreturn_t aha1542_interrupt(int irq, void *dev_id)
{
    struct Scsi_Host *sh = dev_id;
    struct aha1542_hostdata *aha1542 = shost_priv(sh);
    void (*my_done)(struct scsi_cmnd *) = NULL;
    int errstatus, mbi, mbo, mbistatus;
    int number_serviced;
    unsigned long flags;
    struct scsi_cmnd *tmp_cmd;
    int flag;
    struct mailbox *mb = aha1542->mb;
    struct ccb *ccb = aha1542->ccb;

#ifdef DEBUG
    {
        flag = inb(INTRFLAGS(sh->io_port));
        shost_printk(KERN_DEBUG, sh, "aha1542_intr_handle: ");
        if (!(flag & ANYINTR))
            printk("no interrupt?");
        if (flag & MBIF)
            printk("MBIF ");
        if (flag & MBOA)
            printk("MBOF ");
        if (flag & HACC)
            printk("HACC ");
        if (flag & SCRD)
            printk("SCRD ");
        printk("status %02x\n", inb(STATUS(sh->io_port)));
    };
#endif
    number_serviced = 0;

    spin_lock_irqsave(sh->host_lock, flags);
    while (1) {
        flag = inb(INTRFLAGS(sh->io_port));

        /* Check for unusual interrupts.  If any of these happen, we should
           probably do something special, but for now just printing a message
           is sufficient.  A SCSI reset detected is something that we really
           need to deal with in some way. */
        if (flag & ~MBIF) {
            if (flag & MBOA)
                printk("MBOF ");
            if (flag & HACC)
                printk("HACC ");
            if (flag & SCRD)
                printk("SCRD ");
        }
        aha1542_intr_reset(sh->io_port);

        mbi = aha1542->aha1542_last_mbi_used + 1;
        if (mbi >= 2 * AHA1542_MAILBOXES)
            mbi = AHA1542_MAILBOXES;

        do {
            if (mb[mbi].status != 0)
                break;
            mbi++;
            if (mbi >= 2 * AHA1542_MAILBOXES)
                mbi = AHA1542_MAILBOXES;
        } while (mbi != aha1542->aha1542_last_mbi_used);

        if (mb[mbi].status == 0) {
            spin_unlock_irqrestore(sh->host_lock, flags);
            /* Hmm, no mail.  Must have read it the last time around */
            if (!number_serviced)
                shost_printk(KERN_WARNING, sh, "interrupt received, but no mail.\n");
            return IRQ_HANDLED;
        };

        mbo = (scsi2int(mb[mbi].ccbptr) - (isa_virt_to_bus(&ccb[0]))) / sizeof(struct ccb);
        mbistatus = mb[mbi].status;
        mb[mbi].status = 0;
        aha1542->aha1542_last_mbi_used = mbi;

#ifdef DEBUG
        if (ccb[mbo].tarstat | ccb[mbo].hastat)
            shost_printk(KERN_DEBUG, sh, "aha1542_command: returning %x (status %d)\n",
                         ccb[mbo].tarstat + ((int) ccb[mbo].hastat << 16), mb[mbi].status);
#endif

        if (mbistatus == 3)
            continue;	/* Aborted command not found */

#ifdef DEBUG
        shost_printk(KERN_DEBUG, sh, "...done %d %d\n", mbo, mbi);
#endif

        tmp_cmd = aha1542->int_cmds[mbo];

        if (!tmp_cmd || !tmp_cmd->scsi_done) {
            spin_unlock_irqrestore(sh->host_lock, flags);
            shost_printk(KERN_WARNING, sh, "Unexpected interrupt\n");
            shost_printk(KERN_WARNING, sh, "tarstat=%x, hastat=%x idlun=%x ccb#=%d\n", ccb[mbo].tarstat,
                         ccb[mbo].hastat, ccb[mbo].idlun, mbo);
            return IRQ_HANDLED;
        }
        my_done = tmp_cmd->scsi_done;
        kfree(tmp_cmd->host_scribble);
        tmp_cmd->host_scribble = NULL;
        /* Fetch the sense data, and tuck it away, in the required slot.  The
           Adaptec automatically fetches it, and there is no guarantee that
           we will still have it in the cdb when we come back */
        if (ccb[mbo].tarstat == 2)
            memcpy(tmp_cmd->sense_buffer, &ccb[mbo].cdb[ccb[mbo].cdblen],
                   SCSI_SENSE_BUFFERSIZE);


        /* is there mail :-) */

        /* more error checking left out here */
        if (mbistatus != 1)
            /* This is surely wrong, but I don't know what's right */
            errstatus = makecode(ccb[mbo].hastat, ccb[mbo].tarstat);
        else
            errstatus = 0;

#ifdef DEBUG
        if (errstatus)
            shost_printk(KERN_DEBUG, sh, "(aha1542 error:%x %x %x) ", errstatus,
                         ccb[mbo].hastat, ccb[mbo].tarstat);
        if (ccb[mbo].tarstat == 2)
            print_hex_dump_bytes("sense: ", DUMP_PREFIX_NONE, &ccb[mbo].cdb[ccb[mbo].cdblen], 12);
        if (errstatus)
            printk("aha1542_intr_handle: returning %6x\n", errstatus);
#endif
        tmp_cmd->result = errstatus;
        aha1542->int_cmds[mbo] = NULL;	/* This effectively frees up the mailbox slot, as
						   far as queuecommand is concerned */
        my_done(tmp_cmd);
        number_serviced++;
    };
}
Example #16
0
		lprintf(" Exp: %-9d %s\n",(long)c[EXPERIENCE],class[c[LEVEL]-1]);
		lprintf("HP: %3d(%3d) STR=%-2d INT=%-2d ",
			(long)c[HP],(long)c[HPMAX],(long)(c[STRENGTH]+c[STREXTRA]),(long)c[INTELLIGENCE]);
		lprintf("WIS=%-2d CON=%-2d DEX=%-2d CHA=%-2d LV:",
			(long)c[WISDOM],(long)c[CONSTITUTION],(long)c[DEXTERITY],(long)c[CHARISMA]);

		if ((level==0) || (wizard))  c[TELEFLAG]=0;
		if (c[TELEFLAG])  lprcat(" ?");  else  lprcat(levelname[level]);
		lprintf("  Gold: %-6d",(long)c[GOLD]);
		always=1;  botside();
		c[TMP] = c[STRENGTH]+c[STREXTRA];
		for (i=0; i<100; i++) cbak[i]=c[i];
		return;
		}

	botsub(makecode(SPELLS,8,18),"%3d");
	if (c[SPELLMAX]>99)  botsub(makecode(SPELLMAX,12,18),"%3d)");
					else botsub(makecode(SPELLMAX,12,18),"%2d) ");
	botsub(makecode(HP,5,19),"%3d");
	botsub(makecode(HPMAX,9,19),"%3d");
	botsub(makecode(AC,21,18),"%-3d");
	botsub(makecode(WCLASS,30,18),"%-3d");
	botsub(makecode(EXPERIENCE,49,18),"%-9d");
	if (c[LEVEL] != cbak[LEVEL])
		{ cursor(59,18);	lprcat(class[c[LEVEL]-1]);  }
	if (c[LEVEL]>99) botsub(makecode(LEVEL,40,18),"%3d");
				else botsub(makecode(LEVEL,40,18)," %-2d");
	c[TMP] = c[STRENGTH]+c[STREXTRA];	botsub(makecode(TMP,18,19),"%-2d");
	botsub(makecode(INTELLIGENCE,25,19),"%-2d");
	botsub(makecode(WISDOM,32,19),"%-2d");
	botsub(makecode(CONSTITUTION,39,19),"%-2d");