30 March 2010, 18:53 | #1 | |
Registered User
Join Date: Oct 2009
Location: Belgium
Age: 50
Posts: 42
|
access emulated memory
Hi,
Actually I have a question, not really a problem. The question is quite technical... I would like to access the emulated Amiga memory from the x86 side as efficiently as possible. Is the following piece of code okay? Quote:
|
|
30 March 2010, 19:40 | #2 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,506
|
Your code fails when accessing IO regions.
special_mem is the important bit. JIT uses normal (indirect) memory access functions when building native x86 code, direct access is only enabled if special_mem has correct flags set after memory access function returns. Do not assume if memory region is directly accessible by checking address ranges. ("too easy solution but too fragile") You only need to do normal indirect "check" access only once per memory "bank" to confirm if direct access is supported. |
30 March 2010, 23:20 | #3 | |||
Registered User
Join Date: Oct 2009
Location: Belgium
Age: 50
Posts: 42
|
Quote:
In "newcpu/execute_normal", the emulator executes one instruction after the other until a jump instruction is reached (end of block). For each instruction, it remembers the status of the memory access: Quote:
Quote:
Last edited by ara; 30 March 2010 at 23:25. |
|||
30 March 2010, 23:37 | #4 | ||
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,506
|
Quote:
Quote:
|
||
30 March 2010, 23:46 | #5 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,506
|
I think this is fast and safe and is not JIT specific:
if (valid_address(addr, len)) paddr = get_real_address(addr); // paddr can be used directly else // loop using get_byte() or similar |
31 March 2010, 00:43 | #6 |
Registered User
Join Date: Oct 2009
Location: Belgium
Age: 50
Posts: 42
|
Thanks for your help. The solution based on valid_address/get_real_address looks fine.
I just took a look at EvalException(...). Oh my god... What happens if you have an illegal memory access inside the WinUAE code due to an ordinary bug? Will it also try to "fix" it? |
03 April 2010, 13:05 | #7 | ||
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,506
|
Quote:
Quote:
|
||
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
memory access speed question | Lord Riton | Coders. General | 42 | 27 February 2019 14:26 |
Break on Memory Access? | Khyron | support.WinUAE | 3 | 21 August 2010 00:10 |
Blizzard Turbo Memory - SMD memory chips doesn't work | sanjyuubi | Hardware mods | 5 | 26 May 2010 15:40 |
HOWTO : Access the Interwebs from within an emulated WB | NewDeli | New to Emulation or Amiga scene | 16 | 29 September 2009 00:54 |
System you would like to see emulated next | Ian | Retrogaming General Discussion | 18 | 08 November 2001 08:16 |
|
|