Browse Source

Adding devtls to kernel.

Removed put* functions from main.c and fns.h
In proc.c removed old disabled put64 due to a
"implicit declaration" error.

Change-Id: I129e85e4fcab182231475ffe30a0fbf0d453f01b
Elbing Miss 8 years ago
parent
commit
06a59507dd
6 changed files with 15 additions and 35 deletions
  1. 0 4
      sys/src/9/k10/fns.h
  2. 1 0
      sys/src/9/k10/k8cpu.json
  3. 0 25
      sys/src/9/k10/main.c
  4. 13 1
      sys/src/9/port/devtls.c
  5. 1 0
      sys/src/9/port/port.json
  6. 0 5
      sys/src/9/port/proc.c

+ 0 - 4
sys/src/9/k10/fns.h

@@ -271,10 +271,6 @@ void DONE(void);
 
 /* all these go to 0x3f8 */
 void hi(char *s);
-void put64(uint64_t);
-void put32(uint32_t);
-void put16(uint16_t);
-void put8(uint8_t);
 
 Mach *machp(void);
 Proc *externup(void);

+ 1 - 0
sys/src/9/k10/k8cpu.json

@@ -39,6 +39,7 @@
 					"segment",
 					"srv",
 					"ssl",
+					"tls",
 					"uart",
 					"ws",
 					"usb",

+ 0 - 25
sys/src/9/k10/main.c

@@ -390,31 +390,6 @@ void bmemset(void *p)
 {
 	__asm__ __volatile__("1: jmp 1b");
 }
-
-void put8(uint8_t c)
-{
-	char x[] = "0123456789abcdef";
-	wave(x[c>>4]);
-	wave(x[c&0xf]);
-}
-
-void put16(uint16_t s)
-{
-	put8(s>>8);
-	put8(s);
-}
-
-void put32(uint32_t u)
-{
-	put16(u>>16);
-	put16(u);
-}
-
-void put64(uint64_t v)
-{
-	put32(v>>32);
-	put32(v);
-}
 */
 
 void debugtouser(void *va)

+ 13 - 1
sys/src/9/port/devtls.c

@@ -425,6 +425,7 @@ tlsstat(Chan *c, uint8_t *db, int32_t n)
 static Chan*
 tlsopen(Chan *c, int omode)
 {
+	Proc *up = externup();
 	TlsRec *tr, **pp;
 	int t, perm;
 
@@ -512,6 +513,7 @@ tlsopen(Chan *c, int omode)
 static int32_t
 tlswstat(Chan *c, uint8_t *dp, int32_t n)
 {
+	Proc *up = externup();
 	Dir *d;
 	TlsRec *tr;
 	int rv;
@@ -536,7 +538,7 @@ tlswstat(Chan *c, uint8_t *dp, int32_t n)
 		error(Eshortstat);
 	if(!emptystr(d->uid))
 		kstrdup(&tr->user, d->uid);
-	if(d->mode != ~0UL)
+	if(d->mode != (uint32_t)~0UL)
 		tr->perm = d->mode;
 
 	free(d);
@@ -566,6 +568,7 @@ dechandq(TlsRec *tr)
 static void
 tlsclose(Chan *c)
 {
+	Proc *up = externup();
 	TlsRec *tr;
 	int t;
 
@@ -748,6 +751,7 @@ tlsclosed(TlsRec *tr, int new)
 static void
 tlsrecread(TlsRec *tr)
 {
+	Proc *up = externup();
 	OneWay *volatile in;
 	Block *volatile b;
 	uint8_t *p, seq[8], header[RecHdrLen], hmac[MD5dlen];
@@ -1007,6 +1011,7 @@ if(tr->debug) pprint("rcvError: %s\n", msg);
 static void
 alertHand(TlsRec *tr, char *msg)
 {
+	Proc *up = externup();
 	Block *b;
 	int n;
 
@@ -1064,6 +1069,7 @@ checkstate(TlsRec *tr, int ishand, int ok)
 static Block*
 tlsbread(Chan *c, int32_t n, int64_t offset)
 {
+	Proc *up = externup();
 	int ty;
 	Block *b;
 	TlsRec *volatile tr;
@@ -1138,6 +1144,7 @@ if(tr->debug) pdump(BLEN(b), b->rp, "consumed:");
 static int32_t
 tlsread(Chan *c, void *a, int32_t n, int64_t off)
 {
+	Proc *up = externup();
 	Block *volatile b;
 	Block *nb;
 	uint8_t *va;
@@ -1228,6 +1235,7 @@ tlsread(Chan *c, void *a, int32_t n, int64_t off)
 static void
 tlsrecwrite(TlsRec *tr, int type, Block *b)
 {
+	Proc *up = externup();
 	Block *volatile bb;
 	Block *nb;
 	uint8_t *p, seq[8];
@@ -1480,6 +1488,7 @@ parseencalg(char *p)
 static int32_t
 tlswrite(Chan *c, void *a, int32_t n, int64_t off)
 {
+	Proc *up = externup();
 	Encalg *ea;
 	Hashalg *ha;
 	TlsRec *volatile tr;
@@ -1795,6 +1804,7 @@ buftochan(char *p)
 static void
 sendAlert(TlsRec *tr, int err)
 {
+	Proc *up = externup();
 	Block *b;
 	int i, fatal;
 	char *msg;
@@ -1877,6 +1887,7 @@ tlshangup(TlsRec *tr)
 static TlsRec*
 newtls(Chan *ch)
 {
+	Proc *up = externup();
 	TlsRec **pp, **ep, **np;
 	char **nmp;
 	int t, newmax;
@@ -1927,6 +1938,7 @@ newtls(Chan *ch)
 static TlsRec *
 mktlsrec(void)
 {
+	Proc *up = externup();
 	TlsRec *tr;
 
 	tr = mallocz(sizeof(*tr), 1);

+ 1 - 0
sys/src/9/port/port.json

@@ -36,6 +36,7 @@
 			"../port/devsegment.c",
 			"../port/devsrv.c",
 			"../port/devssl.c",
+			"../port/devtls.c",
 			"../port/devtab.c",
 			"../port/devtrace.c",
 			"../port/devuart.c",

+ 0 - 5
sys/src/9/port/proc.c

@@ -911,7 +911,6 @@ found:
 	p->state = Scheding;
 	if(0)hi("runproc, pm->mp = sys->machptr[machp()->machno]\n");
 	p->mp = sys->machptr[machp()->machno];
-	if(0){hi("runproc, sys->machptr[machp()->machno] = "); put64((uint64_t)p->mp); hi("\n");}
 
 	if(edflock(p)){
 		edfrun(p, rq == &run.runq[PriEdf]);	/* start deadline timer and do admin */
@@ -921,10 +920,6 @@ found:
 		proctrace(p, SRun, 0);
 	/* avoiding warnings, this will be removed */
 	USED(mach0sched); USED(smprunproc);
-	if(0){hi("runproc, returning p ");
-	put64((uint64_t)p);
-	hi("\n");}
-
 
 	return p;
 }