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

Re: [MiNT] strange memory violation

søn, 06,.11.2005 kl. 12.08 +0100, skrev Konrad Kokoszkiewicz:
> > after this, Toswin was still active (just desktop.prg was killed, so 
> > I've tried it from this)
> > memory violation, type: private, PC: 1112c3c, Addr: 1a9a2be, test killed
> > 
> > after restart, I've tried it from gdb:
> > memory violation, type: private, PC: 1c922be, Addr: 1c922be, gdb(!) killed
> > memory violation, type: free, PC: 1112c3c, Addr: 18da2be, test killed 
> > (yeah, two memory violations at once)
> > 
> > Could me someone tell, what I'm doing wrong?
> You are doing wrong one thing: everything.

 And then some!

> You're grabbing an interrupt vector and it points to your program. This is a 
> timer interrupt and it occurs asynchronously to task switches, so it occurs even 
> when your program does not run (it is waiting for its turn to run). The memory 
> that belong to your program is NOT ACCESSIBLE AT THAT TIME. But the timer 
> interrupt code tries to access it. So the current process gets bus errors, 
> naturally.
> First of all, you should never ever make an interrupt vector point to your user 
> application. This is unsafe. When the application somehow crashes and exits 
> behind your control, its memory becomes invalid, and the next interrupt you had 
> grabbed will instantly bring the system down.
> Second, you must mark your program Supervisor-protected to avoid bus errors.
> Third, MiNT systems will never be stable if such style of programming doesn't 
> become exstinct once for good.

 And I second this more than I can express! This kind of programming is
just plain unacceptable! Please read up on how to write clean programs!
Sorry to say, I'm extremely not, _not_, _NOT!_ interested in seeing such
software on MiNT.

 Best Regards,
Odd Skancke