Home AESAES ObjektfunktionenObjektfunktionen Eigenschaft-FunktionenEigenschaft-Funktionen

8.19 Prozessverwaltung

This library is only available on GEM XM. These functions allow to run up to 10 GEM and DOS applications at once, swapping out to eXpanded Memory (XM) or to disk. Each process uses a 'channel' to store its system area, work area, interrupt table and swap file.

proc_create Create a new process
proc_delete Close all desk accessories
proc_info Obtain info about a process
proc_malloc Allocate memory
proc_mfree Release memory
proc_run Run process
proc_setblock Shrink channel and create swap file
proc_shrink Shrink channel with optional swap creation
proc_switch Switch to process

8.19.1 proc_create

Name: »Process create« - Create a new process
 
AES-Nummer: 60
 
Deklaration: int16_t proc_create ( void *address, int32_t size, int16_t is_swap, int16_t is_gem, int16_t *num );
 
Beschreibung: The call proc_create allocates a new process ID but does not launch the process. The following apply:
 
address Channel address at which to load process
size Space to allocate, or 0 to allocate maximum channel space
is_swap Nonzero if the process can be swapped out, zero if it must stay paged in. The GEM XM Desktop marks accessories as not to be paged out
is_gem Nonzero if the process is a GEM application, zero for DOS application
num Process ID of new process

Note: Since GEM XM doesn't support having more than one newly-launched process waiting around, the process with ID num must be launched through proc_run before calling proc_create again.
 
Ergebnis: An error has arisen only if the value 0 is returned (no more ID available).
 
Verfügbar: The function is only available under GEM XM and FreeGEM/XM.
 
Gruppe: Prozessverwaltung
 
Querverweis: Binding   proc_run   proc_info   proc_switch
 

8.19.1.1 Bindings für proc_create

C: int16_t proc_create ( void *address, int32_t size, int16_t is_swap, int16_t is_gem, int16_t *num );
 
Umsetzung:
 
int16_t proc_create (void *address, int32_t size, int16_t is_swap,
                 int16_t is_gem, int16_t *num)
{
   int_in[0]  = is_swap;
   int_in[1]  = is_gem;
   addr_in[0] = address;
   addr_in[1] = size;

   crys_if(60);

   *num = int_out[1];

   return ( int_out[0] );
}
GEM-Arrays:
 

Adresse Feldelement Belegung
control control[0] 60 # Opcode der Funktion
control+2 control[1] 2 # Einträge in int_in
control+4 control[2] 2 # Einträge in int_out
control+6 control[3] 2 # Einträge in addr_in
control+8 control[4] 0 # Einträge in addr_out
int_in int_in[0] is_swap
int_in+2 int_in[1] is_gem
addr_in addr_in[0] address
addr_in+4 addr_in[1] size
int_out int_out[0] Return-Wert
int_out+2 int_out[1] num

8.19.2 proc_delete

Name: »Process delete« - Close all desk accessories
 
AES-Nummer: 62
 
Deklaration: int16_t proc_delete ( int16_t pr_deid );
 
Beschreibung: The call proc_delete shuts down all desk accessories. The pr_deid parameter is ignored, but Desktop uses -1.
 
Ergebnis: Return value of the function is unknown at present.
 
Verfügbar: The function is only available under GEM XM and FreeGEM/XM.
 
Gruppe: Prozessverwaltung
 
Querverweis: Binding
 

8.19.2.1 Bindings für proc_delete

C: int16_t proc_delete ( int16_t pr_deid );
 
Umsetzung:
 
int16_t proc_delete (int16_t pr_deid)
{
   int_in[0]  = pr_deid;
   return ( crys_if(62) );
}
GEM-Arrays:
 

Adresse Feldelement Belegung
control control[0] 62 # Opcode der Funktion
control+2 control[1] 1 # Einträge in int_in
control+4 control[2] 1 # Einträge in int_out
control+6 control[3] 0 # Einträge in addr_in
control+8 control[4] 0 # Einträge in addr_out
int_in int_in[0] pr_deid
int_out int_out[0] Return-Wert

8.19.3 proc_info

Name: »Process information« - Obtains information about a process
 
