Hi,
I have been doing some testing of some Exception processing for Bus and Address errors and I appear to have found a problem. According to the Motorola documentation when a Bus Error occurs the stack should contain the following data Highest to lowest address.
Program Counter (Long Word)
Status Register (Word)
Instrution Register (Word)
Address (Long Word)
Special Data (Word)
According to Motorola, the structure of the Special Data is:
bits 0-2 = Function Code
bit 3 = INSTRUCTION/NOT: INSTRUCTION = 0, NOT = 1.
bit 4 = R/W (READ/WRITE): WRITE = 0, READ = 1.
The above information was sourced from Page B-3 figure B2 from
http://www.freescale.com/files/archives/doc/ref_manual/M68000PRM.pdfIn my testing all the data execpt the Special Data is correct.
The Special Data is not containing the Read/Write part correctly as it is always a 0 regardless of what the code was doing.
Read Sample Code.
Code:
00000000 7 MEMORY INVALID $8000,$8200
00000008 8 ORG $08
00000008= 0000100C 9 DC.L BUS_ERROR
0000000C 10
00001000 11 ORG $1000
00001000 12 START: ; first instruction of program
00001000 2039 00008100 13 MOVE.L $8100,D0
00001006 103C 0009 14 MOVE.B #9,D0
0000100A 4E4F 15 TRAP #15 ; halt simulator
0000100C 16
0000100C 17 BUS_ERROR
0000100C 4E71 18 NOP
0000100E 4E73 19 RTE
00001010 20
00001010 21
00001010 22 END START ; last line of source
Memory Stack at line 18
Code:
00FFFFF0: FF FF 00 00 00 81 00 20 39 20 00 00 00 10 02
Line 13 is a read from invalid address, No Good
Address 00FFFFF2 should contain 01 not 00 and I think the Function Code might be wrong.
Write Sample Code
Code:
00000000 7 MEMORY INVALID $8000,$8200
00000008 8 ORG $08
00000008= 0000100C 9 DC.L BUS_ERROR
0000000C 10
00001000 11 ORG $1000
00001000 12 START: ; first instruction of program
00001000 23C0 00008100 13 MOVE.L D0,$8100
00001006 103C 0009 14 MOVE.B #9,D0
0000100A 4E4F 15 TRAP #15 ; halt simulator
0000100C 16
0000100C 17 BUS_ERROR
0000100C 4E71 18 NOP
0000100E 4E73 19 RTE
00001010 20
00001010 21
00001010 22 END START ; last line of source
Memory Stack at line 18
Code:
00FFFFF0: FF FF 00 05 00 81 00 23 C0 20 00 00 00 10 02
Line 13 is a write to invalid address, All appears good although the Function Code has changed, not sure if that is right.
Is this a bug? or am I missing something?
Thanks
Kenneth