COMMENT @----------------------------------------------------------------------

	Copyright (c) GeoWorks 1989 -- All Rights Reserved

PROJECT:	PC GEOS
FILE:		system.def

DECLARER:	Kernel

DESCRIPTION:
	This file defines various structures and routines in the kernel.

	$Id: system.def,v 1.2 98/04/30 15:45:35 joon Exp $

------------------------------------------------------------------------------@

SetDef	__SYSTEM

StartKernel

include localize.def

global DosExec:far
global SysLocateFileInDosPath:far
global SysGetDosEnvironment:far
global SysNotify:far
global SysRegisterScreen:far
global SysShutdown:far
global SysSetExitFlags:far
global SysLockBIOS:appfar
global SysUnlockBIOS:appfar
global SYSENABLEAPO:far
global SYSDISABLEAPO:far
global SYSGETINKWIDTHANDHEIGHT:far
global SYSSETINKWIDTHANDHEIGHT:far



;-

global _DosExec:far
global SYSLOCATEFILEINDOSPATH:far
global SYSGETDOSENVIRONMENT:far
global SYSNOTIFY:far
global SYSREGISTERSCREEN:far
global _SysShutdown:far
global SYSSETEXITFLAGS:far
global SYSGETCONFIG:far
global SYSGETECLEVEL:far
global SYSSETECLEVEL:far
global UTILHEX32TOASCII:far
global UTILASCIITOHEX32:far
global SYSGETPENMODE:far

global SysCopyToStackDSSI:appfar
global SysCopyToStackDSBX:appfar
global SysCopyToStackDSDX:appfar
global SysCopyToStackBXSI:appfar
global SysCopyToStackESDI:appfar
global SysRemoveFromStack:appfar
global SysCopyToBlock:appfar

;-----------------------------------------------------------------------------
;			 System Configuration
;-----------------------------------------------------------------------------
SysGetConfig	equ	SYSGETCONFIG

;
; Flags indicating machine configuration
;
SysConfigFlags	record
	SCF_UNDER_SWAT:1,	; Non-zero if kernel started by Swat stub
	SCF_2ND_IC:1,		; Non-zero if second 8259 present
	SCF_RTC:1,		; Non-zero if real-time clock around
	SCF_COPROC:1,		; Non-zero if math coprocessor present
	SCF_RESTARTED:1		; Non-zero if restarted from our tsr
	SCF_CRASHED:1		; Non-zero if we crashed the last time we ran
	SCF_MCA:1		; Non-zero if we're on a Micro Channel machine
	SCF_LOGGING:1		; Non-zero if we're writing log messages
				; see code in Library/User/User/userLog.asm
SysConfigFlags	end

SysProcessorType etype byte, 0
SPT_8088	  enum SysProcessorType
SPT_8086	  enum SysProcessorType, SPT_8088
SPT_80186	  enum SysProcessorType
SPT_80286	  enum SysProcessorType
SPT_80386	  enum SysProcessorType
SPT_80486	  enum SysProcessorType

SysMachineType etype byte, 0
SMT_UNKNOWN	enum SysMachineType
SMT_PC		enum SysMachineType
SMT_PC_CONV	enum SysMachineType
SMT_PC_JR	enum SysMachineType
SMT_PC_XT	enum SysMachineType
SMT_PC_XT_286	enum SysMachineType
SMT_PC_AT	enum SysMachineType
SMT_PS2_30	enum SysMachineType
SMT_PS2_50	enum SysMachineType
SMT_PS2_60	enum SysMachineType
SMT_PS2_80	enum SysMachineType
SMT_PS1		enum SysMachineType
SMT_PRODUCT_SPECIFIC_1	enum	SysMachineType  ; responder G1 board(ext clk)
SMT_PRODUCT_SPECIFIC_2	enum	SysMachineType  ; responder G4 board(int clk)
SMT_PRODUCT_SPECIFIC_3	enum	SysMachineType  ; responder G8(A3 silicon)
SMT_PRODUCT_SPECIFIC_4	enum	SysMachineType
SMT_PRODUCT_SPECIFIC_5	enum	SysMachineType	; responder w/ A6 or later chip

;-----------------------------------------------------------------------------
;		Constants for CPUID instruction
;-----------------------------------------------------------------------------

VENDOR_ID_STR_INTEL	equ	"GenuineIntel"
VENDOR_ID_STR_AMD	equ	"AuthenticAMD"

ProcessorType	etype
	PT_OEM		enum	ProcessorType
	PT_OVERDRIVE	enum	ProcessorType
	PT_DUAL		enum	ProcessorType

ProcessorFamily	etype
	PF_486		enum	ProcessorFamily, 4
	PF_PENTIUM	enum	ProcessorFamily, 5
	PF_PENTIUM_PRO	enum	ProcessorFamily, 6

CPUIDVerHigh	record
	:16			; reserved
CPUIDVerHigh	end

CPUIDVerLow	record
	:2			; reserved
	CPUIDVL_TYPE		ProcessorType:2
	CPUIDVL_FAMILY		ProcessorFamily:4
	CPUIDVL_MODEL		:4
	CPUIDVL_STEPPING	:4
CPUIDVerLow	end

IntelProcFeaturesHigh	record
	:16			; reserved
IntelProcFeaturesHigh	end

IntelProcFeaturesLow	record
	IPFL_CMOV	:1
	IPFL_MCA	:1
	IPFL_PGE	:1
	IPFL_MTRR	:1
	:2			; reserved
	IPFL_APIC	:1
	IPFL_CXS	:1
	IPFL_MCE	:1
	IPFL_PAE	:1
	IPFL_MSR	:1
	IPFL_TSC	:1
	IPFL_PSE	:1
	IPFL_DE		:1
	IPFL_VME	:1
	IPFL_FPU	:1
IntelProcFeaturesLow	end

AMDProcFeaturesHigh	record
	:16			; reserved
AMDProcFeaturesHigh	end

AMDProcFeaturesLow	record
	:15			; reserved
	APFL_FPU	:1
AMDProcFeaturesLow	end

ProcessorFeaturesHigh	union
	PFH_intel	IntelProcFeaturesHigh
	PFH_amd		AMDProcFeaturesHigh
ProcessorFeaturesHigh	end

ProcessorFeaturesLow	union
	PFL_intel	IntelProcFeaturesLow
	PFL_amd		AMDProcFeaturesLow
ProcessorFeaturesLow	ends

CPUIDInfo	etype	dword

CPUIDI_VENDOR		enum	CPUIDInfo
; Return:	EAX	= max. CPUID input value supported
;		ECX.EDX.EBX	= vendor ID string (1st char in BL.low)

CPUIDI_VER_AND_FEATURE	enum	CPUIDInfo
; Return:	EAX	= CPUIDVerHigh.CPUIDVerLow
;		EBX	= processor-specific
;		ECX	= processor-specific
;		EDX	= ProcessorFeaturesHigh.ProcessorFeaturesLow

CPUIDI_CACHE		enum	CPUIDInfo


COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
		cpuid
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

SYNOPSIS:	CPU Identification

PASS:		EAX	= CPUIDInfo

PSEUDO CODE/STRATEGY:

KNOWN BUGS/SIDE EFFECTS/IDEAS:

REVISION HISTORY:
	Name	Date		Description
	----	----		-----------
	ayuen	9/06/00   	Initial version

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
cpuid		macro
	.inst	byte	0x0F, 0xA2
		endm



;-----------------------------------------------------------------------------
;		System Video Configuration
;-----------------------------------------------------------------------------
;These values are stored in kernel variables, and are accessible using
;SysGetInfo with SGIT_INITIAL_TEXT_MODE, etc.

;The following is a byte value that is stored in KLV_initialTextMode.

