* VAX question
@ 1992-07-26 5:50 dwagoner
1992-07-26 21:19 ` Boyd Roberts
1992-07-27 13:40 ` VAX question Dileep Bhandarkar
0 siblings, 2 replies; 11+ messages in thread
From: dwagoner @ 1992-07-26 5:50 UTC (permalink / raw)
Can anyone explain the difference between P0 and P1 space on a VAX?
Text and initialized data segments (on BSD 4.3, at least) wind up
in P0 space; unitialized data (i.e. stack) is placed in P1 space.
The two regions are accessed using different base registers; P1 is
a bit tricky to work with in comparison to P0.
Explanations to this ignorant layman are appreciated...
-- Dave Wagoner
System Janitor
Wright State University
Dayton(a), Ohio
===============================================================================
/ wrt higher education:
_ /| /
"Ack Thippfft!" \'o.O` /~~~/ /| | / /~~~ "That which does
=(___)= / / /~| | / /~~~ not kill us
(Just more technobabble) U ~~~~~ ~ ~ ~~ ~~~ makes us stronger..."
(System Janitor)
===============================================================================
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: VAX question
1992-07-26 5:50 VAX question dwagoner
@ 1992-07-26 21:19 ` Boyd Roberts
1992-07-26 22:39 ` VAX question (P0/P1 space) Eliot Moss
1992-07-27 13:40 ` VAX question Dileep Bhandarkar
1 sibling, 1 reply; 11+ messages in thread
From: Boyd Roberts @ 1992-07-26 21:19 UTC (permalink / raw)
In article <1992Jul26.015003.1@matrix.cs.wright.edu>, dwagoner@matrix.cs.wright.edu writes:
> Can anyone explain the difference between P0 and P1 space on a VAX?
P0 space starts at 0 and goes to 0x3FFFFFFF. P1 space starts at 0x7FFFFFFF
and extends down to 0x40000000. P0 is used for text, data and bss. P1
is used for the stack. [I hope i've got the numbers right; anyway it's
all to do with the top two bits of the address:
31 30 ... 0
o o o o ... o
^ ^
| |--------- P0/P1
|
|----------- user/kernel space
kernel P1 is invalid].
> Text and initialized data segments (on BSD 4.3, at least) wind up
> in P0 space; unitialized data (i.e. stack) is placed in P1 space.
Uninitialised data is known as bss and belongs in P0.
> The two regions are accessed using different base registers; P1 is
> a bit tricky to work with in comparison to P0.
Well, I always thought that it was counter intuitive for the human
but was designed to be simple for the machine. I think the idea
was to use the same arithmetic for both regions. From memory, the P1
length register indicated how much is _not_ mapped.
Boyd Roberts boyd@prl.dec.com
``When the going gets wierd, the weird turn pro...''
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: VAX question (P0/P1 space)
1992-07-26 21:19 ` Boyd Roberts
@ 1992-07-26 22:39 ` Eliot Moss
1992-07-27 21:24 ` Paul Dormitzer
0 siblings, 1 reply; 11+ messages in thread
From: Eliot Moss @ 1992-07-26 22:39 UTC (permalink / raw)
A couple of remarks:
1) P0 grows upwards from 0 and is where text, initialized data, and statically
allocated uninitialized data are normally placed. Most libraries also put
dynamically allocated data (malloc/free, etc.) in P0, but, if you're careful
about your stack space, you can use P1 for dynamically allocated data (i.e.,
the stack pointer need not be the low end of P1 space).
2) P1 grows downwards from the middle of the address space, and is usually
used for the stack, which the hardware instruction manage by moving towards
lower addresses on pushes and calls, and higher addresses on pops and returns.
One can allocate beyond the end of the stack (but be aware that at least a few
words beyond the end of the stack may be used for emulation scratch space
(e.g., floating point instructions not supported directly in hardware)).
3) Kernel space is the third quarter of the address space, as previously
noted, and is generally shared among all processes (but pages have different
protections in user, exec, supervisor, and kernel modes, so this is safe,
etc.)
4) The fourth quarter of the address space is generally used for I/O devices
and could be called "I/O space", though I am not sure if that is an "official"
designation.
I have participated in the design and implementation of user mode threads
packages, and we found we can place the multiple stacks in either P0 or P1
space with no particular problems. The only way in which the spaces tend to
impinge on design is this: all pages in P0 space up to the highest one
allocated, and all pages in P1 space down to the lowest one allocated, MUST
have a page table entry (PTE), even if it is set no access. The memory
management hardware on many other machines allows sparse allocation, but the
hardware on the VAX precludes that, and ultimately every page you have
impinges on non-pageable kernel space (the page tables for your page tables),
so this resource tends to be jealously guarded by any operating system,
meaning you have to be careful about you allocate things for some kinds of
languages (e.g., it's not as nice for heap management in a LISP system, etc.,
as one might prefer).
--
J. Eliot B. Moss, Associate Professor
Department of Computer Science
Lederle Graduate Research Center
University of Massachusetts
Amherst, MA 01003
(413) 545-4206, 545-1249 (fax); Moss@cs.umass.edu
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: VAX question
1992-07-26 5:50 VAX question dwagoner
1992-07-26 21:19 ` Boyd Roberts
@ 1992-07-27 13:40 ` Dileep Bhandarkar
1992-07-27 16:44 ` CP/M lives!
1 sibling, 1 reply; 11+ messages in thread
From: Dileep Bhandarkar @ 1992-07-27 13:40 UTC (permalink / raw)
In article <1992Jul26.015003.1@matrix.cs.wright.edu>, dwagoner@matrix.cs.wright.edu writes...
>
>
>Can anyone explain the difference between P0 and P1 space on a VAX?
>Text and initialized data segments (on BSD 4.3, at least) wind up
>in P0 space; unitialized data (i.e. stack) is placed in P1 space.
>The two regions are accessed using different base registers; P1 is
>a bit tricky to work with in comparison to P0.
>
>Explanations to this ignorant layman are appreciated...
>
The P0 space begins at virtual address 0 and grows in the direction of larger
addresses. P1 starts at virtual address 2**31-1 and grows in the direction of
smaller addresses. Since the P1 region grows towards smaller addresses, the
base and length registers describe the part of P1 space that is not accessible.
Dileep
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: VAX question
1992-07-27 13:40 ` VAX question Dileep Bhandarkar
@ 1992-07-27 16:44 ` CP/M lives!
0 siblings, 0 replies; 11+ messages in thread
From: CP/M lives! @ 1992-07-27 16:44 UTC (permalink / raw)
In article <1992Jul27.134542.4845@ryn.mro4.dec.com>, bhandarkar@wrksys.enet.dec.com (Dileep Bhandarkar) writes:
> The P0 space begins at virtual address 0 and grows in the direction of larger
> addresses. P1 starts at virtual address 2**31-1 and grows in the direction of
> smaller addresses. Since the P1 region grows towards smaller addresses, the
> base and length registers describe the part of P1 space that is not accessible.
I think that the reason for this is so that you can put the user stack
way the heck up there in the address space without having to have a page
table large enough to map the entire virtual space for each process. If you
put the stack at the top of P0 space, for instance, the page table for the
process would have to have enough entries to map all of P0 space. Since most
of P0 space is unused, it doesn't make sense to require the page table to
include all of it.
Separating the stack into P1 space and making P1 space grow down lets the
machine keep the stack in a separate page table.
RISC processors sidestep the issue by pushing page table lookup into
softwareland.
Roger Ivie
ivie@cc.usu.edu
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: VAX question (P0/P1 space)
1992-07-26 22:39 ` VAX question (P0/P1 space) Eliot Moss
@ 1992-07-27 21:24 ` Paul Dormitzer
1992-07-28 15:51 ` Paul Dormitzer
1992-08-05 10:28 ` reading E-net address on DecStation 3100 Delamper Lukas
0 siblings, 2 replies; 11+ messages in thread
From: Paul Dormitzer @ 1992-07-27 21:24 UTC (permalink / raw)
In article <MOSS.92Jul26183952@ibis.cs.umass.edu>, moss@cs.umass.edu (Eliot Moss) writes:
|>
|>3) Kernel space is the third quarter of the address space, as previously
|>noted, and is generally shared among all processes (but pages have different
|>protections in user, exec, supervisor, and kernel modes, so this is safe,
|>etc.)
|>
This is S0 space.
|>4) The fourth quarter of the address space is generally used for I/O devices
|>and could be called "I/O space", though I am not sure if that is an "official"
|>designation.
|>
Here you're confusing the high-address physical address space and virtual
address space. The high-address physical addresses are indeed I/O space, but
the high-address virtual addresses are S1 space, which has been "reserved for
future expansion" in most VAX implementations, and was finally defined as an
extension of S0 space to double the system vitrual address space in the newest
VAX implementations.
As a side note, not all operating systems use the virtual address regions the
same way. VAXELN uses an interesting partition of the three available
address spaces. S0 is shared by all jobs in the system, P1 is shared by all
processes in a job (but not between jobs), and P0 is private to each process.
Paul
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: VAX question (P0/P1 space)
1992-07-27 21:24 ` Paul Dormitzer
@ 1992-07-28 15:51 ` Paul Dormitzer
1992-08-05 10:28 ` reading E-net address on DecStation 3100 Delamper Lukas
1 sibling, 0 replies; 11+ messages in thread
From: Paul Dormitzer @ 1992-07-28 15:51 UTC (permalink / raw)
In article <1397@sousa.ltn.dec.com>, dormitze@vssad.enet.dec.com (Paul Dormitzer) writes:
|>same way. VAXELN uses an interesting partition of the three available
|>address spaces. S0 is shared by all jobs in the system, P1 is shared by all
|>processes in a job (but not between jobs), and P0 is private to each process.
|>
|>Paul
|>
Oops, I got P0 and P1 backwards. P0 is shared between processes in a job and P1
is private to each process.
Paul
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: reading E-net address on DecStation 3100
1992-07-27 21:24 ` Paul Dormitzer
1992-07-28 15:51 ` Paul Dormitzer
@ 1992-08-05 10:28 ` Delamper Lukas
1992-08-05 17:03 ` Gary A. Gaudet
1 sibling, 1 reply; 11+ messages in thread
From: Delamper Lukas @ 1992-08-05 10:28 UTC (permalink / raw)
*
* getadr.c -- program to acquire ethernet controller addresses
* (c) Digital Equipment Corporation, 1989
* Author: Jim Lieb, Digital Equipment Corp. suntan::lieb
* This program is distributed free as a demostration
* of network access methods. No warrantee is expressed or
* implied.
*
* Application: Use the getadr function to get the hardware address
* for the system in applications where the license key is
* verified by checking something unique like a system serial
* number (not always present on DEC cpus).
*
* NOTE: There is a difference between the hardware address and the
* physical address of Digital manufactured Ethernet controller.
* The hardware address is a unique number, typically of the
* form: 08-00-2B-xx-xx-xx, as assigned by IEEE authority. The
* xx-xx-xx number is fixed in ROM and is unique for each
* controller. This address is guaranteed fixed and unique.
* The physical address is programmable and is MODIFIED by the
* DECnet routing layer to encode the 16 bit Phase IV DECnet
* address in the least significant 2 octets (byte swapped)
* of the source address of packets. This address, typically
* of the form aa-00-04-00-yy-yy where yy-yy is the DECnet
* address, becomes the address used by the controller for
* packet receive and transmit.
*/
#include <strings.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <stdio.h>
static char getadrSID[] = "@(#)getadr.c 1.3 8/17/89 demo";
extern int errno;
int getadr();
/* main -- Shell to demonstrate the call to the getadr function. This
* also prints the address contents to stdout.
*/
main(argc, argv, envp)
int argc;
char **argv, **envp;
{
struct ifreq ifr;
char *interface;
if(argc < 2)
interface = NULL;
else
interface = argv[1];
if(getadr(interface, &ifr) < 0) {
fprintf(stderr, "getadr failed, exiting\n");
exit(1);
}
printf("ifr_name = '%s'\n", ifr.ifr_name);
printf("family = %04x\n", 0xffff & ifr.ifr_addr.sa_family);
printf(
"Ethernet hardware address = (%02x-%02x-%02x-%02x-%02x-%02x)\n",
0xff & ifr.ifr_addr.sa_family,
0xff & (ifr.ifr_addr.sa_family >> 8),
0xff & ifr.ifr_addr.sa_data[0],
0xff & ifr.ifr_addr.sa_data[1],
0xff & ifr.ifr_addr.sa_data[2],
0xff & ifr.ifr_addr.sa_data[3]);
printf(
"Ethernet physical address = (%02x-%02x-%02x-%02x-%02x-%02x)\n",
0xff & ifr.ifr_addr.sa_data[4],
0xff & ifr.ifr_addr.sa_data[5],
0xff & ifr.ifr_addr.sa_data[6],
0xff & ifr.ifr_addr.sa_data[7],
0xff & ifr.ifr_addr.sa_data[8],
0xff & ifr.ifr_addr.sa_data[9]);
}
/* getadr -- get primary ethernet interface address
* read /etc/rc.local to find primary interface and query that
* device. This function does not require setuid(2) priviledges.
* NOTE: Assumes standard Ultrix rc.local as set up by
* netsetup(8). Will break if rc.local was hacked...
*/
/* offsets for tokens on rc.local line */
#define IFCONFIG 0
#define INTERFACE 1
#define HOSTNAME 2
#define BROADCAST 3
#define NUMTOKENS 4
int getadr(name, ifrp)
char *name;
struct ifreq *ifrp;
{
int stat, i, s;
char line[256];
FILE *rcf;
char *tokens[NUMTOKENS];
char *cp;
if((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
perror("getadr, socket failed");
return( -1);
}
if(name != NULL)
strcpy(ifrp->ifr_name, name);
else {
if((rcf = fopen("/etc/rc.local", "r")) == NULL) {
perror("getadr, open failed on rc.local");
return -1;
}
while((cp = fgets(line, 256, rcf)) != NULL) {
for(i = 0; i < NUMTOKENS; i++) {
tokens[i] = cp;
while(*cp != NULL && *cp != ' ' &&
*cp != '\t') cp++;
if(*cp == NULL)
continue;
*cp++ = NULL;
while(*cp == ' ' || *cp == '\t') cp++;
}
if(strcmp(tokens[IFCONFIG], "/etc/ifconfig") == 0
&& strcmp(tokens[HOSTNAME], "`/bin/hostname`") == 0
&& strcmp(tokens[BROADCAST], "broadcast") == 0)
break;
}
fclose(rcf);
strcpy(ifrp->ifr_name, tokens[INTERFACE]);
}
if((stat = ioctl(s, SIOCRPHYSADDR, ifrp)) == -1) {
perror("getadr, ioctl failed");
return -1;
}
return 0;
}
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: reading E-net address on DecStation 3100
1992-08-05 10:28 ` reading E-net address on DecStation 3100 Delamper Lukas
@ 1992-08-05 17:03 ` Gary A. Gaudet
1992-08-07 12:31 ` E.C. Loyd
0 siblings, 1 reply; 11+ messages in thread
From: Gary A. Gaudet @ 1992-08-05 17:03 UTC (permalink / raw)
Try...
/etc/uerf | more
Look for...
...
----- EVENT INFORMATION -----
EVENT CLASS OPERATIONAL EVENT
OS EVENT TYPE 300. SYSTEM STARTUP
...
ln0: DEC LANCE Ethernet Interface,
_hardware address: 08:00:2b:0e:32:a8
...
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: reading E-net address on DecStation 3100
1992-08-05 17:03 ` Gary A. Gaudet
@ 1992-08-07 12:31 ` E.C. Loyd
1992-08-10 5:23 ` Peter Kaiser
0 siblings, 1 reply; 11+ messages in thread
From: E.C. Loyd @ 1992-08-07 12:31 UTC (permalink / raw)
In article <1992Aug5.170329.12460@decvax.dec.com> gaudet@decvax.dec.com (Gary A. Gaudet) writes:
>Try...
>
> /etc/uerf | more
>
>Look for...
>
> ...
> ----- EVENT INFORMATION -----
>
> EVENT CLASS OPERATIONAL EVENT
> OS EVENT TYPE 300. SYSTEM STARTUP
> ...
> ln0: DEC LANCE Ethernet Interface,
> _hardware address: 08:00:2b:0e:32:a8
> ...
Yes, that works, but it's not what the person was looking for. There is
an IOCTL that you can make to the hardware controller and get the hardware
address, and the current address (DECnet, for one, changes the hardware address
to be AA-00-xx-xx-xx-xx instead of 08-00-2B-xx-xx-xx, so it can do lookups
based on a broadcast address and the NCP database). This is what the person
was looking for, and I sent a snippet of code to do this. If anyone else
is interested, let me know and I'll drop you the code.
-Eric
--
ECLDCO@RITVAX.bitnet ECL6895@RITVAX.bitnet
ECLDCO@ultb.isc.rit.edu ECL6895@ultb.isc.rit.edu
Eric Loyd's the name, Data Center Operations is the game.
Opinions and irrational outbursts are MY pride and joy. Not my employer's.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: reading E-net address on DecStation 3100
1992-08-07 12:31 ` E.C. Loyd
@ 1992-08-10 5:23 ` Peter Kaiser
0 siblings, 0 replies; 11+ messages in thread
From: Peter Kaiser @ 1992-08-10 5:23 UTC (permalink / raw)
--
Code to do this is also on Digital's freeware CD.
___Pete
kaiser@uniriv.vbo.dec.com
+33 92.95.62.97 (DTN 828-6297)
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~1992-08-10 5:23 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1992-07-26 5:50 VAX question dwagoner
1992-07-26 21:19 ` Boyd Roberts
1992-07-26 22:39 ` VAX question (P0/P1 space) Eliot Moss
1992-07-27 21:24 ` Paul Dormitzer
1992-07-28 15:51 ` Paul Dormitzer
1992-08-05 10:28 ` reading E-net address on DecStation 3100 Delamper Lukas
1992-08-05 17:03 ` Gary A. Gaudet
1992-08-07 12:31 ` E.C. Loyd
1992-08-10 5:23 ` Peter Kaiser
1992-07-27 13:40 ` VAX question Dileep Bhandarkar
1992-07-27 16:44 ` CP/M lives!
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox