NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-amd64/52596: Another netbsd-8 panic



The following reply was made to PR port-amd64/52596; it has been noted by GNATS.

From: maya%netbsd.org@localhost
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: port-amd64/52596: Another netbsd-8 panic
Date: Sun, 8 Oct 2017 11:18:01 +0000

 I am going to test this change:
 
 Index: x86/fpu.c
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/x86/x86/fpu.c,v
 retrieving revision 1.13
 diff -u -p -r1.13 fpu.c
 --- x86/fpu.c	17 Sep 2017 09:41:35 -0000	1.13
 +++ x86/fpu.c	8 Oct 2017 11:13:13 -0000
 @@ -394,10 +394,12 @@ fpudna(struct trapframe *frame)
  	ci->ci_fpcurlwp = l;
  	pcb->pcb_fpcpu = ci;
  
 -	if (i386_use_fxsave) {
 -		if (x86_xsave_features != 0) {
 +	switch (x86_fpu_save) {
 +		case FPU_SAVE_XSAVEOPT:
 +		case FPU_SAVE_XSAVE:
  			xrstor(&pcb->pcb_savefpu, x86_xsave_features);
 -		} else {
 +			break;
 +		case FPU_SAVE_FXSAVE:
  			/*
  			 * AMD FPU's do not restore FIP, FDP, and FOP on
  			 * fxrstor, leaking other process's execution history.
 @@ -412,9 +414,9 @@ fpudna(struct trapframe *frame)
  			fldummy();
  
  			fxrstor(&pcb->pcb_savefpu);
 -		}
 -	} else {
 -		frstor(&pcb->pcb_savefpu);
 +			break;
 +		case FPU_SAVE_FSAVE:
 +			frstor(&pcb->pcb_savefpu);
  	}
  
  	KASSERT(ci == curcpu());
 @@ -442,13 +444,20 @@ fpusave_cpu(bool save)
  
  	if (save) {
  		clts();
 -		if (i386_use_fxsave) {
 -			if (x86_xsave_features != 0)
 +
 +		switch (x86_fpu_save) {
 +			case FPU_SAVE_XSAVEOPT:
 +				xsaveopt(&pcb->pcb_savefpu, x86_xsave_features);
 +				break;
 +			case FPU_SAVE_XSAVE:
  				xsave(&pcb->pcb_savefpu, x86_xsave_features);
 -			else
 +				break;
 +			case FPU_SAVE_FXSAVE:
  				fxsave(&pcb->pcb_savefpu);
 -		} else {
 -			fnsave(&pcb->pcb_savefpu);
 +				break;
 +			case FPU_SAVE_FSAVE:
 +				fnsave(&pcb->pcb_savefpu);
 +				break;
  		}
  	}
  
 


Home | Main Index | Thread Index | Old Index