Esempio n. 1
0
void
_start(void)
{
	// read in the video buffer address
	// it assumes that the MMU mappings haven't changed
	// and the buffer is in the 4kb SRAM
	volatile unsigned *LCDSADDR1 = (unsigned *)0x7300014;
	__display_buf = (*LCDSADDR1 & 0xffff) * 2 + 0x7f00000;

	// set the screen height for the <hpstdio.h> module
	extern int __scr_h;
	__scr_h = (sys_lcdgetheight() == 64)? 10: 13;

	// declare locally to reduce executable size
	unsigned state_buffer[4];
	__exit_stk_state = state_buffer;

	// turn interrupts off so we can use the screen
	sys_intOff();

	// will return 0 when exitting
	if (_exit_save((unsigned *)state_buffer)) {
		show_system_info();
		__exit_cleanup();
	}

	// turn interrupts on for the OS
	sys_intOn();
}
Esempio n. 2
0
/*
 * Normal program termination
 */
void exit(int rv)
{
	/* Perform exit-specific cleanup (atexit and on_exit) */
	LOCK;
	if (__exit_cleanup) {
		__exit_cleanup(rv);
	}
	UNLOCK;

    /* If we are using stdio, try to shut it down.  At the very least,
	 * this will attempt to commit all buffered writes.  It may also
	 * unbuffer all writable files, or close them outright.
	 * Check the stdio routines for details. */
	if (_stdio_term) 
	    _stdio_term();

	_exit(rv);
}
Esempio n. 3
0
void
_start(void)
{
	// read in the video buffer address
	// it assumes that the MMU mappings haven't changed
	// and the buffer is in the 4kb SRAM
	volatile unsigned *LCDSADDR1 = (unsigned *)0x7300014;
	__display_buf = (*LCDSADDR1 & 0xffff) * 2 + 0x7f00000;

	// set the screen height for the <hpstdio.h> module
	extern int __scr_h;
	__scr_h = 11;

	// declare locally to reduce executable size
	int state_buffer[4], lcd_buffer[17];
	__exit_stk_state = state_buffer;

	// turn interrupts off so we can use the screen
	sys_intOff();

	// save current hardware state
	sys_lcdsave(lcd_buffer);

	// slow down the clock to save power
	sys_slowOn();

	// will return 0 when exitting
	if (_exit_save((unsigned *)state_buffer)) {
		main();
		__exit_cleanup();
	}

	// restore original hardware values
	sys_slowOff();
	sys_lcdrestore(lcd_buffer);

	// turn interrupts on for the OS
	sys_intOn();
}