Parcourir la source

Getting rid of machp() accesses with interrupts enabled, most of them beningn, some of them dubious.
Moving page size stuff to sys got rid of plenty of them.
A pass at stack traces, made sure the frame pointer chain terminates in main and before crossing to user.

Change-Id: Icae8eabd0aecf992c714a36eea5c4fee9817a169

Aki Nyrhinen il y a 8 ans
Parent
commit
8428ebaabc

+ 15 - 15
sys/src/9/k10/archk10.c

@@ -295,10 +295,10 @@ archmmu(void)
 	 */
 	assert(PGSZ == 4*KiB);
 
-	machp()->pgszlg2[0] = 12;
-	machp()->pgszmask[0] = (1<<12)-1;
-	machp()->pgsz[0] = 1<<12;
-	machp()->npgsz = 1;
+	sys->pgszlg2[0] = 12;
+	sys->pgszmask[0] = (1<<12)-1;
+	sys->pgsz[0] = 1<<12;
+	sys->npgsz = 1;
 	if(machp()->ncpuinfos == 0 && cpuidinit() == 0)
 		return 1;
 
@@ -308,22 +308,22 @@ archmmu(void)
 	 */
 	if(!(machp()->cpuinfo[1][3] & 0x00000008))
 		return 1;
-	machp()->pgszlg2[1] = 21;
-	machp()->pgszmask[1] = (1<<21)-1;
-	machp()->pgsz[1] = 1<<21;
-	machp()->npgsz = 2;
+	sys->pgszlg2[1] = 21;
+	sys->pgszmask[1] = (1<<21)-1;
+	sys->pgsz[1] = 1<<21;
+	sys->npgsz = 2;
 
 	/*
 	 * Check the Page1GB bit in function 0x80000001 DX for 1*GiB support.
 	 */
 	if(cpuidinfo(0x80000001, 0, info) && (info[3] & 0x04000000)){
-		machp()->pgszlg2[2] = 30;
-		machp()->pgszmask[2] = (1<<30)-1;
-		machp()->pgsz[2] = 1<<30;
-		machp()->npgsz = 3;
+		sys->pgszlg2[2] = 30;
+		sys->pgszmask[2] = (1<<30)-1;
+		sys->pgsz[2] = 1<<30;
+		sys->npgsz = 3;
 	}
 
-	return machp()->npgsz;
+	return sys->npgsz;
 }
 
 static int
@@ -404,7 +404,7 @@ microdelay(int microsecs)
 	uint64_t r, t;
 
 	r = rdtsc();
-	for(t = r + machp()->cpumhz*microsecs; r < t; r = rdtsc())
+	for(t = r + (sys->cyclefreq*microsecs)/1000000ull; r < t; r = rdtsc())
 		;
 }
 
@@ -414,6 +414,6 @@ millidelay(int millisecs)
 	uint64_t r, t;
 
 	r = rdtsc();
-	for(t = r + machp()->cpumhz*1000ull*millisecs; r < t; r = rdtsc())
+	for(t = r + (sys->cyclefreq*millisecs)/1000ull; r < t; r = rdtsc())
 		;
 }

+ 4 - 4
sys/src/9/k10/asm.c

@@ -326,7 +326,7 @@ asmmeminit(void)
 	int cx;
 #endif /* ConfCrap */
 
-	assert(!((sys->vmunmapped|sys->vmend) & machp()->pgszmask[1]));
+	assert(!((sys->vmunmapped|sys->vmend) & sys->pgszmask[1]));
 
 	if((pa = mmuphysaddr(sys->vmunused)) == ~0)
 		panic("asmmeminit 1");
