Josh wrote:
Adrian,
You are almost certainly running into a problem with the
G3/G4's split L1 I and D caches. Basically what happens is that the
L1 I cache can contain stale bit after the D cache get loaded with
your code. After you copy the code into your mmap created buffer,
call msync on it with the MS_INVALIDATE option. This should cause
the kernel to flush the dcache for that region then invalidate the
icache for the region. After that, it should behave as expected.
Thanks - that was the problem. However, I wrote a small asm routine to flush the caches - msync will not flush them - anyway, now it works just fine [btw - there should be a cacheflush() system call which in my Linux is documented in the man pages but not present in the libraries nor in the headers...] However, I just found another problem. I'm compiling a simple module on Linux/PPC and then I'm trying to load/link it under MacOS. It works just fine, except when I'm calling external functions - it seems to me that calling convension is not the same for Linux/PPC and MacOS. I'm a rookie in PPC assembler, but what I understood is that when entering into a proc the link register contains the return address. Under Linux/PPC, gcc generates code that will save the link register into r0 and then save it into a memory location relative to the r1(sp) register. However, when I'm calling the natively exported MacOS function, the code of the function will first save one of the registers at entry in the same memory location that the Link register was saved - so, when the function will try to return to the calee, the LR will be invalid. Any idea how/if the MacOSX's cc compiler can be forced to generate code for a function to help me here? bye, .mady Adrian MARINESCU, RAV Development Team - http://www.rav.ro PGP Key : http://homepages.gecad.ro/mady/mady.asc Key ID : 1024/1F365951 Adrian MARINESCU <mady@gecad.ro> Key fingerprint = 0397 839F F8A6 E720 A49E 7D07 469C BB5C _______________________________________________ darwin-kernel mailing list | darwin-kernel@lists.apple.com Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-kernel Do not post admin requests to the list. They will be ignored.
participants (1)
-
Adrian MARINESCU