[comp.os.minix] minimal terminating program

broman@schroeder.nosc.mil (Vincent Broman) (02/11/89)

Now that I have some time, I've been trying to crosscompile
Minix using Turbo-C and A86.  It worked to some extent
before, but not now.  The system calls seem to have no effect --
even _exit() returns to the caller!

At first I thought it was a problem with the crosscompilation,
but after boiling it down, what should be the minimal
terminating Minix program (appended below) still gets
a reply from the OS after sending the EXIT message.

It cannot get any simpler than this!  How could this
go wrong on a vanilla v1.2 (PC) Minix?  Something Dumb, I hope.

---------------------------------------------------------------
.globl begdata, enddata, begtext, endtext, begbss, endbss
.data
begdata:
message:
        .word   0, 1, 0,0,0,0,0,0
enddata:
.text
begtext:
        mov ax,*0              | ; MM dest
        mov bx,#message        | ; &message
        mov cx,*3              | ; BOTH
        int 0x20               | ; call Minix   _exit

| NOTREACHED
deadend:
        jmp     deadend
endtext:
.bss
begbss:
endbss:
----------------------------------------------------------------
and the .ASM version also if it helps...
------------------------------------------------------------------
        name    crtso
; Turbo-C v1.5 boilerplate
_TEXT   segment byte public 'CODE'
DGROUP  group   _DATA,_BSS
        assume  cs:_TEXT,ds:DGROUP,ss:DGROUP
_TEXT   ends
_DATA   segment word public 'DATA'
_DATA   ends
_BSS    segment word public 'BSS'
_BSS    ends
_STACK  segment byte stack 'STACK'
_STACK  ends

_DATA   segment word public 'DATA'
message dw      0
mtype   dw      1       ; EXIT
stuff   dw      0,0,0,0,0,0
_DATA   ends

_TEXT   segment byte public 'CODE'
        assume  cs:_TEXT,ds:DGROUP,ss:DGROUP

crtso:
        mov ax,0               ; MM dest
        mov bx,offset message  ; &message
        mov cx,3               ; BOTH
        int 020h               ; call Minix   _exit

; NOTREACHED

        mov     ax,DGROUP       ; create one entry in relocation table
                                ; from which dos2out gets the textsize
deadend:
        jmp     deadend
_TEXT   ends
        end
------------------------------------------------------------------

Vincent Broman,  code 632, Naval Ocean Systems Center, San Diego, CA 92152, USA
phone: +1 619 553 1641    Internet: broman@nosc.mil   Uucp: sdcsvax!nosc!broman