@@ -362,11 +362,11 @@ asmmeminit(void)
 		hi = assem->addr+assem->size;
 		/* Convert a range into pages */
 		for(mem = lo; mem < hi; mem = nextmem){
-			nextmem = (mem + PGLSZ(0)) & ~machp()->pgszmask[0];
+			nextmem = (mem + PGLSZ(0)) & ~sys->pgszmask[0];
 
 			/* Try large pages first */
-			for(i = machp()->npgsz - 1; i >= 0; i--){
-				if((mem & machp()->pgszmask[i]) != 0)
+			for(i = sys->npgsz - 1; i >= 0; i--){
+				if((mem & sys->pgszmask[i]) != 0)
 					continue;
 				if(mem + PGLSZ(i) > hi)
 					continue;

+ 15 - 6
sys/src/9/k10/dat.h

@@ -33,6 +33,7 @@ typedef struct PNOTIFY PNOTIFY;
 typedef uint64_t PTE;
 typedef struct Proc Proc;
 typedef struct Sys Sys;
+typedef struct Stackframe Stackframe;
 typedef uint64_t uintmem;				/* Physical address (hideous) */
 typedef struct Ureg Ureg;
 typedef struct Vctl Vctl;
@@ -174,11 +175,6 @@ struct MMMU
 	Page*	pml4;			/* pml4 for this processor */
 	PTE*	pmap;			/* unused as of yet */
 
-	uint	pgszlg2[NPGSZ];		/* per Mach or per Sys? */
-	uint	pgszmask[NPGSZ];
-	uint	pgsz[NPGSZ];
-	int	npgsz;
-
 	Page	pml4kludge;		/* NIX KLUDGE: we need a page */
 };
 
@@ -316,6 +312,12 @@ struct Mach
 	NIX;
 };
 
+struct Stackframe
+{
+	Stackframe *next;
+	uintptr_t pc;
+};
+
 /*
  * This is the low memory map, between 0x100000 and 0x110000.
  * It is located there to allow fundamental datastructures to be
@@ -368,10 +370,17 @@ struct Sys {
 		unsigned char	ptrpage[4*KiB];
 	};
 
+	uint64_t	cyclefreq;		/* Frequency of user readable cycle counter (mach 0) */
+
+	uint	pgszlg2[NPGSZ];		/* per Mach or per Sys? */
+	uint	pgszmask[NPGSZ];	/* Per sys -aki */
+	uint	pgsz[NPGSZ];
+	int	npgsz;
+
 	unsigned char	_57344_[2][4*KiB];		/* unused */
 };
 
-extern Sys* sys;
+extern Sys *sys;
 
 /*
  * KMap

+ 1 - 1
sys/src/9/k10/devarch.c

@@ -613,7 +613,7 @@ delay(int millisecs)
 	if(millisecs <= 0)
 		millisecs = 1;
 	r = rdtsc();
-	for(t = r + machp()->cpumhz*1000ull*millisecs; r < t; r = rdtsc())
+	for(t = r + (sys->cyclefreq*millisecs)/1000ull; r < t; r = rdtsc())
 		;
 }
 

+ 2 - 0
sys/src/9/k10/entry.S

@@ -349,6 +349,7 @@ _zap0done:
 	movq	%rbx, %rsi
 	movq	%rax, %rax
 	movq	%rax, %rdi				/* multiboot magic */
+	xorq	%rbp, %rbp			/* stack trace ends here */
 	CALL	main
 
 .globl ndnr
@@ -588,6 +589,7 @@ _apstart64v:
 	movq	%rax, %rsi			/* Mach * */
 
 	MOVQ	8(%rsi), %rAX			/* m->splpc */
+	xorq	%rbp, %rbp			/* stack trace ends here */
 	CALL	*%raX				/* CALL squidboy(SB) */
 
 

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

@@ -148,6 +148,8 @@ uint64_t	spllo(void);
 void	splx(uint64_t);
 void	splxpc(uint64_t);
 void	kstackok(void); /* panic if kstack guards garbaged, works with and without externup */
+Stackframe	*stackframe(void); /* l64v.S */
+void	stacksnippet(void);
 void	stopac(void);
 void	syncclock(void);
 void	syscall(int scallnr, Ureg *ureg);

+ 3 - 0
sys/src/9/k10/l64idt.S

@@ -106,6 +106,9 @@ _intrnested:
 
 	MOVQ	%rsp, %rdi // it's ok, we saved %rdi.
 	xorq	%rax, %rax
+	/* if we came from user, stack traces end here */
+	CMPW	$SSEL(SiCS, SsTIGDT|SsRPL0), 144(%rsp)
+	cmovneq	%rax, %rbp
 	pushq	%rax
 	popfq				/* clear all flags. is there something else we should clear too? */
 	CALL	_trap

+ 9 - 0
sys/src/9/k10/l64v.S

@@ -282,6 +282,15 @@ sfence:
 	SFENCE
 	RET
 
