🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

3 total messages Started by Badger BA 64810 Sun, 24 Sep 1989 21:05
Bad LALIGN(p) define for pdp11 in sysmacros.h
#108
Author: Badger BA 64810
Date: Sun, 24 Sep 1989 21:05
47 lines
2570 bytes
I noticed what seems to be an error in ATT System V Release 3.2 Upgrade 2.1 
system file sysmacros.h.  The error only affects pdp11 systems, because it
is conditionally compiled.  Since this is a 80386 release, perhaps no 
one is affected.  Nonetheless, here's my patch:

diff -c /user03/sec/l/V3_2_1/usr/src/uts/i386/sys/sysmacros.h /user03/sec/l/Vcm/usr/src/Vcm/uts/i386/sys/sysmacros.h 
*** /user03/sec/l/V3_2_1/usr/src/uts/i386/sys/sysmacros.h	Tue May 17 17:22:08 1988
--- /user03/sec/l/Vcm/usr/src/Vcm/uts/i386/sys/sysmacros.h	Sun Sep 24 16:44:28 1989
***************
*** 191,197 ****
  #ifdef	pdp11
  #define	SALIGN(p)		(char *)(((int)p+1) & ~1)
  #define	IALIGN(p)		(char *)(((int)p+1) & ~1)
! #define LALIGN(p)		(char *)(((int)p+1) & ~3)
  #endif
  #if vax | i386
  #define	SALIGN(p)		(char *)(((int)p+1) & ~1)
--- 191,197 ----
  #ifdef	pdp11
  #define	SALIGN(p)		(char *)(((int)p+1) & ~1)
  #define	IALIGN(p)		(char *)(((int)p+1) & ~1)
! #define	LALIGN(p)		(char *)(((int)p+3) & ~3)
  #endif
  #if vax | i386
  #define	SALIGN(p)		(char *)(((int)p+1) & ~1)

Note that I've changed a space to a tab and a '1' to a '3'.  
Now the LALIGN(p) matches the one defined for when 
``#if vax | i386'' is in effect (not shown here).

I have two questions about this.

1.  Technical:  Is it really a good idea to convert to (int)?
Wouldn't (unsigned int) or (unsigned long) be safer?  I've seen 
a similar operation elsewhere in kernel code which does:
	(char *)((int)p + 3) & ~3L) 
Is this any better?

2.  Procedural:  What's the official way to submit these things
to ATT?  I haven't seen any ``problem report'' forms in the backs
of our manuals, (unlike DIGITAL which puts one in theirs).  Is 
there an ATT network address which accepts bug reports, like 
Sun has?
    -----	-	-	-	-	-	-	-	----
Bernard A. Badger Jr.	407/984-6385          |``Get a LIFE!''  -- J.H. Conway
Harris GISD, Melbourne, FL  32902             |Buddy, can you paradigm?
Internet: bbadger%x102c@trantor.harris-atd.com|'s/./&&/g' Tom sed expansively.
Re: Bad LALIGN(p) define for pdp11 in sysmacros.h
#109
Author: Doug Gwyn
Date: Mon, 25 Sep 1989 01:25
21 lines
1323 bytes
In article <2721@trantor.harris-atd.com> bbadger@x102c.harris-atd.com (Badger BA 64810) writes:
>Now the LALIGN(p) matches the one defined for when 
>``#if vax | i386'' is in effect (not shown here).

Yeah, and now you've broken it.  PDP-11 longs need be aligned
only on a word boundary, not on a longword boundary.

>1.  Technical:  Is it really a good idea to convert to (int)?

On a PDP-11, sure.

>2.  Procedural:  What's the official way to submit these things to ATT?

Submit a software trouble report.  If you have subscribed to
the appropriate level of software support, you should have a
folder that contains forms and instructions.

>Is there an ATT network address which accepts bug reports, like Sun has?

There is (or was) a command "trenter" that would guide you through
the steps of filling out a trouble report then e-mail it somewhere.
Re: Bad LALIGN(p) define for pdp11 in sysmacros.h
#110
Author: Badger BA 64810
Date: Thu, 28 Sep 1989 20:38
62 lines
2928 bytes
In article <11150@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn) writes:
>In article <2721@trantor.harris-atd.com> bbadger@x102c.harris-atd.com (Badger BA 64810) writes:
>>Now the LALIGN(p) matches the one defined for when 
>>``#if vax | i386'' is in effect (not shown here).
>
>Yeah, and now you've broken it.  PDP-11 longs need be aligned
>only on a word boundary, not on a longword boundary.
>
Well, I thought that longs might only be aligned to even bytes,
but then shouldn't the definition of LALIGN be the same as IALIGN?

#ifdef	pdp11
#define	SALIGN(p)		(char *)(((int)p+1) & ~1)
#define	IALIGN(p)		(char *)(((int)p+1) & ~1)
#define LALIGN(p)		(char *)(((int)p+1) & ~3)	/* ??? */
#endif
#if vax | i386
#define	SALIGN(p)		(char *)(((int)p+1) & ~1)
#define	IALIGN(p)		(char *)(((int)p+3) & ~3)
#define	LALIGN(p)		(char *)(((int)p+3) & ~3)
#endif

An generalized alignment macro would always use the same number like this:
#define ALIGN(p,m)  	(char *)(((int)p+m) & ~m)
	p	+1&~3	+3&~3
	0	0	0
	1	0	4
	2	0	4
	3	4	4
	4	4	4
	5	4	8
	6	4	8
	7	8	8
	8	8	8
Is there any possible reason to use the +1&~3 pattern?  I can't see it.

>>1.  Technical:  Is it really a good idea to convert to (int)?
>
>On a PDP-11, sure.
I was more worried about the VAX.
#define	LALIGN(p)		(char *)(((int)p+3) & ~3)
However, I guess since each macro set is machine dependent, it could
be changed to handle whatever int size that pointers turned out to be.
I guess that there isn't a machine-independent way to do this.  It
should only be a problem if (sizeof(int) != sizeof(* char)).
>
>>2.  Procedural:  What's the official way to submit these things to ATT?
>
>Submit a software trouble report.  If you have subscribed to
>the appropriate level of software support, you should have a
>folder that contains forms and instructions.
>
>>Is there an ATT network address which accepts bug reports, like Sun has?
>
>There is (or was) a command "trenter" that would guide you through
>the steps of filling out a trouble report then e-mail it somewhere.
No such command here.

    -----	-	-	-	-	-	-	-	----
Bernard A. Badger Jr.	407/984-6385          |``Get a LIFE!''  -- J.H. Conway
Harris GISD, Melbourne, FL  32902             |Buddy, can you paradigm?
Internet: bbadger%x102c@trantor.harris-atd.com|'s/./&&/g' Tom sed expansively.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads