File:  [Research Unix] / researchv10no / cmd / adb / seq / module.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:35 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Norman

/*
 * code to hide the stupid module structure
 * trivialized version for new sequent system
 */

#include "defs.h"
#include <a.out.h>

static struct modtbl mod;

/*
 * init stuff
 * store the single module entry from the a.out
 */

modinit(h)
register struct exec *h;
{

	mod = h->a_modtbl;
}

/*
 * link index to addr, data version
 * link entry is just an address
 */

ADDR
mtodata(d, sp)
int d;
int sp;
{
	ADDR a;

	a = (ADDR)(mod.m_linkbase + (d * sizeof(long)));
	return ((ADDR)ltow(lget(a, sp)));

}

/*
 * link index to addr, text version
 * link entry is offset,,module
 */

ADDR
mtotext(d, sp)
int d;
int sp;
{
	register long x;

	x = ltow(lget((ADDR)(mod.m_linkbase + (d * sizeof(long))), sp));
	return (mod.m_programbase + ((x >> 16) & 0xffff));
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.