SysInitialTextMode	etype	byte, 0
   SITM_UNKNOWN		enum	SysInitialTextMode, 0
   					;Used in cases where we don't check for
					;the initial video mode (Zoomer).

   ;These are absolute guesses. See what BIOS defines, and fill in these
   ;names and values, just for documentation's sake.

   SITM_TEXT_80_25_16_COLOR		enum	SysInitialTextMode, 3
   								;= CH0F_8025
   SITM_TEXT_80_25_MONO			enum	SysInitialTextMode, 7
   								;= CH02_8025
   ;SITM_TEXT_132_25_MONO		enum	SysInitialTextMode, 5

;This is a list of the graphics modes that are standardized enough so
;that we can auto-detect their presence in the loader, and display
;a splash screen. (IMPORTANT: update the tables in Loader/loaderDisplay.asm
;and Library/User/User/userScreen.asm if you change this enumerated type.)

SysSimpleGraphicsMode	etype	byte, 0
    SSGM_NONE				enum	SysSimpleGraphicsMode, 0
    SSGM_VGA				enum	SysSimpleGraphicsMode, 1
    SSGM_EGA				enum	SysSimpleGraphicsMode, 2
    SSGM_MCGA				enum	SysSimpleGraphicsMode, 3
    SSGM_HGC				enum	SysSimpleGraphicsMode, 4
    SSGM_CGA				enum	SysSimpleGraphicsMode, 5
    SSGM_SPECIAL			enum	SysSimpleGraphicsMode, 6
    SSGM_SVGA_VESA			enum	SysSimpleGraphicsMode, 7

;The above type is used for both KLV_defSimpleGraphicsMode
;and KLV_curSimpleGraphicsMode. The precise definition of each SSGM_ value
;can only be explained in the context of those two variables:

if 0
(from Include/Internal/kLoader.def)

    KLV_defSimpleGraphicsMode	SysSimpleGraphicsMode

    ;The value stored here is interpreted as follows:
    ;	SSGM_NONE		- No simple graphics mode could be determined
    ;				by the loader. Unless one is specified in the
    ;				GEOS.INI file, PC/GEOS will have to exit.
    ;
    ;   SSGM_VGA...SSGM_CGA	- The loader suggests this as a default
    ;				graphics mode, should there be none specified
    ;				in the GEOS.INI file.
    ;
    ;   SSGM_SPECIAL		- (Handled as SSGM_NONE is.)

    KLV_curSimpleGraphicsMode	SysSimpleGraphicsMode

    ;The value stored here is interpreted as follows:
    ;   SSGM_NONE		- The loader DID NOT switch screens. The initial
    ;				text mode display is still visible. (The kernel
    ;				needs to know this when exiting prematurely.)
    ;
    ;	SSGM_VGA...SSGM_CGA	- The loader DID switch to a graphics screen,
    ;				and display the splash screen text & graphics.
    ;
    ;	SSGM_SPECIAL		- The loader detected an "exotic" video mode,
    ;				and was able to switch to it and display
    ;				a splash screen in that mode. The video driver
    ;				will have to detect that its mode is already
    ;				active, to avoid re-setting the mode again,
    ;				which would most likely nuke the splash screen.
endif

;-----------------------------------------------------------------------------
;			 Version control
;-----------------------------------------------------------------------------
global SysGetVersion:far

;--------------------------------------------------------------------------
;			Parameters to SysShutdown
;--------------------------------------------------------------------------

SysShutdownType etype word		; Note: SysNotify depends on these
					;  things increasing in severity as
					;  the number increases. Place any new
					;  modes in the proper order.
SST_CLEAN		enum SysShutdownType
;	Shut down applications cleanly, allowing ones that wish to abort
;	the shutdown to do so. MSG_META_CONFIRM_SHUTDOWN is sent out
;	via the MANUFACTURER_ID_GEOWORKS:GCNSLT_SHUTDOWN_CONTROL list.
;
;	Pass:	^lcx:dx	= object to notify when everything's been confirmed
;			= 0:0 to simply notify the UI in the standard
;			  fashion (via MSG_META_DETACH)
;		bp	= message to send it. When the message is sent,
;			  cx will be 0 if the shutdown request has been
;			  denied; non-zero if the shutdown may proceed.
;	Return:	carry set if another shutdown is already in-progress
;

