Exemplo n.º 1
0
static void eth_pre_exception_handler(void)
{
	netpoll_set_trap(1);
}
Exemplo n.º 2
0
static asmlinkage void netpoll_netdump(struct pt_regs *regs, void *platform_arg)
{
	reply_t reply;
	char *tmp = command_tmp;
	extern unsigned long totalram_pages;
	struct pt_regs myregs;
	req_t *req;

	/*
	 * Just in case we are crashing within the networking code
	 * ... attempt to fix up.
	 */
	netpoll_reset_locks(&np);
	platform_fix_regs();
	platform_timestamp(t0);
	netpoll_set_trap(1); /* bypass networking stack */

	local_irq_disable();
	local_bh_disable();
	printk("< netdump activated - performing handshake with the server. >\n");
	netdump_startup_handshake(&np);

	printk("< handshake completed - listening for dump requests. >\n");

	while (netdump_mode) {
		Dprintk("main netdump loop: polling controller ...\n");
		netpoll_poll(&np);

		req = get_new_req();
		if (!req)
			continue;

		Dprintk("got new req, command %d.\n", req->command);
		print_status(req);
		switch (req->command) {
		case COMM_NONE:
			Dprintk("got NO command.\n");
			break;

		case COMM_SEND_MEM:
			Dprintk("got MEM command.\n");
			send_netdump_mem(&np, req);
			break;

		case COMM_EXIT:
			Dprintk("got EXIT command.\n");
			netdump_mode = 0;
			netpoll_set_trap(0);
			break;

		case COMM_REBOOT:
			Dprintk("got REBOOT command.\n");
			printk("netdump: rebooting in 3 seconds.\n");
			netdump_mdelay(3000);
			machine_restart(NULL);
			break;

		case COMM_HELLO:
			sprintf(tmp, "Hello, this is netdump version 0.%02d\n",
				NETDUMP_VERSION);
			reply.code = REPLY_HELLO;
			reply.nr = req->nr;
			reply.info = NETDUMP_VERSION;
			send_netdump_msg(&np, tmp, strlen(tmp), &reply);
			break;

		case COMM_GET_PAGE_SIZE:
			sprintf(tmp, "PAGE_SIZE: %ld\n", PAGE_SIZE);
			reply.code = REPLY_PAGE_SIZE;
			reply.nr = req->nr;
			reply.info = PAGE_SIZE;
			send_netdump_msg(&np, tmp, strlen(tmp), &reply);
			break;

		case COMM_GET_REGS:
			reply.code = REPLY_REGS;
			reply.nr = req->nr;
			reply.info = (u32)totalram_pages;
        		send_netdump_msg(&np, tmp,
				platform_get_regs(tmp, &myregs), &reply);
			break;

		case COMM_GET_NR_PAGES:
			reply.code = REPLY_NR_PAGES;
			reply.nr = req->nr;
			reply.info = platform_max_pfn();
			sprintf(tmp, 
				"Number of pages: %ld\n", platform_max_pfn());
			send_netdump_msg(&np, tmp, strlen(tmp), &reply);
			break;

		case COMM_SHOW_STATE:
			/* send response first */
			reply.code = REPLY_SHOW_STATE;
			reply.nr = req->nr;
			reply.info = 0;

			netdump_mode = 0;
			if (regs)
				show_regs(regs);
			show_state();
			show_mem();
			netdump_mode = 1;

			send_netdump_msg(&np, tmp, strlen(tmp), &reply);

			break;

		default:
			reply.code = REPLY_ERROR;
			reply.nr = req->nr;
			reply.info = req->command;
			Dprintk("got UNKNOWN command!\n");
			sprintf(tmp, "Got unknown command code %d!\n", 
				req->command);
			send_netdump_msg(&np, tmp, strlen(tmp), &reply);
			break;
		}
		kfree(req);
		req = NULL;
	}
	sprintf(tmp, "NETDUMP end.\n");
	reply.code = REPLY_END_NETDUMP;
	reply.nr = 0;
	reply.info = 0;
	send_netdump_msg(&np, tmp, strlen(tmp), &reply);
	printk("NETDUMP END!\n");
}
Exemplo n.º 3
0
static void eth_post_exception_handler(void)
{
	netpoll_set_trap(0);
}