[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] XDD addon proposal



Hm, maybe this will a good starting point

I propose two new calls avialible only for XDD (and inside kernel):

long RegisterAPI(long API_ID, *void P, long N)
*api_ret CallAPI(long API_ID, long N)

First a little explanation: kernel would store speciall tables for 
each API we would define, those tables would contain pointers to lists
of such structures:

struct {
     long FLAGS;
     *void P
} API_LIST_MEMBER

FLAGS is a bitfield that describes that member, it could be: 
READ_ONLY (this API member can only be read), NO_MULTIPLE (only one 
XDD can register this function), ...

This would be lists to lists becouse we would allow few (depending on 
such API description) XDD to register the same function. Kernel would 
call those functions one by one and stop if one handles the call.

RegisterAPI description:
long API_ID - id of an API where we want to register our function 
(APM_API, LIBKERN_API, ...)
*void P - pointer to a function that is registered, that function 
must return pointer to a structure that is discussed here later with 
CallAPI description
long N - number of function in API that we want to register.

Return value: E_OK, E_TAKEN, E_ERROR, E_UNKNOWN_API, 
E_UNKNOWN_API_FNUMBER, ...

CallAPI description:
long API_ID - if of an API we call
long N - number of function in that API

Return value: pointer to such structure:

struct {
     long state;
     long retval;
} api_ret;

state - HANDLED or UNHANDLED
retval - returning value (valid only if state==HANDLED)

Ok, now description how it works:

Situation Shutdown() is called with POWEROFF parameter.

Shutdown code does everything it should do (kill processes, ...)

Then Shutdown checks if POWEROFF function is registered and id it is 
it calls it (or calls directly as it should not return and if it 
does, it can print "System Halted").

Uff....

On last thing:
We can implement this as system calls avialible only for XDD, or as a 
new parts of kerinfo interface (that is already passed to XDDs) and 
that solution seems better for me.

Comments highly welcome.

--
Semper Fidelis

Adam Klobukowski
atari@gabo.pl