SST_CLEAN_FORCED	enum SysShutdownType
;	Shut down applications cleanly, but do not send out 
;	MSG_META_CONFIRM_SHUTDOWN.
;
;	Pass:	nothing
;	Return:	nothing
;

SST_DIRTY		enum SysShutdownType
;	Do not shut down applications. Attempt to exit device drivers and close
;	all open files, however.
;
;	Pass:	ds:si	= reason for the shutdown (null-terminated string).
;			  si = -1 if no reason to give the user.
;	Return:	doesn't
;

SST_PANIC		enum SysShutdownType
;	Do not shut down applications. Do not close files. Only exit device
;	drivers marked with GA_SYSTEM. This can be really bad for the system
;	and should be used only in dire straits.
;
;	Pass:	nothing
;	Return:	doesn't
;

SST_REBOOT		enum SysShutdownType
;	Like SST_DIRTY, but warm-boots the machine, rather than just exiting
;	to DOS.
;
;	Pass:	nothing
;	Return:	doesn't
;

SST_RESTART		enum SysShutdownType
;	Like SST_CLEAN_FORCED, but reload the system, rather than exiting to
;	DOS.
;
;	Pass:	nothing
;	Return:	only if couldn't set up for restart (e.g. loader.exe wasn't
;			found)
;

SST_FINAL		enum SysShutdownType
;	Perform the final phase of an SST_CLEAN or SST_CLEAN_FORCED shutdown.
;
;	Pass:	ds:si	= reason for shutdown (si = -1 if no reason to give)
;	Return:	doesn't
;

SST_SUSPEND		enum SysShutdownType
;	Suspend system operation in preparation for switching to a new DOS
;	task. Broadcasts MSG_META_CONFIRM_SHUTDOWN through the system's
;	MANUFACTURER_ID_GEOWORKS:GCNSLT_SHUTDOWN_CONTROL list.
;
;	Pass:	^lcx:dx	= object to notify when everything's been confirmed
;		bp	= message to send it. When the message is sent,
;			  cx will be 0 if the shutdown request has been
;			  denied; non-zero if the shutdown may proceed.
;	Return:	carry set if another shutdown is already in-progress
;

SST_CONFIRM_START	enum SysShutdownType
;	Called by the recipient of a MSG_META_CONFIRM_SHUTDOWN so there's some
;	order to the way confirmation boxes are presented to the user. Only one
;	thread may be confirming the shutdown at a time. The caller will block
;	until it is given permission. SysShutdown will return carry set to
;	indicate that some other thread has already canceled the shutdown and
;	the caller should *not* put up its confirmation box. It need not call
;	SysShutdown again.
;
;	Pass:	nothing
;	Return:	carry set if some other object has already denied the shutdown
;			request. Caller should do nothing further.
;

SST_CONFIRM_END		enum SysShutdownType
;	Finishes the handling of a MSG_META_CONFIRM_SHUTDOWN.
;
;	Pass:	cx	= 0 to deny the shutdown.
;			= non-zero to allow the shutdown.
;	Return:	nothing
;

SST_CLEAN_REBOOT	enum SysShutdownType
;	Does a clean shutdown (ie. closes applications, allows aborting)
;	then warm-boots the machine.
;
;	NOTE: this is not supported in the retail upgrade kernel,
;	so use with caution.
;
;	Pass:	same as SST_CLEAN
;	Return:	same as SST_CLEAN
;

SST_POWER_OFF		enum SysShutdownType
;	Does a clean shutdown (i.e. closes applications, allows aborting)
;	then tells the user that the computer may be safely powered off.
;
;	NOTE: this is not supported in kernels prior to NewDeal Beta3
;	so use with caution.
;
;	Pass:	same as SST_CLEAN
;	Return:	same as SST_CLEAN
;

