Beispiel #1
0
void
output_tty_ioctl(int fd, uint32_t cmd, uint32_t arg)
{
	printf("\tretval: %d\n", read_eax());

	switch (cmd) {
		case TCGETS:
			if (arg != 0)
				skip(sizeof(struct termios));
			break;
		case TIOCGWINSZ:
			if (arg != 0)
				skip(sizeof(struct winsize));
			break;
		case FIONREAD:
			if (arg != 0)
				skip(sizeof(int));
			break;
		case FIONBIO:
			break;
		case TCGETA:
			if (arg != 0)
				skip(sizeof(struct termio));
			break;
		case TCSETA:
			break;
		default:
			INJ_WARNING("Unknown tty ioctl cmd 0x%x\n", cmd);
			THROW(EXCEPTION_FATAL, "unsupport ioctl 0x%x", cmd);
	}

	return;
}
Beispiel #2
0
void
output_read(int nr)
{
	int32_t ret = read_eax();
	if (ret > 0)
		skip(ret);
	printf("read:\t%d\n", ret);
}
Beispiel #3
0
void
output_pread64(int nr)
{
	int32_t ret = read_eax();
	if (ret > 0)
		skip(ret);
	printf("pread64:\t%d\n", ret);
}
Beispiel #4
0
void
output_lstat64(int nr)
{
	int32_t ret;
	ret = read_eax();
	if (ret >= 0)
		skip(sizeof(struct stat64));
	printf("lstat64\t%d\n", ret);
}
Beispiel #5
0
void
output_time(int nr)
{
	printf("time:\t%d\n", read_eax());

	uint32_t ebx;
	read_obj(ebx);
	if (ebx != 0)
		skip(sizeof(time_t));
}
Beispiel #6
0
void
output_wait4(int nr)
{
	printf("wait4:\t%d\n", read_eax());
	uintptr_t stat_addr = read_uint32();
	if (stat_addr != 0)
		skip(sizeof(int));
	uintptr_t ru = read_uint32();
	if (ru != 0)
		skip(sizeof(struct rusage));
}
Beispiel #7
0
void
output_gettimeofday(int nr)
{
	int32_t ret = read_eax();
	if (ret >= 0) {
		uintptr_t TP, TZP;
		read_obj(TP);
		read_obj(TZP);

		if (TP != 0)
			skip(sizeof(struct k_timeval));
		if (TZP != 0)
			skip(sizeof(struct k_timezone));
	}
	printf("gettimeofday:\t%d\n", ret);
}
Beispiel #8
0
void
output_rt_sigprocmask(int nr)
{
	int32_t ret = read_eax();
	if (ret == 0) {
		int sigsetsize;
		read_obj(sigsetsize);
		if (sigsetsize == sizeof(k_sigset_t)) {
			int32_t oset;
			read_obj(oset);
			if (oset)
				skip(sigsetsize);
		}
	}
	printf("rt_sigprocmask:\t%d\n", ret);
}
Beispiel #9
0
void
output_rt_sigaction(int nr)
{
	int32_t ret = read_eax();
	if (ret == 0) {
		int sigsetsize;
		uintptr_t act;
		uintptr_t oact;
		read_obj(sigsetsize);
		read_obj(oact);
		read_obj(act);

		if (sigsetsize == sizeof(k_sigset_t)) {
			if (oact != 0)
				skip(sizeof(struct k_sigaction));
		}
		printf("rt_sigaction(act=0x%x, oact=0x%x):\t%d\n",
				act, oact, ret);
	} else {
		printf("rt_sigaction:\t%d\n", ret);
	}
}
Beispiel #10
0
void
output__newselect(int nr)
{
	int retval;
	retval = read_eax();
	printf("_newselect:\t0x%x\n", retval);

	int n;
	uint32_t inp, outp, exp;
	read_obj(n);
	read_obj(inp);
	read_obj(outp);
	read_obj(exp);

	int fd_bytes = FDS_BYTES(n);
	if (inp != 0)
		skip(fd_bytes);
	if (outp != 0)
		skip(fd_bytes);
	if (exp != 0)
		skip(fd_bytes);
}
Beispiel #11
0
//exception dispatcher
void _on_exception(int code, int codedata, CPUState *cpudata) {
  e9printf("_on_exception called.  code: %d, codedata: %d, cpudata: %p\n", code, codedata, cpudata);
  e9printf("  eax: %x, ebx: %x, edx: %x\n", read_eax(), read_ebx(), read_edx());
  e9printf("  ebp: %x, esp: %x, eip: %x\n\n", read_ebp(), read_esp(), get_eip());

  //sanitize code, just to be safe
  code = code & 31;
  
  int handled = 0;
  for (LinkNode *node=exception_stacks[code].first; node; node=node->next) {
    ExceptionHandler handler = node->data;
    
    if (handler(code, codedata, cpudata)) {
      handled = 1;
      break;
    }
  }
  
  if (!handled) {
    e9printf("Unhandled exception %d\n", code);
    kerror(-1, "Unhandled exception");
  }
}
Beispiel #12
0
void
output_close(int nr)
{
	printf("close:\t%d\n", read_eax());
}
Beispiel #13
0
void
output_vmsplice(int nr)
{
	int32_t ret = read_eax();
	printf("vmsplice:\t%d\n", ret);
}