Advent calendar for nerds

355 views
Skip to first unread message

Bernhard Nebel

unread,
Nov 27, 2019, 2:40:52 PM11/27/19
to [PiDP-11]
Here you can see our Advent calender: https://youtu.be/mVXr7JJOvTs

It shows the BSD2.11 idle pattern and the number of days til Christmas (binary coded) in the data row.
The program is attached. Note that here we celebrate it already on Dec 24.

Cheers,
Bernhard


xmas.c

Jeff Thieleke

unread,
Nov 27, 2019, 7:49:39 PM11/27/19
to [PiDP-11]
I like it!

I'm guessing there is no userland access to the Display/Light Register?  Maybe it doesn't even work in simh?  If it did, that would be a great way to display things like this.




SwitchRegister.png

Jeff Thieleke

unread,
Nov 27, 2019, 7:53:15 PM11/27/19
to [PiDP-11]
And it does work.  27 days until December 24th.


IMG_20191127_185137_copy.jpg

Digby R.S. Tarvin

unread,
Nov 27, 2019, 8:43:23 PM11/27/19
to Jeff Thieleke, [PiDP-11]
Please forgive the repetition, but I'm not sure how searchable the history of this list is,  so as the question was asked, and for anyone interested, here is a rehash of an example of userland access to the lights and switches registers I sent back in June. If you are able to rebuild your kernel, the change is trivial, and I find it quite useful.

With the latest patches it is possible to do it with /dev/mem, but you have to run in 'insecure' mode, and giving write (or even read) access to that file involves a lot more trust than I would like to give to make generally available.  The getsw() system call did exist in early versions of Bell Unix, but apparently not BSD, even at a relatively hostile university environment, so I don't think it a particular security issue.

I wasn't successful getting it included in the latest set of patches, but when I get some time I might re-do it as a front panel 'driver' which wont be quite as trivial, but would give better access control and avoids the issue of their being no standard way to allocate unused system call numbers. I discussed it with b...@softjar.se and I think that would be his preferred option.

But for now this is a simple hack and is a nice little exercise for anyone looking for an excuse to experiment with a kernel build.

DigbyT

UserLand Front Panel Acces
======================
int getsw() - return current switch settings
void setdr(int) - set display register

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.

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
<trimmed>
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 :)
...
The addition to /usr/src/sys/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;
> }
>
> /*
To add the system calls, edit /usr/src/sys/init_sysent.c:
digbyt[26] % diff init_sysent.c.orig init_sysent.c
17a18,22
> /* 1.0 local additions - DRST */
>
> pdpgetsw();
> pdpsetdr();
>
256a262
> #if 0
257a264,266
> #else
>       1, pdpsetdr,                    /* 147 = set display register */
> #endif
269a279
> #if 0
270a281,283
> #else
>       0, pdpgetsw,                    /* 151 = get switch register */
> #endif
274a288,290
> #if 0
>       1, pdpsetdr,                    /* 156 = set display register */
> #endif
I havn't bothered adding the new calls to the C library yet. They can be accessed with the following trivial piece of assembler (fplib.s):
        .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

--
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/a35f134c-5fd5-4466-ab2d-f3794284d8d9%40googlegroups.com.

Jeff Thieleke

unread,
Nov 27, 2019, 11:05:05 PM11/27/19
to [PiDP-11]
Wow...I must have either missed this or it was over my head at the time (or both)

I haven't had a chance to rebuild a kernel with this yet, but I feel like there should be another group that is more development focused where these contributions would get the appropriate attention.
To unsubscribe from this group and stop receiving emails from it, send an email to pid...@googlegroups.com.

Rene Richarz

unread,
Nov 28, 2019, 2:27:38 AM11/28/19
to pid...@googlegroups.com
Very nice!

I am using my PiDP 11 quite a bit, doing some programming in 2.11 BSD, and in Linux. But the lights and switches are mostly decoration. From my work on the Raspberry Pi and my own 6502 replica I know that it is a lot of fun to program some patterns for the lights. I think that it would therefore be a very nice addition for our standard BSD image to add a C include file or library with functions to read the switches and and write to some light registers. Hopefully this can be done in standard user mode without elevated privileges.

I am quite sure that if somebody would implement and document this a few more people would use their PiDP-11 to do some easy programming.

Another simple example would be a binary to octal and decimal converter and vice versa. I have put one in my pidp11-2.11bsd github repo, but it would be nice to display the output on the front panel lights and get input from the switches.

There are also some simple games, such as for example a reaction time test, which could be made using such a function.

Johnny Billquist

unread,
Nov 28, 2019, 4:37:05 AM11/28/19
to Digby R.S. Tarvin, [PiDP-11]
Yes, I would much more like to have it as a device. And no, you
shouldn't write a new device for it. Add it as a minor number to the
console.

That way it will be possible to actually have some control over who have
access, and you can also make the access exclusive. A system call
essentially means anyone can do it, and multiple programs can do it in
parallel, making it a bit too chaotic, I think.

Johnny