+/*
+ *	x86 convention is to use %rbp as the frame pointer,
+ *	so we just return that register
+ */
+.global stackframe
+stackframe:
+	movq	%rbp, %rax
+	retq
+
 /*
  *	disable interrupts,
  *	return old flags for splx()

+ 2 - 1
sys/src/9/k10/l64vsyscall.S

@@ -75,7 +75,8 @@ syscallentry:
 	movq	%rax, %rdi
 	xorq	%rax, %rax
 	pushq	%rax
-	popfq				/* clear all flags. is there something else we should clear too? */
+	popfq			/* clear all flags. is there something else we should clear too? */
+	movq	$0, %rbp	/* stack traces end here */
 	CALL	syscall
 
 	.globl	syscallreturn

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

@@ -55,6 +55,27 @@ static int vflag = 1;
 
 int nosmp = 1;
 
+
+/*
+ *	this may need improvement, but right now it's just for
+ *	pretty printing below, so it doesn't need to be accurate
+ */
+static int
+ktextaddr(uintptr_t pc)
+{
+	return (pc & 0xfffffffff0000000) == 0xfffffffff0000000;
+}
+
+void
+stacksnippet(void)
+{
+	Stackframe *stkfr;
+	print(" stack:");
+	for(stkfr = stackframe(); stkfr != nil; stkfr = stkfr->next)
+		print(" %c:%p", ktextaddr(stkfr->pc) ? 'k' : '?', ktextaddr(stkfr->pc) ? (stkfr->pc & 0xfffffff) : stkfr->pc);
+	print("\n");
+}
+
 void
 machp_bad(void)
 {
@@ -74,7 +95,8 @@ machp_bad(void)
 		return;
 	}
 	trace[i] = badpc;
-	print("machp access spllo pc %p\n", badpc);
+	print("machp access spllo,");
+	stacksnippet();
 }
 
 void
@@ -492,6 +514,7 @@ main(uint32_t mbmagic, uint32_t mbaddress)
 	 */
 	mach->cpuhz = 2000000000ll;
 	mach->cpumhz = 2000;
+	sys->cyclefreq = mach->cpuhz;
 
 	cgainit();
 	i8250console("0");
@@ -516,6 +539,7 @@ main(uint32_t mbmagic, uint32_t mbaddress)
 	if((hz = archhz()) != 0ll){
 		mach->cpuhz = hz;
 		mach->cyclefreq = hz;
+		sys->cyclefreq = hz;
 		mach->cpumhz = hz/1000000ll;
 	}
 	//iprint("archhz returns 0x%lld\n", hz);

+ 2 - 2
sys/src/9/k10/mmu.c

@@ -402,7 +402,7 @@ mmuput(uintptr_t va, Page *pg, uint attr)
 		print("%s", buf);
 	}
 	assert(pg->pgszi >= 0);
-	pgsz = machp()->pgsz[pg->pgszi];
+	pgsz = sys->pgsz[pg->pgszi];
 	if(pa & (pgsz-1))
 		panic("mmuput: pa offset non zero: %#ullx\n", pa);
 	pa |= pteflags(attr);
@@ -789,7 +789,7 @@ mmuinit(void)
 	uint64_t o, pa, r, sz;
 
 	archmmu();
-	DBG("mach%d: %#p pml4 %#p npgsz %d\n", machp()->machno, machp(), machp()->pml4, machp()->npgsz);
+	DBG("mach%d: %#p pml4 %#p npgsz %d\n", machp()->machno, machp(), machp()->pml4, sys->npgsz);
 
 	if(machp()->machno != 0){
 		/* NIX: KLUDGE: Has to go when each mach is using

+ 10 - 3
sys/src/9/k10/trap.c

@@ -413,14 +413,21 @@ trap(Ureg* ureg)
 			if(up)
 				up->nqtrap++;
 
-		if(ctl->isr)
+		if(ctl->isr){
 			ctl->isr(vno);
+			if(islo())print("trap %d: isr %p enabled interrupts\n", vno, ctl->isr);
+		}
 		for(v = ctl; v != nil; v = v->next){
-			if(v->f)
+			if(v->f){
 				v->f(ureg, v->a);
+				if(islo())print("trap %d: ctlf %p enabled interrupts\n", vno, v->f);
+			}
 		}
-		if(ctl->eoi)
+		if(ctl->eoi){
 			ctl->eoi(vno);
+			if(islo())print("trap %d: eoi %p enabled interrupts\n", vno, ctl->eoi);
+		}
+
 		intrtime(vno);
 		if(ctl->isintr){
 			if(ctl->irq == IrqCLOCK || ctl->irq == IrqTIMER)

+ 1 - 1
sys/src/9/port/devproc.c

@@ -1823,7 +1823,7 @@ procctlmemio(Proc *p, uintptr_t offset, int n, void *va, int read)
 	pte = s->map[soff/PTEMAPMEM];
 	if(pte == 0)
 		panic("procctlmemio");
-	pgsz = machp()->pgsz[s->pgszi];
+	pgsz = sys->pgsz[s->pgszi];
 	pg = pte->pages[(soff&(PTEMAPMEM-1))/pgsz];
 	if(pagedout(pg))
 		panic("procctlmemio1");

+ 5 - 4
sys/src/9/port/fault.c

@@ -47,9 +47,9 @@ fault(uintptr_t addr, uintptr_t pc, int ftype)
 
 	sps = up->psstate;
 	up->psstate = "Fault";
-	spllo();
 
 	machp()->pfault++;
+	spllo();
 	for(i = 0;; i++) {
 		s = seg(up, addr, 1);	 /* leaves s->lk qlocked if seg != nil */
 		//print("%s fault seg for %p is %p base %p top %p\n", faulttypes[ftype], addr, s, s->base, s->top);
@@ -76,7 +76,7 @@ fault(uintptr_t addr, uintptr_t pc, int ftype)
 		if(i > 0 && (i%1000) == 0)
 			print("fault: tried %d times\n", i);
 	}
