English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 24 April 2010, 14:32   #1
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
68040 MMU jsr/bsr

(I guess this is too difficult question as usual..)

68040's bus error handling is partial restart (stop reading if you don't know what it means ) and bus errors caused by writes usually happen after instruction has completed and before next (possibly later) instruction starts. Reads always restart current instruction (after exception ends)

Question: what does JSR and BSR do if stack write causes bus error exception? Is it considered normal delayed write? (no restart)

1) SP gets adjusted (SP=SP-4) and PC changed before exception starts, exception returns to new PC. (=no restart)
2) SP and PC not touched. Restart instruction after exception returns.
3) something else?

(remember that 68060 is full restart, not same as 68040)
Toni Wilen is online now  
Old 25 April 2010, 17:41   #2
matthey
Banned
 
Join Date: Jan 2010
Location: Kansas
Posts: 1,284
The best person to answer that question would be Thomas Richter. He has not turned to the dark side yet. His e-mail is the same as in all his mu programs on Aminet or you could post your question on http://www.natami.net which he frequents. I take it that the information was not in the 68040 User Manual? You could always find out by testing.
matthey is offline  
Old 27 April 2010, 23:01   #3
Wepl
Moderator
 
Wepl's Avatar
 
Join Date: Nov 2001
Location: Germany
Posts: 866
I assume:
in supervisor it will lock the machine by a double bus fault
in user mode it will create standard format $7 frame with wb2 set and pc will point to the destination address of bsr/jsr

if you are interested on the stack frame generated I could test it here

Last edited by Wepl; 27 April 2010 at 23:02. Reason: typo
Wepl is offline  
Old 28 April 2010, 10:56   #4
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
Quote:
Originally Posted by matthey View Post
The best person to answer that question would be Thomas Richter. He has not turned to the dark side yet. His e-mail is the same as in all his mu programs on Aminet or you could post your question on http://www.natami.net which he frequents. I take it that the information was not in the 68040 User Manual? You could always find out by testing.
I don't post in other Amiga related forums, sorry. Thomas probably knows, thanks

User manual is quite useless in this situation. I don't have a 68040.

Quote:
Originally Posted by Wepl View Post
I assume:
in supervisor it will lock the machine by a double bus fault
Double bus fault even if current exception is non-bus exception? (too lazy to check manuals just now..)

Quote:
in user mode it will create standard format $7 frame with wb2 set and pc will point to the destination address of bsr/jsr

if you are interested on the stack frame generated I could test it here
That is what Aranym does but because most programs won't care (even netbsd and linux) I only trust real CPUs.

Please check it if you really feel bored enough
Toni Wilen is online now  
Old 28 April 2010, 20:13   #5
Wepl
Moderator
 
Wepl's Avatar
 
Join Date: Nov 2001
Location: Germany
Posts: 866
Quote:
Originally Posted by Toni Wilen View Post
Double bus fault even if current exception is non-bus exception? (too lazy to check manuals just now..)
if the supervisor stack cannot be written, writing the stackframe will fail too (except using the msp maybe)
Quote:
Originally Posted by Toni Wilen View Post
That is what Aranym does but because most programs won't care (even netbsd and linux) I only trust real CPUs.

Please check it if you really feel bored enough
Code:
ShadowMem  735BE50 -  739BE50 ( 262144) AbsolutMem    40000 -    40000 (      0)
Resload    7FB8000 -  7FC2160 (  41312) at 7FB8000  GL=$7FD5000
Slave      7FDE000 -  7FDE0B0 (    176) at 7FDE000  BaseMemSize=$40000
ExpMem     7FC4000 -  7FD4000 (  65536) at 7FC4000
attn=7F(40,82) fc=65535 kn=1000 cs=B847 rw=0 zpt=-1 ep=0 ei=0
setcpu=33D(DC,IC,SCB,ECB,BNC)

Exception "Access Fault" ($7008) PC = $7FDE08C (Slave $8C) Long Write to $40FFC

$07fde082 move         #0,sr
$07fde086 bsr.b        $7fde08c
$07fde088 illegal
$07fde08a nop
$07fde08c illegal
$07fde08e illegal

exception stackframe:
$07FD3DC4 000007FD E08C7008 07FB894C 04810001 00810005 00040FFC 00040FFC 07FDE088
$07FD3DE4 00040FFC 07FDE088 DDDDDDDD DDDDDDDD DDDDDDDD DDDDDDDD DDDDDDDD

  ----0---- ----1---- ----2---- ----3---- ----4---- ----5---- ----6---- ----7----
Dx D0D0D0D0  D1D1D1D1  D2D2D2D2  D3D3D3D3  D4D4D4D4  D5D5D5D5  D6D6D6D6  D7D7D7D7
Ax    41000   7FDE090  A2A2A2A2  A3A3A3A3    BFE001   7FB8000    DFF000

                 TTSM III   XNZVC
PC= 7FDE08C  SR %0000000000000000  USP=40FFC  ISP=7FD3DC4  MSP=3F800
VBR=7FD6000  SFC=5  DFC=1  CACR=80008000  
TC=8000  URP=07FB6000  SRP=07FB6000  MMUSR=00000000
DTT0=00000000  DTT1=00000000  ITT0=00000000  ITT1=00000000
Attached Files
File Type: slave bus40.slave (212 Bytes, 361 views)
Wepl is offline  
Old 28 April 2010, 20:57   #6
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
Thanks, it was as expected but unfortunately this does not fix remaining problem (in some situations stack is either corrupted or stack pointer address is incorrrect) but at least JSR/BSR behavior is confirmed.
Toni Wilen is online now  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
68030, 68040 and 68060 MMU support (really!) Toni Wilen support.WinUAE 262 19 February 2019 12:36
bsr.l on 68000 doesn't crash StingRay support.WinUAE 5 22 September 2012 21:43
Undefined symbol bsr.b init_bitmaps VoltureX Coders. General 12 13 November 2011 16:11
Game appears to use weird JSR instructions MethodGit Coders. General 15 18 March 2011 16:26
clr.b -(SP) followed by bsr... Photon Coders. General 19 18 January 2011 22:42

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 14:13.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.08065 seconds with 14 queries