bare-startup.c 850 Bytes
Newer Older
1 2 3 4 5 6 7 8
/*
 * Alessandro Rubini for CERN, 2011 -- GNU LGPL v2.1 or later
 */

/*
 * This is the startup thing for "freestanding" stuff under Linux.
 * It must also clear the BSS as I'm too lazy to do that in asm
 */
9 10
#include <pptp/pptp.h>
#include <pptp/diag.h>
11 12 13
#include "bare-linux.h"


14
void pptp_clear_bss(void)
15 16
{
	int *ptr;
17
	extern int __bss_start, __bss_end;
18 19 20 21 22 23

	for (ptr = &__bss_start; ptr < &__bss_end; ptr++)
		*ptr = 0;
}

static struct pp_instance ppi_static;
24
static struct pp_net_path net_path_static;
25

26
void pptp_main(void)
27 28 29 30 31
{
	struct pp_instance *ppi = &ppi_static; /* no malloc, one instance */

	pp_puts("bare: starting. Compiled on " __DATE__ "\n");

32
	ppi->net_path = &net_path_static;
33 34 35 36
	if (bare_open_ch(ppi, "eth0")) {
		pp_diag_error(ppi, bare_errno);
		pp_diag_fatal(ppi, "open_ch", "");
	}
37
	pp_open_instance(ppi, 0);
38 39 40

	bare_main_loop(ppi);
}