DosExecFlags	record
	DEF_PROMPT:1, 		;Set if we want to prompt the user to strike a
				; key to return to GEOS
	DEF_FORCED_SHUTDOWN:1, 	;Set if we want to force the user to shutdown
				; (cannot abort, program must be run)
	DEF_INTERACTIVE:1,	;Set if program being run is interactive shell
				; and we should change $PROMPT to tell the
				; user to type "exit" to return to GEOS.
	DEF_SWAP_EXEC:1,	;Set if GEOS should be swapped out instead
				; of shutdown.
	DEF_SWAP_TSR:1,		;Set if GEOS should swap itself out and TSR,
				; *without* executing the program.
	DEF_MEM_REQ:1		;Set if a DosExecArgAndMemReqStruct is passed
				; to DosExec in es:di instead of the argument
				; string
	:2
DosExecFlags	end

DosExecMemReq	struct
	DEMR_minimum	word		; minimum memory requirement
	DEMR_optimal	word		; optimal memory requirement
DosExecMemReq	ends

DosExecMemReqsStruct	struct
	DEMRS_tsr		BooleanByte	BB_FALSE    ; program is a TSR
	DEMRS_conventional	DosExecMemReq	<0,0>	; conventional
	DEMRS_upper		DosExecMemReq	<0,0>	; upper
	DEMRS_ems		DosExecMemReq	<0,0>	; EMS
	DEMRS_xms		DosExecMemReq	<0,0>	; XMS
	DEMRS_extended		DosExecMemReq	<0,0>	; raw extended
DosExecMemReqsStruct	ends

DosExecArgAndMemReqsStruct	struct
	DEAAMRS_arguments	fptr.char	; fptr to null-terminated
						;  argument string.  Should
						;  point to a null string
						;  if no argument
	DEAAMRS_memReq		DosExecMemReqsStruct
DosExecArgAndMemReqsStruct	ends

;--------------------------------------------------------------------------
;		  Flags Controlling How System Exits
;--------------------------------------------------------------------------
ExitFlags	record
    EF_POWER_OFF:1		; Set if exit should signal user when it's
				;  safe to turn off the machine.
    EF_PANIC:1			; Set if exit is panicky so we shouldn't
				;  write out the .ini file.
    EF_RUN_DOS:1		; Set if should run a DOS program
    EF_OLD_EXIT:1		; Set if should use old-style (int 20h) exit
				;  call (if accidentally run under DOS 1.x)
    EF_RESET:1			; Set if should reset the machine instead of
				;  exiting.
    EF_RESTART:1		; Set if should reload GEOS at the end.
ExitFlags	end

;--------------------------------------------------------------------------
;			Flags to SysNotify
;--------------------------------------------------------------------------

SysNotifyFlags 	record
    SNF_RETRY:1,		; Retry the operation.
    SNF_EXIT:1,			; Shutdown the system.
    SNF_ABORT:1,		; Abort the operation.
    SNF_CONTINUE:1,		; Continue when done. This is different from
				;  SNF_RETRY as it implies the notification is
				;  not for a real error, but just to notify
				;  the user of something.
    SNF_REBOOT:1,		; Hard exit -- dirty shutdown followed by
				;  reload/restart of GEOS
    SNF_BIZARRE:1,		; Indicates notice is unexpected and user
				;  should be directed to the trouble-shooting
				;  guide.
    SNF_READ_STRING:1		; Second-string pointer is buffer into which
				;  a string should be read. Buffer should be
				;  SYS_NOTIFY_MAX_STRING chars long. Control
				;  will return when user hits Return. String
				;  will be null-terminated.
				;
				;  THIS IS NOT YET IMPLEMENTED
    SNF_DONT_INVAL_WIN_TREE:1	; Don't force invalidation of window tree
				;  after closing SysNotify box.
    :8
SysNotifyFlags	end


SYS_NOTIFY_MAX_STRING	equ	45	; greatest number of chars allowed
					;  in a string passed to SysNotify

SysGetPenMode	equ	SYSGETPENMODE

;-------------------------------------------------------------------------------
;
;	Flags telling UtilHex32ToAscii how the caller wants the result
;	formatted.
;
;-------------------------------------------------------------------------------

global UtilHex32ToAscii:far

;	All buffer sizes must be even (for proper stack allocation)

SBCS <UHTA_NO_NULL_TERM_BUFFER_SIZE	equ	10			>
DBCS <UHTA_NO_NULL_TERM_BUFFER_SIZE	equ	10*(size wchar)		>

SBCS <UHTA_NULL_TERM_BUFFER_SIZE	equ	11+1			>
DBCS <UHTA_NULL_TERM_BUFFER_SIZE	equ	11*(size wchar)		>

	;NOTE: the following are to be used in addition to the above.
SBCS <UHTA_SPACE_FOR_SIGN		equ	1+1			>
DBCS <UHTA_SPACE_FOR_SIGN		equ	1*(size wchar)		>
SBCS <UHTA_SPACE_FOR_SEPARATORS		equ	3+1			>
DBCS <UHTA_SPACE_FOR_SEPARATORS		equ	3*(size wchar)		>

SBCS <UHTA_ALL_BUFFER_SIZE		equ	10+1+1+3+1		>
DBCS <UHTA_ALL_BUFFER_SIZE		equ	(10+1+1+3)*(size wchar)	>

	;
	;NOTE: be sure to use the correct buffer size for the flags that
	;you use (ie. null terminate, signed, thousands separators).
	;
UtilHexToAsciiFlags record
    :11
    UHTAF_SBCS_STRING:1			;ie. result is SBCS (DBCS only)
	;NOTE: this cannot be used with any of the flags below except
	;UHTAF_NULL_TERMINATE.  It is intended for kernel use.
	;
    UHTAF_THOUSANDS_SEPARATORS:1	;ie. commas between thousands
    UHTAF_SIGNED_VALUE:1		;ie. high bit is sign
    UHTAF_INCLUDE_LEADING_ZEROS:1	;eg: 0001234
    UHTAF_NULL_TERMINATE:1		;ie. append NULL
UtilHexToAsciiFlags end


;-------------------------------------------------------------------------------
;
;	Return value for UtilAsciiToHex32, if an error occurs
;
;-------------------------------------------------------------------------------

global UtilAsciiToHex32:far

UtilAsciiToHexError	etype	word
UATH_NON_NUMERIC_DIGIT_IN_STRING	enum UtilAsciiToHexError
UATH_CONVERT_OVERFLOW			enum UtilAsciiToHexError

;------------------------------------------------------------------------------
;
;	Subsystem Notification
;
;------------------------------------------------------------------------------
global	SysSendNotification:far
;	Desc:	Deliver notification to a particular subsystem, either now
;		or when the subsystem is loaded.
;
;	Pass:	si	= SysSubsystemType
;		di	= SysNotificationType
;		ax, bx, cx, dx = notification data
;	Return:	nothing
;

global	SysHookNotification:far
;	Desc:	Arrange for notifications sent via SysSendNotification for
;		the indicated subsystem to arrive at the given routine.
;
;	Pass:	si	= SysSubsystemType
;		cx:dx	= virtual far pointer of routine to call:
;			  Pass:	di	= SysNotificationType
;				ax, bx, cx, dx = notification data
;			  Return:	nothing
;	Return:	carry set if subsystem already hooked or ignored
;

global	SysUnhookNotification:far
;	Desc:	Stop receiving notifications for a subsystem.
;
;	Pass:	si	= SysSubsystemType
;		cx:dx	= virtual far pointer of routine that was receiving
;			  notifications
;	Return:	nothing
;

global	SysIgnoreNotification:far
;	Desc:	Drop all past and future notifications for the indicated
;		subsystem on the floor, as it will not be activated, making
;		the notifications unnecessary.
;
;	Pass:	si	= SysSubsystemType
;	Return:	carry set if subsystem already hooked.
;

