[TUHS] Design of the AT&T assembly syntax

Alexander Voropay alec at sensi.org
Wed Oct 30 00:38:36 AEST 2019

Robert Clausecker <fuz at fuz.su> wrote:

> > I've tried Microport SystemV /386 (SysV R3.2). It uses COFF
> Nice find!  It seems to use lcall to selector 7 for system calls.  A
> similar choice was made in 386BSD all the way through FreeBSD 2.2.8
> where it was replaced with int $0x80 as in Linux.

Technically speaking
lcall $0x07,$0
uses selector 0 with RPL=3 (bit0 and bit1==1) and LDT (bit2==1)

It seems it's oldest way to call kernel from userspace on x86 architecture.
AT&T's programmers used this sycall convention for SysVR3 and
SysVR4 on i386 (not sure about SysVR2 on i286).
There are very few examples with lcall-type syscall  i.e.
(figure 3-26)
(and leaked SysVR4 i386 sources)

William Jolitz used this convention in his amazing articles about
porting BSD4.3 to the i386 (c)1991
(p."System Call Inteface"). See also 386BSD 0.0:
(Did he run AT&T userspace on his kernel ???)
As you mentioned, most of early *BSD systems on i386 also used lcall.

Linus selected to use "DOS-style" call with INT 0x80.
More recent BSD on i386 also use INT.

Solaris on x86 (ex. SysVR4) also uses lcall. See a
and Solaris (later OpenSolaris and later Illumos) sourcecode.

More information about the TUHS mailing list