AES-Nummer: 63
 
Deklaration: int16_t proc_info ( int16_t pid, int16_t *is_swap, int16_t *is_gem, void **address, int32_t *csize, void **endmem, int32_t *ssize, void **intaddr );
 
Beschreibung: The call proc_info inquires information about a process. The following apply:
 
pid Process ID about which to get info
is_swap Nonzero if swappable, else zero
is_gem Nonzero for a GEM application, zero for a DOS application
address Address of channel
csize Size of channel
endmem First address beyond end of process memory
ssize Channel system size
intaddr Address of process's copy of the interrupt vector table
Ergebnis: An error has arisen only if the value 0 is returned.
 
Verfügbar: The function is only available under GEM XM and FreeGEM/XM.
 
Gruppe: Fensterverwaltung
 
Querverweis: Binding   proc_create   proc_run   proc_switch
 

8.19.3.1 Bindings für proc_info

C: int16_t proc_info ( int16_t pid, int16_t *is_swap, int16_t *is_gem, void **address, int32_t *csize, void **endmem, int32_t *ssize, void **intaddr );
 
Umsetzung:
 
int16_t proc_info (int16_t pid, int16_t *is_swap, int16_t *is_gem,
              void **address, int32_t *csize, void **endmem,
              int32_t *ssize, void **intaddr)
{
   int_in[0]  = pid;

   crys_if(63);

   *is_swap  = int_out[1];
   *is_gem   = int_out[2];
   *address  = addr_out[0];
   *csize    = addr_out[1];
   *endmem   = addr_out[2];
   *ssize    = addr_out[3];
   *intaddr  = addr_out[4];

   return ( int_out[0] );
}
GEM-Arrays:
 

Adresse Feldelement Belegung
control control[0] 63 # Opcode der Funktion
control+2 control[1] 1 # Einträge in int_in
control+4 control[2] 3 # Einträge in int_out
control+6 control[3] 0 # Einträge in addr_in
control+8 control[4] 5 # Einträge in addr_out
int_in int_in[0] pid
int_out int_out[0] Return-Wert
int_out+2 int_out[1] is_swap
int_out+4 int_out[2] is_gem
addr_out addr_out[0] address
addr_out+4 addr_out[1] csize
addr_out+8 addr_out[2] endmem
addr_out+12 addr_out[3] ssize
addr_out+16 addr_out[4] intaddr

8.19.4 proc_malloc

Name: »Process memory allocation« - Allocate memory
 
AES-Nummer: 64
 
Deklaration: void *proc_malloc ( int32_t size, int32_t *ret_size );
 
Beschreibung: The call proc_malloc allocates a memory block of size bytes.
 
Ergebnis: The function returns a pointer to the allocated memory block, or 0 if failed. ret_size is filled with either the size of the allocated memory block, or with the maximum available size.
 
Verfügbar: The function is only available under GEM XM and FreeGEM/XM.
 
Gruppe: Prozessverwaltung
 
Querverweis: Binding   proc_mfree   proc_setblock   proc_shrink
 

8.19.4.1 Bindings für proc_malloc

C: void *proc_malloc ( int32_t size, int32_t *ret_size );
 
Umsetzung:
 
void *proc_malloc (int32_t size, int32_t *ret_size)
{
   addr_in[0] = size;

   crys_if(64);

   *ret_size = addr_out[1];

   return ( addr_out[0] );
}
GEM-Arrays:
 

Adresse Feldelement Belegung
control control[0] 64 # Opcode der Funktion
control+2 control[1] 0 # Einträge in int_in
control+4 control[2] 1 # Einträge in int_out
control+6 control[3] 1 # Einträge in addr_in
control+8 control[4] 2 # Einträge in addr_out
addr_in addr_in[0] size
int_out int_out[0] 1 if success, or 0 if failure
addr_out addr_out[0] Return-Wert
addr_out+4 addr_out[1] ret_size

8.19.5 proc_mfree

Name: »Process memory free« - Release memory
 
AES-Nummer: 65
 
Deklaration: int16_t proc_mfree ( int16_t pr_mfid );
 
Beschreibung: The call proc_mfree deletes the channel associated to the process ID pr_mfid from memory and disk for reuse.
 
