mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
blueswirl's latest console patches.
git-svn-id: svn://coreboot.org/openbios/openbios-devel@72 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
@@ -225,22 +225,23 @@ void outl(u32 reg, u32 val)
|
||||
* terminal initialization and cleanup.
|
||||
*/
|
||||
|
||||
static struct termios saved_termios;
|
||||
|
||||
static void init_terminal(void)
|
||||
{
|
||||
struct termios termios;
|
||||
|
||||
tcgetattr(0, &saved_termios);
|
||||
tcgetattr(0, &termios);
|
||||
termios.c_lflag &= ~(ICANON | ECHO);
|
||||
termios.c_cc[VMIN] = 1;
|
||||
termios.c_cc[VTIME] = 3; // 300 ms
|
||||
tcsetattr(0, 0, &termios);
|
||||
}
|
||||
|
||||
static void exit_terminal(void)
|
||||
{
|
||||
struct termios termios;
|
||||
|
||||
tcgetattr(0, &termios);
|
||||
termios.c_lflag |= (ICANON | ECHO);
|
||||
tcsetattr(0, 0, &termios);
|
||||
tcsetattr(0, 0, &saved_termios);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -286,6 +287,21 @@ segv_handler(int signo __attribute__ ((unused)),
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Interrupt handler. linux specific?
|
||||
* Restore terminal state on ctrl-C.
|
||||
*/
|
||||
|
||||
static void
|
||||
int_handler(int signo __attribute__ ((unused)),
|
||||
siginfo_t * si __attribute__ ((unused)),
|
||||
void *context __attribute__ ((unused)))
|
||||
{
|
||||
printk("\n");
|
||||
exit_terminal();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* allocate memory and prepare engine for memory management.
|
||||
*/
|
||||
@@ -461,6 +477,18 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* set terminal to do non blocking reads */
|
||||
init_terminal();
|
||||
|
||||
if (verbose)
|
||||
printk("Installing SIGINT handler...");
|
||||
|
||||
sa.sa_sigaction = int_handler;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sa.sa_flags = SA_SIGINFO | SA_NODEFER;
|
||||
sigaction(SIGINT, &sa, 0);
|
||||
|
||||
if (verbose)
|
||||
printk("done.\n");
|
||||
|
||||
read_dictionary(argv[optind]);
|
||||
|
||||
PUSH_xt( bind_noname_func(arch_init) );
|
||||
|
||||
@@ -593,7 +593,7 @@ static void store(void)
|
||||
const ucell *aaddr = (ucell *)cell2pointer(POP());
|
||||
const ucell x = POP();
|
||||
#ifdef CONFIG_DEBUG_INTERNAL
|
||||
printf("!: %lx : %lx -> %lx\n", aaddr, read_ucell(aaddr), x);
|
||||
printk("!: %lx : %lx -> %lx\n", aaddr, read_ucell(aaddr), x);
|
||||
#endif
|
||||
write_ucell(aaddr,x);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user