-
+	splhi();
 	up->psstate = sps;
 	return 0;
 fail:
@@ -94,6 +94,7 @@ fail:
 			faulttypes[ftype],
 			up->pid, addr, pc);
 	}
+	splhi();
 	up->psstate = sps;
 	return -1;
 }
@@ -130,7 +131,7 @@ fixfault(Segment *s, uintptr_t addr, int ftype, int dommuput, int color)
 	Page **pg, *lkp, *new;
 	Page *(*fn)(Segment*, uintptr_t);
 
-	pgsz = machp()->pgsz[s->pgszi];
+	pgsz = sys->pgsz[s->pgszi];
 	addr &= ~(pgsz-1);
 	soff = addr-s->base;
 	p = &s->map[soff/PTEMAPMEM];
@@ -304,7 +305,7 @@ pio(Segment *s, uintptr_t addr, uint32_t soff, Page **p, int color)
 	loadrec = *p;
 	daddr = ask = 0;
 	c = nil;
-	pgsz = machp()->pgsz[s->pgszi];
+	pgsz = sys->pgsz[s->pgszi];
 	if(loadrec == nil) {	/* from a text/data image */
 		daddr = s->ldseg.pg0fileoff + soff;
 		doff = s->ldseg.pg0off;

+ 13 - 13
sys/src/9/port/page.c

@@ -43,11 +43,11 @@ seprintpagestats(char *s, char *e)
 	int i;
 
 	lock(&pga);
-	for(i = 0; i < machp()->npgsz; i++)
-		if(machp()->pgsz[i] != 0)
+	for(i = 0; i < sys->npgsz; i++)
+		if(sys->pgsz[i] != 0)
 			s = seprint(s, e, "%uld/%d %dK user pages avail\n",
 				pga.pgsza[i].freecount,
-				pga.pgsza[i].npages.ref, machp()->pgsz[i]/KiB);
+				pga.pgsza[i].npages.ref, sys->pgsz[i]/KiB);
 	unlock(&pga);
 	return s;
 }
@@ -64,23 +64,23 @@ pageinit(void)
 	Page *pg;
 
 	pga.userinit = 1;
-	DBG("pageinit: npgsz = %d\n", machp()->npgsz);
+	DBG("pageinit: npgsz = %d\n", sys->npgsz);
 	/*
 	 * Don't pre-allocate 4K pages, we are not using them anymore.
 	 */
