📄 config.a86
字号:
; File : $CONFIG.A86$
;
; Description :
;
; Original Author : DIGITAL RESEARCH
;
; Last Edited By : $CALDERA$
;
;-----------------------------------------------------------------------;
; Copyright Work of Caldera, Inc. All Rights Reserved.
;
; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL,
; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC.
; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES
; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF
; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO
; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE
; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE
; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED,
; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED,
; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST,
; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF
; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT
; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND
; CIVIL LIABILITY.
;-----------------------------------------------------------------------;
;
; *** Current Edit History ***
; *** End of Current Edit History ***
;
; $Log$
;
; CONFIG.A86 1.35 93/12/01 18:30:29
; nls_temp_area grows to 258 bytes
; CONFIG.A86 1.34 93/11/28 15:30:27
; Support HIBUFFERS in UMB's
; CONFIG.A86 1.32 93/11/22 15:02:14
; Bus Master checks do Int 21/0D before/after to discard any buffers
; CONFIG.A86 1.30 93/11/18 18:02:26
; Add primitive multi-master checking
; CONFIG.A86 1.27 93/11/04 16:34:24
; Extra callout to STACKER to determine if a drive is valid
; CONFIG.A86 1.26 93/11/03 17:00:19
; Stop dblspace phantom drives from appearing (FATsize=0)
; CONFIG.A86 1.25 93/09/14 20:12:24
; Initialise LFLG_PHYSICAL better - allow for zero FAT's meaning phantom drive
; CONFIG.A86 1.24 93/09/02 22:34:50
; Add header to system allocations
; CONFIG.A86 1.23 93/08/06 20:55:23
; re-arrange device init order for SCREATE.SYS on a VDISK.SYS
; CONFIG.A86 1.22 93/08/02 14:45:55
; hide preload drives from func_device
; CONFIG.A86 1.20 93/07/28 19:19:08
; call to SetupHMA before AllocHMA in setup_buffers allows buffers to go high
; on novell memory managers
; ENDLOG
include config.equ
include i:msdos.equ
include i:char.def
include i:reqhdr.equ
include i:driver.equ
include i:fdos.equ
include i:f52data.def ; Function 52 DOS Data Area
include i:doshndl.def ; DOS Handle Structure Definition
include i:country.def
TRUE equ 0FFFFh ; value of TRUE
FALSE equ 0 ; value of FALSE
CGROUP group INITCODE, INITDATA
INITCODE CSEG PARA 'INITCODE'
extrn AllocHMA:near
extrn SetupHMA:near
extrn alloc_instseg:near ; Allocate "Segment" Instance Memory
extrn alloc_hiseg:near ; Allocate "Segment" High Memory
extrn alloc_seg:near ; Allocate "Segment" Memory
extrn config_process:near
extrn InitStacks:near
extrn HookInt2F:near
extrn UnhookInt2F:near
extrn Verify386:near
Public config_init
config_init: ; Initialize the CONFIG data
ret
Public country_init
country_init:
;------------
push ds
push es
push di
push si
; Obtain the address of the DBCS table in the BDOS.
mov ax, 06507h ; Extended Country Info: get DBCS ptr
mov bx, 0FFFFh ; codepage number: -1 for global cp
mov cx, 00005h ; size of info. buffer
mov dx, 0FFFFh ; country code: -1 for current country
mov di, offset dbcs_buf
push ds
pop es ; es:di -> 5 byte buffer
int DOS_INT ; returns with buffer filled in
; Get the current country information.
mov dx, offset ctry_info ; ds:dx -> buffer to be filled in
mov ax, 03800h ; get current country info
int DOS_INT
jnc ctry_info_done ; no carry = no error
; Failed to get country info. Place dummy uppercase routine in table.
mov si, offset ctry_info
mov CI_CASEOFF[si], offset myretf
mov CI_CASESEG[si], cs
mov bx, country_code
ctry_info_done:
mov country_code, bx
pop si
pop di
pop es
pop ds
ret
myretf: retf
;
; CONFIG is called after the BIOS INIT code has been relocated to high
; memory, the BIOS and BDOS have been initialised.
;
Public config ; Process CONFIG.SYS, loading and
config: ; initialising device drivers
call country_init ; initialise DBCS tbl and country info
mov ax,max_secsize ; get maximum sector size in BIOS
les bx,func52_ptr
cmp ax,es:F52_SECSIZE[bx] ; larger than default?
jbe cfg_skip ; skip if not
mov es:F52_SECSIZE[bx],ax ; else update sector size
cfg_skip:
call cpu_init ; initialise CPU type
push ds ! pop es
call config_process ; Process CONFIG.SYS
cmp num_files,MIN_NUM_FILES ; Ensure the Minimum number of File
jae cfg_ex10 ; have been allocated.
mov num_files,MIN_NUM_FILES
cfg_ex10:
xor ax,ax
mov al,init_buf ; now ensure we have allocated
mov num_buf,ax ; the correct number of buffers
call SetupDeblocking ; do our thing with deblocking
call config_finish ; clean up configuration
call setup_fopen ; allocate disk hashing
call setup_history
ret
cpu_init:
; If we are on a 386 or above set CPU flag
call Verify386 ; make sure it's a 386
jc cpu_init10 ; skip setting falg if not
les bx,func52_ptr
mov es:F52_CPU_TYPE[bx],1 ; we have a 386 !
cpu_init10:
stc ; it's not a 386
ret
SetupDeblocking:
;---------------
; Some types of hard disk controller give us problems with disk access of
; mapped memory (eg. upper memory, LIM pages).
; We can force single sector deblocking in the disk driver to avoid these
; problems. On DRDOS 5/6 our default was single sector I/O above A000, but
; this gives performance problems when devices/tsr's are loaded into upper
; memory (eg. STACKER, SERVER). To avoid this we use the following strategy.
;
; Default for CONFIG is A000, and may be updated at any time by a DEBLOCK=
; statement. If this happens the user setting has priority.
;
; At the end of CONFIG, assume no user supplied setting, we do some simple
; tests for multi-master controllers. If these fail we leave the settings
; at A000. If they succeed we go ahead and change the default setting to
; deblock at FFFF. The test is to read the 1st sector into low memory, and
; again into upper memory. If we read the same thing then assume all is well.
; If we can't do this leave the deblocking set at A000.
;
; NB. We will still have problems from LIM, and from DMA crossing page
; boundaries on some memory managers (eg. DRDOS 5.0)
;
les bx,func52_ptr
lea bx,F52_DEVROOT[bx] ; ES:BX -> NUL device link
cmp DeblockSetByUser,FALSE
je SetupDeblocking20 ; the user is king
SetupDeblocking10:
push cs ! pop es ; ES -> local data again
ret
SetupDeblocking20: ; get next device driver
les bx,es:[bx] ; we want resident disk device
cmp bx,0FFFFh ; end of the chain ?
je SetupDeblocking10
test es:word ptr 4[bx],8000h
jnz SetupDeblocking20 ; we assume one disk device at 70:xxxx
mov ax,es
cmp ax,cs:bios_seg ; scan for resident disk in IO.SYS
jne SetupDeblocking20
cmp es:word ptr 18[bx],0EDCh
jne SetupDeblocking20 ; is it our disk driver ?
lea ax,22[bx] ; deblocking variable is here
mov deblockOffset,ax ; remember that for fixups
mov deblockSeg,es
mov ax,es:DH_STRATEGY[bx] ; Set up the STRATEGY Entry Point
mov strategy_off,ax
mov strategy_seg,es
mov ax,es:DH_INTERRUPT[bx] ; Set up the INTERRUPT Entry Point
mov interrupt_off,ax
mov interrupt_seg,es
mov al,es:DH_NAME[bx] ; get # supported units
cbw
mov numUnits,ax ; remember for later
mov ax,(MS_M_STRATEGY*256)+1; set allocation strategy
mov bl,42h ; to last fit, upper only
int DOS_INT
mov bx,512/16 ; we need a 512 byte buffer
mov ah, MS_M_ALLOC ; try to allocate on in upper memory
int DOS_INT
jc SetupDeblocking50
mov UpperMemoryBuffer,ax ; use this for deblocking checks
mov cx,numUnits ; CX = # of drives supported
mov dx,'C'-'A' ; start with drive C:
sub cx,dx ; CX = # of potential hard disks
jbe SetupDeblocking40 ; skip tests if none
SetupDeblocking30: ; DX = next drive, CX = drive count
push cx ! push dx
call BusMasterCheck ; check if drive DL bus master disk
pop dx ! pop cx
jc SetupDeblocking40 ; is so leave deblocking alone
inc dx ; else move to next drive
loop SetupDeblocking30 ; repeat for all drives
les bx,deblockPointer
mov es:word ptr [bx],0FFFFh ; safe to disable deblocking
SetupDeblocking40:
mov es,UpperMemoryBuffer
mov ah,MS_M_FREE
int DOS_INT ; free the upper memory buffer
SetupDeblocking50:
mov ax,(MS_M_STRATEGY*256)+1; set allocation strategy
mov bl,0 ; to first fit
int DOS_INT
push cs ! pop es ; ES -> local data again
ret
BusMasterCheck: ; determine if we have an old troublesome controller
;--------------
; On Entry:
; DL = drive to check (zero based)
; On Exit:
; CY set if troublesome drive
;
call BusMasterRemovable ; is it a removable device ?
jnc BMCheck10 ; yes, skip the checks
mov ax,mem_current ; read into low memory
call BusMasterRead ; read one sector from disk
jc BMCheck10 ; give up if we couldn't read
mov es,mem_current ; ensure at least the 1st word will
mov ax,es:.0 ; differ if the read doesn't happen
not ax
mov es,UpperMemoryBuffer
mov es:.0,ax
mov ax,UpperMemoryBuffer ; read into upper memory
call BusMasterRead ; read one sector from disk
jc BMCheck10 ; give up if we couldn't read
xor si,si
xor di,di
mov cx,512/2
mov es,mem_current
mov ds,UpperMemoryBuffer
repe cmpsw ; does the sector match ?
push cs ! pop ds
je BMCheck10 ; yes, everything is fine
stc ; no, better leave DEBLOCK at A000
BMCheck10:
ret
BusMasterRemovable:
;------------------
; On Entry:
; DL = drive
; On Exit:
; CY set if not a removable drive
; DL preserved
;
push cs ! pop es
mov bx,offset removableMediaRequest
mov es:RH_UNIT[bx],dl
callf cs:strategy
callf cs:interrupt
test es:RH_STATUS[bx],RHS_BUSY
jz BusMasterRemovable10
stc ; busy bit set, it's a hard disk
BusMasterRemovable10:
ret
BusMasterRead: ; Read first sector from drive BL
;-------------
; On Entry:
; AX = segment of buffer
; DL = 02 for C:, 03 for D:, etc.
; Exit:
; CY clear if deblocking not required
; DL preserved
;
les bx,deblockPointer
mov es:word ptr [bx],0FFFFh ; no deblocking during the test
push cs ! pop es
mov bx,offset readRequest
mov es:RH_UNIT[bx],dl
mov es:RH4_BUFOFF[bx],0
mov es:RH4_BUFSEG[bx],ax
mov es:RH4_COUNT[bx],1
callf cs:strategy
callf cs:interrupt
test es:RH_STATUS[bx],RHS_ERROR
jz BusMasterRead10
stc ; error bit set, say we had a problem
BusMasterRead10:
les bx,deblockPointer
mov es:word ptr [bx],0A000h ; enable deblocking again
ret
Public setup_stacks
setup_stacks:
mov cx,num_stacks ; we want this many stacks
jcxz setup_stacks10 ; skip if we don't want any
mov dx,stack_size ; they should be this big
call InitStacks ; initialise the stacks
setup_stacks10:
ret
setup_history:
test history_flg,RLF_ENHANCED
jz setup_hist10 ; if history not enabled just exit
push es
les bx,drdos_ptr ; Get the internal data area
mov si,es:DRDOS_HIST1CTL[bx]; Get the address of History Control
mov ax,history_size ; Get Offset buffer for History data
call setup_hist20 ; Allocate Buffer 1
mov si,es:DRDOS_HIST2CTL[bx]; Get the address of History Control 2
mov ax,history_size ; Get Offset buffer for History data
call setup_hist20 ; Allocate Buffer 2
mov al,history_flg ; copy history state
mov es:DRDOS_HISTFLG[bx],al ; into DRDOS data area
pop es
setup_hist10:
ret
setup_hist20:
and ax,not 15 ; round to a complete paragraph
add ax,16 ; always be a para bigger
mov es:word ptr 02[si],ax ; Buffer Tail Address
mov cl,4
push ax ; save buffers size in bytes
shr ax,cl ; convert to para's
mov dl,'H' ; History buffer
call alloc_instseg ; Allocate Buffer
mov es:word ptr 00[si],ax ; Buffer Start Address
pop cx ; recover buffer size in bytes
push es
mov es,ax ; point ES at buffer seg
xor di,di ; ES:DI -> buffer
xor ax,ax ; zero it
rep stosb ; before use
pop es
ret
Public device_init, resident_device_init
; DEVICE_INIT will initialise the device with the Device Header at
; ES:BX
;
; Entry:
; ES:DI Address of First Device Header
; DS:SI Command Line Parameters
;
; Exit:
; AX Top bit set on error, error code in AL
;
device_init:
;-----------
push es ! push di
call build_cmd_tail ; point DS:SI to dos style cmd line
pop di ! pop es
call HookInt2F ; hook the Int 2F vector
call resident_device_init
call UnhookInt2F ; get off the Int 2F vector
test ax,ax ; set the flags
ret
resident_device_init:
;--------------------
mov rel_unit,0 ; set rel unit to zero for block devices
mov dev_count,0
mov bx,offset request_hdr ; ds:bx -> command block
if TRUE
mov ax,mem_max ; AX:0 -> top of available memory
mov ds:RH0_RESIDENT,0 ; pass to the device driver
mov ds:RH0_RESIDENT+2,ax ; in the RESIDENT field
else
mov ds:RH0_RESIDENT,di ; Force the default RESIDENT field
mov ds:RH0_RESIDENT+2,es ; to be the error condition
endif
dev_i10:
push si
push es ! push di
call save_vecs ; save interrupt vectors
mov bx,offset request_hdr ; ds:bx -> command block
call dev_init ; initialise the device driver
test es:DH_ATTRIB[di],DA_CHARDEV
jnz dev_i18 ; skip if a character device
cmp ds:RH0_NUNITS,0 ; no drives installed for disk device?
je dev_i_err ; failed if no drives found
dev_i18:
mov ax,ds:RH0_RESIDENT ; Calculate the address of
mov cl,4 ; last paragraph used by the
shr ax,cl ; device driver. If this is the
add ax,ds:RH0_RESIDENT+2 ; device driver CS then error
test ds:RH0_RESIDENT,15 ; allow for partial para ?
jz dev_i19
inc ax ; round it up
dev_i19:
cmp ax,strategy_seg
jbe dev_i_err
cmp ax,mem_max ; Check for Memory Overflow
jb dev_i30 ; if it does then we can't install
call restore_vecs ; so replace interrupt vectors
dev_i_err: ; device initialization failed!
les di,cs:func52_ptr ; ES:DI -> internal data
mov ax,es
or ax,di ; DOS data area present yet?
pop di ! pop es ; recover the device header
les di,es:DH_NEXT[di] ; try next device driver
jz dev_i60 ; if it's resident initialisation
mov di,0FFFFh ; else stop now
jmps dev_i60
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -