home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue2 / SDL.ARC / !unixlib / source / clib / h / kernel < prev    next >
Encoding:
Text File  |  2004-09-05  |  5.0 KB  |  165 lines

  1. /****************************************************************************
  2.  *
  3.  * $Source: /usr/local/cvsroot/gccsdk/unixlib/source/clib/kernel.h,v $
  4.  * $Date: 2004/06/01 18:45:26 $
  5.  * $Revision: 1.7 $
  6.  * $State: Exp $
  7.  * $Author: nick $
  8.  *
  9.  * This file is intended to provide an interface between UnixLib and
  10.  * DeskLib, for the few _kernel calls that it uses. Any simularity between
  11.  * this and the Norcroft kernel.h file is probably due to having to use
  12.  * identical structs.
  13.  *
  14.  ***************************************************************************/
  15.  
  16. #ifndef __KERNEL_H
  17. #define __KERNEL_H
  18.  
  19. #ifndef __UNIXLIB_FEATURES_H
  20. #include <unixlib/features.h>
  21. #endif
  22.  
  23. __BEGIN_DECLS
  24.  
  25. typedef struct
  26. {
  27.    int r[10];
  28. } _kernel_swi_regs;
  29.  
  30. typedef struct
  31. {
  32.    int load, exec;
  33.    int start, end;
  34. } _kernel_osfile_block;
  35.  
  36. typedef struct
  37. {
  38.    int errnum;
  39.    char errmess[252];
  40. } _kernel_oserror;
  41.  
  42. typedef struct stack_chunk
  43. {
  44.   unsigned long sc_mark;
  45.   struct stack_chunk *sc_next, *sc_prev;
  46.   unsigned long sc_size;
  47.   int (*sc_deallocate) (void);
  48. } _kernel_stack_chunk;
  49.  
  50. extern int _kernel_fpavailable (void) __THROW;
  51.  
  52. /* Passes argument string to SWI "OS_CLI". */
  53. extern int _kernel_oscli (const char *__s) __THROW;
  54.  
  55. #define _kernel_NONX 0x80000000
  56. /* Call the SWI specified by 'no'. 'in' points to a register block
  57.    for SWI entry. 'out' points to a register block for SWI exit.
  58.    The X bit is set by _kernel_swi unless bit 31 is set.  */
  59. extern _kernel_oserror *_kernel_swi (int __no, _kernel_swi_regs *__in,
  60.                      _kernel_swi_regs *__out) __THROW;
  61.  
  62. /* Similar to _kernel_swi but the carry flag status is returned in
  63.    'carry'.  */
  64. extern _kernel_oserror *
  65. _kernel_swi_c (int __no, _kernel_swi_regs *__in,
  66.            _kernel_swi_regs *__out, int *__carry) __THROW;
  67.  
  68. /* Return the last OS error since the last time _kernel_last_oserror
  69.    was called.  Return zero if no errors have occurred.  */
  70. extern _kernel_oserror *_kernel_last_oserror (void) __THROW;
  71.  
  72. /* Perform an OS_Byte operation.
  73.    R1 is returned in the bottom byte, R2 in the second byte,
  74.    if carry set, then third byte = 1.  */
  75. extern int _kernel_osbyte (int __operation, int __x, int __y) __THROW;
  76.  
  77. /* Read a character from the OS input stream.  */
  78. extern int _kernel_osrdch (void) __THROW;
  79.  
  80. /* Write a character to the OS output streams.  The return value indicates
  81.    success or failure.  */
  82. extern int _kernel_oswrch (int __ch) __THROW;
  83.  
  84. /* Return the next byte from the file 'handle'. Return -1 on EOF.  */
  85. extern int _kernel_osbget (unsigned __handle) __THROW;
  86.  
  87. /* Write the byte 'ch' to the file 'handle'. Return success or failure.  */
  88. extern int _kernel_osbput (int __ch, unsigned __handle) __THROW;
  89.  
  90. /* Perform an OS_File operation. The _kernel_osfile_block provides
  91.    values for registers R2-R5.  */
  92. extern int _kernel_osfile (int __operation, const char *__name,
  93.                _kernel_osfile_block *__inout) __THROW;
  94.  
  95. typedef struct
  96. {
  97.   void * dataptr;
  98.   int nbytes, fileptr;
  99.   int buf_len;
  100.   char *wild_fld;
  101. } _kernel_osgbpb_block;
  102.  
  103. /* Read/write a number of bytes on file 'handle'. */
  104. extern int _kernel_osgbpb (int __operation, unsigned __handle,
  105.                          _kernel_osgbpb_block *__inout) __THROW;
  106.  
  107. /* Perform an OS_Word operation.  */
  108. extern int _kernel_osword (int __operation, int *__data) __THROW;
  109.  
  110. /* Open or close a file. Open returns a file handle, close just
  111.    indicates success/failure.  */
  112. extern int _kernel_osfind (int __operation, char *__name) __THROW;
  113.  
  114. /* Perform an OS_Args operation. Generally returns the value in R2,
  115.    unless op = 0.  */
  116. extern int _kernel_osargs (int __operation, unsigned __handle,
  117.                int __arg) __THROW;
  118.  
  119. /* Read the value of system variable 'name', placing the
  120.    result in 'buffer'.  */
  121. extern _kernel_oserror *
  122. _kernel_getenv (const char *__name, char *__buffer, unsigned __size) __THROW;
  123.  
  124. /* Set the system variable 'name' with 'value'. If 'value == 0' then
  125.    'name' is deleted.  */
  126. extern _kernel_oserror *
  127. _kernel_setenv (const char *__name, const char *__value) __THROW;
  128.  
  129. /* Unsigned divide and remainder function. Returns the remainder in R1. */
  130. extern unsigned int
  131. _kernel_udiv (unsigned int __divisor,
  132.           unsigned int __dividend) __THROW __attribute__ ((__const__));
  133.  
  134. /* Unsigned remainder function.  */
  135. extern unsigned int
  136. _kernel_urem (unsigned int __divisor,
  137.           unsigned int __dividend) __THROW __attribute__ ((__const__));
  138.  
  139. /* Unsigned divide and remainder function by 10.
  140.    Returns the remainder in R1. */
  141. extern unsigned int
  142. _kernel_udiv10 (unsigned int __dividend) __THROW __attribute__ ((__const__));
  143.  
  144. /* Signed divide and remainder function. Returns the remainder in R1. */
  145. extern int
  146. _kernel_sdiv (int __divisor, int __dividend) __THROW
  147.      __attribute__ ((__const__));
  148.  
  149. /* Signed remainder function.  */
  150. extern int
  151. _kernel_srem (int __divisor, int __dividend) __THROW
  152.      __attribute__ ((__const__));
  153.  
  154. /* Signed divide and remainder function by 10.
  155.    Returns the remainder in R1. */
  156. extern int
  157. _kernel_sdiv10 (int __dividend) __THROW __attribute__ ((__const__));
  158.  
  159. /* Return a pointer to the current stack chunk.  */
  160. extern _kernel_stack_chunk *_kernel_current_stack_chunk (void) __THROW;
  161.  
  162. __END_DECLS
  163.  
  164. #endif
  165.