-	for(si = 1; si < machp()->npgsz; si++){
+	for(si = 1; si < sys->npgsz; si++){
 		for(i = 0; i < Nstartpgs; i++){
 			if(si < 2)
 				color = -1;
 			else
 				color = i;
-			pg = pgalloc(machp()->pgsz[si], color);
+			pg = pgalloc(sys->pgsz[si], color);
 			if(pg == nil){
 				DBG("pageinit: pgalloc failed. breaking.\n");
 				break;	/* don't consume more memory */
 			}
 			DBG("pageinit: alloced pa %#P sz %#ux color %d\n",
-				pg->pa, machp()->pgsz[si], pg->color);
+				pg->pa, sys->pgsz[si], pg->color);
 			lock(&pga);
 			pg->ref = 0;
 			pagechainhead(pg);
@@ -96,8 +96,8 @@ getpgszi(usize size)
 {
 	int si;
 
-	for(si = 0; si < machp()->npgsz; si++)
-		if(size == machp()->pgsz[si])
+	for(si = 0; si < sys->npgsz; si++)
+		if(size == sys->pgsz[si])
 			return si;
 	print("getpgszi: size %#ulx not found\n", size);
 	return -1;
@@ -130,7 +130,7 @@ void
 pgfree(Page* pg)
 {
 	decref(&pga.pgsza[pg->pgszi].npages);
-	physfree(pg->pa, machp()->pgsz[pg->pgszi]);
+	physfree(pg->pa, sys->pgsz[pg->pgszi]);
 	free(pg);
 }
 
@@ -313,13 +313,13 @@ if (VA(k) == 0xfffffe007d800000ULL) trip++;
 		int i;
 		uint64_t *v = (void *)VA(k);
 		if (1)
-		for(i = 0; i < machp()->pgsz[p->pgszi]/sizeof(*v); i++)
+		for(i = 0; i < sys->pgsz[p->pgszi]/sizeof(*v); i++)
 			v[i] = 0;
 //if (trip) die("trip");
 		kunmap(k);
 	}
 	DBG("newpage: va %#p pa %#ullx pgsz %#ux color %d\n",
-		p->va, p->pa, machp()->pgsz[p->pgszi], p->color);
+		p->va, p->pa, sys->pgsz[p->pgszi], p->color);
 
 	return p;
 }
@@ -498,7 +498,7 @@ copypage(Page *f, Page *t)
 		panic("copypage");
 	ks = kmap(f);
 	kd = kmap(t);
-	memmove((void*)VA(kd), (void*)VA(ks), machp()->pgsz[t->pgszi]);
+	memmove((void*)VA(kd), (void*)VA(ks), sys->pgsz[t->pgszi]);
 	kunmap(ks);
 	kunmap(kd);
 }

+ 4 - 4
sys/src/9/port/pager.c

@@ -200,11 +200,11 @@ freepages(int si, int once)
 	Pgsza *pa;
 	Page *p;
 