On 2019-11-28 02:43, Digby R.S. Tarvin wrote:
> Please forgive the repetition, but I'm not sure how searchable the
> history of this list is,  so as the question was asked, and for anyone
> interested, here is a rehash of an example of userland access to the
> lights and switches registers I sent back in June. If you are able to
> rebuild your kernel, the change is trivial, and I find it quite useful.
>
> With the latest patches it is possible to do it with /dev/mem, but you
> have to run in 'insecure' mode, and giving write (or even read) access
> to that file involves a lot more trust than I would like to give to make
> generally available.  The getsw() system call did exist in early
> versions of Bell Unix, but apparently not BSD, even at a relatively
> hostile university environment, so I don't think it a particular
> security issue.
>
> I wasn't successful getting it included in the latest set of patches,
> but when I get some time I might re-do it as a front panel 'driver'
> which wont be quite as trivial, but would give better access control and
> avoids the issue of their being no standard way to allocate unused
> system call numbers. I discussed it with b...@softjar.se
> <mailto:b...@softjar.se> and I think that would be his preferred option.
> <http://goog_684768610>
> http://www.bitsavers.org/pdf/dec/pdp11/1170/EK-KB11C-TM-001_1170procMan.pdf
>
>
>
> SwitchRegister.png
>
>
>
> On Wednesday, November 27, 2019 at 1:40:52 PM UTC-6, Bernhard Nebel
> wrote:
>
> Here you can see our Advent calender:https://youtu.be/mVXr7JJOvTs
>
> It shows the BSD2.11 idle pattern and the number of days til
> Christmas (binary coded) in the data row.
> The program is attached. Note that here we celebrate it already
> on Dec 24.
>
> Cheers,
> Bernhard
>
>
> --
> 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
> <mailto:pidp-11+u...@googlegroups.com>.
> <https://groups.google.com/d/msgid/pidp-11/a35f134c-5fd5-4466-ab2d-f3794284d8d9%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
> --
> 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
> <mailto:pidp-11+u...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pidp-11/CACo5X5i9k-KddobiPHD9Y7DEoh2G3QjLr99jpwFcriC4O%3Dmzyg%40mail.gmail.com
> <https://groups.google.com/d/msgid/pidp-11/CACo5X5i9k-KddobiPHD9Y7DEoh2G3QjLr99jpwFcriC4O%3Dmzyg%40mail.gmail.com?utm_medium=email&utm_source=footer>.

--
Johnny Billquist || "I'm on a bus
|| on a psychedelic trip
email: b...@softjar.se || Reading murder books
pdp is alive! || tryin' to stay hip" - B. Idol

Frank Wortner

unread,
Nov 29, 2019, 1:34:56 PM11/29/19
to [PiDP-11]
Adding switch register and data register as device special files in /dev would also allow languages that can't directly or easily do system calls to have access as well.  Pascal and Fortran could read the switch register and manipulate the lights through "normal" file I/O.  Even sh could come to the party!  :-)

echo "Set the switches to the desired value"
read value < /dev/switchregister
echo "Your desired value is" $value

Johnny Billquist

unread,
Nov 29, 2019, 4:47:56 PM11/29/19
to [PiDP-11]
Indeed.

So many nice things could happen. The only question is in which format
should a read/write be. Text? Binary? In the end it's a 16-bit word...

Johnny
> --
> 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
> <mailto:pidp-11+u...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pidp-11/f8e266b7-4310-4655-b76f-fdc20210ef06%40googlegroups.com
> <https://groups.google.com/d/msgid/pidp-11/f8e266b7-4310-4655-b76f-fdc20210ef06%40googlegroups.com?utm_medium=email&utm_source=footer>.

Frank Wortner

unread,
Nov 29, 2019, 5:11:56 PM11/29/19
to [PiDP-11]
IMHO, text would probably be compatible with most programming languages at the cost of making the driver code larger and more complex.  I just like the idea of being able play with the registers from any language, including those that can't (easily) do binary I/O.

Johnny Billquist

unread,
Nov 29, 2019, 5:16:03 PM11/29/19
to [PiDP-11]
Yes, there is definitely a point in a text interface.

Next question would be - what base? 2? 8? 10? 16? Something else? :-)
Of course, I guess we should terminate on newline...

Johnny
> --
> 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
> <mailto:pidp-11+u...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pidp-11/f0e28c51-4edb-4d1a-9adc-518c3785ee13%40googlegroups.com
> <https://groups.google.com/d/msgid/pidp-11/f0e28c51-4edb-4d1a-9adc-518c3785ee13%40googlegroups.com?utm_medium=email&utm_source=footer>.

Frank Wortner

unread,
Dec 2, 2019, 5:15:29 PM12/2/19
to [PiDP-11]
If you want to be true to the PDP-11, then octal is the way to go! ;-)

However, since my speculative example was a shell script, base 10 seems more natural.  I may be wrong, but I can't think of an *easy* way to print a number in anything other than base 10 from a Bourne shell script.  Maybe ...

echo "obase=8;"$value | bc > /dev/switchregister

... but that is kind of ugly.  Reading would probably be even nastier.

I also forget if FORTRAN or Pascal can print octal.

Johnny Billquist

