Ignore:
Timestamp:
Jan 3, 2013, 1:22:56 PM (13 years ago)
Author:
rousseau
Message:

Fixed the Open Watcom build

Building with Open Watcom produced a non working driver.

Causes & Fixes

o Enum types were 8 bits when using WCC

This caused the functions with variable arguments to fail.
Adding the -ei compiler-flag to WCC solved this issue.

o Incorrect inline assembler syntax to call DeviceHelp in os2ahci.c

DeviceHelp is a 16:16 far pointer residing in memory.
MASM interprets 'call DeviceHelp' differently than WASM.
The correct syntax is: 'call dword ptr [DeviceHelp]'.

o Missing segments from TGROUP in init.asm

WLINK then generates the AUTO class, most probably causing incorrect
relocation fixups.

Enhancements

o WASM (or JWASM) can now be used instead of ALP
o WCC can now be used instead of CL
o The Open Watcom linker (WLINK) can now be used instead of LINK
o Streamlined both makefiles a notch so it's easy to use both tool-chains

To investigate

o CL barks about a missing prototype for DevHelp_Yield() in lib.c

The prototype is actually defined in dhcalls.h but CL still barks.

o Using WCC with ALP and WLINK produces an oversized image

Probaly due to misplaced BSS segments. WCC with ALP and LINK produces
a normal sized image however.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/os2ahci/init.asm

    r141 r144  
    88; Constants
    99                DEV_IDC  EQU    0400h        ;  IDC bit for ADD flags
    10        
     10
    1111; -----------------------------------------------------------------------------
    1212; Public symbols
    1313
    1414                PUBLIC  _asm_strat           ; low-level strategy routine
    15                 PUBLIC  _asm_idc_entry       ; low-level IDC entry point 
     15                PUBLIC  _asm_idc_entry       ; low-level IDC entry point
    1616                PUBLIC  _asm_krnl_exit       ; low-level kernel exit routine
    1717                PUBLIC  _readl               ; MMIO read (32 bits)
     
    2929                PUBLIC  _end_of_data         ; end of all data (label)
    3030                PUBLIC  _end_of_code         ; end of all code (label)
    31        
     31
    3232; ----------------------------------------------------------------------------
    3333; Device Driver Header
     
    6565; such as C.
    6666
     67; When using the Watcom Linker, the segment ordering can be overridden in
     68; the Watcom Makefile (wmakefile) where the Linker response-file is generated
     69; containing statements for segment ordering. First you can order by class and
     70; for each class you can specify the order of the segments within that class.
     71; See the ORDER directive in the wlink documentation.
    6772_DATA           SEGMENT WORD PUBLIC 'DATA'
    6873readl_dbg_fmt   db      "readl(%04x:%04x) = 0x%08lx"
     
    7277_DATA           ENDS
    7378
     79LIBDATA         SEGMENT WORD PUBLIC 'DATA'
     80LIBDATA         ENDS
     81
    7482CONST           SEGMENT WORD PUBLIC 'CONST'
    7583CONST           ENDS
     
    8391
    8492_z_data         SEGMENT WORD PUBLIC 'BSS'
    85 _end_of_data    db      0
     93_end_of_data    db      ?
    8694_z_data         ENDS
    8795
     
    98106CODE            ENDS
    99107
     108LIBCODE         SEGMENT WORD PUBLIC 'CODE'
     109LIBCODE         ENDS
     110
    100111RMCode          SEGMENT WORD PUBLIC 'CODE'
    101112RMCode          ENDS
    102 
    103 LIBCODE         SEGMENT WORD PUBLIC 'CODE'
    104 LIBCODE         ENDS
    105113
    106114_z_text         SEGMENT WORD PUBLIC 'CODE'
     
    108116_z_text         ENDS
    109117
    110 DGROUP          GROUP   DEVHDR, _DATA, CONST, _BSS, c_common, _z_data
    111 TGROUP          GROUP   _TEXT, CODE, _z_text
     118
     119; The Watcom Linker behaves differently than the IBM/MS Linkers when segments
     120; are defined but not added to the corresponding group. So when you define a
     121; a new (logical) segment and want it to be part of a physical segment (group)
     122; then don't forget to add it below or unresolvable or miscalculated
     123; relocations can be the result.
     124DGROUP          GROUP   DEVHDR, _DATA, LIBDATA, _BSS, c_common, _z_data
     125TGROUP          GROUP   _TEXT, CODE, LIBCODE, RMCode, _z_text
     126
    112127
    113128; ----------------------------------------------------------------------------
     
    140155; IDC entry point (Assembler stub)
    141156_asm_idc_entry  PROC    FAR
    142        
     157
    143158                ; push request packet address
    144159                PUSH    ES
     
    171186
    172187                RET
    173 _asm_krnl_exit  ENDP       
    174        
     188_asm_krnl_exit  ENDP
     189
    175190
    176191                .386
     
    293308
    294309
    295 ; Halfway-decent 32-bit implementation of memcpy(). 
     310; Halfway-decent 32-bit implementation of memcpy().
    296311;
    297312; C prototype: void *memcpy(void _far *d, void _far *s, size_t n);
     
    377392
    378393
    379 ; Unsigned long divide routine; 
     394; Unsigned long divide routine;
    380395; taken from OS/2 Uniaud project, original author: Timur Tabi
    381396__U4D           proc    near
     
    394409                ret
    395410__U4D           endp
    396        
    397 ; Long multiply routine; 
     411
     412; Long multiply routine;
    398413; taken from OS/2 Uniaud project, original author: Timur Tabi
    399414__U4M           proc    near
     
    412427
    413428
    414 ; Signed long divide routine; 
     429; Signed long divide routine;
    415430; taken from OS/2 Uniaud project, original author: Timur Tabi
    416431__I4D           proc    near
     
    429444                ret
    430445__I4D           endp
    431        
     446
    432447                .286
    433448
Note: See TracChangeset for help on using the changeset viewer.