/*************************************************************************
 ** mmu.library                                                         **
 **                                                                     **
 ** a system library for arbitration and control of the MC68K MMUs      **
 **                                                                     **
 ** © 1998 THOR-Software, Thomas Richter                                **
 ** No commercial use, reassembly, modification without prior, written  **
 ** permission of the authors.                                          **
 ** Including this library in any commercial software REQUIRES a        **
 ** written permission and the payment of a small fee.                  **
 **                                                                     **
 **---------------------------------------------------------------------**
 ** Definition of tags for the MMU library                              **
 *************************************************************************/

#ifndef MMU_MMUTAGS_H
#define MMU_MMUTAGS_H

#ifndef UTILITY_TAGITEM_H
#include "utility/tagitem.h"
#endif

#define MAPTAG_DUMMY            ( TAG_USER + 0x03e00000 )

/* SetProperties and SetPageProperties tags */

#define MAPTAG_DESTINATION      ( MAPTAG_DUMMY + 1 )
/* destination in case the memory gets remapped */

#define MAPTAG_BLOCKID          ( MAPTAG_DUMMY + 2 )
/* a unique block ID for swapped out pages. MUST be given. */

#define MAPTAG_USERDATA         ( MAPTAG_DUMMY + 3 )
/* user data for invalid, non-repairable pages. Optional. */

#define MAPTAG_DESCRIPTOR       ( MAPTAG_DUMMY + 4 )
/* the real descriptor for indirect pages. */


/* CreateMMUContext tags */

#define MCXTAG_DUMMY            ( TAG_USER + 0x03e00100 )

#define MCXTAG_COPY             ( MCXTAG_DUMMY + 1 )
/* copy the definition from another context, given as tag argument */

#define MCXTAG_EXECBASE         ( MCXTAG_DUMMY + 16 )
/* disable the special AbsExecBase and low-memory handling ? */


/* AddContextHook tags */

#define MADTAG_DUMMY            ( TAG_USER + 0x03e00200 )

#define MADTAG_CONTEXT          ( MADTAG_DUMMY + 0 )
/* the context to which the context hook should be added. */

#define MADTAG_TASK             ( MADTAG_DUMMY + 1 )
/* if the exception is task specific, then this is the task pointer.
   Note that many task specific handlers slow down exception handling. */

#define MADTAG_TYPE             ( MADTAG_DUMMY + 2 )
/* type of the exception, MMUEH_SEGFAULT, MMUEH_SWAPPED, MMUEH_SWITCH or
   MMUEH_LAUNCH. See exceptions.h */

#define MADTAG_CODE             ( MADTAG_DUMMY + 3 )
/* the code to be called on exceptions. Should be assembly. 
   a0 is the struct ExceptionData *, a1 and a4 are pointers to the data
   item, see below, a5 is the pointer to the code and a6 is the MMUBase.
   d0-d1/a0-a1 and a4-a5 are scratch registers. The exception handler must
   return with the Z flag set (i.e. an "equal" condition) and d0 cleared to
   indicate that it handled the exception and no other handler should be
   called. */

#define MADTAG_DATA             ( MADTAG_DUMMY + 4 )
/* data to be loaded for the exception handler, will be passed in a1 
   and a4 */

#define MADTAG_NAME             ( MADTAG_DUMMY + 5 )
/* a unique name for the handler. The library makes currently no use of
   this name. */

#define MADTAG_PRI              ( MADTAG_DUMMY + 6 )
/* the priority of the handler. Higher priority handlers are called first.
   Should be above 32 for "emergency stack swap in" handlers, between 32
   and -32 for standard handlers and below -32 for debugging tools like the
   Enforcer and similar. */

/* AddMessageHook tags */

#define MADTAG_CATCHERPORT      ( MADTAG_DUMMY + 0x100 )
/* the port to send the exception message to for message hook types. */

#endif
