ref: 98b1a59547584bd823ed0aa3db0a65c6af56e0d6
parent: 21669c4c9734c948eb3be971db7a345b5349469a
author: aiju <devnull@localhost>
date: Sat Jun 17 19:30:23 EDT 2017
vmx(1): don't zero all memory, don't abandon uart on eof, sleep before transmitting uart data
--- a/sys/src/cmd/vmx/io.c
+++ b/sys/src/cmd/vmx/io.c
@@ -1020,9 +1020,11 @@
UART *u;
char buf[128], *p;
int rc;
+ int eofctr;
threadsetname("uart rx");
u = uv;
+ eofctr = 0;
for(;;){
rc = read(u->infd, buf, sizeof(buf));
if(rc < 0){
@@ -1030,9 +1032,12 @@
threadexits("read: %r");
}
if(rc == 0){
- vmerror("read(uartrx): eof");
- threadexits("read: eof");
- }
+ if(++eofctr == 100){ /* keep trying but give up eventually */
+ vmerror("read(uartrx): eof");
+ threadexits("read: eof");
+ }
+ continue;
+ }else eofctr = 0;
for(p = buf; p < buf + rc; p++){
send(u->inch, p);
sendnotif((void(*)(void*))uartkick, u);
@@ -1052,6 +1057,8 @@
p = buf;
recv(u->outch, p);
p++;
+ sendnotif((void(*)(void*))uartkick, u);
+ sleep(1);
while(sendnotif((void(*)(void*))uartkick, u), p < buf+sizeof(buf) && nbrecv(u->outch, p) > 0)
p++;
if(write(u->outfd, buf, p - buf) < p - buf)
@@ -1216,7 +1223,7 @@
0x084, 0x084, nopio, nil, /* dma -- used by openbsd for delay by dummy read */
0x100, 0x110, nopio, nil, /* elnk3 */
0x240, 0x25f, nopio, nil, /* ne2000 */
- 0x279, 0x279, nopio, nil, /* isa pnp */
+ 0x278, 0x27a, nopio, nil, /* LPT1 / ISA PNP */
0x280, 0x29f, nopio, nil, /* ne2000 */
0x2e8, 0x2ef, nopio, nil, /* COM4 */
0x300, 0x31f, nopio, nil, /* ne2000 */
--- a/sys/src/cmd/vmx/vmx.c
+++ b/sys/src/cmd/vmx/vmx.c
@@ -304,7 +304,7 @@
gmem = segattach(0, sn, nil, sz);
if(gmem == (void*)-1) sysfatal("segattach: %r");
}
- memset(gmem, 0, sz);
+ memset(gmem, 0, sz > 1>>24 ? 1>>24 : sz);
p = gmem;
for(r = mmap; r != nil; r = r->next){
if(r->segname == nil) continue;