xen: fix early console

This commit is contained in:
mischief 2014-06-24 19:37:03 -07:00
parent 5ba95fdb07
commit 2060daf3b0
3 changed files with 10 additions and 20 deletions

View file

@ -59,6 +59,7 @@ void insl(int, void*, int);
int intrdisable(int, void (*)(Ureg *, void *), void*, int, char*); int intrdisable(int, void (*)(Ureg *, void *), void*, int, char*);
void intrenable(int, void (*)(Ureg*, void*), void*, int, char*); void intrenable(int, void (*)(Ureg*, void*), void*, int, char*);
int ioalloc(int, int, int, char*); int ioalloc(int, int, int, char*);
void ioinit(void);
int isaconfig(char*, int, ISAConf*); int isaconfig(char*, int, ISAConf*);
void kbdenable(void); void kbdenable(void);
#define kmapinval() #define kmapinval()

View file

@ -73,8 +73,9 @@ main(void)
{ {
mach0init(); mach0init();
options(); options();
quotefmtinstall(); ioinit();
xenconsinit(); xenconsinit();
quotefmtinstall();
//consdebug = rdb; //consdebug = rdb;
print("\nPlan 9 (%s)\n", xenstart->magic); print("\nPlan 9 (%s)\n", xenstart->magic);

View file

@ -90,7 +90,7 @@ interrupt(Ureg*, void *arg)
coherence(); coherence();
while (cons != con->in_prod) { while (cons != con->in_prod) {
c = con->in[MASK_XENCONS_IDX(cons++, con->in)]; c = con->in[MASK_XENCONS_IDX(cons++, con->in)];
uartrecv(uart, c & 0xFF); uartrecv(uart, c);
} }
coherence(); coherence();
con->in_cons = cons; con->in_cons = cons;
@ -232,22 +232,13 @@ xenputc(Uart*, int c)
struct xencons_interface *con = xencons.intf; struct xencons_interface *con = xencons.intf;
unsigned long prod; unsigned long prod;
c &= 0xFF;
ilock(&xencons.txlock); ilock(&xencons.txlock);
/*
while(con->out_cons == con->out_prod)
HYPERVISOR_yield();
*/
if(con->out_cons == con->out_prod){
iunlock(&xencons.txlock);
return;
}
prod = con->out_prod; prod = con->out_prod;
if((prod - con->out_cons) < sizeof(con->out)){
if((con->out[MASK_XENCONS_IDX(prod++, con->out)] = c) == '\n') if (c == '\n')
con->out[MASK_XENCONS_IDX(prod++, con->out)] = '\r'; con->out[MASK_XENCONS_IDX(prod++, con->out)] = '\r';
con->out[MASK_XENCONS_IDX(prod++, con->out)] = c;
}
coherence(); coherence();
con->out_prod = prod; con->out_prod = prod;
@ -303,6 +294,7 @@ xenconsinit(void)
xencons.evtchn = xenstart->console_evtchn; xencons.evtchn = xenstart->console_evtchn;
consuart = &xenuart; consuart = &xenuart;
consuart->console = 1;
} }
void void
@ -326,9 +318,5 @@ kbdenable(void)
consuart = uart; consuart = uart;
uart->console = 1; uart->console = 1;
uartputs("CONSOLE1\n", 9);
//*(char*)0 = 0;
} }