unread,
Dec 2, 2019, 5:53:29 PM12/2/19
to Frank Wortner, [PiDP-11]
From FORTRAN it's easy. Or at least from DEC FORTRAN. I don't know for
sure about the Fortran in 2.11BSD. I have never looked...

Pascal might be worse...

So the question remains... :-)

Johnny
> --
> 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
> <mailto:pidp-11+u...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pidp-11/b8ad3200-0f2c-4cef-80fc-6269bef20908%40googlegroups.com
> <https://groups.google.com/d/msgid/pidp-11/b8ad3200-0f2c-4cef-80fc-6269bef20908%40googlegroups.com?utm_medium=email&utm_source=footer>.

Jason Vanick

unread,
Dec 2, 2019, 6:30:51 PM12/2/19
to [PiDP-11]
if you're using csh, you can use printf just like in C:

10% jvanick-> printf "%x\n" 254
fe
11% jvanick-> printf "%x\n" 15
f
12% jvanick-> printf "%x\n" 16
10



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/e34cf89b-2a31-6beb-ae6d-c79dda0472a1%40softjar.se.


--
Princredible, Inc.
- Quality Screen Printing at Incredible Prices
847-751-1321

Digby R.S. Tarvin

unread,
Dec 2, 2019, 7:22:54 PM12/2/19
to Jason Vanick, [PiDP-11]
Oscar's pidp11.sh script which reads the switches and uses them to select the booted OS  has an example of one way to deal with decima/octal conversions in a shell script. 

As an alternative to having to do base conversion in a shell script (trading a more sophisticated driver for simpler clients) it could do something like this (using bash syntax)
 exec 3<>/dev/panel  # open the front panel device for read/write as file descriptor 3
 read switches <&3  #assign switch values to $switches using default radix
 echo "77" >&3 # assign display register to 77 interpreted using current radix
 echo "r20" >&3 # set radix to 16 (assuming current radix was 8)
 read switches <&3 # get switch settings in hex
 echo "f00" >&3 # write a hex value to the display register
 echo "r0" >&3 # set current radix to 0 meaning binary

Default radix can be selected using minor device. If you set the interface to binary mode (radix 0) then you can no longer issue commands to change the radix. So to recover just close and re-open. It would probably only be necessary to support 0,2,8,10 and 16. Perhaps "F20" could be used to select hex radix with returns upper case A-F. If you were not sure of the default radix (it could be encoded in the file name) you could always start with a
echo "r1" >&3
to switch to base 2, then select something else. I would assume binary would never be the default.
Radix selection could apply to the file table entry, so simultaneous users need not interfere.

I think that covers most common switch/display register requirement with a single (initially ascii)  control file.   

Usage would be even simpler from any normal language supporting file open/close/read/write...

Or even simpler, forget the radix control command and just allocate 5 minor device numbers and create /dev/panel, /dev/panel2, /dev/panel8, /dev/panel10 and /dev/panel16 which read/write in binary, or base 2, 8, 10 or 16 ascii, respectively.

If using  cons.c, minor 0-(n-1) are used for up to n KL11's. Anyone know what the maximum number of KL11s would be? Ie which would be the first n available for front panel I/O..

DigbyT
 


Frank Wortner

unread,
Dec 2, 2019, 11:34:45 PM12/2/19
to [PiDP-11]
I have used up to 8, but that was due to being hardware constrained.  I had to use what I was given by the start up company I worked for.  The result barely ran each terminal at 2400 baud.

In a less silly configuration, there would normally be only 1 KL for the console.  User terminals connected to DZs or DHs.

vlai...@gmail.com

unread,
Nov 11, 2024, 2:36:04 PM11/11/24
to [PiDP-11]
replying to this first as i'm about to query status of the later discussion on the thread ... a really nice piece of code.. and sort of relevant in a few weeks :) 

vlai...@gmail.com

unread,
Nov 11, 2024, 2:38:41 PM11/11/24
to [PiDP-11]
Hi, sorry for reviving an old thread but did anything ever come out of this discussion about adding the panel access
as a device rather than syscalls ? 


br,
-V

Johnny Billquist

unread,
Nov 11, 2024, 3:18:30 PM11/11/24
to pid...@googlegroups.com
I certainly haven't done anything. I could, but I have so many other
projects going on as well...

Johnny
> > <http://goog_684768610 <http://goog_684768610>>
> >
> http://www.bitsavers.org/pdf/dec/pdp11/1170/EK-KB11C-TM-001_1170procMan.pdf <http://www.bitsavers.org/pdf/dec/pdp11/1170/EK-KB11C-TM-001_1170procMan.pdf>
> >
> >
> >
> > SwitchRegister.png
> >
> >
> >
> > On Wednesday, November 27, 2019 at 1:40:52 PM UTC-6, Bernhard Nebel
> > wrote:
> >
> > Here you can see our Advent calender:https://youtu.be/mVXr7JJOvTs
> <https://youtu.be/mVXr7JJOvTs>
> >
> > It shows the BSD2.11 idle pattern and the number of days til
> > Christmas (binary coded) in the data row.
> > The program is attached. Note that here we celebrate it already
> > on Dec 24.
> >
> > Cheers,
> > Bernhard
> >
> >
> > --
> > 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
> > <mailto:pidp-11+u...@googlegroups.com>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/pidp-11/a35f134c-5fd5-4466-ab2d-f3794284d8d9%40googlegroups.com <https://groups.google.com/d/msgid/pidp-11/a35f134c-5fd5-4466-ab2d-f3794284d8d9%40googlegroups.com>
> >
> <https://groups.google.com/d/msgid/pidp-11/a35f134c-5fd5-4466-ab2d-f3794284d8d9%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/pidp-11/a35f134c-5fd5-4466-ab2d-f3794284d8d9%40googlegroups.com?utm_medium=email&utm_source=footer>>.
> >
> > --
> > 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
> > <mailto:pidp-11+u...@googlegroups.com>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/pidp-11/CACo5X5i9k-KddobiPHD9Y7DEoh2G3QjLr99jpwFcriC4O%3Dmzyg%40mail.gmail.com <https://groups.google.com/d/msgid/pidp-11/CACo5X5i9k-KddobiPHD9Y7DEoh2G3QjLr99jpwFcriC4O%3Dmzyg%40mail.gmail.com>
> >
> <https://groups.google.com/d/msgid/pidp-11/CACo5X5i9k-KddobiPHD9Y7DEoh2G3QjLr99jpwFcriC4O%3Dmzyg%40mail.gmail.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/pidp-11/CACo5X5i9k-KddobiPHD9Y7DEoh2G3QjLr99jpwFcriC4O%3Dmzyg%40mail.gmail.com?utm_medium=email&utm_source=footer>>.
>
> --
> Johnny Billquist || "I'm on a bus
> || on a psychedelic trip
> email: b...@softjar.se || Reading murder books
> pdp is alive! || tryin' to stay hip" - B. Idol
>
> --
> 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
> <mailto:pidp-11+u...@googlegroups.com>.
> To view this discussion visit
> https://groups.google.com/d/msgid/pidp-11/418000f2-8b72-425f-a86c-cc8fb0456b3en%40googlegroups.com <https://groups.google.com/d/msgid/pidp-11/418000f2-8b72-425f-a86c-cc8fb0456b3en%40googlegroups.com?utm_medium=email&utm_source=footer>.

Ville Laitinen

unread,
Nov 11, 2024, 3:50:23 PM11/11/24
to Johnny Billquist, pid...@googlegroups.com
Would someone have a patch ready maybe waiting for submission ? :) 

I don't have an issue with using the already provided syscalls and adding them to libc / use as include macros in the code.
... but if there is interest i could try to hack something up ... (even as a console minor starting at 8?? - although i really do not see why this should be included in an existing driver other than to avoid rewriting the device numbering code in the kernel to make it flexible enough to support additions... which i do hope someone picks up at some point :) 

br,
-V

To unsubscribe from this group and stop receiving emails from it, send an email to pidp-11+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pidp-11/7c8f77e6-a6fb-4b1e-bc4c-b3f74f7eb21c%40softjar.se.

Mark Matlock

unread,
Nov 11, 2024, 5:25:34 PM11/11/24
to vlai...@gmail.com, [PiDP-11]
   Back in 2019 when the PiDP-11/70 had not been out long, Lee Gleason provided a good tutorial on accessing the display register in RSX from a user program.



clock.mac.txt

Johnny Billquist

unread,
Nov 11, 2024, 6:10:33 PM11/11/24
to [PiDP-11]
Accessing as in reading? There is a system call for that.
GSSW$

If you want to write, you just need to build your program privileged,
and write to the correct address.

With Unix it is a bit trickier, since you don't have as direct access to
the I/O page, even if you are root, from a program. You need to fool
around a bit more. Which is why a device driver would make sense. The
big question is just if you'd do changes by read/write or if you'd use
ioctl() for the interaction.

Johnny
> https://rsx11.blogspot.com/2019/06/ <https://rsx11.blogspot.com/2019/06/>
>
>
> --
> 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
> <mailto:pidp-11+u...@googlegroups.com>.
> To view this discussion visit
> https://groups.google.com/d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com <https://groups.google.com/d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?utm_medium=email&utm_source=footer>.
>
>
>
>> On Nov 11, 2024, at 1:38 PM, vlai...@gmail.com <vlai...@gmail.com> wrote:
>>
>> Hi, sorry for reviving an old thread but did anything ever come out of
>> this discussion about adding the panel access
>> as a device rather than syscalls ?
>>
>>
>> br,
>> -V
>
> --
> 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
> <mailto:pidp-11+u...@googlegroups.com>.
> To view this discussion visit
> https://groups.google.com/d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com <https://groups.google.com/d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?utm_medium=email&utm_source=footer>.

Ville Laitinen

unread,
Nov 11, 2024, 7:07:04 PM11/11/24
to Johnny Billquist, [PiDP-11]
ioctl would make more sense if using the existing cons driver... but would need usespace binaries to help so it would kind of defeat the idea of being able to cat to/from /dev/panel (for example) 
Just my opinion... not trying to extinguish the discussion :) 



