Ho Hum ... Same old symphony different conductor!
kur4o wrote:First one being odd vs even address, writing a value to. If you try to write a value[usually a word or dword] to odd address it crashed.
It was hard to debug and only by chance I figured it out. These cpus are word based and don`t like single bytes handling.
Thanks kur4o, I was hoping that would help, apparently not ... I have been stating for a long long time this is a problem, it is clearly documented that the processor is word sized, and everything must remain word aligned on an even address!
This is what I believe the issue to be, IMO the assembly Kernel's VPWReceive is broke, it forces us to have it's receive buffer off alignment (starting on a odd address), this affects everything right down the chain.
Moving bytes around proves absolutely nothing, it's a complete waste of time, it does not relocate the receive buffer to an even address, if it does, it breaks VPWReceive.
I believe this is causing addressing errors at the beginning and end of RAM pages, and this is what causes PCM's with smaller RAM sizes to crash (RAM pages are smaller).
It is also highly likely causing byte overlaps of used RAM thus stepping on each others toes. One does it aligned, the other does not, and this will move around accordingly, just exactly as is happening!
I assure you, I am working as hard as I can learn how to prove this ... ATM, I have an almost complete Kernel that is 100% aligned, it has one problem, it is deaf, not silent, but deaf! It cannot receive.
There is only one oddity, ProcessCRC response can only send 13 bytes, beyond 13 bytes VPWSend goes into an infinite loop in,
Code: Select all
VPWSendWaitForFlush:
bsr.w ResetWatchdog | Scratch the dog
bsr.w WasteTime | Twiddle thumbs
move.b (J1850_Status).l, %d0 | Get status byte
andi.b #0xE0, %d0 | Mask RFS 1110 0000
cmpi.b #0xE0, %d0 | Empty except for completion byte status
bne.s VPWSendWaitForFlush | Loop until true
move.b (J1850_RX_FIFO).l, %d0 | Read FIFO
The only 'alignment' changes made are to the reply part of ProcessCRC, doing exactly the same process as every other sub that uses VPWSend to load the reply buffer.
All other sub routines that use VPWSend can send much longer messages, I tested 2048 bytes (+header and sum) from several sub's and let it run over night, the next day it was still zipping along happily!
I do not know the DLC, nor do I have a PRM or datasheet on it and I really don't see how it could have been affected, especially only by one sub routine, ProcessCRC.
I do know one thing for absolute certainty, the way it is right now in the repo, is wrong, it is well documented that code and data must be aligned and until it's fixed there is no proving anything else because there will always be that question!
As for buggy or missing instructions ... In the case of the assembly kernel, I call hogwash on that!
We are using nothing but well developed core instructions that have been in every m68k ... The core design was solid by the time the PCM's we are interested in came out, I don't know when GM started using the M68k and don't care.
I do know they have been around a very very long time, longer than many around here have been alive, 44 years, they are used in a lot of things and are extremely well documented, including their quirks.
There are no issues with moveq, one just needs to understand it's valid use by design ... It is only good for source values ranging from -128 to 127, yet it is a 32bit signed instruction, no different then addq and subq with a valid source range from 1 to 8.
They are strictly instructions meant for speed critical use!
Absolute vs Indirect addressing, I have tested both ways on every PCM (P01, P04 AMD and Intel, P08, P10, P12, P12b, P59 AMD and Intel, E54) and yet to find any issues or change accessing RAM.
Yes, 16 bit addresses are sign extended to 32 bits ...
The code is so simple and carefully crafted there is no need to complicate it with stack tricks.
-Enjoy