Ergebnis: An error has arisen if the value 0 is returned.
 
Verfügbar: This function is only available under GEM XM and FreeGEM/XM.
 
Gruppe: Prozessverwaltung
 
Querverweis: Binding   proc_malloc   proc_setblock   proc_shrink
 

8.19.5.1 Bindings für proc_mfree

C: int16_t proc_mfree ( int16_t pr_mfid );
 
Umsetzung:
 
int16_t proc_mfree (int16_t pr_mfid)
{
   int_in[0]  = pr_mfid;
   return ( crys_if(65) );
}
GEM-Arrays:
 

Adresse Feldelement Belegung
control control[0] 65 # Opcode der Funktion
control+2 control[1] 1 # Einträge in int_in
control+4 control[2] 1 # Einträge in int_out
control+6 control[3] 0 # Einträge in addr_in
control+8 control[4] 0 # Einträge in addr_out
int_in int_in[0] pr_mfid
int_out int_out[0] Return-Wert

8.19.6 proc_run

Name: »Process run« - Run a process
 
AES-Nummer: 61
 
Deklaration: int16_t proc_run ( int16_t pid, int16_t is_graphical, int16_t options, int8_t *command, int8_t *tail );
 
Beschreibung: The call proc_run launches a process previously created with proc_create. The following apply:
 
pid Process ID previously returned by proc_create
is_graphical Nonzero for a GEM program, zero for a DOS program
options Special load options:
3 Program is a desk accessory
4 If this is a GEM program, its windows remain visible whichever program is in the foreground; otherwise they are only visible when the program in question is in the foreground
-1 If the gl_allwins flag is turned on, then behaves like type 4. Otherwise behaves as default. GEM provides no option to turn this flag on programmatically; you have to patch the AES by writing a nonzero value in the byte that follows the marker 'zyxg' inside the binary AES file.
command Name of program to run
tail Command tail to pass to it

Note: The odd range of values passed to the load options is chosen for compatibility with the isover flag of shel_write.
 
Ergebnis: An error has arisen only if the value 0 is returned.
 
Verfügbar: The function is only available under GEM XM and FreeGEM/XM.
 
Gruppe: Prozessverwaltung
 
Querverweis: Binding   proc_create   proc_info   proc_switch
 

8.19.6.1 Bindings für proc_run

C: int16_t proc_run ( int16_t pid, int16_t is_graphical, int16_t options, int8_t *command, int8_t *tail );
 
Umsetzung:
 
int16_t proc_run (int16_t pid, int16_t is_graphical, int16_t options,
                 int8_t *command, int8_t *tail)
{
   int_in[0]  = pid;
   int_in[1]  = is_graphical;
   int_in[2]  = options;
   addr_in[0] = command;
   addr_in[1] = tail;

   return ( crys_if(61) );
}
GEM-Arrays:
 

Adresse Feldelement Belegung
control control[0] 61 # Opcode der Funktion
control+2 control[1] 3 # Einträge in int_in
control+4 control[2] 1 # Einträge in int_out
control+6 control[3] 2 # Einträge in addr_in
control+8 control[4] 0 # Einträge in addr_out
int_in int_in[0] pid
int_in+2 int_in[1] is_graphical
int_in+4 int_in[2] options
addr_in addr_in[0] command
addr_in+4 addr_in[1] tail
int_out int_out[0] Return-Wert

8.19.7 proc_setblock

Name: »Process set block« - Shrink channel and create swap file
 
AES-Nummer: 67
 
Deklaration: int16_t proc_setblock ( int16_t pr_seid );
 
Beschreibung: The call proc_setblock reduces the channel size allocated to the process pr_seid to what it is using now by eliminating its free memory, and creates the swap file used to page it out.
 
Note This function calls proc_shrink(pr_seid, 1, &dummy, &dummy). The FreeGEM/XM Desktop defines this function as proc_shrink() with PROC_SHRINK=67 and omit to define a function for opcode 68. Original sources stated PROC_SETBLOCK=67 (with PID only) and PROC_SHRINK=68 (with extra parameters), as documented here.
 
Ergebnis: An error has arisen only if the value 0 is returned.
 
