;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; RDOS operating system
; Copyright (C) 1988-2000, Leif Ekblad
;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. The only exception to this rule
; is for commercial usage in embedded systems. For information on
; usage in commercial embedded systems, contact embedded@rdos.net
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
;
; The author of this program may be contacted at leif@rdos.net
;
; GATE.DEF
; Gate structures
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

OS_GATE_SHIFT = 4

;
; this structure cannot be more than 16 bytes long!
;

os_gate_entry      STRUC
os_gate_offset         DD ?
os_gate_sel            DW ?
os_gate_name_offset    DD ?
os_gate_name_sel       DW ?
os_gate_flags          DW ?
os_gate_entry      ENDS

SERV_GATE_SHIFT = 4

;
; this structure cannot be more than 16 bytes long!
;

serv_gate_entry        STRUC
serv_gate_proc_offset  DD ?
serv_gate_proc_sel     DW ?
serv_gate_name_offset  DD ?
serv_gate_name_sel     DW ?
serv_gate_entry        ENDS

;
; this structure cannot be more than 32 bytes long!
;

USER_GATE_SHIFT = 5

user_gate_entry      STRUC
user_gate_entry_offset32     DD ?
user_gate_entry_sel32        DW ?
user_gate_name_offset        DD ?
user_gate_name_sel           DW ?
user_gate_entry_offset16     DD ?
user_gate_entry_sel16        DW ?
user_gate_sel16              DW ?
user_gate_sel32              DW ?
user_gate_syscall_flags      DB ?
user_gate_syscall_par        DB 3 DUP(?)
user_gate_transfer           DW ?
user_gate_space              DD ?
user_gate_entry      ENDS

UG_SYSCALL_FLAG_HAS_PAR0    = 1
UG_SYSCALL_FLAG_HAS_PAR1    = 2
UG_SYSCALL_FLAG_HAS_PAR2    = 3

UG_SYSCALL_PAR0_SHIFT       = 8
UG_SYSCALL_PAR1_SHIFT       = 16
UG_SYSCALL_PAR2_SHIFT       = 24

UG_SYSCALL_RD_ES_EDI        = 0
UG_SYSCALL_WR_ES_EDI        = 1

UG_SYSCALL_RD_DS_ESI        = 2
UG_SYSCALL_WR_DS_ESI        = 3

UG_SYSCALL_RD_PAR_ES_EDI       = (UG_SYSCALL_FLAG_HAS_PAR0 + (UG_SYSCALL_RD_ES_EDI SHL UG_SYSCALL_PAR0_SHIFT))
UG_SYSCALL_WR_PAR_ES_EDI       = (UG_SYSCALL_FLAG_HAS_PAR0 + (UG_SYSCALL_WR_ES_EDI SHL UG_SYSCALL_PAR0_SHIFT))

UG_SYSCALL_RD_PAR_DS_ESI       = (UG_SYSCALL_FLAG_HAS_PAR0 + (UG_SYSCALL_RD_DS_ESI SHL UG_SYSCALL_PAR0_SHIFT))
UG_SYSCALL_WR_PAR_DS_ESI       = (UG_SYSCALL_FLAG_HAS_PAR0 + (UG_SYSCALL_WR_DS_ESI SHL UG_SYSCALL_PAR0_SHIFT))
