Ignore:
Timestamp:
Mar 18, 2021, 8:57:36 PM (4 years ago)
Author:
David Azarewicz
Message:

Merge changes from Paul's uniaud32next branch.

Location:
GPL/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk

  • GPL/trunk/drv32/startup.inc

    r32 r679  
    5353                ENDM
    5454
    55 
    56 IFDEF KEE
    5755;pushfd/popfd trashed by fucking BUGY KernThunkStackTo32
    5856;fix idea by zuko
     
    6462        push    stacksel
    6563        push    stackbase
    66 
    6764        push    edx
    6865        mov     edx, ss
    6966        mov     stacksel, edx
    7067        pushfd
    71 
    7268        call    KernThunkStackTo32
    7369        popfd
    7470        mov     stackbase, edx
    75         pop     edx     ;trashed by KernThunkStackTo32
    76         xor     eax, eax ; mark success
     71        pop     edx      ;trashed by KernThunkStackTo32
    7772        ENDM
     73
    7874;;******************************************************************************
    7975;;******************************************************************************
     
    8783        pop     eax     ;trashed by KernThunkStackTo32
    8884        ENDM
     85
    8986;;******************************************************************************
    9087;;******************************************************************************
     
    9794        pop     eax     ;trashed by KernThunkStackTo16
    9895        pop     edx     ;trashed by KernThunkStackTo16 when called in interrupt context
    99 
    10096        pop     stackbase
    10197        pop     stacksel
     
    113109        pop     edx     ;trashed by KernThunkStackTo16 when called in interrupt context
    114110        ENDM
    115 ;;******************************************************************************
    116 ;;******************************************************************************
    117111
    118 ELSE
    119 
    120 ;;******************************************************************************
    121 ;;Need to preserve fs:ebx!! (all other registers must be saved by the caller)
    122 ;;******************************************************************************
    123 DevThunkStackTo32 MACRO
    124         LOCAL @@stackok, @@stackchangeend
    125 
    126 ;;;;        int     3
    127        
    128         pushfd
    129         cli
    130         pop     dword ptr [cpuflags]
    131 
    132         ;check if kernel DS selector DPL == 3; if so, change to 0       
    133         call    FixSelDPL
    134 
    135         ;allocate private stack
    136         push    fs
    137         call    StackAlloc
    138         pop     fs                             ;trashed by StackAlloc
    139         mov     dword ptr [fInitStack], 1
    140 
    141         cmp     eax, 0
    142         jne     @@stackok
    143        
    144 IFDEF DEBUG
    145         int     3   ;this is very fatal
    146 ENDIF
    147         call    RestoreSelDPL
    148         mov     eax, -1                         ;mark failure
    149 
    150         push    dword ptr [cpuflags]
    151         popfd
    152         jmp     short @@stackchangeend
    153        
    154 @@stackok:
    155         ;stack ptr in eax
    156         call    dword ptr [intSwitchStack]
    157 
    158         push    dword ptr [cpuflags]
    159         popfd
    160 
    161         mov     eax, 0                          ;mark success
    162 @@stackchangeend:
    163         ENDM
    164        
    165 ;;******************************************************************************
    166 ;;******************************************************************************
    167 DevThunkStackTo32_Int MACRO
    168         LOCAL @@cont32
    169 
    170         cmp     dword ptr [fInitStack], 0
    171         je      @@cont32
    172 
    173 ;;;;        int     3
    174         pushfd
    175         cli
    176         pop     dword ptr [cpuflags]
    177 
    178         mov     dword ptr [tempeax], eax        ;save eax
    179 
    180         pop     eax             ;pop saved flat stack pointer
    181 
    182         ;and switch back to our flat stack again
    183         call    dword ptr [intSwitchStack]
    184 
    185         mov     eax, dword ptr [tempeax]        ;restore eax
    186         push    dword ptr [cpuflags]
    187         popfd
    188 
    189 @@cont32:
    190         ENDM
    191        
    192 ;;******************************************************************************
    193 ;;******************************************************************************
    194 DevThunkStackTo16 MACRO
    195 ;;;;        int     3
    196 
    197         pushfd
    198         cli
    199         pop     dword ptr [cpuflags]
    200 
    201         mov     dword ptr [tempeax], eax        ;save eax
    202         mov     dword ptr [tempesi], esi        ;save esi
    203 
    204         mov     esi, esp
    205         xor     eax, eax        ;switch to 16 bits stack
    206         call    dword ptr [intSwitchStack]
    207 
    208         mov     eax, esi       
    209         call    StackFree
    210 
    211         call    RestoreSelDPL
    212 
    213         mov     eax, dword ptr [tempeax]
    214         mov     esi, dword ptr [tempesi]
    215                
    216         push    dword ptr [cpuflags]
    217         popfd
    218        
    219         ENDM
    220        
    221 ;;******************************************************************************
    222 ;;******************************************************************************
    223 DevThunkStackTo16_Int MACRO
    224         LOCAL @@cont16
    225 
    226         cmp     dword ptr [fInitStack], 0
    227         je      @@cont16
    228 
    229 ;;;;        int     3
    230         pushfd
    231         cli
    232         pop     dword ptr [cpuflags]
    233 
    234         mov     dword ptr [tempeax], eax        ;save eax
    235         mov     dword ptr [tempesi], esi        ;save esi
    236         mov     esi, esp
    237         xor     eax, eax        ;switch to 16 bits stack
    238         call    dword ptr [intSwitchStack]
    239         push    esi             ;flat stack ptr (popped before switching back to flat)
    240 
    241         mov     eax, dword ptr [tempeax]
    242         mov     esi, dword ptr [tempesi]
    243         push    dword ptr [cpuflags]
    244         popfd
    245 
    246 @@cont16:
    247         ENDM
    248 
    249 ENDIF ;KEE
    250 
    251 IFDEF FLATSTACK       
    252112;*******************************************************************************
    253113;enter a function that needs to switch to a 16 bits stack
     
    263123                push    esi
    264124                push    edi
    265 
    266125                ;to access the parameters on the 32 bits stack, once we've switched
    267126                mov     edi, ebp
    268 
    269127                DevThunkStackTo16_Int
    270128                ENDM
     129
    271130;*******************************************************************************
    272131;switch stack from 16 bits to 32 bits and return
     
    288147;;******************************************************************************
    289148
    290 ENDIF
    291149
    292150;Constants and structure definitions
    293 
    294 DevHlp_VirtToLin        EQU     5Bh
    295 DevHlp_VMLock           EQU     55h
    296151
    297152; Status word masks
     
    330185o_status        dw ?
    331186rpInitOut       ends
    332 
    333 
    334 ; definitions for 16 bits resource manager buffers
    335 ; (also in rm.hpp!!)
    336 MAXSIZE_RMNodeData     EQU 1024
    337 MAXSIZE_RMResources    EQU 128
    338 MAXSIZE_RMHandleList   EQU 128
    339 MAXSIZE_RMResourceList EQU 256
Note: See TracChangeset for help on using the changeset viewer.