code: 9ferno

Download patch

ref: 07bee1c2ea89752e608d881dde2e2a4a1e738516
parent: ef1061c6c6123570d90899426953b850d7167758
author: 9ferno <gophone2015@gmail.com>
date: Mon Aug 9 08:41:27 EDT 2021

show config setup by bios and 9boot

--- a/os/pc/bootargs.c
+++ b/os/pc/bootargs.c
@@ -192,3 +192,13 @@
 	poperror();
 	free(p);
 }
+
+void
+showconf(void)
+{
+	int i;
+
+	for(i = 0; i < nconf; i++){
+		print("%s=%s\n", confname[i], confval[i]);
+	}
+}
--- a/os/pc/uarti8250.c
+++ b/os/pc/uarti8250.c
@@ -435,28 +435,25 @@
 static void
 i8250kick(Uart* uart)
 {
-	int i, n;
+	int i;
 	Ctlr *ctlr;
 
-	if(uart->cts == 0 || uart->blocked )
+	if(uart->cts == 0 || uart->blocked)
 		return;
 
 	/*
-	 *  Stagesize here imposes an arbitrary limit to make sure
+	 *  128 here is an arbitrary limit to make sure
 	 *  we don't stay in this loop too long.  If the
-	 *  chip's output queue is longer than Stagesize, too
-	 *  bad, performance will be slower.
-	 *  Stagesize = 1024
+	 *  chip's output queue is longer than 128, too
+	 *  bad -- presotto
 	 */
 	ctlr = uart->regs;
-	if(!(csr8r(ctlr, Lsr) & Thre))
-		return;
-	for(n = uartstageoutput(uart); n > 0; n--, uart->op++){
+	for(i = 0; i < 128; i++){
 		if(!(csr8r(ctlr, Lsr) & Thre))
 			break;
-		if(uart->op >= uart->oe)
+		if(uart->op >= uart->oe && uartstageoutput(uart) == 0)
 			break;
-		outb(ctlr->io+Thr, *uart->op);
+		outb(ctlr->io+Thr, *(uart->op++));
 	}
 }
 
--- a/os/pc64/main.c
+++ b/os/pc64/main.c
@@ -96,8 +96,9 @@
 }
 
 void
-setupdebug(void)
+showconfig(void)
 {
+	showconf();
 	print("kdzero 0x%p confaddr 0x%p apbootstrap 0x%p idtaddr 0x%p\n"
 		"\tcpu0mach 0x%p cpu0sp 0x%p cpu0gdt 0x%p\n"
 		"\tcpu0pml4 0x%p cpu0pdp 0x%p  cpu0pd 0x%p\n"
@@ -126,7 +127,7 @@
 	quotefmtinstall();
 	screeninit();
 	print("\nInferno release built at %lud\n", kerndate);
-	setupdebug();
+	showconfig();
 	cpuidentify();
 	meminit0();			/* builds the memmap */
 	archinit();
--- a/os/port/devuart.c
+++ b/os/port/devuart.c
@@ -628,12 +628,9 @@
 {
 	int n;
 
-	if(p->op < p->oe)
-		return p->oe - p->op;
 	n = qconsume(p->oq, p->ostage, Stagesize);
-	if(n <= 0){
+	if(n <= 0)
 		return 0;
-	}
 	p->op = p->ostage;
 	p->oe = p->ostage + n;
 	return n;
--- a/os/port/portfns.h
+++ b/os/port/portfns.h
@@ -269,6 +269,7 @@
 void		setmalloctag(void*, uintptr);
 int		setpri(int);
 void		setrealloctag(void*, uintptr);
+void	showconf(void);
 char*		skipslash(char*);
 void		sleep(Rendez*, int(*)(void*), void*);
 void*		smalloc(uintptr);