Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

causeway: cleanup code #1377

Merged
merged 1 commit into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions bld/causeway/asm/api.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1607,32 +1607,32 @@ cwAPI_RelMemSO proc near
;Zero any segment registers using this selector.
;
mov bx,w[ebp+Int_SI]
and bx,0ffffh-3
and bx,NOT 3
jz api33_bad ; MED 11/18/96, screen out null pointer releases
xor cx,cx
mov ax,w[ebp+Int_DS]
and ax,0ffffh-3
and ax,NOT 3
cmp ax,bx
jnz api33_0
mov w[ebp+Int_DS],cx
mov ds,cx
api33_0:
mov ax,w[ebp+Int_ES]
and ax,0ffffh-3
and ax,NOT 3
cmp ax,bx
jnz api33_1
mov w[ebp+Int_ES],cx
mov es,cx
api33_1:
mov ax,w[ebp+Int_FS]
and ax,0ffffh-3
and ax,NOT 3
cmp ax,bx
jnz api33_2
mov w[ebp+Int_FS],cx
mov fs,cx
api33_2:
mov ax,w[ebp+Int_GS]
and ax,0ffffh-3
and ax,NOT 3
cmp ax,bx
jnz api33_3
mov w[ebp+Int_GS],cx
Expand Down Expand Up @@ -2715,7 +2715,7 @@ _SetSelector proc near
cmp ebx,-1
jz api61_ok
add ebx,4095
and ebx,0FFFFFFFFh-4095
and ebx,NOT 4095
dec ebx
;
api61_ok:
Expand Down Expand Up @@ -2820,28 +2820,28 @@ _RelSelector proc near
push ax
push bx
push cx
and bx,0ffffh-3
and bx,NOT 3
xor cx,cx
mov ax,ds
and ax,0ffffh-3
and ax,NOT 3
cmp ax,bx
jnz api62_0
mov ds,cx
api62_0:
mov ax,es
and ax,0ffffh-3
and ax,NOT 3
cmp ax,bx
jnz api62_1
mov es,cx
api62_1:
mov ax,fs
and ax,0ffffh-3
and ax,NOT 3
cmp ax,bx
jnz api62_2
mov fs,cx
api62_2:
mov ax,gs
and ax,0ffffh-3
and ax,NOT 3
cmp ax,bx
jnz api62_3
mov gs,cx
Expand Down
8 changes: 4 additions & 4 deletions bld/causeway/asm/cw32.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ cw5_A20OFF:
shl eax,4 ;linear address.
mov ebx,eax
add eax,4095
and eax,0ffffffffh-4095 ;round up to next page.
and eax,NOT 4095 ;round up to next page.
sub eax,ebx
shr eax,4
mov bx,ax
Expand Down Expand Up @@ -1193,7 +1193,7 @@ cw5_OldWay:
shl eax,4 ;make linear.
mov ebx,eax
add eax,4095
and eax,0FFFFFFFFh-4095 ;round up to nearest page.
and eax,NOT 4095 ;round up to nearest page.
mov ecx,eax
sub ecx,ebx
shr ecx,4
Expand Down Expand Up @@ -1823,7 +1823,7 @@ cw5_VCPI:
shr edi,12 ;page number.
shl edi,2 ;*4 bytes per entry.
mov eax,es:[di] ;get physical address.
and eax,0FFFFFFFFh-4095 ;clear status bits.
and eax,NOT 4095 ;clear status bits.
mov VCPI_CR3,eax ;set VCPI CR3 value as well.
mov es,KernalTSSReal
xor di,di
Expand All @@ -1835,7 +1835,7 @@ cw5_VCPI:
shr edi,12 ;page number.
shl edi,2 ;*4 bytes per entry.
mov eax,es:[di] ;get physical address.
and eax,0FFFFFFFFh-4095 ;clear status bits.
and eax,NOT 4095 ;clear status bits.
or eax,111b ;user+write+present.
mov es,PageDirReal
mov di,1023*4
Expand Down
40 changes: 20 additions & 20 deletions bld/causeway/asm/ldt.asm
Original file line number Diff line number Diff line change
Expand Up @@ -116,26 +116,26 @@ RawRelDescriptor proc near
push eax
push ebx
push ecx
and ebx,0ffffh-7
and ebx,0ffffh AND (NOT 7) ;lose RPL & TI
xor ecx,ecx
xor eax,eax
mov ax,ds
and eax,not 7
and eax,not 7 ;lose RPL & TI
cmp eax,ebx
jnz ldt2_0
mov ds,cx
ldt2_0: mov ax,es
and eax,not 7
and eax,not 7 ;lose RPL & TI
cmp eax,ebx
jnz ldt2_1
mov es,cx
ldt2_1: mov ax,fs
and eax,not 7
and eax,not 7 ;lose RPL & TI
cmp eax,ebx
jnz ldt2_2
mov fs,cx
ldt2_2: mov ax,gs
and eax,not 7
and eax,not 7 ;lose RPL & TI
cmp eax,ebx
jnz ldt2_3
mov gs,cx
Expand All @@ -151,12 +151,12 @@ ldt2_3:
mov ax,KernalDS ;make our data addresable.
mov ds,ax
assume ds:_cwRaw
mov ax,KernalZero ;make LDT addresable.
mov ax,KernalZero ;make LDT addresable.
mov es,ax
movzx esi,bx ;Get selector to use.
shr esi,3 ;/8 for descriptor number.
movzx esi,bx ;Get selector to use.
shr esi,3 ;/8 for descriptor number.
add esi,MDTLinear+4
mov BYTE PTR es:[esi],0 ;mark this entry as free.
mov BYTE PTR es:[esi],0 ;mark this entry as free.
movzx esi,bx
and esi,not 7
add esi,MDTLinear
Expand Down Expand Up @@ -333,18 +333,18 @@ RawSetSelLimit proc near
mov ax,KernalDS ;make our data addresable.
mov ds,ax
assume ds:_cwRaw
mov ax,KernalZero ;make LDT addresable.
mov ax,KernalZero ;make LDT addresable.
mov es,ax
movzx esi,bx ;Get the selector.
and si,0ffffh-7 ;lose RPL & TI.
add esi,MDTLinear ;offset into descriptor table.
movzx esi,bx ;Get the selector.
and si,NOT 7 ;lose RPL & TI.
add esi,MDTLinear ;offset into descriptor table.
shl ecx,16
mov cx,dx
xor al,al
cmp ecx,100000h ; see if we need to set g bit
cmp ecx,100000h ; see if we need to set g bit
jc ldt5_2
shr ecx,12 ; div by 4096
or al,80h ; set g bit
shr ecx,12 ; div by 4096
or al,80h ; set g bit
ldt5_2: mov es:[esi],cx ;store low word of limit.
shr ecx,16
or cl,al
Expand Down Expand Up @@ -380,11 +380,11 @@ RawSetSelBase proc near
mov ax,KernalDS ;make our data addressable.
mov ds,ax
assume ds:_cwRaw
mov ax,KernalZero ;make LDT addressable.
mov ax,KernalZero ;make LDT addressable.
mov es,ax
movzx esi,bx ;Get the selector.
and si,0ffffh-7 ;lose RPL & TI.
add esi,MDTLinear ;offset into descriptor table.
movzx esi,bx ;Get the selector.
and si,NOT 7 ;lose RPL & TI.
add esi,MDTLinear ;offset into descriptor table.
mov es:[esi+4],cl ;base mid.
mov es:[esi+7],ch ;base high.
mov es:[esi+2],dx ;base low.
Expand Down
34 changes: 17 additions & 17 deletions bld/causeway/asm/memory.asm
Original file line number Diff line number Diff line change
Expand Up @@ -814,11 +814,11 @@ mem5_2: call PhysicalGetPage
jnc mem5_3
call UnMapPhysical
jc mem5_10
mem5_3: and ecx,1 ;put user bits in useful place.
mem5_3: and ecx,1 ;put user bits in useful place.
shl ecx,10
and edx,0FFFFFFFFh-4095 ;lose user bits.
and edx,NOT 4095 ;lose user bits.
or edx,111b ;present+user+write.
or edx,ecx ;set use flags.
or edx,ecx ;set use flags.
mov DWORD PTR es:[edi],edx ;store this tables address.
push edi
sub edi,PageDirLinear
Expand Down Expand Up @@ -1126,10 +1126,10 @@ RawUnLockMemory proc near
shl esi,16
mov si,di
add esi,ebx
and ebx,0FFFFFFFFh-4095 ;round down to nearest page.
and ebx,NOT 4095 ;round down to nearest page.
mov d[_LM_BlockBase],ebx
add esi,4095
and esi,0FFFFFFFFh-4095 ;round up to next page.
and esi,NOT 4095 ;round up to next page.
dec esi
mov d[_LM_BlockEnd],esi ;store address of last page.
;
Expand Down Expand Up @@ -1737,11 +1737,11 @@ MapPhysical proc near
mov ax,KernalZero ;make everything addresable.
mov es,ax
;
and ecx,1 ;put user bits in useful place.
and ecx,1 ;put user bits in useful place.
shl ecx,10
and edx,0FFFFFFFFh-4095 ;lose user bits.
mov eax,LinearEntry ;get new entry number.
shr eax,10 ;/1024 for page dir entry.
and edx,NOT 4095 ;lose user bits.
mov eax,LinearEntry ;get new entry number.
shr eax,10 ;/1024 for page dir entry.
;
mov esi,PageDirLinear ;get page table address.
test DWORD PTR es:[esi+eax*4],1 ;this page present?
Expand Down Expand Up @@ -1909,7 +1909,7 @@ mem11_ok:
;
mov eax,LinearEntry ;get new entry number.
mov esi,1024*4096*1023 ;base of page alias's.
and DWORD PTR es:[esi+eax*4],0FFFFFFFFh-(3 shl 5) ;clear accesed & dirty bits.
and DWORD PTR es:[esi+eax*4],NOT (3 shl 5) ;clear accesed & dirty bits.
call EmuCR3Flush
;
mem11_NoRead:
Expand Down Expand Up @@ -2166,10 +2166,10 @@ mem12_error_anyway:
mem12_5:
;Now remove it from the page table and exit.
;
and DWORD PTR fs:[edi],0FFFFFFFFh-1 ;mark as not present.
and DWORD PTR fs:[edi],NOT 1;mark as not present.
mov edx,fs:[edi] ;get page entry.
mov ecx,edx
and edx,0FFFFFFFFh-4095 ;lose flag bits.
and edx,NOT 4095 ;lose flag bits.
shr ecx,10
and ecx,1 ;preserve user flags.
call EmuCR3Flush
Expand Down Expand Up @@ -2779,29 +2779,29 @@ RawRelDOSMemory proc near
push ebx
push ecx
mov ebx,edx
and ebx,0ffffh-7
and ebx,0ffffh AND (NOT 7) ;lose RPL & TI
xor ecx,ecx
xor eax,eax
mov ax,ds
and eax,not 7
and eax,not 7 ;lose RPL & TI
cmp eax,ebx
jnz mem21_z0
mov ds,cx
mem21_z0:
mov ax,es
and eax,not 7
and eax,not 7 ;lose RPL & TI
cmp eax,ebx
jnz mem21_z1
mov es,cx
mem21_z1:
mov ax,fs
and eax,not 7
and eax,not 7 ;lose RPL & TI
cmp eax,ebx
jnz mem21_z2
mov fs,cx
mem21_z2:
mov ax,gs
and eax,not 7
and eax,not 7 ;lose RPL & TI
cmp eax,ebx
jnz mem21_z3
mov gs,cx
Expand Down
Loading
Loading