a. New getsw/setsr system calls for user land front panel access b. Configured for PDP 11/70 instead of default 11/44 c. TIMEZONE changed from 480 to zero (PST to GMT) d. LINEHZ changed from 60 to 50 (need 'set CLK 50HZ' in /opt/pidp11/systems/211bsd/boot.ini) e. fixed a small bug in the panel display in mch_xxx.s and halved the update rate so I know which kernel I am running...
Some of those choices might not suit everyone, but 50HZ looks normal to me (I last used a PDP11/70 in Australia) and it just reduces the clock interrupts (and hence idle display update rate) by 20% and for some reason fixed a problem I was having with inaccurate timekeeping. The PST timezone meant having to add an inconvenient offset to the date command when setting that date. I think selecting the 11/70 processor sacrifices portability with earlier architectures for the ability to use the more efficient instructions for crossing address space boundaries.
The idea was that when debugging or wanting some feedback from a program, I can write directly to the display register with a putdr(v) in my program and switch the console to show the display register. Likewise, when needing to make a decision (verbose logging, for example) I can read the switches and check a switch setting to make the decision. So basically an excuse to play with the front panel :)
Rebuilding the kernel was enlightening. The kernel overlay technique is clever, but a pain when you overflow and have to rearrange things. The kernel start to panic after a fairly innocuous change, and it continued to happen even after reversing the change. It turned out that the build number shown in the kernel identification string:
BSD pdp11 2.11 2.11 BSD UNIX #2: Fri Jun 21 04:20:07 BST 2019 root@pdp11:/usr/src/sys/DIGBYT pdp11
had increased to 10, and the extra byte required to hold the extra digit had pushed me over the size limit...
The addition to machine/kern_pdp.c was:
digbyt[21] % diff kern_pdp.c.orig kern_pdp.c
27a28,47
> * Provide user access to PDP11 front panel display and switch registers
> */
> #define SW ((short *)0177570)
>
> pdpgetsw()
> {
> u.u_r.r_val1 = *SW;
> }
>
> pdpsetdr()
> {
> register struct a {
> int swval;
> } *uap = (struct a *)u.u_ap;
>
> *SW = uap->swval;
> }
>
> /*
I havn't bothered adding the new calls to the C library yet. They can be accessed with the following trivial piece of assembler:
.globl _getsw,_setdr_getsw:sys 151.rts pc_setdr:sys 147.rts pc
Where 147 and 151 were the last two unused system call entries.
I put the results on my web site here if anyone wants to try it:
http://skaro.afraid.org:4280/software/bsd211
If anyone wants to try building the kernel themselves, I can put the modified kernel source files and some instructions up as well.
If anyone else has tinkered with the kernel, I would be interested to hear what you did.
Regards,
DigbyT
--
You received this message because you are subscribed to the Google Groups "[PiDP-11]" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pidp-11+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pidp-11/CALPcpNqcWsm2v3jPmKSH7mx2QdfOFEg11551sVh9Zq95cxJFSA%40mail.gmail.com.
> I was able to read the switch register without too much trouble using
> /dev/mem, but it has the disadvantage of requiring the user or program
> to have elevated privilege.
>
> I was also able to write to the display register using /dev/mem, but
> only in single user mode because /dev/mem is readonly at other times.
That is, unless you change the security level to -1 before going multiuser.
> Anyway, as an interesting exercise in rebuilding the kernel, I added the
> two system calls that I wanted, and also while I was at it, did some
> other customizing as follows:
>
> a. New getsw/setsr system calls for user land front panel access
Fair enough. Another option would have been to create a device for it.
The problem with this is, of course, that you can have several programs
using the system call, since they will overwrite each others values.
> b. Configured for PDP 11/70 instead of default 11/44
What default? Are you talking about some system someone have prepared
for you before.
> c. TIMEZONE changed from 480 to zero (PST to GMT)
Everyone have their own preference, of course. But this is only relevant
at startup before the system is properly up and running, since after
that the time zone handling is done in a different way.
> d. LINEHZ changed from 60 to 50 (need 'set CLK 50HZ' in /opt/pidp11/systems/211bsd/boot.ini)
I usually prefer to run at 50 Hz, but that is also just an arbitrary
preference. As long as it matches between simh config and the kernel
config everything will be fine.
> e. fixed a small bug in the panel display in mch_xxx.s and halved the update rate so I know which kernel I am running...
>
> Some of those choices might not suit everyone, but 50HZ looks normal to me (I last used a PDP11/70 in Australia) and it just reduces the clock interrupts (and hence idle display update rate) by 20% and for some reason fixed a problem I was having with inaccurate timekeeping. The PST timezone meant having to add an inconvenient offset to the date command when setting that date.
Not sure what you mean by the update rate. I would not expect that to be
related to the simulated clock rate of the PDP-11.
INT(LOCAL, rdisply, 0377) / idle patternINT(LOCAL, wcount, 2) / rotate rdisply every wcount callsENTRY(idle)mov PS,-(sp) / save current SPL, indicate that nomov $1,_noproc / process is runningdec wcount / if (--wcount <= 0) {bgt 1fmov $2,wcount / wcount = 2clc / rdisply <<= 1rol rdisplybpl 1f / if (``one shifted out'')bis $1,rdisply / rdisply |= 11: / }mov rdisply,r0 / wait displays contents of r0SPLLOW / set SPL low so we can be interruptedwait / wait for something to happenmov (sp)+,PS / restore previous SPLrts pc / and return
> I think selecting the 11/70 processor sacrifices portability with earlier architectures for the ability to use the more efficient instructions for crossing address space boundaries.
Uh, that was a bit of a confusing statement. We are talking about
2.11BSD here. Any model that can run 2.11BSD is compatible enough that
it don't really make a difference. So pick whatever model. It will work
on the other models as well. There are no portability or compatibility
issues to talk about.
In comparing the 11/44 and 11/70, the 11/44 is actually a later
architecture, and it has some features and functionality the 11/70 lack,
while the 11/70 have some more capabilities in the MMU, which no
software ever used (which is why later models dropped them).
You can essentially divide PDP-11s into four groups. 16-bit addressing,
18-bit addressing and 22-bit addressing with either Unibus or Qbus.
Within each of these groups the models are very much compatible.
With the 22-bit addressing machines, there are a difference between
Unibus and Qbus, since all DMA on Unibus machines are still only using
18-bit addressing, so an additional layer of address translation is
needed, which is called the Unibus map. But most systems running on
22-bit machine dynamically decide if they have a Unibus map, or Qbus.
And 2.11BSD only runs on 22-bit machines.
# PDP-11 machine type; allowable values are GENERIC, 44, 70, 73. GENERIC# should only be used to build a distribution kernel. The only use of this# option is to select the proper in-line PS instructions (references to the# PSW use 'spl', 'mfps/mtps' or 'movb' instructions depending on the cpu type).#PDP11 GENERIC # distribution kernelPDP11 44 # PDP-11/44#PDP11 70 # PDP-11/70,45,50,55#PDP11 73 # PDP-11/73,53,83,93,84,94
> The idea was that when debugging or wanting some feedback from a program, I can write directly to the display register with a putdr(v) in my program and switch the console to show the display register. Likewise, when needing to make a decision (verbose logging, for example) I can read the switches and check a switch setting to make the decision. So basically an excuse to play with the front panel :)
>
> Rebuilding the kernel was enlightening. The kernel overlay technique is clever, but a pain when you overflow and have to rearrange things. The kernel start to panic after a fairly innocuous change, and it continued to happen even after reversing the change. It turned out that the build number shown in the kernel identification string:
>
> BSD pdp11 2.11 2.11 BSD UNIX*#2*: Fri Jun 21 04:20:07 BST 2019 root@pdp11:/usr/src/sys/DIGBYT pdp11
>
> had increased to 10, and the extra byte required to hold the extra digit had pushed me over the size limit...
Oh joy... That was ugly. However, I would have expected that you should
have gotten an error at the link stage in this case.
> The addition to machine/kern_pdp.c was:
>
> digbyt[21] % diff kern_pdp.c.orig kern_pdp.c
> 27a28,47
>> * Provide user access to PDP11 front panel display and switch registers
>> */
>> #define SW ((short *)0177570)
>>
>> pdpgetsw()
>> {
>> u.u_r.r_val1 = *SW;
>> }
>>
>> pdpsetdr()
>> {
>> register struct a {
>> int swval;
>> } *uap = (struct a *)u.u_ap;
>>
>> *SW = uap->swval;
>> }
>>
>> /*
That could be cleaned up a little. Why the struct a thingy for example?
But otherwise, it's a simple enough extension...
> I havn't bothered adding the new calls to the C library yet. They can be accessed with the following trivial piece of assembler:
It would be very easy to add the system calls as well. All you need is
adding it to the Makefile.
> Where 147 and 151 were the last two unused system call entries.
Any particular reason why you picked those two ones then? There are
other, earlier numbers also unused, not to mention everything above 155.
> If anyone else has tinkered with the kernel, I would be interested to hear what you did.
Phew. Bug fixes, device driver changes, boot changes... I can't
remember. Various things.
>
> That is, unless you change the security level to -1 before going
> multiuser.
>
>
> Ah, is that how you do that? Would have been handy to know to simplify
> experimentation,
> but as a long term solution I think it is better not to have to run
> insecure.
It was introduced/fixed only in patch #450. So if you're not totally up
to date, it's not possible to do that way. Earlier, you had to recompile
the kernel (or if it was init) in order to be able to keep insecure when
going multiuser.
Path #450 is the last/latest patch for 2.11BSD.
> > b. Configured for PDP 11/70 instead of default 11/44
>
> What default? Are you talking about some system someone have prepared
> for you before.
>
>
> Sorry - by 'default' I meant the sys/conf/ZEKE configuration from which
> the 'out of the box' kernel was built.
Oho. That is not a configuration I have on my system, so it's something
that have been provided/made by someone down the line
> > c. TIMEZONE changed from 480 to zero (PST to GMT)
>
> Everyone have their own preference, of course. But this is only
> relevant
> at startup before the system is properly up and running, since after
> that the time zone handling is done in a different way.
>
>
> That's what I would have though - but it seemed to effect the operation
> of /bin/date, such that on the original system I had to subtract 8 hours
> from the time I wanted in order to set the system date (or alternatively
> leave the system using a PST timezone file).
>
> I don't recall that problem with BSD 4.4, so just assumed it was a 2.11
> thing..
>
> If anyone knows if this behavior is normal for 2.11 I would be
> interested to know.
Local time is usually handled by /etc/localtime, which normally would be
a symbolic link to /usr/share/zoneinfo/<whatever>. In my case, I point
it at /usr/share/zoneinfo/CET .
This is not unique to 2.11BSD. Pretty much all Unix systems does it this
way. I think even Linux does it the same. Anyway, any kernel defined
offsets would commonly only be used to manage an offset to some time
stored in an RTC, but it might also be applied if no /etc/localtime exists.
> > d. LINEHZ changed from 60 to 50 (need 'set CLK 50HZ' in
> /opt/pidp11/systems/211bsd/boot.ini)
>
> I usually prefer to run at 50 Hz, but that is also just an arbitrary
> preference. As long as it matches between simh config and the kernel
> config everything will be fine.
>
>
> It seemed to fix a clock problem I had, but I havn't gone back to 60HZ
> to see if I can reproduce the original issues, so it might
> just have been coincidence (when I first set up the system, I noticed
> the clock stopped ticking after a couple of days, and after
> re-booting, ran very slowly. The change to 50HZ was an experiment to see
> if it made a difference, and for some reason I had
> no further problems after that).
Sounds weird if you observed some problem which really was related to
this. The only things happening based on this would be how fast the
clock on the emulated PDP-11 OS is running. If simh is set to 60 Hz, and
the PDP-11 OS set to 50 Hz, time will run too fast. If simh is set to 50
Hz and the PDP-11 OS to 60 Hz, time will run slow. If both agree, time
will run right, and all the difference will be how long a clock tick is.
Nothing else knows or cares about this.
> The rotating pattern on the 'Data Paths' display is implemented by
> updating the pattern variable and loading it into R0 immediately before
> the WAIT instruction on an idle system, repeats on each clock interrupt
> until a process becomes schedulable. The WAIT instruction apparently
> leaves the value in the R0 register displayed. This is the code:
[...]
Yes, the behavior of the WAIT instruction is documented, but I can't
properly remember where right now.
Anyway, the rotation of the pattern isn't done at every clock tick, or
it would all just be a dim pattern. But the speed of the rotation might
be different depending on the clock, if the OS just use a fixed value
independent of the clock frequency. Can't remember if that is the case
in 2.11BSD, but your code snipped would suggest that it indeed is a
hardcoded value causing the rotation speed to differ depending on the
clock frequency.
By the way, the WAIT is just putting R0 on the data bus. Which is why
you need to have the display selector set to that, and not the display
register.
[C library]
> It would be very easy to add the system calls as well. All you need is
> adding it to the Makefile.
>
>
> You mean the makefile in /usr/src/lib/libc/pdp/sys? I think you are
> right, but the Makefile is very 'clever' and generates the source
> for the various system calls on the fly (just from the syscall name and
> a bunch of macros in SYS.h) and pipes it through the preprocessor
> and assembler. I didn't want to mess with it till I had time to
> understand it fully. And making a new libc would make it harder for anyone
> else to reproduce my system - unless I wanted to make a complete
> alternate distribution.
Right. The makefile is rather clever, and you really only have to add
the "file" to the makefile to make it all add up. Of course, you could
also add a "prototype" of the function to some header file, but this is
all pre ANSI-C anyhow, so not much of function prototypes anyway.
> > If anyone else has tinkered with the kernel, I would be
> interested to hear what you did.
>
> Phew. Bug fixes, device driver changes, boot changes... I can't
> remember. Various things.
>
>
> Sounds as though you have a lot more experience than I do. I had
> tinkered with BSD/OS many years ago, but this was my first
> hack at BSD211 or Unix in general on a PDP11/70.
Possibly. But I think it's a good exercise to give into the 2.11BSD
kernel, so all kudos to you for doing just that.
Nice to see.
> Is there an easy way to check what my patch level is? And is there an
> official site for
> patches and the latest distributions?
You should have a /VERSION file, which tells.
There are several official sites.
ftp://ftp.update.uu.se/pub/pdp11/2.11BSD
http://www.tuhs.org/Archive/PDP-11/Distributions/ucb/2.11BSD/Patches
ftp://ftp.2bsd.com/pub/2.11BSD
And I was misremembering. The fix for the securelevel was patch 451,
which is the latest.
>
> That code fragment included the counter which caused the update to
> occur on every second WAIT instruction. That would be a complete rotation
> every 16/25 seconds, which seems about right
Yup. Or 16/30 if you are running on a 60 Hz clock.
> [C library]
> > It would be very easy to add the system calls as well. All
> you need is
> > adding it to the Makefile.
> >
> >
> > You mean the makefile in /usr/src/lib/libc/pdp/sys? I think you are
> > right, but the Makefile is very 'clever' and generates the source
> > for the various system calls on the fly (just from the syscall
> name and
> > a bunch of macros in SYS.h) and pipes it through the preprocessor
> > and assembler. I didn't want to mess with it till I had time to
> > understand it fully. And making a new libc would make it harder
> for anyone
> > else to reproduce my system - unless I wanted to make a complete
> > alternate distribution.
>
> Right. The makefile is rather clever, and you really only have to add
> the "file" to the makefile to make it all add up. Of course, you could
> also add a "prototype" of the function to some header file, but this is
> all pre ANSI-C anyhow, so not much of function prototypes anyway.
>
>
> The lack of ANSI function parameters define syntax seems like the
> most common issue when porting modern source back to 211.
That is usually one of the big ones, yes. The other being the limited
space available. Especially for data.
>
> Thanks. The kernel build seems much more elegant than the linux approach.
Agreed. Linux is most of the time a rather ugly hack.
> One other question springs to mind while I am talking to someone with a bit
> more knowledge of this system - do you know what the '/netnix' file does?
>
> I see it is built along with the '/unix' file when making the kernel,
> but I don't recall
> anything similar on other BSD systems I have used.
/netnix contains all the parts of TCP/IP. Because of the way the system
is done, all the networking is in a separate image that gets loaded by
the kernel along the way, and is not mapped into the kernel.
If you build a system without networking, this part does not exist.
I probably should go back and check details, but I seem to remember that
all the networking is running in supervisor mode.
Hi. This is getting rather technical, so people, let me know if me and
Digby should take this off the list...
On 2019-06-22 14:22, Digby R.S. Tarvin wrote:
> [patching]
> The system I am running seems ok, but I don't really know its history,
> so I will
> be holding my breath while applying patches.
I think that even if you grab the "latest" source tree, some patching
will still be required.
I guess I should maybe create new sets at some point, if Steven don't do it.
I rather just also realized that some people might be helped if I
created a virtual tape already in order for doing an installation from
scratch. All the bits and pieces are there on the ftp site, but unless
you have some system with a tape drive, it might be hard to create a
tape, or even a virtual tape, for doing the installation.
I'll see if I can't create an installation distribution tape at least in
the next few days...
The rate of fixes on 2.11BSD have gone down over the years, but it's
still actively being supported, and patches are welcome
> My hacked kernel bumped the delay from 2 to 4 - just to provide a visual
> indication
> that I am running my modified system. I wanted to make a more
> interesting change,
> but anything that increased the size pushed me over a segment limit and
> I havn't
> built up the courage to go too deeply into trying to understand the
> overlay system.
The overlay system in 2.11BSD is both very simple, and somewhat limited.
For the kernel, each overlay cannot exceed 8Kbyte (4Kword), but apart
from that, code can pretty much be moved around anywhere without
restrictions.
I usually move code around quite a lot from the default.
That is, move things between different overlays as you see fit. Don't
move things out from base into overlays.
And if you do a "size" on the kernel, you'll see the sizes of the
different overlays, and see where you have plenty of space left, and
where there is a squeeze. Then just edit the Makefile and move things
between the overlays. I usually move the toy out of OV6 to OV9 for example.
digbyt[348] % size /unixtext data bss dec hex57024 6270 33148 96442 178ba total text: 116352overlays: 7808,7488,7872,7296,4544,6336,4992,5696,7296
[memory management]
So what you are looking for is already there, as far as addressing more
than 64K goes.
I'm not aware of any memory analysis or statistics software, but I
haven't really looked much. You can, of course, use profiling, and if
you know where different pieces are, you can tell how much moving around
there is. But since overlays are only done using the MMU, there is
essentially no bottleneck in there. You do have swapping, but that swaps
whole processes in and out. And you can, of course, see how much
swapping is going on.
vmstat is your friend here.
digbyt[459] % free -smem: 28861/61440 (46%) free, 57/122 (46%) coremap entries free
swap: 14731/16719 (88%) free, 91/109 (83%) swapmap entries free
entry Size Start
0: 12 00000001 ($000001)
1: 1 00000155 ($00006d)
2: 11 00000227 ($000097)
3: 2 00000352 ($0000ea)
4: 12 00000430 ($000118)
5: 3 00000530 ($000158)
6: 25 00000614 ($00018c)
7: 22 00000734 ($0001dc)
8: 37 00001031 ($000219)
9: 22 00001211 ($000289)
10: 23 00001640 ($0003a0)
11: 29 00002260 ($0004b0)
12: 2 00002434 ($00051c)
13: 38 00003130 ($000658)
14: 7 00003524 ($000754)
15: 56 00003675 ($0007bd)
16: 80 00004131 ($000859)
17: 14349 00004503 ($000943)
> [/netnix]
> That rather rather neat, and I suppose explains why there are some
> things that don't work when you
> boot off something other than the default /unix. Presumably specifying
> ra(0,0,0)newunix does not
> result in the kernel being able to locate /newnetnix...
I can't remember, but it might be that it looks for a name based on the
kernel, but I might just not remember much of this right. I would have
to go and look at the sources...
I guess it is neat in one way, but it is sortof just a result of the
limitations of the system as well, which would be different if the
limitations and restrictions were different.
Please don't take this offline. I'll take all the free education I can get.
# cd /usr/src/sys/conf# cp ZEKE MYCONFIG# vi MYCONFIG
digbyt[493] % diff ZEKE DIGBYT30,31c30,31< #LINEHZ 50 # clock frequency European< LINEHZ 60 # clock frequency USA---> LINEHZ 50 # clock frequency European> #LINEHZ 60 # clock frequency USA38,39c38,39
< PDP11 44 # PDP-11/44< #PDP11 70 # PDP-11/70,45,50,55
---> #PDP11 44 # PDP-11/44> PDP11 70 # PDP-11/70,45,50,5546c46< IDENT ZEKE # machine name---> IDENT DIGBYT # machine name67c67,68< TIMEZONE 480 # PST---> #TIMEZONE 480 # PST> TIMEZONE 0 # GMT
# ./config MYCONFIG# cd ../MYCONFIG# make
digbyt[486] % diff Makefile Makefile.orig
72c72< sys_pipe.o clock.o init_main.o---> sys_pipe.o74c74< OV6= dn.o kern_pdp.o machdep2.o subr_prf.o syscalls.o \---> OV6= clock.o dn.o init_main.o kern_pdp.o machdep2.o subr_prf.o syscalls.o \
--
You received this message because you are subscribed to the Google Groups "[PiDP-11]" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pidp-11+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pidp-11/799cf8fd-9e19-4c0b-90a8-f4e6da31810f%40googlegroups.com.
BSD elec70 2.11 2.11 BSD UNIX #2: Fri Jun 21 04:20:07 BST 2019 root@pdp11:/usr/src/sys/DIGBYT pdp11
I was thinking that it might help to try and locate the address that the trap occurs at.
One thing on my mind also is that apparently you use a custom size RA driver. Can you replicate the issue with a standard disk and driver?
30,31c30,31< #LINEHZ 50 # clock frequency European< LINEHZ 60 # clock frequency USA---> LINEHZ 50 # clock frequency European> #LINEHZ 60 # clock frequency USA38,39c38,39
< PDP11 44 # PDP-11/44< #PDP11 70 # PDP-11/70,45,50,55
---> #PDP11 44 # PDP-11/44> PDP11 70 # PDP-11/70,45,50,5546c46< IDENT ZEKE # machine name---> IDENT DIGBYT # machine name67c67,68< TIMEZONE 480 # PST---> #TIMEZONE 480 # PST> TIMEZONE 0 # GMT
install -c -o root -g kmem -m 744 unix /unixinstall -c -o root -g kmem -m 744 netnix /netnix
I’m pretty sure it has nothing to do with the length of the version string, mine is way longer for instance - I include the full domain name.
--
You received this message because you are subscribed to the Google Groups "[PiDP-11]" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pidp-11+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pidp-11/CACo5X5j%2Bf2qvawkOw9gdmf2WPc1Fh5DuzDo6aom%3Dojwh-1DGqg%40mail.gmail.com.
I decided to create a duplicate ZEKE kernel. First, to see if it would build at all and, second, to see if it matched the existing kernel in, at least, size. It would be a plus if it actually ran.
Greetings Digby,If you compare the newly created makefile with the original you will probably see a difference in the overlay allocations. I did when I tried to recompile, I had to copy the makefile from the previous build into the new build directory to get a successful linkage. Since then I have found this tool to automate the process of generating the overlays in the makefile - I haven't needed to use it yet though.I discovered the problem by searching for the meaning of the 413 error.The essence of the problem is that the makefile template does not suit the newly created build, it needs amending after the configuration is created.Kind regards, David.
I decided to create a duplicate ZEKE kernel. First, to see if it would build at all and, second, to see if it matched the existing kernel in, at least, size. It would be a plus if it actually ran.No joy! The linker threw an error saying the payload was too large for a type 413 file, whatever that means.
Here's another thing: Above, it was mentioned that various .o files needed to move. Well, in my ZEKE Makefile, sys_pipe.o is in OV5, not BASE, and clock.c and init_main.o are already in OV6I wonder if there are different distributions of ZEKE
To unsubscribe from this group and stop receiving emails from it, send an email to pidp-11+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pidp-11/751f2932-4639-d69e-26e9-10201376c1a7%40softjar.se.