ack/util/int/text.c

47 lines
1,010 B
C
Raw Permalink Normal View History

2019-03-17 14:42:00 +00:00
/** @file
* Program counter manipulation routines */
1988-06-22 16:57:09 +00:00
1994-06-24 11:31:16 +00:00
/* $Id$ */
1988-06-22 16:57:09 +00:00
2019-03-17 14:42:00 +00:00
#include "em_abs.h"
1988-06-22 16:57:09 +00:00
#include "global.h"
#include "alloc.h"
#include "trap.h"
#include "text.h"
#include "read.h"
#include "proctab.h"
#include "warn.h"
2019-03-17 14:42:00 +00:00
void init_text(void)
{
DB = i2p(NTEXT); /* set Descriptor Base */
NProc = NPROC; /* set Number of Proc. Descriptors */
1988-06-22 16:57:09 +00:00
PI = -1; /* initialize Procedure Identifier */
PC = 0; /* initialize Program Counter */
text = Malloc((size)p2i(DB), "text space");
}
/************************************************************************
* Program Counter division *
************************************************************************
* *
* newPC(p) - check and adjust PC. *
* *
************************************************************************/
2019-03-17 14:42:00 +00:00
void newPC(register ptr p)
1988-06-22 16:57:09 +00:00
{
register struct proc *pr = &proctab[PI];
if (p >= DB) {
wtrap(WPCOVFL, EBADPC);
}
if (p < pr->pr_ep || p >= pr->pr_ff) {
wtrap(WPCPROC, EBADPC);
}
PC = p;
}