;*************************************************************************
;** 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.                  **
;**                                                                     **
;** This is an internal header file, do not depend on anything here.    **
;** Use the official include files.                                     **
;** Distributed only for the mmu.library development group for private  **
;** use.                                                                **
;**                                                                     **
;**---------------------------------------------------------------------**
;** Block: The library base                                             **
;** Definition of the library base                                      **
;*************************************************************************

;FOLD Library base
;*************************************************
;** Library base                                **
;** this is the MMU library base                **
;*************************************************
        rsreset
                                ;first the node structure
mulib_succ:             rs.l 1          ;pointer to next library
mulib_pred:             rs.l 1          ;to previous
mulib_type:             rs.b 1          ;NT_LIBRARY
mulib_pri:              rs.b 1          ;priority, left blank
mulib_name:             rs.l 1          ;name of the game
                                ;the exec library header
mulib_flags:            rs.b 1          ;exec library flags
mulib_pad:              rs.b 1
mulib_negsize:          rs.w 1          ;jump vectors
mulib_possize:          rs.w 1          ;positive size, i.e. size of this structure
mulib_version:          rs.w 1
mulib_revision:         rs.w 1
mulib_idstring:         rs.l 1          ;ASCII vendor identification
mulib_sum:              rs.l 1          ;checksum
mulib_opencnt:          rs.w 1          ;open count
                                ;private mmu library header follows here
mulib_MMUType:          rs.b 1          ;type of mmu detected, see below
mulib_cludgefill0:      rs.b 1
mulib_Flags1:           rs.l 1          ;private flags, see below

mulib_Segment:          rs.l 1          ;Library segment for unloading

                                ;vectors to other libraries
mulib_SysBase:          rs.l 1          ;ExecBase. Important!
mulib_UtilityBase:      rs.l 1          ;utility.library
                                ;system lists
mulib_ContextList:      rs.l 3          ;minlist of known contexts.
                                ;other important pointers
mulib_CurrentContext:   rs.l 1          ;currently active context
mulib_DefaultContext:   rs.l 1          ;context for standard applications, NULL context

                                ;Processor specific data follows here
mulib_TableAlign:      rs.l 1           ;Alignment required for the MMU tables
mulib_PageSize:        rs.l 1           ;Page size choosen. Should be 4K

mulib_InitialShift:    rs.b 1           ;Initial shift bits, only used for MC68851/MC68030
mulib_LevelABits:      rs.b 1           ;Bits for the Root Index level of the tree
mulib_LevelBBits:      rs.b 1           ;Bits for the Pointer Index level of the tree
mulib_LevelCBits:      rs.b 1           ;Bits for the Page Index level of the tree
mulib_LevelDBits:      rs.b 1           ;Bits for the Level D pointer, used only in MC68851/68030
mulib_PageBits:        rs.b 1           ;Bits for the Page Offset level of the tree

mulib_reserved1:       rs.b 2

mulib_SuperTree:       rs.l 2           ;Supervisor Root Pointer, if any

                                ;at this point, we start with
                                ;the internal jump vectors for
                                ;processor specific routines.
                                ;These are filled in at startup
                                ;This is CODE, and the CPU jumps
                                ;directly in here.

mulib_CopyVBR:         rs.w 3           ;Copy the vector base to the address
                                        ;below and set VBR
mulib_EnterContext:    rs.w 3           ;Set the MMU root pointer
mulib_GetMMUData:      rs.w 3           ;Fill in processor specific data
mulib_reserved2:       rs.w 3

                                ;the vector base starts here
mulib_VectorBase:       rs.b $100       ;to be filled in

mulib_len:              rs.b 0
;ENDFOLD
;FOLD Standard library flags definitions we care about
lib_changed     =       1
lib_sumused     =       2
lib_delexp      =       3       ;marked for expunge
lib_exp0cnt     =       4       ;special system expunge flag
;ENDFOLD
;FOLD Standard node types we care about
NT_UNKNOWN      EQU 0
NT_TASK         EQU 1   ; Exec task
NT_INTERRUPT    EQU 2
NT_DEVICE       EQU 3
NT_MSGPORT      EQU 4
NT_MESSAGE      EQU 5   ; Indicates message currently pending
NT_FREEMSG      EQU 6
NT_REPLYMSG     EQU 7   ; Message has been replied
NT_RESOURCE     EQU 8
NT_LIBRARY      EQU 9
NT_MEMORY       EQU 10
NT_SOFTINT      EQU 11  ; Internal flag used by SoftInts
NT_PROCESS      EQU 13  ; AmigaDOS Process
NT_SIGNALSEM    EQU 15  ; signal semaphores

NT_CONTEXT      EQU 32  ;A context node, private.
;ENDFOLD
;FOLD MMU types known
mutype_none     =       0       ;no mmu detected
mutype_68851    =       '2'     ;68020 mmu
mutype_68030    =       '3'     ;68030 mmu
mutype_68040    =       '4'     ;68040 mmu
mutype=68060    =       '6'     ;68060 mmu
;ENDFOLD
;FOLD Private flags in the library base
mmuf1_contextopen       =       0       ;a context is in use
;ENDFOLD

