/*
 * $Header: /smsa/bsd:include/arm/page0.h:bsd  1.11  $
 * $Source: /smsa/bsd:include/arm/page0.h: $
 *
 * Copyright (c) 1988 Acorn Computers Ltd., Cambridge, England
 *
 */

#ifndef	__arm_page0_h
#define	__arm_page0_h
#define	__machine_page0_h	"arm"

#ifndef	__machine_int_hndlr_h
#include "int_hndlr.h"
#endif
#ifndef	__machine_fp_h
#include "fp.h"
#endif

/* Protection applied to page 0, for user access or not */
#define PAGE0_PROT		APG_UR

/*
 * The system message buffer now lives in page 0. It takes up 4Kb (see
 * <sys/msgbuf.h>).
 */
#define PAGE0_END		NBPG
#define MSGBUF_BASE		(PAGE0_END - sizeof(struct msgbuf))

/*
 * FPE/FPS workspace lives at a fixed page 0 address (0x2000)
 * assembled into the code.
 */
#define	FPU_WORK_LIMIT		0x2000
#define FPU_WORK_BASE		(FPU_WORK_LIMIT - 0x100 - 0x100)

/*
 * These "STACK" definitions refer to the top (ie address just beyond)
 * a down growing stack.
 */
#define	SWTCH_STACK_SIZE	(1024 * 4)
#define	SWTCH_STACK		FPU_WORK_BASE
/* BOOT stack is shared with the SWTCH stack, since only used during booting */
#define	BOOT_STACK		SWTCH_STACK
#define	BOOT_STACK_SIZE		SWTCH_STACK_SIZE
/* The interrupt priority table lives in page 0 these days */
#define INT_PRIO_TBL_SIZE	((MAX_SPL+1)*sizeof(struct int_prio_tbl))
#define INT_PRIO_TBL		((SWTCH_STACK - SWTCH_STACK_SIZE) - \
				 INT_PRIO_TBL_SIZE)
/* The byte->word expansion table used by the VC driver does too */
#define EXPAND_BYTE_BASE	(INT_PRIO_TBL - 256*4)

/*
 * The following definitions are to do with the routines load_fp_regs
 * and save_fp_regs, whose code (and data) is copied to and executed
 * in a temporarily writeable page 0 for reasons to do with the
 * floating point emulator.
 */
#define FPU_TDATA_SIZE		(sizeof(struct fp_regs))
#define FPU_TDATA_BASE		(EXPAND_BYTE_BASE - FPU_TDATA_SIZE)
#define FPU_TCODE_SIZE		(100*4)		/* allow 100 words code total */
#define FPU_TCODE_BASE		(FPU_TDATA_BASE - FPU_TCODE_SIZE)

/*
 * The lowest part of page 0 contains the vectors and a small piece of
 * FIQ code.  This is limited to 256 bytes in total.
 */
#define	VECTORS_LIMIT		0x100

/*
 * With current values there is a little space below the fpu register
 * load/save code down to the vector area limit. We define a sanity
 * check, used in genassym.c, to ensure we stay in bounds.
 */

#define PAGE0_SANE()	(FPU_TCODE_BASE >= VECTORS_LIMIT) 


/*
 * Between the floating point system workspace ending at 0x2000 and
 * the message buffer which starts at 0x7000 there is a 20Kb hole: it
 * was previously used for the page-on-disc (pod) table, but that has
 * been completely eliminated for RISC iX 1.2.  We define its limits
 * here so that the space can be released to the chunk memory list
 * early in booting and claimed for other purposes.
 */
#define PAGE0_HOLE_BASE		FPU_WORK_LIMIT
#define PAGE0_HOLE_SIZE		(MSGBUF_BASE - FPU_WORK_LIMIT)


#endif/*__arm_page0_h*/

/* EOF page0.h */
