Register

Syscall compatibility

Discuss issues related to the fx-9860G Software Development Kit
Senior Member
User avatar
Posts: 113
Joined: Sun Dec 16, 2012 2:59 pm
Calculators: None

Syscall compatibility

Postby Casimo » Fri Sep 06, 2013 5:21 pm

Why does calling system calls like

Code: Select all
typedef char*(*sc_cpv)(void);
const unsigned int sc0135[] = { 0xD201D002, 0x422B0009, 0x80010070, 0x0135 };
#define ML_vram_adress (*(sc_cpv)sc0135)


work with an SH4, but why

Code: Select all
static int SysCallCode[] = {0xD201422B,0x60F20000,0x80010070};
static int (*SysCall)( int R4, int R5, int R6, int R7, int FNo ) = (void*)&SysCallCode;
char* ML_vram_adress()
{
    return (char*)((*SysCall)(0, 0, 0, 0, 309));
}


not?

I guess its the use of the adresses, but I want to be sure ;) .
Image

Senior Member
User avatar
Posts: 605
Joined: Sat Sep 15, 2012 6:59 am
Location: Krautland ****
Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400

Re: Syscall compatibility

Postby SimonLothar » Sat Sep 07, 2013 2:28 pm

Color me amazed!

This worked for me:

const int SysCallCode[] = {0xD201422B,0x60F20000,0x80010070};

Obviously an issue of the MPU7305's Memory Management Unit (MMU).
Running code from virtual mapped RAM seems to lead to mayhem on fx-9860(SH-4)-types.

The statements
static int SysCallCode[] = {0xD201422B,0x60F20000,0x80010070};
and outside of any function:
int SysCallCode[] = {0xD201422B,0x60F20000,0x80010070};

will place SysCallCode into static RAM, which is virtualized.

If you place the code onto stack, which is not virtualized, the calculator does not crash.
They seem to have activated some access protection function of the MMU/TLB on the fx-9860(SH-4)-types.
I'll be back!

Return to Casio fx-9860 SDK

Who is online

Users browsing this forum: No registered users and 18 guests