SysSubsystemType	etype	protominor word, 0, 9
    SST_MAILBOX		enum	SysSubsystemType
    ;	System inbox/outbox. Notification types & parameters defined in
    ;	mailbox.def
    ;
    SST_MEDIUM		enum	SysSubsystemType
    ;   Medium notifications defined in medium.def

		protominor	DevicePowerSubsystem

    SST_DEVICE_POWER	enum	SysSubsystemType
    ;	Power-management driver device power control. Parameters are same as
    ;	for DR_POWER_DEVICE_ON_OFF in Internal/powerDr.def

		protominor	DocumentIndicatorSubsystem

    SST_INDICATOR 	enum SysSubsystemType
    ;	Interface to Indicator application for # of documents (see
    ;	Internal/Resp/indicator.def)

		protominor	IrdaStatusSubsystem

    SST_IRDA		enum SysSubsystemType
    ;	IrDA link status.  Parameters are the same as NII_STATUS_INDICATION
    ;	in Internal/irlapDr.def.

		protoreset

		protominor	SocketStatusSubsystem

    SST_SOCKET		enum	SysSubsystemType
    ;   Socket link status.  Socket notifications defined in sockmisc.def
	
		protoreset

SysNotificationType	record
    SNT_AX_MEM:1		; AX holds memory handle
    SNT_BX_MEM:1		; BX holds memory handle
    SNT_CX_MEM:1		; CX holds memory handle
    SNT_DX_MEM:1		; DX holds memory handle
    SNT_NOTIFICATION:12		; notification number
SysNotificationType	end

global SYSSENDNOTIFICATION:far
global SYSHOOKNOTIFICATION:far
global SYSUNHOOKNOTIFICATION:far
global SYSIGNORENOTIFICATION:far

;-------------------------------------------------------------------------------
;
;	Auto Power Off control
;
;-------------------------------------------------------------------------------
SysEnableAPO	equ	SYSENABLEAPO
SysDisableAPO	equ	SYSDISABLEAPO

;-------------------------------------------------------------------------------
;
;	Ink control
;
;-------------------------------------------------------------------------------

SysGetInkWidthAndHeight	equ	SYSGETINKWIDTHANDHEIGHT
global SysSetInkWidthAndHeight:far

;------------------------------------------------------------------------------
;
;	direct memory access
;
;------------------------------------------------------------------------------

protominor	UtilMappingWindow

;
; maximum number of windows that can be provided
;
UTIL_WINDOW_MAX_NUM_WINDOWS	equ	4


UtilWinInfo	struct
	UWI_addr	sptr	; window segment (NULL if not supported)
	UWI_paraSize	word	; window size in paragraphs
UtilWinInfo	ends

UtilWinPhyMemInfo	struct
	UWPMI_addr	dword		; physical memory address
	UWPMI_paraSize	word		; physical memory size in paragraphs
UtilWinPhyMemInfo	ends

UtilWinPhyMemInfoBlk	struct
	UWPMIB_count	word
	UWPMIB_info	label	UtilWinPhyMemInfo
UtilWinPhyMemInfoBlk	ends

global	SysGetUtilWindowInfo:far
global	SYSGETUTILWINDOWINFO:far
;
; Returns address and size of direct mapping window, if present
;
; Pass:		dx:bp	= UtilWinInfo array of UTIL_WINDOW_MAX_NUM_WINDOWS
;			  entries
;		ds:si	= permanent name of geode (GEODE_NAME_SIZE chars)
; Return:	ax	= TRUE if mapping window supported
;		array filled
;		^hbx	= block of UtilWinPhyMemInfoBlk entries for this
;			  geode
;

global	SysMapUtilWindow:far
global	SYSMAPUTILWINDOW:far
;
; Maps physical memory to mapping window.
;
; Pass:		dxbp = physical address to map in (starts at 100000h)
;		ax = window number to use
; Return:	ax = number of paragraphs mapped in (i.e. size of window -
;						offset into window where
;						passed physical address
;						begins)
;		dx:bp = beginning of physical data in map window
;

global	SYSUNMAPUTILWINDOW:far
SysUnmapUtilWindow	equ	SYSUNMAPUTILWINDOW
;
; Releases mapping of physical memory from mapping window.  Restores
; previously mapped physical memory, if any.
;
; Pass:		nothing
; Return:	ax = non-zero if error
;

protoreset

EndKernel
