Re: Fwd: newb question : list of elligible computers to debian-68k
On Mon, 20 Oct 2008, Finn Thain wrote:
> I think the page fault normally precedes the F-line exception but when
> the FPU op spans the page boundary, the F-line exception goes missing...
> but I could be wrong.
I think I was wrong about that. Table 8-4 says that a Data Access Error
can have a pending unimplemented FP instruction exception, but an
Instruction Access Error is reported after all previous instructions and
associated exceptions have completed.
> > > I guess what Apple does is detect this special case of ATC fault,
> > > then if the bad instruction is one it knows how to fixup it manually
> > > creates the instruction emulation stack frame and does the emulation
> > > followed by the page fault code for the missing page.
> > > I believe an ATC fault would normally just cause the next page to be
> > > loaded.
> > That's what I have been thinking - is there a way to fabricate the
> > F-line exception stack from what is available on the stack at the time
> > the page fault was taken? (From the errata, it appears as if the PC is
> > still pointing to the faulting instruction... maybe that can be used
> > for a quick check in the page fault handler? What is the situation
> > with a plain page fault?)
> >From the M68040 User's Manual, p. 8-7,
> "[The processor] saves the vector offset, PC, and internal copy of the
> SR on the stack. The saved PC value is the logical address of the
> instruction executing at the time the fault was detected. This
> instruction is not necessarily the one that initiated the bus cycle
> since the processor overlaps execution of instructions."
> According to the erratum, in this case the access error exception frame
> will show the fault address for the page fault (i.e. start of following
> page), rather than the fault address for the unimplemented instrution.
> And the saved PC will indicate the unimplemented instruction, whereas
> for a normal access error it would vary.
> So you have to figure out, for an ATC exception with a fault address at
> the start of a page, whether an instruction at the page boundary might
> have (1) been executed prior to the ATC exception (difficult when you
> can't rely on the saved PC?) and (2) is an FPU op in need of emulation
> and (3) there is no pending exception for this unimplemented instruction
... so in fact it won't be pending. But it may or may not have been raised
and handled already, depending on whether the bug lost the exception or
not (the bug is apparently not dependable).
No idea what to do about (1). Since I don't understand the implications of
"overlapped execution", I can't hazard a guess as to whether this kind of
fix is even theoretically feasible.