meulenbr@cstw68.prl.philips.nl (Frans Meulenbroeks) (02/01/90)
Hi! First of all thanks to all the people who mailed or posted their ST 1.5.0 experiences. With the postings and the mm I reposted two weeks ago most people should be able to get the stuff up and running. I'll come with official fixes later on when the dust settles. Only urgent fixes get out right now. After fixing my hardware problem, I noticed that the kernel still would crash every once in a while. The most common cause was a panic caused by a trap 2. After a lot of searching I discovered a flaw in stmpx.s which caused the problem. Below is a fix for stmpx.s and stmain.c. You'll need to apply both of them! The fixes are part of the official ST 1.5.0 version. After applying this fixes my system ran an entire evening test programs without crashing once! regards, Frans Meulenbroeks. new crc's: 19902 9214 stmain.c 15124 9321 stmpx.s # This is a shell archive. # Remove everything above and including the cut line. # Then run the rest of the file through sh. -----cut here-----cut here-----cut here-----cut here----- #!/bin/sh # shar: Shell Archiver # Run the following text with /bin/sh to create: # stmain.c.cdif # stmpx.s.cdif # This archive created: Thu Feb 1 13:53:18 1990 sed 's/^X//' << \SHAR_EOF > stmain.c.cdif X*** ../../150/STkernel/stmain.c Sun Jan 7 12:18:53 1990 X--- stmain.c Tue Jan 30 20:40:47 1990 X*************** X*** 60,67 **** X rp->p_reg.sp = ktsb; X rp->p_splow = rp->p_reg.sp; X rp->p_reg.pc = (reg_t) tasktab[t + NR_TASKS].initial_pc; X! if (!isidlehardware(t)) lock_ready(rp); /* IDLE, HARDWARE neveready */ X! rp->p_reg.psw = 0x2200; /* S-BIT, SPL2 */ X rp->p_map[T].mem_len = sizes[0]; X /* rp->p_map[T].mem_phys = 0; */ X rp->p_map[D].mem_len = sizes[1]; X--- 60,71 ---- X rp->p_reg.sp = ktsb; X rp->p_splow = rp->p_reg.sp; X rp->p_reg.pc = (reg_t) tasktab[t + NR_TASKS].initial_pc; X! if (!isidlehardware(t)) { X! lock_ready(rp); /* IDLE, HARDWARE neveready */ X! rp->p_reg.psw = 0x2200; /* S-BIT, SPL2 */ X! } else { X! rp->p_reg.psw = 0x0200; /* SPL2 */ X! } X rp->p_map[T].mem_len = sizes[0]; X /* rp->p_map[T].mem_phys = 0; */ X rp->p_map[D].mem_len = sizes[1]; SHAR_EOF sed 's/^X//' << \SHAR_EOF > stmpx.s.cdif X*** ../../150/STkernel/stmpx.s Sun Jan 7 12:47:02 1990 X--- stmpx.s Tue Jan 30 20:47:23 1990 X*************** X*** 165,171 **** X err: X add.l #8,sp ! remove extra context X trp: X! jsr save X jsr _trap X bra restart X trc: X--- 165,171 ---- X err: X add.l #8,sp ! remove extra context X trp: X! bsr save X jsr _trap X bra restart X trc: X*************** X*** 173,187 **** X beq trp ! No, do normal trace processing X rte ! don't trace; execute system call X int: X! jsr save X jsr _rupt X bra restart X non: X! jsr save X jsr _none X bra restart X sys: X! jsr save ! d0, d1 and a0 not modified X move.l a0,-(sp) ! m_ptr X move.w d1,-(sp) ! src_dest X move.w d0,-(sp) ! SEND/RECEIVE/BOTH X--- 173,187 ---- X beq trp ! No, do normal trace processing X rte ! don't trace; execute system call X int: X! bsr save X jsr _rupt X bra restart X non: X! bsr save X jsr _none X bra restart X sys: X! bsr save ! d0, d1 and a0 not modified X move.l a0,-(sp) ! m_ptr X move.w d1,-(sp) ! src_dest X move.w d0,-(sp) ! SEND/RECEIVE/BOTH X*************** X*** 203,212 **** X move.l #_timint,a0 X bsr async X clk: X sub.w #1,clkcnt X! beq cont X rte X! cont: X move.w #4,clkcnt X movem.l FREEREGS,-(sp) X move.l #_clock_handler,a0 X--- 203,214 ---- X move.l #_timint,a0 X bsr async X clk: X+ ! since the clock cannot be programmed to interrupt at HZ frequency X+ ! we'll have to do a divide-by-four in software. X sub.w #1,clkcnt X! beq L2a X rte X! L2a: X move.w #4,clkcnt X movem.l FREEREGS,-(sp) X move.l #_clock_handler,a0 X*************** X*** 255,272 **** X move.w #0x2700,sr X sub.b #1,_k_reenter X movem.l (sp)+,FREEREGS X- cmp.l #0,_rdy_head+TASK_Q ! any task just readied? X- beq L3 ! no: branch and return from interrupt X btst #5,(sp) ! previously in kernel mode? X! beq L4 ! no: branch and do task switch X! ! the next test is rather machine dependent X! ! for the Atari ST test for previous processor priority >= 4 X! btst #2,(sp) ! interrupting interrupt? X! beq L4 ! no: branch and do task switch X L3: X rte X L4: X! jsr save X jsr _lock_pick_proc X bra restart X ! X--- 257,271 ---- X move.w #0x2700,sr X sub.b #1,_k_reenter X movem.l (sp)+,FREEREGS X btst #5,(sp) ! previously in kernel mode? X! ! (interrupted a task or another interrupt) X! bne L3 ! yes: branch and return from interrupt X! cmp.l #0,_rdy_head+TASK_Q ! any task just readied? X! bne L4 ! yes: branch and do task switch X L3: X rte X L4: X! bsr save X jsr _lock_pick_proc X bra restart X ! X*************** X*** 289,297 **** X move.w (sp)+,savsr(a6) ! sr X move.l (sp)+,savpc(a6) ! pc X add.b #1,_k_reenter ! from -1 if not reentering X! ! bne L5a X! ! move.l #k_stktop,sp X! L5a: jmp (a1) X X restart: X ! Flush any held-up interrupts. X--- 288,295 ---- X move.w (sp)+,savsr(a6) ! sr X move.l (sp)+,savpc(a6) ! pc X add.b #1,_k_reenter ! from -1 if not reentering X! move.l #k_stktop,sp X! jmp (a1) X X restart: X ! Flush any held-up interrupts. X*************** X*** 300,305 **** X--- 298,305 ---- X ! other handlers can reenter since flushing is only done when k_reenter == 0. X X move.w #0x2700,sr X+ tst.b _k_reenter X+ bne over_call_unhold X cmp.l #0,_held_head X beq over_call_unhold X jsr _unhold SHAR_EOF # End of shell archive exit 0 Frans Meulenbroeks (meulenbr@cst.philips.nl) Centre for Software Technology ( or try: ...!mcsun!phigate!prle!cst!meulenbr)