To unsubscribe from this group and stop receiving emails from it, send an email to pidp-11+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pidp-11/4b95d97c-cf3e-4988-be06-a0035ea38275%40softjar.se.

Johnny Billquist

unread,
Nov 11, 2024, 7:10:39 PM11/11/24
to Ville Laitinen, [PiDP-11]
Using the existing cons driver works no matter which way you do it.

But I'm sortof leaning towards ioctl since the data is really 16 bits,
and if you just do read/write you're dealing with bytes. Then you'd
probably want some way to sync things again, so it all becomes a bit messy.

Johnny

On 2024-11-12 01:06, Ville Laitinen wrote:
> ioctl would make more sense if using the existing cons driver... but
> would need usespace binaries to help so it would kind of defeat the idea
> of being able to cat to/from /dev/panel (for example)
> Just my opinion... not trying to extinguish the discussion :)
>
>
>
> On Tue, Nov 12, 2024 at 1:10 AM Johnny Billquist <b...@softjar.se
> <mailto:b...@softjar.se>> wrote:
>
> Accessing as in reading? There is a system call for that.
> GSSW$
>
> If you want to write, you just need to build your program privileged,
> and write to the correct address.
>
> With Unix it is a bit trickier, since you don't have as direct
> access to
> the I/O page, even if you are root, from a program. You need to fool
> around a bit more. Which is why a device driver would make sense. The
> big question is just if you'd do changes by read/write or if you'd use
> ioctl() for the interaction.
>
>    Johnny
>
> On 2024-11-11 23:25, Mark Matlock wrote:
> >     Back in 2019 when the PiDP-11/70 had not beenout long, Lee
> Gleason
> > provided a good tutorial on accessing the display register in RSX
> from a
> > user program.
> >
> > https://rsx11.blogspot.com/2019/06/
> <https://rsx11.blogspot.com/2019/06/>
> <https://rsx11.blogspot.com/2019/06/
> <https://rsx11.blogspot.com/2019/06/>>
> >
> >
> > --
> > 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
> <mailto:pidp-11%2Bunsu...@googlegroups.com>
> > <mailto:pidp-11+u...@googlegroups.com
> <mailto:pidp-11%2Bunsu...@googlegroups.com>>.
> > To view this discussion visit
> >
> https://groups.google.com/d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com <https://groups.google.com/d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com> <https://groups.google.com/d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?utm_medium=email&utm_source=footer>>.
> >
> >
> >
> >> On Nov 11, 2024, at 1:38 PM, vlai...@gmail.com
> <mailto:vlai...@gmail.com> <vlai...@gmail.com
> <mailto:vlai...@gmail.com>> wrote:
> >>
> >> Hi, sorry for reviving an old thread but did anything ever come
> out of
> >> this discussion about adding the panel access
> >> as a device rather than syscalls ?
> >>
> >>
> >> br,
> >> -V
> >
> > --
> > 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
> <mailto:pidp-11%2Bunsu...@googlegroups.com>
> > <mailto:pidp-11+u...@googlegroups.com
> <mailto:pidp-11%2Bunsu...@googlegroups.com>>.
> > To view this discussion visit
> >
> https://groups.google.com/d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com <https://groups.google.com/d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com> <https://groups.google.com/d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?utm_medium=email&utm_source=footer>>.
>
> --
> Johnny Billquist                  || "I'm on a bus
>                                    ||  on a psychedelic trip
> email: b...@softjar.se <mailto:b...@softjar.se>             ||
> Reading murder books
> pdp is alive!                    ||  tryin' to stay hip" - B. Idol
>
> --
> 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
> <mailto:pidp-11%2Bunsu...@googlegroups.com>.
> To view this discussion visit
> https://groups.google.com/d/msgid/pidp-11/4b95d97c-cf3e-4988-be06-a0035ea38275%40softjar.se <https://groups.google.com/d/msgid/pidp-11/4b95d97c-cf3e-4988-be06-a0035ea38275%40softjar.se>.

Ville Laitinen

unread,
Nov 11, 2024, 7:43:32 PM11/11/24
to Johnny Billquist, [PiDP-11]
i'll try to hack something up for ioctl/usr helpers and hopefully something as a nicer alternative for a cons minor device by eow... still hoping someone will pick up fixing the device allocation scheme  - i'm pretty sure there are more than a few device drivers developed in the past few years that have not been published because they are virtual devices 

br,
-V

Johnny Billquist

unread,
Nov 11, 2024, 8:03:40 PM11/11/24
to Ville Laitinen, [PiDP-11]
Not sure what your comments about device drivers are about.

Just add some code that implements access to the switch register as a
different minor number in the existing console device driver (or why not
as another variant on the /dev/mem driver, which might be considered
even more logical to place it in).

It should be extremely straight forward.

Johnny