-	for(; si < machp()->npgsz; si++){
+	for(; si < sys->npgsz; si++){
 		pa = &pga.pgsza[si];
 		if(pa->freecount > 0){
 			DBG("kickpager() up %#p: releasing %udK pages\n",
-				up, machp()->pgsz[si]/KiB);
+				up, sys->pgsz[si]/KiB);
 			lock(&pga);
 			if(pa->freecount == 0){
 				unlock(&pga);
@@ -227,7 +227,7 @@ tryalloc(int pgszi, int color)
 {
 	Page *p;
 
-	p = pgalloc(machp()->pgsz[pgszi], color);
+	p = pgalloc(sys->pgsz[pgszi], color);
 	if(p != nil){
 		lock(&pga);
 		pagechainhead(p);
@@ -288,7 +288,7 @@ kickpager(int pgszi, int color)
 	/*
 	 * If pgszi is <= text page size, try releasing text pages.
 	 */
-	if(machp()->pgsz[pgszi] <= 2*MiB){
+	if(sys->pgsz[pgszi] <= 2*MiB){
 		pstats.ntext++;
 		DBG("kickpager() up %#p: reclaiming text pages\n", up);
 		pageouttext(pgszi, color);

+ 3 - 3
sys/src/9/port/proc.c

@@ -181,7 +181,7 @@ sched(void)
 	Proc *up = externup();
 	Proc *p;
 
-	if(machp()->ilockdepth)
+	if(!islo() && machp()->ilockdepth)
 		panic("cpu%d: ilockdepth %d, last lock %#p at %#p, sched called from %#p",
 			machp()->machno,
 			machp()->ilockdepth,
@@ -798,7 +798,7 @@ loop:
 	 *  or one that hasn't moved in a while (load balancing).  Every
 	 *  time around the loop affinity goes down.
 	 */
-	spllo();
+	splhi();
 	for(i = 0;; i++){
 		/*
 		 *  find the highest priority target process that this
@@ -815,6 +815,7 @@ loop:
 
 		/* waste time or halt the CPU */
 		idlehands();
+		splhi();
 		/* remember how much time we're here */
 		now = perfticks();
 		machp()->perf.inidle += now-start;
@@ -822,7 +823,6 @@ loop:
 	}
 
 found:
-	splhi();
 	p = dequeueproc(&run, rq, p);
 	if(p == nil)
 		goto loop;

+ 6 - 2
sys/src/9/port/qlock.c

@@ -36,8 +36,12 @@ qlock(QLock *q)
 	uint64_t t0;
 
 	cycles(&t0);
-	if(machp()->ilockdepth != 0)
-		print("qlock: %#p: ilockdepth %d", getcallerpc(&q), machp()->ilockdepth);
+
+	if(!islo() && machp()->ilockdepth != 0){
+		print("qlock with ilockdepth %d,", machp()->ilockdepth);
+		stacksnippet();
+	}
+
 	if(up != nil && up->nlocks)
 		print("qlock: %#p: nlocks %d", getcallerpc(&q), up->nlocks);
 

+ 4 - 4
sys/src/9/port/segment.c

@@ -32,7 +32,7 @@ segppn(Segment *s, uintmem pa)
 {
 	uintmem pgsz;
 
-	pgsz = machp()->pgsz[s->pgszi];
+	pgsz = sys->pgsz[s->pgszi];
 	pa &= ~(pgsz-1);
 	return pa;
 }
@@ -278,7 +278,7 @@ segpage(Segment *s, Page *p)
 	pte = &s->map[soff/PTEMAPMEM];
 	if(*pte == 0)
 		*pte = ptealloc(s);
-	pgsz = machp()->pgsz[s->pgszi];
+	pgsz = sys->pgsz[s->pgszi];
 	pg = &(*pte)->pages[(soff&(PTEMAPMEM-1))/pgsz];
 	*pg = p;
 	if(pg < (*pte)->first)
@@ -299,7 +299,7 @@ mfreeseg(Segment *s, uintptr_t start, int pages)
 	Page *pg;
 	Page *list;
 
-	pgsz = machp()->pgsz[s->pgszi];
+	pgsz = sys->pgsz[s->pgszi];
 	soff = start-s->base;
 	j = (soff&(PTEMAPMEM-1))/pgsz;
 
@@ -404,7 +404,7 @@ prepageseg(int i)
 	if(s == nil)
 		return;
 	DBG("prepage: base %#p top %#p\n", s->base, s->top);
-	pgsz = machp()->pgsz[s->pgszi];
+	pgsz = sys->pgsz[s->pgszi];
 	for(addr = s->base; addr < s->top; addr += pgsz)
 		fault(addr, -1, (s->type & SG_WRITE) ? FT_WRITE : FT_READ);
 }

+ 3 - 1
sys/src/9/port/sysproc.c

@@ -386,10 +386,12 @@ execac(Ar0* ar0, int flags, char *ufile, char **argv)
 		error(Ebadexec);
 	}
 
+	/* TODO(aki): not sure I see the point
 	if(up->ac != nil && up->ac != machp())
 		up->color = corecolor(up->ac->machno);
 	else
 		up->color = corecolor(machp()->machno);
+	*/
 
 	/*
 	 * The new stack is temporarily mapped elsewhere.
@@ -433,7 +435,7 @@ execac(Ar0* ar0, int flags, char *ufile, char **argv)
 	 * First, the top-of-stack structure.
 	 */
 	tos = (Tos*)stack;
-	tos->cyclefreq = machp()->cyclefreq;
+	tos->cyclefreq = sys->cyclefreq;
 	cycles((uint64_t*)&tos->pcycles);
 	tos->pcycles = -tos->pcycles;
 	tos->kcycles = tos->pcycles;

+ 1 - 1
sys/src/9/port/sysseg.c

@@ -96,7 +96,7 @@ ibrk(uintptr_t addr, int seg)
 	if(addr < s->base)
 		addr = s->base;
 
-	pgsz = machp()->pgsz[s->pgszi];
+	pgsz = sys->pgsz[s->pgszi];
 	newtop = ROUNDUP(addr, pgsz);
 	newsize = (newtop-s->base)/pgsz;
 	if(newtop < s->top) {

+ 0 - 1
sys/src/9/port/taslock.c

@@ -249,7 +249,6 @@ canlock(Lock *l)
 		up->lastlock = l;
 	l->_pc = getcallerpc(&l);
 	l->p = up;
-	l->m = machp();
 	l->isilock = 0;
 	if(LOCKCYCLES)
 		cycles(&l->lockcycles);