Verfügbar: The function is only available under GEM XM and FreeGEM/XM.
 
Gruppe: Prozessverwaltung
 
Querverweis: Binding   proc_malloc   proc_mfree   proc_shrink
 

8.19.7.1 Bindings für proc_setblock

C: int16_t proc_setblock ( int16_t pr_seid );
 
Umsetzung:
 
int16_t proc_setblock (int16_t pr_seid)
{
   int_in[0]  = pr_seid;
   return ( crys_if(67) );
}
GEM-Arrays:
 

Adresse Feldelement Belegung
control control[0] 67 # Opcode der Funktion
control+2 control[1] 1 # Einträge in int_in
control+4 control[2] 1 # Einträge in int_out
control+6 control[3] 0 # Einträge in addr_in
control+8 control[4] 0 # Einträge in addr_out
int_in int_in[0] pr_seid
int_out int_out[0] Return-Wert

8.19.8 proc_shrink

Name: »Process shrink« - Shrink channel
 
AES-Nummer: 68
 
Deklaration: int16_t proc_shrink ( int16_t pr_shid, int16_t createswap, void *address, int32_t *size );
 
Beschreibung: The call proc_shrink reduces the size of the channel allocated to the process pr_shid to what it is using now by eliminating its free memory, and optionally creates the swap file used to page it out if createswap is set to 1.
 
Note: This function is not used by FreeGEM/XM Desktop. On this environment, the function with opcode 67 is called proc_shrink and there is no binding for opcode 68.
 
Ergebnis: An error has arisen only if the value 0 is returned. On success, this function returns the new size and address of the channel.
 
Verfügbar: The function is only available under GEM XM.
 
Gruppe: Prozessverwaltung
 
Querverweis: Binding   proc_malloc   proc_mfree   proc_setblock
 

8.19.8.1 Bindings für proc_shrink

C: int16_t proc_shrink ( int16_t pr_shid, int16_t createswap, void *address, int32_t *size );
 
Umsetzung:
 
int16_t proc_shrink (int16_t pr_shid, int16_t createswap, void *address, int32_t *size)
{
   int_in[0]  = pr_shid;
   int_in[1]  = createswap;

   crys_if(68);

   *address = addr_out[0];
   *size    = addr_out[1];

   return ( int_out[0] );
}
GEM-Arrays:
 

Adresse Feldelement Belegung
control control[0] 68 # Opcode der Funktion
control+2 control[1] 2 # Einträge in int_in
control+4 control[2] 1 # Einträge in int_out
control+6 control[3] 0 # Einträge in addr_in
control+8 control[4] 2 # Einträge in addr_out
int_in int_in[0] pr_shid
int_in+2 int_in[1] createswap
int_out int_out[0] Return-Wert
addr_out addr_out[0] address
addr_out+4 addr_out[1] size

8.19.9 proc_switch

Name: »Process switch« - Switch to process
 
AES-Nummer: 66
 
Deklaration: int16_t proc_switch ( int16_t pr_swid );
 
Beschreibung: The call proc_switch switches to process with the ID pr_swid.
 
Ergebnis: Returns 0 if process is already the active process, else 1.
 
Verfügbar: This function is only available under GEM XM and FreeGEM/XM.
 
Gruppe: Prozessverwaltung
 
Querverweis: Binding   proc_create   proc_info   proc_run
 

8.19.9.1 Bindings für proc_switch

C: int16_t proc_switch ( int16_t pr_swid );
 
Umsetzung:
 
int16_t proc_switch (int16_t pr_swid)
{
   int_in[0]  = pr_swid;
   return ( crys_if(66) );
}
GEM-Arrays:
 

Adresse Feldelement Belegung
control control[0] 66 # Opcode der Funktion
control+2 control[1] 1 # Einträge in int_in
control+4 control[2] 1 # Einträge in int_out
control+6 control[3] 0 # Einträge in addr_in
control+8 control[4] 0 # Einträge in addr_out
int_in int_in[0] pr_swid
int_out int_out[0] Return-Wert

Home AESAES ObjektfunktionenObjektfunktionen Eigenschaft-FunktionenEigenschaft-Funktionen