I have a problem with my kernel. Watcom was inserting some code that makes my kernel crash.

call    near ptr 0FFFFFFFFh


Im using 11.0c but I might upgrade to Open Watcom 1.3.
Is there a command line perimeter or something that can make Watcom not insert stuff like that.
Posted on 2006-08-27 13:31:59 by Mike359
It's most likely an error from your side.

Which input and output formats are you using? Any funky linker script? etc...
Posted on 2006-08-27 14:10:53 by f0dder
Im using JLOC. Everyting links fine and dandy. The dissassembled version shows:

seg000:00010000 seg000          segment byte public 'CODE' use32
seg000:00010000                assume cs:seg000
seg000:00010000                ;org 10000h
seg000:00010000                assume es:nothing, ss:nothing, ds:nothing, fs:nothing, gs:nothing
seg000:00010000                cli
seg000:00010001                call    sub_10008
seg000:00010006                cli
seg000:00010007                hlt
seg000:00010008
seg000:00010008 sub_10008      proc near              ; CODE XREF: seg000:00010001p
seg000:00010008                push    8
seg000:0001000D                call    near ptr 0FFFFFFFFh
seg000:00010012                push    edx
seg000:00010013                mov    eax, large ds:37h
seg000:00010018                lea    edx,
seg000:0001001B                mov    large ds:37h, edx
seg000:00010021                mov    byte ptr , 21h ; '!'
seg000:00010024                mov    eax, large ds:37h
seg000:00010029                lea    edx,
seg000:0001002C                mov    large ds:37h, edx
seg000:00010032                mov    byte ptr , 7
seg000:00010035
seg000:00010035 loc_10035:                              ; CODE XREF: sub_10008+2Dj
seg000:00010035                jmp    short loc_10035
seg000:00010035 sub_10008      endp


call    near ptr 0FFFFFFFFh is not susposd to be there. Does Open Watcom 1.3 fix this?
Posted on 2006-08-27 17:16:48 by Mike359
Try disassembling the .obj file and see what the "call near ..." is supposed to call. Perhaps also use the "generate asm listing" compiler switch, if the .obj doesn't make sense either.
Posted on 2006-08-28 07:25:12 by f0dder
What kind of tool can I use?
Posted on 2006-08-28 18:06:36 by Mike359
For disassembling .obj, IDA is *the* tool... "Idafre41" is probably what you want to look at.

http://www.simtel.com/product.php?id=27629 (ida37fw.zip, 3.7)
http://www.simtel.com/product.php?id=29498 (idafre41.zip, 4.1)

For generating an asm listing, look at the commandline parameters the watcom compiler takes - it's been a while since I used it, so I don't know the command off the top of my head.
Posted on 2006-08-29 01:00:34 by f0dder
Thanks for the "tool". Although I fixed the compiler problem by adding the "-s" perimeter this still looks usefull.
Posted on 2006-08-29 12:18:54 by Mike359
Hm, what does the "-s" parameter do?

EDIT: ah, just downloaded OpenWatcom 1.5 as a last thing before I goto(bed);

-s means "remove stack checks". So, your problem was that wcc inserts calls to a stackcheck routine, and that you didn't link that in from the library... for some reason, jloc has generated an output instead of erroring about a missing external (doesn't it even give a warning?).

So, a fault on your side, not a compiler bug :)
Posted on 2006-08-29 18:02:11 by f0dder
:lol:
Hey man what can I say.  ;)
Posted on 2006-08-29 18:35:46 by Mike359