On 2024-11-12 01:43, Ville Laitinen wrote:
> i'll try to hack something up for ioctl/usr helpers and hopefully
> something as a nicer alternative for a cons minor device by eow... still
> hoping someone will pick up fixing the device allocation scheme  -i'm
> pretty sure there are more than a few device drivers developed in the
> past few years that have not been published because they are virtual
> devices
>
> br,
> -V
>
> On Tue, Nov 12, 2024 at 2:10 AM Johnny Billquist <b...@softjar.se
> <mailto:b...@softjar.se>> wrote:
>
> Using the existing cons driver works no matter which way you do it.
>
> But I'm sortof leaning towards ioctl since the data is really 16 bits,
> and if you just do read/write you're dealing with bytes. Then you'd
> probably want some way to sync things again, so it all becomes a bit
> messy.
>
>    Johnny
>
> On 2024-11-12 01:06, Ville Laitinen wrote:
> > ioctl would make more sense if using the existing cons driver...but
> > would need usespace binaries to help so it would kind of defeat
> the idea
> > of being able to cat to/from /dev/panel (for example)
> > Just my opinion... not trying to extinguish the discussion :)
> >
> >
> >
> > On Tue, Nov 12, 2024 at 1:10 AM Johnny Billquist <b...@softjar.se
> <mailto:b...@softjar.se>
> >     <mailto:pidp-11%2Bunsu...@googlegroups.com
> <mailto:pidp-11%252Buns...@googlegroups.com>>
> >      > <mailto:pidp-11+u...@googlegroups.com
> <mailto:pidp-11%2Bunsu...@googlegroups.com>
> >     <mailto:pidp-11%2Bunsu...@googlegroups.com
> <mailto:pidp-11%252Buns...@googlegroups.com>>>.
> >      > To view this discussion visit
> >      >
> >
> https://groups.google.com/d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com <https://groups.google.com/d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com> <https://groups.google.com/d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com <https://groups.google.com/d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com>> <https://groups.google.com/d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?utm_medium=email&utm_source=footer<https://groups.google.com/d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?utm_medium=email&utm_source=footer> <https://groups.google.com/d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?utm_medium=email&utm_source=footer>>>.
> >      >
> >      >
> >      >
> >      >> On Nov 11, 2024, at 1:38 PM, vlai...@gmail.com
> <mailto:vlai...@gmail.com>
> >     <mailto:vlai...@gmail.com <mailto:vlai...@gmail.com>>
> <vlai...@gmail.com <mailto:vlai...@gmail.com>
> >     <mailto:vlai...@gmail.com <mailto:vlai...@gmail.com>>> wrote:
> >      >>
> >      >> Hi, sorry for reviving an old thread but did anything
> ever come
> >     out of
> >      >> this discussion about adding the panel access
> >      >> as a device rather than syscalls ?
> >      >>
> >      >>
> >      >> br,
> >      >> -V
> >      >
> >      > --
> >      > 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
> <mailto:pidp-11%2Bunsu...@googlegroups.com>
> >     <mailto:pidp-11%2Bunsu...@googlegroups.com
> <mailto:pidp-11%252Buns...@googlegroups.com>>
> >      > <mailto:pidp-11+u...@googlegroups.com
> <mailto:pidp-11%2Bunsu...@googlegroups.com>
> >     <mailto:pidp-11%2Bunsu...@googlegroups.com
> <mailto:pidp-11%252Buns...@googlegroups.com>>>.
> >      > To view this discussion visit
> >      >
> >
> https://groups.google.com/d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com <https://groups.google.com/d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com> <https://groups.google.com/d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com <https://groups.google.com/d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com>> <https://groups.google.com/d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?utm_medium=email&utm_source=footer<https://groups.google.com/d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?utm_medium=email&utm_source=footer> <https://groups.google.com/d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?utm_medium=email&utm_source=footer>>>.
> >
> >     --
> >     Johnny Billquist                  || "I'm on a bus
> >                                        ||  on a psychedelic trip
> >     email: b...@softjar.se <mailto:b...@softjar.se>
> <mailto:b...@softjar.se <mailto:b...@softjar.se>>            ||
> >     Reading murder books
> >     pdp is alive!                   ||  tryin' to stay hip" - B.
> Idol
> >
> >     --
> >     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
> <mailto:pidp-11%2Bunsu...@googlegroups.com>
> >     <mailto:pidp-11%2Bunsu...@googlegroups.com
> <mailto:pidp-11%252Buns...@googlegroups.com>>.
> >     To view this discussion visit
> >
> https://groups.google.com/d/msgid/pidp-11/4b95d97c-cf3e-4988-be06-a0035ea38275%40softjar.se <https://groups.google.com/d/msgid/pidp-11/4b95d97c-cf3e-4988-be06-a0035ea38275%40softjar.se> <https://groups.google.com/d/msgid/pidp-11/4b95d97c-cf3e-4988-be06-a0035ea38275%40softjar.se <https://groups.google.com/d/msgid/pidp-11/4b95d97c-cf3e-4988-be06-a0035ea38275%40softjar.se>>.
> >
>
> --
> Johnny Billquist                  || "I'm on a bus
>                                    ||  on a psychedelic trip
> email: b...@softjar.se <mailto:b...@softjar.se>             ||
> Reading murder books
> pdp is alive!                    ||  tryin' to stay hip" - B. Idol
>

--

vlai...@gmail.com

