/*									*/
/* 5799-WZQ (C) COPYRIGHT IBM CORPORATION  1986,1987,1988				*/
/* LICENSED MATERIALS - PROPERTY OF IBM					*/
/* REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083		*/
/*									*/
## this file is pseudo-c that is translated by genassym.awk into 
## the desired c code.
## $Header:genassym.c 12.0$
## $ACIS:genassym.c 12.0$
## $Source: /ibm/acis/usr/sys/ca/RCS/genassym.c,v $
##

## following puts warning into genassym.c ...
/*									*/
/* Warning: this file is generated from:				*/
/* awk -f ../machine/genassym.awk ../machine/genassym.c > genassym.c	*/
/*									*/
#include "../machine/pte.h"

#include "../h/param.h"
#include "../h/buf.h"
#include "../h/vmmeter.h"
#include "../h/vmparam.h"
#include "../h/dir.h"
#include "../h/user.h"
#include "../h/cmap.h"
#include "../h/map.h"
#include "../h/proc.h"
#include "../h/text.h"
#include "../h/mbuf.h"
#include "../h/msgbuf.h"
#include "../machine/fp.h"
#include "../machine/float.h"
#ifdef ATR
#include "../ca_atr/pcif.h"
#endif
#ifdef DEBUG
#include "../machine/debug.h"
#endif DEBUG

main(argc,argv)
char **argv;
{
/* following puts warning into assym.s */
" /* Warning: this file is generated from				*/
" /* awk -f ../machine/genassym.awk ../machine/genassym.c >genassym.c	*/
" /* cc genassym.c ; a.out > assym.s						*/
"
"
" /* proc structure */
struct proc p_addr P_ADDR
struct proc p_cpu P_CPU
struct proc p_link P_LINK
struct proc p_pri P_PRI
struct proc p_p0br P_P0BR
struct proc p_rlink P_RLINK
struct proc p_sid0 P_SID0
struct proc p_sid1 P_SID1
struct proc p_stat P_STAT
struct proc p_szpt P_SZPT
struct proc p_usrpri P_USRPRI
struct proc p_pid P_PID
struct proc p_fpareg P_FPAREG
" /* pcb structure */
struct pcb pcb_ksp PCB_KSP
struct pcb pcb_sr08 PCB_SR08
#ifdef ATR
struct pcb pcb_io PCB_IO
#else
struct pcb pcb_afpalen PCB_AFPALEN
#endif ATR
struct pcb pcb_usp PCB_USP
struct pcb pcb_r0 PCB_R0
struct pcb pcb_r1 PCB_R1
struct pcb pcb_r2 PCB_R2
struct pcb pcb_r3 PCB_R3
struct pcb pcb_r4 PCB_R4
struct pcb pcb_r5 PCB_R5
struct pcb pcb_r6 PCB_R6
struct pcb pcb_r7 PCB_R7
struct pcb pcb_r8 PCB_R8
struct pcb pcb_r9 PCB_R9
struct pcb pcb_r10 PCB_R10
struct pcb pcb_r11 PCB_R11
struct pcb pcb_r12 PCB_R12
struct pcb pcb_r13 PCB_R13
struct pcb pcb_r14 PCB_R14
struct pcb pcb_r15 PCB_R15
struct pcb pcb_iar PCB_IAR
struct pcb pcb_icscs PCB_ICSCS
struct pcb pcb_p0br PCB_P0BR
struct pcb pcb_p0lr PCB_P0LR
struct pcb pcb_p1br PCB_P1BR
struct pcb pcb_p1lr PCB_P1LR
struct pcb pcb_szpt PCB_SZPT
struct pcb pcb_cmap2 PCB_CMAP2
struct pcb pcb_sswap PCB_SSWAP
struct pcb pcb_sigc[0] PCB_SIGC
#ifdef IBMRTPC
struct pcb pcb_ccr PCB_CCR	
#else !IBMRTPC
struct pcb pcb_win PCB_WIN
#endif !IBMRTPC
" /* from vmmeter.h */
struct vmmeter v_swtch V_SWTCH
struct vmmeter v_trap V_TRAP
struct vmmeter v_syscall V_SYSCALL
#ifdef ATR
" /* from pcif */
struct pcif_reg pc_wind128 PC_WIND128
format 0x%x
define PCIF_IO_B_OFFSET PCIF_IO_B_OFFSET
define P_WIND128 P_WIND128
define P_WIND512 P_WIND512
define RESTART_ADDR RESTART_ADDR
format %d
#endif ATR
" /* useful values */
define SRUN SRUN
define SZOMB SZOMB
struct user u_procp U_PROCP
struct user u_floatmask U_FLOATMASK
define USIZE sizeof (struct user)
define PSIZE sizeof (struct proc)
"#undef NPTEPG	/* get rid of old definition */
define NPTEPG NBPG / sizeof(struct pte)
define LOG2NPTEPG log2(NBPG / sizeof(struct pte))
define MAXBSIZE MAXBSIZE	/* max file system block size */
 
"	/* From machine/vmparam.h */
format 0x%x
define ENDOFP1 ENDOFP1
define USTRUCT ENDOFP1-sizeof (struct user)
define KERNSTACK ENDOFP1-sizeof (struct user)
define P1PAGES P1PAGES
define SYS_ORG SYSBASE
format %d
define USRPTSIZE 1*NPTEPG	/* one page worth of page table entries */
 
"	/* From h/cmap.h */
define SZ_CMAP sizeof (struct cmap)

"	/* From h/msgbuf.h */
define MSGBUFPAGES sizeof (struct msgbuf)/NBPG	/* Size of console message buffer in pages */

"	/* From h/mbuf.h */
define NMBCLUSTERS NMBCLUSTERS		/* Number of memory buffer clusters */

"	/* From machine/fp.h */
struct fp_mach status FPM_STATUS
define FPMACHSIZE sizeof (struct fp_mach)
format 0x%x
define FP_S_UNSGD FP_S_unsgd
#ifdef NFL
define USER_FPM	(USRSTACK-NBPG)
#endif NFL
define FLOAT_EMUL	FLOAT_EMUL
define FLOAT_AFPA	FLOAT_AFPA
define FLOAT_FPA	FLOAT_FPA
define FLOAT_AFPA_HARDWARE	FLOAT_AFPA_HARDWARE
define FLOAT_AFPA_DMA	FLOAT_AFPA_DMA
#ifdef DEBUG
"	/* from debug.h */
format 0x%x
define SHOW_SWTCH SHOW_SWTCH
#endif DEBUG
	exit(0);
}

/* calculate log base 2 of a number */
log2(n)
	register int n;
{
	register int i;
	
	for (i=0; i<32; ++i)
		if (((unsigned)1<<i) >= (unsigned) n)
			break;
	return(i);
}
