Revert "print kernel stacktrace for exceptions in kernel"
This reverts commit eff1369cab
.
This was in a working branch and I only intended to commit
exception.c. But I committed the exact inverse. Sorry.
This commit is contained in:
parent
04d2db3c44
commit
b984fa41df
11 changed files with 11 additions and 59 deletions
|
@ -37,7 +37,6 @@ struct fpu_state_s {
|
||||||
/* fpu_image includes 512 bytes of image itself and
|
/* fpu_image includes 512 bytes of image itself and
|
||||||
* additional 15 bytes required for manual 16-byte alignment. */
|
* additional 15 bytes required for manual 16-byte alignment. */
|
||||||
char fpu_image[527];
|
char fpu_image[527];
|
||||||
u32_t checksum;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define INMEMORY(p) (!p->p_seg.p_cr3 || get_cpulocal_var(ptproc) == p)
|
#define INMEMORY(p) (!p->p_seg.p_cr3 || get_cpulocal_var(ptproc) == p)
|
||||||
|
|
|
@ -14,7 +14,7 @@ SRCS += smp.c
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
DPADD+= ${LIBTIMERS} ${LIBSYS} ${LIBEXEC}
|
DPADD+= ${LIBTIMERS} ${LIBSYS} ${LIBEXEC}
|
||||||
LDADD+= -ltimers -lsys -lexec -lz
|
LDADD+= -ltimers -lsys -lexec
|
||||||
|
|
||||||
CFLAGS += -D__kernel__
|
CFLAGS += -D__kernel__
|
||||||
|
|
||||||
|
|
|
@ -58,27 +58,6 @@ FORWARD _PROTOTYPE( void ser_dump_proc_cpu, (void));
|
||||||
FORWARD _PROTOTYPE( void ser_init, (void));
|
FORWARD _PROTOTYPE( void ser_init, (void));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PRIVATE u32_t fpusum(struct proc *p)
|
|
||||||
{
|
|
||||||
void *save_area = p->p_fpu_state.fpu_save_area_p;
|
|
||||||
return crc32(0, save_area, FPU_XFP_SIZE);
|
|
||||||
}
|
|
||||||
|
|
||||||
PUBLIC void fpu_makechecksum(struct proc *p)
|
|
||||||
{
|
|
||||||
p->p_fpu_state.checksum = fpusum(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
PUBLIC void fpu_verifychecksum(struct proc *p)
|
|
||||||
{
|
|
||||||
static int n;
|
|
||||||
n++;
|
|
||||||
if(p->p_fpu_state.checksum != fpusum(p)) {
|
|
||||||
printf("%d / %s fpu state broken!", p->p_endpoint, p->p_name);
|
|
||||||
util_stacktrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PUBLIC __dead void arch_monitor(void)
|
PUBLIC __dead void arch_monitor(void)
|
||||||
{
|
{
|
||||||
monitor();
|
monitor();
|
||||||
|
@ -273,23 +252,16 @@ PUBLIC void fpu_init(void)
|
||||||
|
|
||||||
PUBLIC void save_local_fpu(struct proc *pr)
|
PUBLIC void save_local_fpu(struct proc *pr)
|
||||||
{
|
{
|
||||||
static int n;
|
|
||||||
phys_bytes save_area = (phys_bytes) pr->p_fpu_state.fpu_save_area_p;
|
|
||||||
if(!is_fpu())
|
if(!is_fpu())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* save area must be 16-byte aligned */
|
|
||||||
assert(!(save_area % FPUALIGN));
|
|
||||||
|
|
||||||
/* Save changed FPU context. */
|
/* Save changed FPU context. */
|
||||||
if(osfxsr_feature) {
|
if(osfxsr_feature) {
|
||||||
fxsave(save_area);
|
fxsave(pr->p_fpu_state.fpu_save_area_p);
|
||||||
fninit();
|
fninit();
|
||||||
} else {
|
} else {
|
||||||
fnsave(save_area);
|
fnsave(pr->p_fpu_state.fpu_save_area_p);
|
||||||
}
|
}
|
||||||
|
|
||||||
fpu_makechecksum(pr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PUBLIC void save_fpu(struct proc *pr)
|
PUBLIC void save_fpu(struct proc *pr)
|
||||||
|
@ -332,14 +304,10 @@ PUBLIC void restore_fpu(struct proc *pr)
|
||||||
fninit();
|
fninit();
|
||||||
pr->p_misc_flags |= MF_FPU_INITIALIZED;
|
pr->p_misc_flags |= MF_FPU_INITIALIZED;
|
||||||
} else {
|
} else {
|
||||||
phys_bytes save_area = (phys_bytes) pr->p_fpu_state.fpu_save_area_p;
|
|
||||||
/* save area must be 16-byte aligned */
|
|
||||||
assert(!(save_area % FPUALIGN));
|
|
||||||
fpu_verifychecksum(pr);
|
|
||||||
if(osfxsr_feature) {
|
if(osfxsr_feature) {
|
||||||
fxrstor(save_area);
|
fxrstor(pr->p_fpu_state.fpu_save_area_p);
|
||||||
} else {
|
} else {
|
||||||
frstor(save_area);
|
frstor(pr->p_fpu_state.fpu_save_area_p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,10 +95,10 @@ _PROTOTYPE( void ia32_msr_read, (u32_t reg, u32_t * hi, u32_t * lo) );
|
||||||
_PROTOTYPE( void ia32_msr_write, (u32_t reg, u32_t hi, u32_t lo) );
|
_PROTOTYPE( void ia32_msr_write, (u32_t reg, u32_t hi, u32_t lo) );
|
||||||
_PROTOTYPE( void fninit, (void));
|
_PROTOTYPE( void fninit, (void));
|
||||||
_PROTOTYPE( void clts, (void));
|
_PROTOTYPE( void clts, (void));
|
||||||
_PROTOTYPE( void fxsave, (vir_bytes));
|
_PROTOTYPE( void fxsave, (void *));
|
||||||
_PROTOTYPE( void fnsave, (vir_bytes));
|
_PROTOTYPE( void fnsave, (void *));
|
||||||
_PROTOTYPE( void fxrstor, (vir_bytes));
|
_PROTOTYPE( void fxrstor, (void *));
|
||||||
_PROTOTYPE( void frstor, (vir_bytes));
|
_PROTOTYPE( void frstor, (void *));
|
||||||
_PROTOTYPE( unsigned short fnstsw, (void));
|
_PROTOTYPE( unsigned short fnstsw, (void));
|
||||||
_PROTOTYPE( void fnstcw, (unsigned short* cw));
|
_PROTOTYPE( void fnstcw, (unsigned short* cw));
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
SSREG = SPREG+W
|
SSREG = SPREG+W
|
||||||
P_STACKTOP = SSREG+W
|
P_STACKTOP = SSREG+W
|
||||||
FP_SAVE_AREA_P = P_STACKTOP
|
FP_SAVE_AREA_P = P_STACKTOP
|
||||||
P_LDT_SEL = FP_SAVE_AREA_P + 536
|
P_LDT_SEL = FP_SAVE_AREA_P + 532
|
||||||
P_CR3 = P_LDT_SEL+W
|
P_CR3 = P_LDT_SEL+W
|
||||||
P_CR3_V = P_CR3+4
|
P_CR3_V = P_CR3+4
|
||||||
P_LDT = P_CR3_V+W
|
P_LDT = P_CR3_V+W
|
||||||
|
|
|
@ -37,8 +37,6 @@
|
||||||
*/
|
*/
|
||||||
#define DEBUG_RACE 0
|
#define DEBUG_RACE 0
|
||||||
|
|
||||||
#define DEBUG_FPUCHECK 1
|
|
||||||
|
|
||||||
/* DEBUG_DUMPIPC dumps all IPC to serial; due to the amount of logging it is
|
/* DEBUG_DUMPIPC dumps all IPC to serial; due to the amount of logging it is
|
||||||
* strongly recommended to set "ctty 0" in the boot monitor and run inside a
|
* strongly recommended to set "ctty 0" in the boot monitor and run inside a
|
||||||
* virtual machine if you enable this; on the hardware it would take forever
|
* virtual machine if you enable this; on the hardware it would take forever
|
||||||
|
|
|
@ -257,10 +257,6 @@ PUBLIC void switch_to_user(void)
|
||||||
int tlb_must_refresh = 0;
|
int tlb_must_refresh = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char buf[100];
|
|
||||||
u32_t c;
|
|
||||||
c = crc32(0, buf, 100);
|
|
||||||
|
|
||||||
p = get_cpulocal_var(proc_ptr);
|
p = get_cpulocal_var(proc_ptr);
|
||||||
/*
|
/*
|
||||||
* if the current process is still runnable check the misc flags and let
|
* if the current process is still runnable check the misc flags and let
|
||||||
|
|
|
@ -223,9 +223,6 @@ _PROTOTYPE( int copy_msg_to_user, (struct proc * p, message * src,
|
||||||
_PROTOTYPE(void switch_address_space, (struct proc * p));
|
_PROTOTYPE(void switch_address_space, (struct proc * p));
|
||||||
_PROTOTYPE(void release_address_space, (struct proc *pr));
|
_PROTOTYPE(void release_address_space, (struct proc *pr));
|
||||||
|
|
||||||
_PROTOTYPE(void fpu_makechecksum, (struct proc *p));
|
|
||||||
_PROTOTYPE(void fpu_verifychecksum, (struct proc *p));
|
|
||||||
|
|
||||||
_PROTOTYPE(void enable_fpu_exception, (void));
|
_PROTOTYPE(void enable_fpu_exception, (void));
|
||||||
_PROTOTYPE(void disable_fpu_exception, (void));
|
_PROTOTYPE(void disable_fpu_exception, (void));
|
||||||
_PROTOTYPE(void release_fpu, (struct proc * p));
|
_PROTOTYPE(void release_fpu, (struct proc * p));
|
||||||
|
|
|
@ -65,13 +65,10 @@ PUBLIC int do_fork(struct proc * caller, message * m_ptr)
|
||||||
#if (_MINIX_CHIP == _CHIP_INTEL)
|
#if (_MINIX_CHIP == _CHIP_INTEL)
|
||||||
rpc->p_seg.p_ldt_sel = old_ldt_sel; /* restore descriptors */
|
rpc->p_seg.p_ldt_sel = old_ldt_sel; /* restore descriptors */
|
||||||
rpc->p_fpu_state.fpu_save_area_p = old_fpu_save_area_p;
|
rpc->p_fpu_state.fpu_save_area_p = old_fpu_save_area_p;
|
||||||
if(proc_used_fpu(rpp)) {
|
if(proc_used_fpu(rpp))
|
||||||
fpu_verifychecksum(rpp);
|
|
||||||
memcpy(rpc->p_fpu_state.fpu_save_area_p,
|
memcpy(rpc->p_fpu_state.fpu_save_area_p,
|
||||||
rpp->p_fpu_state.fpu_save_area_p,
|
rpp->p_fpu_state.fpu_save_area_p,
|
||||||
FPU_XFP_SIZE);
|
FPU_XFP_SIZE);
|
||||||
fpu_verifychecksum(rpc);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
if(++gen >= _ENDPOINT_MAX_GENERATION) /* increase generation */
|
if(++gen >= _ENDPOINT_MAX_GENERATION) /* increase generation */
|
||||||
gen = 1; /* generation number wraparound */
|
gen = 1; /* generation number wraparound */
|
||||||
|
|
|
@ -86,7 +86,6 @@ PUBLIC int do_setmcontext(struct proc * caller, message * m_ptr)
|
||||||
rp->p_misc_flags |= MF_FPU_INITIALIZED;
|
rp->p_misc_flags |= MF_FPU_INITIALIZED;
|
||||||
memcpy(rp->p_fpu_state.fpu_save_area_p, &(mc.mc_fpu_state),
|
memcpy(rp->p_fpu_state.fpu_save_area_p, &(mc.mc_fpu_state),
|
||||||
FPU_XFP_SIZE);
|
FPU_XFP_SIZE);
|
||||||
fpu_makechecksum(rp);
|
|
||||||
} else
|
} else
|
||||||
rp->p_misc_flags &= ~MF_FPU_INITIALIZED;
|
rp->p_misc_flags &= ~MF_FPU_INITIALIZED;
|
||||||
/* force reloading FPU in either case */
|
/* force reloading FPU in either case */
|
||||||
|
|
|
@ -56,10 +56,8 @@ PUBLIC int do_sigreturn(struct proc * caller, message * m_ptr)
|
||||||
#if (_MINIX_CHIP == _CHIP_INTEL)
|
#if (_MINIX_CHIP == _CHIP_INTEL)
|
||||||
if(sc.sc_flags & MF_FPU_INITIALIZED)
|
if(sc.sc_flags & MF_FPU_INITIALIZED)
|
||||||
{
|
{
|
||||||
fpu_verifychecksum(rp);
|
|
||||||
memcpy(rp->p_fpu_state.fpu_save_area_p, &sc.sc_fpu_state,
|
memcpy(rp->p_fpu_state.fpu_save_area_p, &sc.sc_fpu_state,
|
||||||
FPU_XFP_SIZE);
|
FPU_XFP_SIZE);
|
||||||
fpu_makechecksum(rp);
|
|
||||||
rp->p_misc_flags |= MF_FPU_INITIALIZED; /* Restore math usage flag. */
|
rp->p_misc_flags |= MF_FPU_INITIALIZED; /* Restore math usage flag. */
|
||||||
/* force reloading FPU */
|
/* force reloading FPU */
|
||||||
release_fpu(rp);
|
release_fpu(rp);
|
||||||
|
|
Loading…
Reference in a new issue