unread,
Apr 25, 2025, 5:10:45 PMApr 25
to [PiDP-11]
No kernel mods needed to read/set the CSW ... there's the magical 'phys' syscall (used only by gt307.c afaik) which root user can use to map
*any* physical address to the running processes data page/segment (the man page has a nice explanation .. and rightfully so a suggestion to avoid using it :) 

Attached code  *should*  work... please do not test it unless you have a backup of everything...

.. copy to csw.c , compile with cc -i csw.c -o csw
."/csw" without arguments should read/show the status of the 16-0 switches in decimal 
."/csw 65535" should light all 16 addressable switch/display register leds if you have the PIDP data (lower dial) set to DISPLAY REGISTER..

br,
-V
csw.c

Ville Laitinen

unread,
Apr 25, 2025, 5:25:22 PMApr 25
to [PiDP-11]
the earlier one relevant to  2.11BSD obviously.
-V


To unsubscribe from this group and stop receiving emails from it, send an email to pidp-11+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pidp-11/9d2e1645-014d-4b2f-8103-88b975bc2879n%40googlegroups.com.

Johnny Billquist

unread,
Apr 26, 2025, 12:20:58 AMApr 26
to pid...@googlegroups.com
Oh, Sure. But then you could just also say "access /dev/mem" (or kmem)
and just write to the right location there.

The problem with either is that any bugs have a reasonable chance to
corrupt the whole system. And thus, only the root user is allowed to
actually do these things.

Access via a device would make it way safer, and easier to work with.
The phys syscall is perhaps even more tricky for people to use than
/dev/mem, since then you need to know which page you can basically remap
to wherever. The man-page don't mention this, but you'll also get EINVAL
if you currently have something else mapped in the page you try to use.

Johnny


On 2025-04-25 23:10, vlai...@gmail.com wrote:
> No kernel mods needed to read/set the CSW ... there's the magical 'phys'
> syscall (used only by gt307.c afaik) which root user can use to map
> *any* physical address to the running processes data page/segment (the
> man page has a nice explanation .. and rightfully so a suggestion to
> avoid using it :)
>
> Attached code  *should*  work... please do not test it unlessyou have a
> > >     big question is just if you'd do changes byread/write or if
> > you'd use
> > >     ioctl() for the interaction.
> > >
> > >         Johnny
> > >
> > >     On 2024-11-11 23:25, Mark Matlock wrote:
> > >      >     Back in 2019 when thePiDP-11/70 had not beenout
> long, Lee
> > >     Gleason
> > >      > provided a good tutorial on accessing the display register
> > in RSX
> > >     from a
> > >      > user program.
> > >      >
> > >      > https://rsx11.blogspot.com/2019/06/ <https://
> rsx11.blogspot.com/2019/06/>
> > <https://rsx11.blogspot.com/2019/06/ <https://
> rsx11.blogspot.com/2019/06/>>
> > >     <https://rsx11.blogspot.com/2019/06/ <https://
> rsx11.blogspot.com/2019/06/>
> > <https://rsx11.blogspot.com/2019/06/ <https://
> rsx11.blogspot.com/2019/06/>>>
> > >     <https://rsx11.blogspot.com/2019/06/ <https://
> rsx11.blogspot.com/2019/06/>
> > <https://rsx11.blogspot.com/2019/06/ <https://
> rsx11.blogspot.com/2019/06/>>
> > >     <https://rsx11.blogspot.com/2019/06/ <https://
> rsx11.blogspot.com/2019/06/>
> > <https://rsx11.blogspot.com/2019/06/ <https://
> rsx11.blogspot.com/2019/06/>>>>
> > >      >
> > >      >
> > >      > --
> > >      > 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
> > <mailto:pidp-11%2Bunsu...@googlegroups.com>
> > >     <mailto:pidp-11%2Bunsu...@googlegroups.com
> > <mailto:pidp-11%252Buns...@googlegroups.com>>
> > >      > <mailto:pidp-11+u...@googlegroups.com
> > <mailto:pidp-11%2Bunsu...@googlegroups.com>
> > >     <mailto:pidp-11%2Bunsu...@googlegroups.com
> > <mailto:pidp-11%252Buns...@googlegroups.com>>>.
> > >      > To view this discussion visit
> > >      >
> > >
> > https://groups.google.com/d/msgid/pidp-11/EBF02DBF-
> B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com <https://groups.google.com/
> d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com>
> <https://groups.google.com/d/msgid/pidp-11/EBF02DBF-
> B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com <https://groups.google.com/
> d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com>>
> <https://groups.google.com/d/msgid/pidp-11/EBF02DBF-
> B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com <https://groups.google.com/
> d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com>
> <https://groups.google.com/d/msgid/pidp-11/EBF02DBF-
> B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com <https://groups.google.com/
> d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com>>>
> <https://groups.google.com/d/msgid/pidp-11/EBF02DBF-
> B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?
> utm_medium=email&utm_source=footer <https://groups.google.com/d/
> msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?
> utm_medium=email&utm_source=footer><https://groups.google.com/d/
> msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?
> utm_medium=email&utm_source=footer <https://groups.google.com/d/
> msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?
> utm_medium=email&utm_source=footer>> <https://groups.google.com/d/
> msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?
> utm_medium=email&utm_source=footer <https://groups.google.com/d/
> msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?
> utm_medium=email&utm_source=footer> <https://groups.google.com/d/
> msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?
> utm_medium=email&utm_source=footer <https://groups.google.com/d/
> msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?
> B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com <https://groups.google.com/
> d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com>
> <https://groups.google.com/d/msgid/pidp-11/EBF02DBF-
> B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com <https://groups.google.com/
> d/msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com>>>
> <https://groups.google.com/d/msgid/pidp-11/EBF02DBF-
> B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?
> utm_medium=email&utm_source=footer <https://groups.google.com/d/
> msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?
> utm_medium=email&utm_source=footer><https://groups.google.com/d/
> msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?
> utm_medium=email&utm_source=footer <https://groups.google.com/d/
> msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?
> utm_medium=email&utm_source=footer>> <https://groups.google.com/d/
> msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?
> utm_medium=email&utm_source=footer <https://groups.google.com/d/
> msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?
> utm_medium=email&utm_source=footer> <https://groups.google.com/d/
> msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?
> utm_medium=email&utm_source=footer <https://groups.google.com/d/
> msgid/pidp-11/EBF02DBF-B9A3-470D-8A0A-3FCDB425ACE6%40rsx11m.com?
> <https://groups.google.com/d/msgid/pidp-11/4b95d97c-cf3e-4988-be06-
> a0035ea38275%40softjar.se <https://groups.google.com/d/msgid/
> pidp-11/4b95d97c-cf3e-4988-be06-a0035ea38275%40softjar.se> <https://
> groups.google.com/d/msgid/pidp-11/4b95d97c-cf3e-4988-be06-
> a0035ea38275%40softjar.se <https://groups.google.com/d/msgid/
> pidp-11/4b95d97c-cf3e-4988-be06-a0035ea38275%40softjar.se>>>.
> > >
> >
> > --
> > Johnny Billquist                 || "I'm on a bus
> >                                    ||  on a psychedelic trip
> > email: b...@softjar.se <mailto:b...@softjar.se>             ||
> > Reading murder books
> > pdp is alive!                    ||  tryin' to stay hip" - B. Idol
> >
>
> --
> Johnny Billquist || "I'm on a bus
> || on a psychedelic trip
> email: b...@softjar.se || Reading murder books
> pdp is alive! || tryin' to stay hip" - B. Idol
>
> --
> 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
> <mailto:pidp-11+u...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/
> pidp-11/9d2e1645-014d-4b2f-8103-88b975bc2879n%40googlegroups.com
> <https://groups.google.com/d/msgid/
> pidp-11/9d2e1645-014d-4b2f-8103-88b975bc2879n%40googlegroups.com?
> utm_medium=email&utm_source=footer>.

