[comp.unix.xenix] MASM syntax for a far call.

ag@elgar.UUCP (Keith Gabryelski) (02/07/89)

I little while ago I posted some instructions on how to get System V
Release 3 signal functions (sigset(), sighold(), sigpause() ...) for a
SCO XENIX 2.3.1 system.  I also posted some code explaining
(unimplemented) select() for SCO XENIX and syscall().

In the assembly language routines I posted there were lines of the
form:

;	call    far 7:0			; Switch to kernel and call SYSNUM.

	db 9ah
	dw 0,0
	dw 7

As you can see, I couldn't figure out the MASM assembler syntax for a
far call.  I used `db's instead.

I was informed by a SCO hack [Brian Chapman] that what I did was
similar to what is found in their source code.

It seems the far call is hardly ever used in the SCO XENIX system and
as such has never been fully implemented in the MASM assembler.

Pax, Keith

Ps, has anyone gotten any use out of the new signal functions?
-- 
ag@elgar.CTS.COM         Keith Gabryelski          ...!{ucsd, crash}!elgar!ag

rosso@sco.COM (Ross Oliver) (02/08/89)

In article <62@elgar.UUCP> ag@elgar.UUCP (Keith Gabryelski) writes:
>As you can see, I couldn't figure out the MASM assembler syntax for a
>far call.  I used `db's instead.
>
>I was informed by a SCO hack [Brian Chapman] that what I did was
>similar to what is found in their source code.
>
>It seems the far call is hardly ever used in the SCO XENIX system and
>as such has never been fully implemented in the MASM assembler.

Actually, far calls are fully implemented in Masm, and in fact are
used exclusively in large model programs.  Normally, you would use
the PROC FAR directive to declare a function that must be reached
with a far call, then use CALL FAR PTR <function address> to make
the call.  For example, here is your basic "Hello world" program,
in stripped-down large model 286 assembly:

EXTRN	_printf:FAR

$SG103	DB	'Hello world!',  0aH,  00H

_main	PROC FAR

	push	ds
	push	OFFSET DGROUP:$SG103
	call	FAR PTR _printf

	leave	
	ret	

_main	ENDP

However, in Keith's example, the DB kludge must be used to force
Masm to make a far call to a numeric rather than a symbolic address.
I suspect that is the reason for its use in the XENIX kernel as well.

Ross Oliver
Technical Support
The Santa Cruz Operation, Inc.