Example #1
0
int __kprobes arch_prepare_kprobe(struct kprobe *p)
{
    p->ainsn.insn[0] = *p->addr;
    flushi(&p->ainsn.insn[0]);

    p->ainsn.insn[1] = BREAKPOINT_INSTRUCTION_2;
    flushi(&p->ainsn.insn[1]);

    p->opcode = *p->addr;
    return 0;
}
int __kprobes arch_prepare_kprobe(struct kprobe *p)
{
	if ((unsigned long) p->addr & 0x3UL)
		return -EILSEQ;

	p->ainsn.insn[0] = *p->addr;
	flushi(&p->ainsn.insn[0]);

	p->ainsn.insn[1] = BREAKPOINT_INSTRUCTION_2;
	flushi(&p->ainsn.insn[1]);

	p->opcode = *p->addr;
	return 0;
}
Example #3
0
File: n1.c Project: 99years/plan9
int control(int a, int b)
{
	int j, k;
	extern Contab *contabp;

	numerr.type = RQERR;
	numerr.req = a;
	if (a == 0 || (j = findmn(a)) == -1)
		return(0);
	if (contabp[j].f == 0) {
		if (trace & TRMAC)
			fprintf(stderr, "invoke macro %s\n", unpair(a));
		if (dip != d)
			for (k = dilev; k; k--)
				if (d[k].curd == a) {
					ERROR "diversion %s invokes itself during diversion",
								unpair(a) WARN;
					edone(0100);
				}
		nxf->nargs = 0;
		if (b)
			collect();
		flushi();
		return pushi(contabp[j].mx, a);	/* BUG??? all that matters is 0/!0 */
	}
	if (b) {
		if (trace & TRREQ)
			fprintf(stderr, "invoke request %s\n", unpair(a));
		 (*contabp[j].f)();
	}
	return(0);
}
Example #4
0
File: n5.c Project: aksr/heirloom
void
casereturn(void)
{
	flushi();
	nflush++;
	while (frame->loopf) {
		frame->loopf = LOOP_FREE;
		popi();
	}
	popi();
}
Example #5
0
File: n5.c Project: aksr/heirloom
static int
getev(int *nxevp, char **namep)
{
	char	*name = NULL;
	int nxev = 0;
	char	c;
	int	i = 0, sz = 0, valid = 1;

	*namep = NULL;
	*nxevp = 0;
	if (skip(0))
		return 0;
	c = cbits(ch);
	if (xflag == 0 || isdigit(c) || c == '(') {
		noscale++;
		nxev = atoi();
		noscale = 0;
		if (nonumb) {
			flushi();
			return 0;
		}
	} else {
		do {
			c = rgetach();
			if (i >= sz)
				name = realloc(name, (sz += 8) * sizeof *name);
			name[i++] = c;
		} while (c);
		if (*name == 0) {
			free(name);
			name = NULL;
			valid = 0;
		}
	}
	flushi();
	*namep = name;
	*nxevp = nxev;
	return valid;
}
Example #6
0
int
nofill()
{
	int	j;
	tchar i;

	if (!pendnf) {
		over = 0;
		tbreak();
		if (trap)
			goto rtn;
		if (nlflg) {
			ch = nflush = 0;
			callsp();
			return (0);
		}
		adsp = adrem = 0;
		nwd = 10000;
	}
	while ((j = (cbits(i = GETCH()))) != '\n') {
		if (j == ohc)
			continue;
		if (j == CONT) {
			pendnf++;
			nflush = 0;
			flushi();
			ckul();
			return (0);
		}
		j = width(i);
		widthp = j;
		numtab[HP].val += j;
		storeline(i, j);
	}
	if (ce) {
		ce--;
		if ((i = quant(nel / 2, HOR)) > 0)
			un += i;
	}
	if (!nc)
		storeline((tchar)FILLER, 0);
	brflg = 2;
	tbreak();
	ckul();
rtn:
	pendnf = nflush = 0;

	return (0);
}
Example #7
0
File: n5.c Project: aksr/heirloom
void
casebrp(void)
{
	if (nc || pgchars) {
		spread = 2;
		flushi();
		if (pgchars)
			tbreak();
		else {
			pendt++;
			text();
		}
	} else
		tbreak();
}
Example #8
0
static void bpf_flush_icache(void *start_, void *end_)
{
#ifdef CONFIG_SPARC64
	/* Cheetah's I-cache is fully coherent.  */
	if (tlb_type == spitfire) {
		unsigned long start = (unsigned long) start_;
		unsigned long end = (unsigned long) end_;

		start &= ~7UL;
		end = (end + 7UL) & ~7UL;
		while (start < end) {
			flushi(start);
			start += 32;
		}
	}
#endif
}
Example #9
0
File: tramp.c Project: ANahr/mono
MonoPIFunc
mono_arch_create_trampoline (MonoMethodSignature *sig, gboolean string_ctor)
{
	guint32 *p, *code_buffer;
	guint stack_size, code_size, i;
	gboolean use_memcpy = FALSE;
	static GHashTable *cache = NULL;
	MonoPIFunc res;

	if (!cache)
		cache = g_hash_table_new ((GHashFunc)mono_signature_hash,
				 (GCompareFunc)mono_metadata_signature_equal);
	
	if ((res = (MonoPIFunc)g_hash_table_lookup(cache, sig)))
		return res;

	calculate_sizes (sig, &stack_size, &code_size, 
			 string_ctor, &use_memcpy);

	p = code_buffer = alloc_code_memory (code_size);
	p = emit_prolog (p, sig, stack_size);
	p = emit_save_parameters (p, sig, stack_size, use_memcpy);
	p = emit_call_and_store_retval (p, sig, stack_size, string_ctor);
	/* we don't return structs here so pass in NULL as signature */
	p = emit_epilog (p, NULL, stack_size);

	g_assert(p <= code_buffer + (code_size / 4));
	
	DEBUG(sparc_disassemble_code (code_buffer, p, sig_to_name(sig, NULL)));

	/* So here's the deal...
	 * UltraSPARC will flush a whole cache line at a time
	 * BUT, older SPARCs won't.
	 * So, be compatable and flush dwords at a time...
	 */

	for (i = 0; i < ((p - code_buffer)/2); i++)
		flushi((code_buffer + (i*8)));

	g_hash_table_insert(cache, sig, code_buffer);

	return (MonoPIFunc)code_buffer;
}
Example #10
0
File: n5.c Project: aksr/heirloom
void
casecontinue(int _break)
{
	int	i, j;
	struct s	*s;

	noscale++;
	if (skip(0) || (i = atoi()) <= 0 || nonumb)
		i = 1;
	noscale--;
	j = 0;
	for (s = frame; s != stk; s = s->pframe)
		if (s->loopf && ++j >= i)
			break;
	if (j != i) {
		if (i == 1) {
			if (warn & WARN_RANGE)
				errprint("%s outside loop", macname(lastrq));
			return;
		}
		if (warn & WARN_RANGE)
			errprint("%s: breaking out of %d current loop "
					"levels but %d requested",
				macname(lastrq), j, i);
		_break = 1;
		i = j;
	}
	flushi();
	nflush++;
	while (i > 1 || _break && i > 0) {
		if (frame->loopf) {
			frame->loopf = LOOP_FREE;
			i--;
		}
		popi();
	}
	if (i == 1) {
		while (frame->loopf == 0)
			popi();
		popi();
	}
}
Example #11
0
File: n1.c Project: 99years/plan9
void caseso(void)
{
	FILE *fp;

	lgf++;
	nextf[0] = 0;
	fp = NULL;
	if (skip() || !getname() || (fp = fopen(nextf, "r")) == NULL || ifi >= NSO) {
		ERROR "can't open file %s", nextf WARN;
		done(02);
	}
	strcpy(cfname[ifi+1], nextf);
	cfline[ifi] = numtabp[CD].val;		/*hold line counter*/
	numtabp[CD].val = 0;
	flushi();
	ifl[ifi] = ifile;
	ifile = fp;
	ipl[ifi] = ip;
	ip = 0;
	nx++;
	nflush++;
	ifi++;
}
Example #12
0
File: n7.c Project: dank101/4.2BSD
nofill(){
	register i, j;

	if(!pendnf){
		over = 0;
		tbreak();
		if(trap)goto rtn;
		if(nlflg){
			ch = nflush = 0;
			callsp();
			return;
		}
		adsp = adrem = 0;
		nwd = 10000;
	}
	while((j = ((i = GETCH()) & CMASK)) != '\n'){
		if(j == ohc)continue;
		if(j == CONT){
			pendnf++;
			nflush = 0;
			flushi();
			ckul();
			return;
		}
		storeline(i,-1);
	}
	if(ce){
		ce--;
		if((i=quant(nel/2,HOR)) > 0)un += i;
	}
	if(!nc)storeline(FILLER,0);
	brflg = 2;
	tbreak();
	ckul();
rtn:
	pendnf = nflush = 0;
}
Example #13
0
File: n1.c Project: 99years/plan9
main(int argc, char *argv[])
{
	char *p;
	int j;
	Tchar i;
	char buf[100];

	buf[0] = '\0';		/* make sure it's empty (silly 3b2) */
	progname = argv[0];
	if ((p = strrchr(progname, '/')) == NULL)
		p = progname;
	else
		p++;
	DWBinit(progname, dwbpaths);
	if (strcmp(p, "nroff") == 0)
		TROFF = 0;
#ifdef UNICODE
	alphabet = 128;	/* unicode for plan 9 */
#endif	/*UNICODE*/
	mnspace();
	nnspace();
	mrehash();
	nrehash();
	numtabp[NL].val = -1;

	while (--argc > 0 && (++argv)[0][0] == '-')
		switch (argv[0][1]) {

		case 'N':	/* ought to be used first... */
			TROFF = 0;
			break;
		case 'd':
			fprintf(stderr, "troff/nroff version %s\n", Version);
			break;
		case 'F':	/* switch font tables from default */
			if (argv[0][2] != '\0') {
				strcpy(termtab, &argv[0][2]);
				strcpy(fontdir, &argv[0][2]);
			} else {
				argv++; argc--;
				strcpy(termtab, argv[0]);
				strcpy(fontdir, argv[0]);
			}
			break;
		case 0:
			goto start;
		case 'i':
			stdi++;
			break;
		case 'n':
			npn = atoi(&argv[0][2]);
			break;
		case 'u':	/* set emboldening amount */
			bdtab[3] = atoi(&argv[0][2]);
			if (bdtab[3] < 0 || bdtab[3] > 50)
				bdtab[3] = 0;
			break;
		case 's':
			if (!(stop = atoi(&argv[0][2])))
				stop++;
			break;
		case 'r':
			sprintf(buf + strlen(buf), ".nr %c %s\n",
				argv[0][2], &argv[0][3]);
			/* not yet cpushback(buf);*/
			/* dotnr(&argv[0][2], &argv[0][3]); */
			break;
		case 'm':
			if (mflg++ >= NMF) {
				ERROR "Too many macro packages: %s", argv[0] WARN;
				break;
			}
			strcpy(mfiles[nmfi], nextf);
			strcat(mfiles[nmfi++], &argv[0][2]);
			break;
		case 'o':
			getpn(&argv[0][2]);
			break;
		case 'T':
			strcpy(devname, &argv[0][2]);
			dotT++;
			break;
		case 'a':
			ascii = 1;
			break;
		case 'h':
			hflg++;
			break;
		case 'e':
			eqflg++;
			break;
		case 'q':
			quiet++;
			save_tty();
			break;
		case 'V':
			fprintf(stdout, "%croff: DWB %s\n", 
					TROFF ? 't' : 'n', DWBVERSION);
			exit(0);
		case 't':
			if (argv[0][2] != '\0')
				trace = trace1 = argv[0][2];
			break;		/* for the sake of compatibility */
		default:
			ERROR "unknown option %s", argv[0] WARN;
			done(02);
		}

start:
	/*
	 * cpushback maintains a LIFO, so push pack the -r arguments
	 * in reverse order to maintain a FIFO in case someone did -rC1 -rC3
	 */
	if (buf[0]) {
		char *p = buf;
		while(*p++)
			;
		while(p > buf) {
			while(strncmp(p, ".nr", 3) != 0)
				p--;
			cpushback(p);
			*p-- = '\0';
		}
	}
	argp = argv;
	rargc = argc;
	nmfi = 0;
	init2();
	setjmp(sjbuf);
loop:
	copyf = lgf = nb = nflush = nlflg = 0;
	if (ip && rbf0(ip) == 0 && ejf && frame->pframe <= ejl && dip == d) {
		nflush++;
		trap = 0;
		eject((Stack *)0);
		goto loop;
	}
	i = getch();
	if (pendt)
		goto Lt;
	if ((j = cbits(i)) == XPAR) {
		copyf++;
		tflg++;
		while (cbits(i) != '\n')
			pchar(i = getch());
		tflg = 0;
		copyf--;			/* pointless */
		goto loop;
	}
	if (j == cc || j == c2) {
		if (j == c2)
			nb++;
		copyf++;
		while ((j = cbits(i = getch())) == ' ' || j == '\t')
			;
		ch = i;
		copyf--;
		control(getrq(), 1);
		flushi();
		goto loop;
	}
Lt:
	ch = i;
	text();
	if (nlflg)
		numtabp[HP].val = 0;
	goto loop;
}
Example #14
0
File: n7.c Project: 99years/plan9
getword(int x)
{
	int j, k;
	Tchar i, *wp;
	int noword;
	int obits;

	j = noword = 0;
	if (x)
		if (pendw) {
			*pendw = 0;
			goto rtn;
		}
	if (wordp = pendw)
		goto g1;
	hyp = hyptr;
	wordp = word;
	over = wne = wch = 0;
	hyoff = 0;
	obits = chbits;
	while (1) {	/* picks up 1st char of word */
		j = cbits(i = GETCH());
		if (j == '\n') {
			wne = wch = 0;
			noword = 1;
			goto rtn;
		}
		if (j == ohc) {
			hyoff = 1;	/* 1 => don't hyphenate */
			continue;
		}
		if (j == ' ') {
			numtabp[HP].val += sps;
			widthp = sps;
			storeword(i, sps);
			continue;
		}
		break;
	}
	storeword(' ' | obits, sps);
	if (spflg) {
		storeword(' ' | obits, sps);
		spflg = 0;
	}
g0:
	if (j == CONT) {
		pendw = wordp;
		nflush = 0;
		flushi();
		return(1);
	}
	if (hyoff != 1) {
		if (j == ohc) {
			hyoff = 2;
			*hyp++ = wordp;
			if (hyp > hyptr + NHYP - 1)
				hyp = hyptr + NHYP - 1;
			goto g1;
		}
		if (((j == '-' || j == EMDASH)) && !(i & ZBIT))	/* zbit avoids \X */
			if (wordp > word + 1) {
				hyoff = 2;
				*hyp++ = wordp + 1;
				if (hyp > hyptr + NHYP - 1)
					hyp = hyptr + NHYP - 1;
			}
	}
	j = width(i);
	numtabp[HP].val += j;
	storeword(i, j);
g1:
	j = cbits(i = GETCH());
	if (j != ' ') {
		static char *sentchar = ".?!";	/* sentence terminators */
		if (j != '\n')
			goto g0;
		wp = wordp-1;	/* handle extra space at end of sentence */
		while (wp >= word) {
			j = cbits(*wp--);
			if (j=='"' || j=='\'' || j==')' || j==']' || j=='*' || j==DAGGER)
				continue;
			for (k = 0; sentchar[k]; k++)
				if (j == sentchar[k]) {
					spflg++;
					break;
				}
			break;
		}
	}
	*wordp = 0;
	numtabp[HP].val += sps;
rtn:
	for (wp = word; *wp; wp++) {
		if (ismot(j))
			break;	/* drechsler */
		j = cbits(*wp);
		if (j == ' ')
			continue;
		if (!(isascii(j) && isdigit(j)) && j != '-')
			break;
	}
	if (*wp == 0)	/* all numbers, so don't hyphenate */
		hyoff = 1;
	wdstart = 0;
	wordp = word;
	pendw = 0;
	*hyp++ = 0;
	setnel();
	return(noword);
}
Example #15
0
File: tramp.c Project: ANahr/mono
void *
mono_arch_create_method_pointer (MonoMethod *method)
{
	MonoMethodSignature *sig;
	MonoJitInfo *ji;
	guint stack_size, code_size, stackval_arg_pos, local_pos;
	guint i, local_start, reg_param = 0, stack_param, cpos, vt_cur;
	guint32 align = 0;
	guint32 *p, *code_buffer;
	gint *vtbuf;
	gint32 simpletype;

	code_size = 1024; /* these should be calculated... */
	stack_size = 1024;
	stack_param = 0;

	sig = method->signature;

	p = code_buffer = g_malloc (code_size);

	DEBUG(fprintf(stderr, "Delegate [start emiting] %s\n", method->name));
	DEBUG(fprintf(stderr, "%s\n", sig_to_name(sig, FALSE)));

	p = emit_prolog (p, sig, stack_size);

	/* fill MonoInvocation */
	sparc_st_imm_ptr (p, sparc_g0, sparc_sp,
		  (MINV_POS + G_STRUCT_OFFSET (MonoInvocation, ex)));
	sparc_st_imm_ptr (p, sparc_g0, sparc_sp,
		  (MINV_POS + G_STRUCT_OFFSET (MonoInvocation, ex_handler)));
	sparc_st_imm_ptr (p, sparc_g0, sparc_sp,
		  (MINV_POS + G_STRUCT_OFFSET (MonoInvocation, parent)));

	sparc_set_ptr (p, (void *)method, sparc_l0);
	sparc_st_imm_ptr (p, sparc_l0, sparc_sp,
		  (MINV_POS + G_STRUCT_OFFSET (MonoInvocation, method)));

	stackval_arg_pos = MINV_POS + sizeof (MonoInvocation);
	local_start = local_pos = stackval_arg_pos + (sig->param_count + 1) * sizeof (stackval);

	if (sig->hasthis) {
		sparc_st_imm_ptr (p, sparc_i0, sparc_sp,
			  (MINV_POS + G_STRUCT_OFFSET (MonoInvocation, obj)));
		reg_param = 1;
	} 

	if (sig->param_count) {
		gint save_count = MIN (OUT_REGS, sig->param_count + sig->hasthis);
		for (i = reg_param; i < save_count; i++) {
			sparc_st_imm_ptr (p, sparc_i0 + i, sparc_sp, local_pos);
			local_pos += SLOT_SIZE;
		}
	}

	/* prepare space for valuetypes */
        vt_cur = local_pos;
        vtbuf = alloca (sizeof(int)*sig->param_count);
        cpos = 0;
        for (i = 0; i < sig->param_count; i++) {
                MonoType *type = sig->params [i];
                vtbuf [i] = -1;
                if (!sig->params[i]->byref && type->type == MONO_TYPE_VALUETYPE) {
                        MonoClass *klass = type->data.klass;
                        gint size;
			
                        if (klass->enumtype)
                                continue;
                        size = mono_class_native_size (klass, &align);
                        cpos += align - 1;
                        cpos &= ~(align - 1);
                        vtbuf [i] = cpos;
                        cpos += size;
                }
        }
        cpos += SLOT_SIZE - 1;
        cpos &= ~(SLOT_SIZE - 1);
	
	local_pos += cpos;
	
	/* set MonoInvocation::stack_args */
	sparc_add_imm (p, 0, sparc_sp, stackval_arg_pos, sparc_l0);
	sparc_st_imm_ptr (p, sparc_l0, sparc_sp,
		  (MINV_POS + G_STRUCT_OFFSET (MonoInvocation, stack_args)));

	/* add stackval arguments */
	for (i=0; i < sig->param_count; i++) {
		int stack_offset;
		int type;
		if (reg_param < OUT_REGS) {
			stack_offset = local_start + i * SLOT_SIZE;
			reg_param++;
		} else {
			stack_offset = stack_size + 8 + stack_param;
			stack_param++;
		}

		if (!sig->params[i]->byref) {
			type = sig->params[i]->type;
		enum_arg:
			switch (type) {
			case MONO_TYPE_I8:
			case MONO_TYPE_U8:
			case MONO_TYPE_I:
			case MONO_TYPE_U:
			case MONO_TYPE_STRING:
			case MONO_TYPE_OBJECT:
			case MONO_TYPE_CLASS:
			case MONO_TYPE_SZARRAY:
			case MONO_TYPE_PTR:
			case MONO_TYPE_R8:
				break;
			case MONO_TYPE_I4:
			case MONO_TYPE_U4:
				stack_offset += SLOT_SIZE - 4;
				break;
			case MONO_TYPE_CHAR:
			case MONO_TYPE_I2:
			case MONO_TYPE_U2:
				stack_offset += SLOT_SIZE - 2;
				break;
			case MONO_TYPE_I1:
			case MONO_TYPE_U1:
			case MONO_TYPE_BOOLEAN:
				stack_offset += SLOT_SIZE - 1;
				break;
	                case MONO_TYPE_VALUETYPE:
	                        if (sig->params[i]->data.klass->enumtype) {
	                                type = sig->params[i]->data.klass->enum_basetype->type;
	                                goto enum_arg;
	                        }
				g_assert(vtbuf[i] >= 0);
	                        break;
			default:
				g_error ("can not cope with delegate arg type %d", type);
			}
		}
	
		sparc_add_imm (p, 0, sparc_sp, stack_offset, sparc_o2);

		if (vtbuf[i] >= 0) {
			sparc_add_imm (p, 0, sparc_sp, vt_cur, sparc_o1);
			sparc_st_imm_ptr (p, sparc_o1, sparc_sp, stackval_arg_pos);
			sparc_add_imm (p, 0, sparc_sp, stackval_arg_pos, 
				       sparc_o1);
			sparc_ld_imm_ptr (p, sparc_o2, 0, sparc_o2);
			vt_cur += vtbuf[i];
		} else {
			sparc_add_imm (p, 0, sparc_sp, stackval_arg_pos, 
				       sparc_o1);
		}

		sparc_set_ptr (p, (void *)sig->params[i], sparc_o0);
		sparc_set (p, (guint32)sig->pinvoke, sparc_o3);

		/* YOU make the CALL! */
		sparc_set_ptr (p, (void *)stackval_from_data, sparc_l0);
		sparc_jmpl_imm (p, sparc_l0, 0, sparc_callsite);
		sparc_nop (p);
                stackval_arg_pos += sizeof(stackval);
	}

	/* return value storage */
	/* Align to dword */
	stackval_arg_pos = (stackval_arg_pos + (8 - 1)) & (~(8 -1));
	if (sig->param_count) {
		sparc_add_imm (p, 0, sparc_sp, stackval_arg_pos, sparc_l0);
	}
	if (!sig->ret->byref && sig->ret->type == MONO_TYPE_VALUETYPE && !sig->ret->data.klass->enumtype) {
#if !SPARCV9
		/* pass on callers buffer */
		sparc_ld_imm_ptr (p, sparc_fp, 64, sparc_l1);
		sparc_st_imm_ptr (p, sparc_l1, sparc_l0, 0);
#else
		sparc_add_imm (p, 0, sparc_l0, sizeof(stackval), sparc_l1);
		sparc_st_imm_ptr (p, sparc_l1, sparc_l0, 0);
#endif
	}

	sparc_st_imm_ptr (p, sparc_l0, sparc_sp,
		  (MINV_POS + G_STRUCT_OFFSET (MonoInvocation, retval)));

	/* call ves_exec_method */
	sparc_add_imm (p, 0, sparc_sp, MINV_POS, sparc_o0);
	sparc_set_ptr (p, (void *)ves_exec_method, sparc_l0);
	sparc_jmpl_imm (p, sparc_l0, 0, sparc_callsite);
	sparc_nop (p);

	/* move retval from stackval to proper place (r3/r4/...) */
        if (sig->ret->byref) {
		sparc_ld_imm_ptr (p, sparc_sp, stackval_arg_pos, sparc_i0 );
        } else {
        enum_retvalue:
                switch (sig->ret->type) {
                case MONO_TYPE_VOID:
                        break;
                case MONO_TYPE_BOOLEAN:
                case MONO_TYPE_I1:
                case MONO_TYPE_U1:
                case MONO_TYPE_I2:
                case MONO_TYPE_U2:
                case MONO_TYPE_I4:
                case MONO_TYPE_U4:
                        sparc_ld_imm (p, sparc_sp, stackval_arg_pos, sparc_i0);
                        break;
                case MONO_TYPE_I:
                case MONO_TYPE_U:
                case MONO_TYPE_OBJECT:
		case MONO_TYPE_STRING:
                case MONO_TYPE_CLASS:
                        sparc_ld_imm_ptr (p, sparc_sp, stackval_arg_pos, sparc_i0);
                        break;
                case MONO_TYPE_I8:
                case MONO_TYPE_U8:
#if SPARCV9
                        sparc_ldx_imm (p, sparc_sp, stackval_arg_pos, sparc_i0);
#else
                        sparc_ld_imm (p, sparc_sp, stackval_arg_pos, sparc_i0);
                        sparc_ld_imm (p, sparc_sp, stackval_arg_pos + 4, sparc_i1);
#endif
                        break;
                case MONO_TYPE_R4:
                        sparc_lddf_imm (p, sparc_sp, stackval_arg_pos, sparc_f0);
			sparc_fdtos(p, sparc_f0, sparc_f0);
                        break;
                case MONO_TYPE_R8:
                        sparc_lddf_imm (p, sparc_sp, stackval_arg_pos, sparc_f0);
                        break;
                case MONO_TYPE_VALUETYPE: {
			gint size;
			gint reg = sparc_i0;
                        if (sig->ret->data.klass->enumtype) {
                                simpletype = sig->ret->data.klass->enum_basetype->type;
                                goto enum_retvalue;
                        }
#if SPARCV9
                        size = mono_class_native_size (sig->ret->data.klass, NULL);
                        sparc_ldx_imm (p, sparc_sp, stackval_arg_pos, sparc_l0);
			if (size <= 16) {
				gint off = 0;
				if (size >= 8) {
		                        sparc_ldx_imm (p, sparc_l0, 0, reg);
					size -= 8;
					off += 8;
					reg++;
				}
				if (size > 0)
		                        sparc_ldx_imm (p, sparc_l0, off, reg);
			} else
	                        NOT_IMPL("value type as ret val from delegate");
#endif
                        break;
		}
                default: 
			g_error ("Type 0x%x not handled yet in thunk creation",
				 sig->ret->type);
                        break;
                }
        }

	p = emit_epilog (p, sig, stack_size);

	for (i = 0; i < ((p - code_buffer)/2); i++)
		flushi((code_buffer + (i*8)));
	
	ji = g_new0 (MonoJitInfo, 1);
        ji->method = method;
        ji->code_size = p - code_buffer;
	ji->code_start = code_buffer;
	
	mono_jit_info_table_add (mono_get_root_domain (), ji);

	DEBUG(sparc_disassemble_code (code_buffer, p, method->name));

	DEBUG(fprintf(stderr, "Delegate [end emiting] %s\n", method->name));

	return ji->code_start;
}
Example #16
0
void __kprobes arch_arm_kprobe(struct kprobe *p)
{
	*p->addr = BREAKPOINT_INSTRUCTION;
	flushi(p->addr);
}
Example #17
0
void __kprobes arch_disarm_kprobe(struct kprobe *p)
{
	*p->addr = p->opcode;
	flushi(p->addr);
}
Example #18
0
int copyb(void)
{
	int i, j, state;
	Tchar ii;
	int req, k;
	Offset savoff;
	Uchar *p;

	if (skip() || !(j = getrq()))
		j = '.';
	req = j;
	p = unpair(j);
	/* was: k = j >> BYTE; j &= BYTEMASK; */
	j = p[0];
	k = p[1];
	copyf++;
	flushi();
	nlflg = 0;
	state = 1;

/* state 0	eat up
 * state 1	look for .
 * state 2	look for first char of end macro
 * state 3	look for second char of end macro
 */

	while (1) {
		i = cbits(ii = getch());
		if (state == 3) {
			if (i == k)
				break;
			if (!k) {
				ch = ii;
				i = getach();
				ch = ii;
				if (!i)
					break;
			}
			state = 0;
			goto c0;
		}
		if (i == '\n') {
			state = 1;
			nlflg = 0;
			goto c0;
		}
		if (state == 1 && i == '.') {
			state++;
			savoff = offset;
			goto c0;
		}
		if (state == 2 && i == j) {
			state++;
			goto c0;
		}
		state = 0;
c0:
		if (offset)
			wbf(ii);
	}
	if (offset) {
		offset = savoff;
		wbf((Tchar)0);
	}
	copyf--;
	return(req);
}