--
Johnny Billquist || "I'm on a bus
|| on a psychedelic trip
email: b...@softjar.se || Reading murder books

vlai...@gmail.com

unread,
May 1, 2025, 3:59:30 PMMay 1
to [PiDP-11]
well yeah.. /dev/mem is RO in normal operation ... but agreed - the phys syscall should not exist :) 

I possibly forgot to share this at the end of last year .. attached is a very minimal extension (minor device 4) to the 'mem' driver.
Access is via a file (character device major 1, minor 1) in /dev access can be controlled same way as any other file in the system.
The driver only accepts word-sized reads/writes and does not do any translation.

Attached file has the kernel patch, very brief and possibly incorrect installation instructions and an example to read/write the register.

Massive thanks to Johnny Billquist for patiently answering stupid questions and providing hints .. and finally 
confirming simh might actually be treating writes to CSW incorrectly. (+ providing a PR for simh-classic for this and some other issues :)


The patch only adds:
in /usr/src/sys/pdp/mem.c 
"
...
#include "iopage.h" /*for CSW*/
...
/* minor device 4 is the DISPLAY/SWITCH register */
  case 4:
  if (iov->iov_len != 2) {
  error = ENXIO;
  break;
  }
  error = uiomove(CSW, 2, uio);
  break;
"

Why restrict to words.. simh (except simh-classic current sources) treat all writes as word-sized.
.. and this is really just one register anyway...

'uiomove' is a general kernel helper to copy stuff from/to user data space , using that 
will work *most* of the time but if the user data pointer is not word-aligned it will fail/not produce 
the intended result on simh at least.
It also has the added + of handling memory faults so using the device on a system that 
does not have the CSW will not end up in a kernel panic :) 

If someone is interested in these i do have ioctl and sysctl examples as well.

.
br,
-V

ps if the attachment is not working i added that to 
for easier(?) access 
csw-mem.tar.Z

vlai...@gmail.com

unread,
May 1, 2025, 4:12:47 PMMay 1
to [PiDP-11]
... this could easily be extended/modified to cover the PiDP-11 bm180 "hack" as well to allow non-root access.

-V

Reply all
Reply to author
Forward
0 new messages