forked from KolibriOS/kolibrios
new kernel
git-svn-id: svn://kolibrios.org@164 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
0e39a3fffe
commit
b6950333ac
268
kernel/trunk/PROC32.INC
Normal file
268
kernel/trunk/PROC32.INC
Normal file
@ -0,0 +1,268 @@
|
||||
|
||||
; Macroinstructions for defining and calling procedures
|
||||
|
||||
macro stdcall proc,[arg] ; directly call STDCALL procedure
|
||||
{ common
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushd arg
|
||||
common
|
||||
end if
|
||||
call proc }
|
||||
|
||||
macro invoke proc,[arg] ; indirectly call STDCALL procedure
|
||||
{ common
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushd arg
|
||||
common
|
||||
end if
|
||||
call [proc] }
|
||||
|
||||
macro ccall proc,[arg] ; directly call CDECL procedure
|
||||
{ common
|
||||
size@ccall = 0
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushd arg
|
||||
size@ccall = size@ccall+4
|
||||
common
|
||||
end if
|
||||
call proc
|
||||
if size@ccall
|
||||
add esp,size@ccall
|
||||
end if }
|
||||
|
||||
macro cinvoke proc,[arg] ; indirectly call CDECL procedure
|
||||
{ common
|
||||
size@ccall = 0
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushd arg
|
||||
size@ccall = size@ccall+4
|
||||
common
|
||||
end if
|
||||
call [proc]
|
||||
if size@ccall
|
||||
add esp,size@ccall
|
||||
end if }
|
||||
|
||||
macro proc [args] ; define procedure
|
||||
{ common
|
||||
match name params, args>
|
||||
\{ define@proc name,<params \} }
|
||||
|
||||
prologue@proc equ prologuedef
|
||||
|
||||
macro prologuedef procname,flag,parmbytes,localbytes,reglist
|
||||
{ if parmbytes | localbytes
|
||||
push ebp
|
||||
mov ebp,esp
|
||||
if localbytes
|
||||
sub esp,localbytes
|
||||
end if
|
||||
end if
|
||||
irps reg, reglist \{ push reg \} }
|
||||
|
||||
epilogue@proc equ epiloguedef
|
||||
|
||||
macro epiloguedef procname,flag,parmbytes,localbytes,reglist
|
||||
{ irps reg, reglist \{ reverse pop reg \}
|
||||
if parmbytes | localbytes
|
||||
leave
|
||||
end if
|
||||
if flag and 10000b
|
||||
retn
|
||||
else
|
||||
retn parmbytes
|
||||
end if }
|
||||
|
||||
macro define@proc name,statement
|
||||
{ local params,flag,regs,parmbytes,localbytes,current
|
||||
if used name
|
||||
name:
|
||||
match =stdcall args, statement \{ params equ args
|
||||
flag = 11b \}
|
||||
match =stdcall, statement \{ params equ
|
||||
flag = 11b \}
|
||||
match =c args, statement \{ params equ args
|
||||
flag = 10001b \}
|
||||
match =c, statement \{ params equ
|
||||
flag = 10001b \}
|
||||
match =params, params \{ params equ statement
|
||||
flag = 0 \}
|
||||
virtual at ebp+8
|
||||
match =uses reglist=,args, params \{ regs equ reglist
|
||||
params equ args \}
|
||||
match =regs =uses reglist, regs params \{ regs equ reglist
|
||||
params equ \}
|
||||
match =regs, regs \{ regs equ \}
|
||||
match =,args, params \{ defargs@proc args \}
|
||||
match =args@proc args, args@proc params \{ defargs@proc args \}
|
||||
parmbytes = $ - (ebp+8)
|
||||
end virtual
|
||||
name # % = parmbytes/4
|
||||
all@vars equ
|
||||
current = 0
|
||||
match prologue:reglist, prologue@proc:<regs> \{ prologue name,flag,parmbytes,localbytes,reglist \}
|
||||
macro locals
|
||||
\{ virtual at ebp-localbytes+current
|
||||
macro label . \\{ deflocal@proc .,:, \\}
|
||||
struc db [val] \\{ \common deflocal@proc .,db,val \\}
|
||||
struc dw [val] \\{ \common deflocal@proc .,dw,val \\}
|
||||
struc dp [val] \\{ \common deflocal@proc .,dp,val \\}
|
||||
struc dd [val] \\{ \common deflocal@proc .,dd,val \\}
|
||||
struc dt [val] \\{ \common deflocal@proc .,dt,val \\}
|
||||
struc dq [val] \\{ \common deflocal@proc .,dq,val \\}
|
||||
struc rb cnt \\{ deflocal@proc .,rb cnt, \\}
|
||||
struc rw cnt \\{ deflocal@proc .,rw cnt, \\}
|
||||
struc rp cnt \\{ deflocal@proc .,rp cnt, \\}
|
||||
struc rd cnt \\{ deflocal@proc .,rd cnt, \\}
|
||||
struc rt cnt \\{ deflocal@proc .,rt cnt, \\}
|
||||
struc rq cnt \\{ deflocal@proc .,rq cnt, \\} \}
|
||||
macro endl
|
||||
\{ purge label
|
||||
restruc db,dw,dp,dd,dt,dq
|
||||
restruc rb,rw,rp,rd,rt,rq
|
||||
restruc byte,word,dword,pword,tword,qword
|
||||
current = $-(ebp-localbytes)
|
||||
end virtual \}
|
||||
macro ret operand
|
||||
\{ match any, operand \\{ retn operand \\}
|
||||
match , operand \\{ match epilogue:reglist, epilogue@proc:<regs>
|
||||
\\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \}
|
||||
macro finish@proc \{ localbytes = (((current-1) shr 2)+1) shl 2
|
||||
end if \} }
|
||||
|
||||
macro defargs@proc [arg]
|
||||
{ common
|
||||
if ~ arg eq
|
||||
forward
|
||||
local ..arg,current@arg
|
||||
match argname:type, arg
|
||||
\{ current@arg equ argname
|
||||
label ..arg type
|
||||
argname equ ..arg
|
||||
if dqword eq type
|
||||
dd ?,?,?,?
|
||||
else if tbyte eq type
|
||||
dd ?,?,?
|
||||
else if qword eq type | pword eq type
|
||||
dd ?,?
|
||||
else
|
||||
dd ?
|
||||
end if \}
|
||||
match =current@arg,current@arg
|
||||
\{ current@arg equ arg
|
||||
arg equ ..arg
|
||||
..arg dd ? \}
|
||||
common
|
||||
args@proc equ current@arg
|
||||
forward
|
||||
restore current@arg
|
||||
common
|
||||
end if }
|
||||
|
||||
macro deflocal@proc name,def,[val]
|
||||
{ common
|
||||
match vars, all@vars \{ all@vars equ all@vars, \}
|
||||
all@vars equ all@vars name
|
||||
forward
|
||||
local ..var,..tmp
|
||||
..var def val
|
||||
match =?, val \{ ..tmp equ \}
|
||||
match any =dup (=?), val \{ ..tmp equ \}
|
||||
match tmp : value, ..tmp : val
|
||||
\{ tmp: end virtual
|
||||
initlocal@proc ..var,def value
|
||||
virtual at tmp\}
|
||||
common
|
||||
match first rest, ..var, \{ name equ first \} }
|
||||
|
||||
macro initlocal@proc name,def
|
||||
{ virtual at name
|
||||
def
|
||||
size@initlocal = $ - name
|
||||
end virtual
|
||||
position@initlocal = 0
|
||||
while size@initlocal > position@initlocal
|
||||
virtual at name
|
||||
def
|
||||
if size@initlocal - position@initlocal < 2
|
||||
current@initlocal = 1
|
||||
load byte@initlocal byte from name+position@initlocal
|
||||
else if size@initlocal - position@initlocal < 4
|
||||
current@initlocal = 2
|
||||
load word@initlocal word from name+position@initlocal
|
||||
else
|
||||
current@initlocal = 4
|
||||
load dword@initlocal dword from name+position@initlocal
|
||||
end if
|
||||
end virtual
|
||||
if current@initlocal = 1
|
||||
mov byte [name+position@initlocal],byte@initlocal
|
||||
else if current@initlocal = 2
|
||||
mov word [name+position@initlocal],word@initlocal
|
||||
else
|
||||
mov dword [name+position@initlocal],dword@initlocal
|
||||
end if
|
||||
position@initlocal = position@initlocal + current@initlocal
|
||||
end while }
|
||||
|
||||
macro endp
|
||||
{ purge ret,locals,endl
|
||||
finish@proc
|
||||
purge finish@proc
|
||||
restore regs@proc
|
||||
match all,args@proc \{ restore all \}
|
||||
restore args@proc
|
||||
match all,all@vars \{ restore all \} }
|
||||
|
||||
macro local [var]
|
||||
{ common
|
||||
locals
|
||||
forward done@local equ
|
||||
match varname[count]:vartype, var
|
||||
\{ match =BYTE, vartype \\{ varname rb count
|
||||
restore done@local \\}
|
||||
match =WORD, vartype \\{ varname rw count
|
||||
restore done@local \\}
|
||||
match =DWORD, vartype \\{ varname rd count
|
||||
restore done@local \\}
|
||||
match =PWORD, vartype \\{ varname rp count
|
||||
restore done@local \\}
|
||||
match =QWORD, vartype \\{ varname rq count
|
||||
restore done@local \\}
|
||||
match =TBYTE, vartype \\{ varname rt count
|
||||
restore done@local \\}
|
||||
match =DQWORD, vartype \\{ label varname dqword
|
||||
rq count+count
|
||||
restore done@local \\}
|
||||
match , done@local \\{ virtual
|
||||
varname vartype
|
||||
end virtual
|
||||
rb count*sizeof.\#vartype
|
||||
restore done@local \\} \}
|
||||
match :varname:vartype, done@local:var
|
||||
\{ match =BYTE, vartype \\{ varname db ?
|
||||
restore done@local \\}
|
||||
match =WORD, vartype \\{ varname dw ?
|
||||
restore done@local \\}
|
||||
match =DWORD, vartype \\{ varname dd ?
|
||||
restore done@local \\}
|
||||
match =PWORD, vartype \\{ varname dp ?
|
||||
restore done@local \\}
|
||||
match =QWORD, vartype \\{ varname dq ?
|
||||
restore done@local \\}
|
||||
match =TBYTE, vartype \\{ varname dt ?
|
||||
restore done@local \\}
|
||||
match =DQWORD, vartype \\{ label varname dqword
|
||||
dq ?,?
|
||||
restore done@local \\}
|
||||
match , done@local \\{ varname vartype
|
||||
restore done@local \\} \}
|
||||
match ,done@local
|
||||
\{ var
|
||||
restore done@local \}
|
||||
common
|
||||
endl }
|
@ -474,6 +474,9 @@ apm_end:
|
||||
cmp ax,0x004f
|
||||
mov si, novesa-0x10000
|
||||
jnz @f
|
||||
mov bx, word [es:di+0x12]
|
||||
shl ebx,16
|
||||
mov [es:0x9050], ebx
|
||||
mov ax,[es:di+4]
|
||||
add ax,'0'*256+'0'
|
||||
mov si,vervesa-0x10000
|
||||
@ -824,7 +827,7 @@ end if
|
||||
mov al, 32 ; BPP
|
||||
jb @f
|
||||
mov [es:0x9000], al
|
||||
mov dword [es:0x9018], 0x800000
|
||||
mov dword [es:0x9018], 0xFFFFFFFF; 0x800000
|
||||
@@:
|
||||
mov [es:0x9008],bx
|
||||
mov [es:0x900A],cx
|
||||
@ -1230,37 +1233,41 @@ sayerr_floppy:
|
||||
; PAGE TABLE
|
||||
|
||||
push dword [es:0x9018]
|
||||
|
||||
map_mem equ 64 ; amount of memory to map
|
||||
|
||||
;
|
||||
; mmap_mem equ 64 ; amount of memory to map
|
||||
;
|
||||
push 0x6000
|
||||
pop es ; es:di = 6000:0
|
||||
xor di,di
|
||||
mov cx,256*map_mem ; Map (mapmem) M
|
||||
; initialize as identity mapping
|
||||
xor eax, eax
|
||||
call pagetable_set
|
||||
|
||||
|
||||
; xor di,di
|
||||
; mov cx,256*mmap_mem ; Map (mapmem) M
|
||||
;; initialize as identity mapping
|
||||
; xor eax, eax
|
||||
; call pagetable_set
|
||||
;
|
||||
;
|
||||
; 4 KB PAGE DIRECTORY
|
||||
|
||||
;
|
||||
push 0x7F00
|
||||
pop es ; es:di = 7F00:0
|
||||
xor di, di
|
||||
mov cx, 64 / 4
|
||||
mov eax, 0x60007 ; for 0 M
|
||||
call pagetable_set
|
||||
xor si,si
|
||||
mov di,second_base_address shr 20
|
||||
mov cx,64/2
|
||||
rep movs word [es:di], [es:si]
|
||||
; xor di, di
|
||||
; mov cx, 64 / 4
|
||||
; mov eax, 0x60007 ; for 0 M
|
||||
; call pagetable_set
|
||||
; xor si,si
|
||||
; mov di,second_base_address shr 20
|
||||
; mov cx,64/2
|
||||
; rep movs word [es:di], [es:si]
|
||||
|
||||
mov eax, 0x7F000 +8+16 ; Page directory and enable caches
|
||||
mov cr3, eax
|
||||
; mov eax, 0x7F000 +8+16 ; Page directory and enable caches
|
||||
; mov cr3, eax
|
||||
|
||||
; SET GRAPHICS
|
||||
|
||||
pop es
|
||||
|
||||
xor ax, ax
|
||||
mov es, ax
|
||||
|
||||
mov ax,[es:0x9008] ; vga & 320x200
|
||||
mov bx, ax
|
||||
cmp ax,0x13
|
||||
|
438
kernel/trunk/const.inc
Normal file
438
kernel/trunk/const.inc
Normal file
@ -0,0 +1,438 @@
|
||||
|
||||
|
||||
drw0 equ 10010010b ; data read/write dpl0
|
||||
drw3 equ 11110010b ; data read/write dpl3
|
||||
cpl0 equ 10011010b ; code read dpl0
|
||||
cpl3 equ 11111010b ; code read dpl3
|
||||
|
||||
D32 equ 01000000b ; 32bit segment
|
||||
G32 equ 10000000b ; page gran
|
||||
|
||||
|
||||
;;;;;;;;;;;;cpu_caps flags;;;;;;;;;;;;;;;;
|
||||
|
||||
CPU_386 equ 3
|
||||
CPU_486 equ 4
|
||||
CPU_PENTIUM equ 5
|
||||
CPU_P6 equ 6
|
||||
CPU_PENTIUM4 equ 0x0F
|
||||
|
||||
CAPS_FPU equ 00 ;on-chip x87 floating point unit
|
||||
CAPS_VME equ 01 ;virtual-mode enhancements
|
||||
CAPS_DE equ 02 ;debugging extensions
|
||||
CAPS_PSE equ 03 ;page-size extensions
|
||||
CAPS_TSC equ 04 ;time stamp counter
|
||||
CAPS_MSR equ 05 ;model-specific registers
|
||||
CAPS_PAE equ 06 ;physical-address extensions
|
||||
CAPS_MCE equ 07 ;machine check exception
|
||||
CAPS_CX8 equ 08 ;CMPXCHG8B instruction
|
||||
CAPS_APIC equ 09 ;on-chip advanced programmable
|
||||
; interrupt controller
|
||||
; 10 ;unused
|
||||
CAPS_SEP equ 11 ;SYSENTER and SYSEXIT instructions
|
||||
CAPS_MTRR equ 12 ;memory-type range registers
|
||||
CAPS_PGE equ 13 ;page global extension
|
||||
CAPS_MCA equ 14 ;machine check architecture
|
||||
CAPS_CMOV equ 15 ;conditional move instructions
|
||||
CAPS_PAT equ 16 ;page attribute table
|
||||
|
||||
CAPS_PSE36 equ 17 ;page-size extensions
|
||||
CAPS_PSN equ 18 ;processor serial number
|
||||
CAPS_CLFLUSH equ 19 ;CLFUSH instruction
|
||||
|
||||
CAPS_DS equ 21 ;debug store
|
||||
CAPS_ACPI equ 22 ;thermal monitor and software
|
||||
;controlled clock supported
|
||||
CAPS_MMX equ 23 ;MMX instructions
|
||||
CAPS_FXSR equ 24 ;FXSAVE and FXRSTOR instructions
|
||||
CAPS_SSE equ 25 ;SSE instructions
|
||||
CAPS_SSE2 equ 26 ;SSE2 instructions
|
||||
CAPS_SS equ 27 ;self-snoop
|
||||
CAPS_HTT equ 28 ;hyper-threading technology
|
||||
CAPS_TM equ 29 ;thermal monitor supported
|
||||
CAPS_IA64 equ 30 ;IA64 capabilities
|
||||
CAPS_PBE equ 31 ;pending break enable
|
||||
|
||||
;ecx
|
||||
CAPS_SSE3 equ 32 ;SSE3 instructions
|
||||
; 33
|
||||
; 34
|
||||
CAPS_MONITOR equ 35 ;MONITOR/MWAIT instructions
|
||||
CAPS_DS_CPL equ 36 ;
|
||||
CAPS_VMX equ 37 ;virtual mode extensions
|
||||
; 38 ;
|
||||
CAPS_EST equ 39 ;enhansed speed step
|
||||
CAPS_TM2 equ 40 ;thermal monitor2 supported
|
||||
; 41
|
||||
CAPS_CID equ 42 ;
|
||||
; 43
|
||||
; 44
|
||||
CAPS_CX16 equ 45 ;CMPXCHG16B instruction
|
||||
CAPS_xTPR equ 46 ;
|
||||
;
|
||||
;reserved
|
||||
;
|
||||
;ext edx /ecx
|
||||
CAPS_SYSCAL equ 64 ;
|
||||
CAPS_XD equ 65 ;execution disable
|
||||
CAPS_FFXSR equ 66 ;
|
||||
CAPS_RDTSCP equ 67 ;
|
||||
CAPS_X64 equ 68 ;
|
||||
CAPS_3DNOW equ 69 ;
|
||||
CAPS_3DNOWEXT equ 70 ;
|
||||
CAPS_LAHF equ 71 ;
|
||||
CAPS_CMP_LEG equ 72 ;
|
||||
CAPS_SVM equ 73 ;secure virual machine
|
||||
CAPS_ALTMOVCR8 equ 74 ;
|
||||
|
||||
|
||||
CR4_VME equ 0x0001
|
||||
CR4_PVI equ 0x0002
|
||||
CR4_TSD equ 0x0004
|
||||
CR4_DE equ 0x0008
|
||||
CR4_PSE equ 0x0010
|
||||
CR4_PAE equ 0x0020
|
||||
CR4_MCE equ 0x0040
|
||||
CR4_PGE equ 0x0080
|
||||
CR4_PCE equ 0x0100
|
||||
CR4_OSFXSR equ 0x0200
|
||||
CR4_OSXMMEXPT equ 0x0400
|
||||
|
||||
|
||||
|
||||
OS_BASE equ 0; 0x80400000
|
||||
|
||||
window_data equ OS_BASE+0x0000000
|
||||
|
||||
CURRENT_TASK equ OS_BASE+0x0003000
|
||||
TASK_COUNT equ OS_BASE+0x0003004
|
||||
TASK_BASE equ OS_BASE+0x0003010
|
||||
TASK_DATA equ OS_BASE+0x0003020
|
||||
TASK_EVENT equ OS_BASE+0x0003020
|
||||
|
||||
save_syscall_data equ OS_BASE+0x0005000
|
||||
|
||||
;mouseunder equ OS_BASE+0x0006900
|
||||
FLOPPY_BUFF equ OS_BASE+0x0008000
|
||||
ACTIVE_PROC_STACK equ OS_BASE+0x000A400
|
||||
idts equ OS_BASE+0x000B100
|
||||
WIN_STACK equ OS_BASE+0x000C000
|
||||
WIN_POS equ OS_BASE+0x000C400
|
||||
FDD_DATA equ OS_BASE+0x000D000
|
||||
|
||||
ENABLE_TASKSWITCH equ OS_BASE+0x000E000
|
||||
PUTPIXEL equ OS_BASE+0x000E020
|
||||
GETPIXEL equ OS_BASE+0x000E024
|
||||
BANK_SWITCH equ OS_BASE+0x000E030
|
||||
|
||||
MOUSE_PICTURE equ OS_BASE+0x000F200
|
||||
MOUSE_VISIBLE equ OS_BASE+0x000F204
|
||||
XY_TEMP equ OS_BASE+0x000F300
|
||||
KEY_COUNT equ OS_BASE+0x000F400
|
||||
KEY_BUFF equ OS_BASE+0x000F401
|
||||
|
||||
BTN_COUNT equ OS_BASE+0x000F500
|
||||
BTN_BUFF equ OS_BASE+0x000F501
|
||||
|
||||
TSC equ OS_BASE+0x000F600
|
||||
MOUSE_PORT equ OS_BASE+0x000F604
|
||||
|
||||
PS2_CHUNK equ OS_BASE+0x000FB00
|
||||
MOUSE_X equ OS_BASE+0x000FB0A
|
||||
MOUSE_Y equ OS_BASE+0x000FB0C
|
||||
|
||||
MOUSE_COLOR_MEM equ OS_BASE+0x000FB10
|
||||
COLOR_TEMP equ OS_BASE+0x000FB30
|
||||
BTN_DOWN equ OS_BASE+0x000FB40
|
||||
MOUSE_DOWN equ OS_BASE+0x000FB44
|
||||
X_UNDER equ OS_BASE+0x000FB4A
|
||||
Y_UNDER equ OS_BASE+0x000FB4C
|
||||
;ScreenBPP equ OS_BASE+0x000FBF1
|
||||
MOUSE_BUFF_COUNT equ OS_BASE+0x000FCFF
|
||||
HD_CACHE_ENT equ OS_BASE+0x000FE10
|
||||
LFBAddress equ OS_BASE+0x000FE80
|
||||
MEM_AMOUNT equ OS_BASE+0x000FE8C
|
||||
LFBSize equ OS_BASE+0x02f9050
|
||||
|
||||
SCR_X_SIZE equ OS_BASE+0x000FE00
|
||||
SCR_Y_SIZE equ OS_BASE+0x000FE04
|
||||
SCR_BYTES_PER_LINE equ OS_BASE+0x000FE08
|
||||
SCR_MODE equ OS_BASE+0x000FE0C
|
||||
|
||||
BTN_ADDR equ OS_BASE+0x000FE88
|
||||
SYS_SHUTDOWN equ OS_BASE+0x000FF00
|
||||
TASK_ACTIVATE equ OS_BASE+0x000FF01
|
||||
|
||||
REDRAW_BACKGROUND equ OS_BASE+0x000FFF0
|
||||
BANK_RW equ OS_BASE+0x000FFF2
|
||||
MOUSE_BACKGROUND equ OS_BASE+0x000FFF4
|
||||
DONT_DRAW_MOUSE equ OS_BASE+0x000FFF5
|
||||
DONT_SWITCH equ OS_BASE+0x000FFFF
|
||||
|
||||
STACK_TOP equ OS_BASE+0x003EC00
|
||||
|
||||
FONT_II equ OS_BASE+0x003EC00
|
||||
FONT_I equ OS_BASE+0x003F600
|
||||
DISK_DATA equ OS_BASE+0x0040000
|
||||
PROC_BASE equ OS_BASE+0x0080000
|
||||
TMP_BUFF equ OS_BASE+0x0090000
|
||||
|
||||
VGABasePtr equ OS_BASE+0x00A0000
|
||||
|
||||
RAMDISK equ OS_BASE+0x0100000
|
||||
RAMDISK_FAT equ OS_BASE+0x0280000
|
||||
FLOPPY_FAT equ OS_BASE+0x0282000
|
||||
SB16_Status equ OS_BASE+0x02B0000
|
||||
BUTTON_INFO equ OS_BASE+0x02C0000
|
||||
RESERVED_PORTS equ OS_BASE+0x02D0000
|
||||
IRQ_SAVE equ OS_BASE+0x02E0000
|
||||
SYS_VAR equ OS_BASE+0x02f0000
|
||||
IMG_BACKGROUND equ OS_BASE+0x0300000
|
||||
WinMapAddress equ OS_BASE+0x0460000
|
||||
display_data equ OS_BASE+0x0460000
|
||||
HD_CACHE equ OS_BASE+0x0600000
|
||||
stack_data_start equ OS_BASE+0x0700000
|
||||
eth_data_start equ OS_BASE+0x0700000
|
||||
stack_data equ OS_BASE+0x0704000
|
||||
stack_data_end equ OS_BASE+0x071ffff
|
||||
VMODE_BASE equ OS_BASE+0x0760000
|
||||
resendQ equ OS_BASE+0x0770000
|
||||
|
||||
;skin_data equ OS_BASE+0x0778000
|
||||
|
||||
draw_data equ OS_BASE+0x0800000
|
||||
sysint_stack_data equ OS_BASE+0x0803000
|
||||
|
||||
tss_data equ OS_BASE+0x0920000
|
||||
|
||||
;tmp_pg_dir equ OS_BASE+0x00050000
|
||||
;tmp_page_map equ 0x00051000
|
||||
;master_tab equ 0x80200000
|
||||
|
||||
pages_tab equ 0x60000000
|
||||
master_tab equ 0x60180000
|
||||
|
||||
sys_pgdir equ OS_BASE+0x00050000
|
||||
sys_master_tab equ OS_BASE+0x00051000
|
||||
sys_pgmap equ OS_BASE+0x00052000
|
||||
|
||||
;lfb_start equ 0x00800000
|
||||
|
||||
;new_app_pdir equ OS_BASE+0x01000000
|
||||
;new_app_master_table equ OS_BASE+0x01001000
|
||||
;new_app_ptable equ OS_BASE+0x01002000
|
||||
|
||||
new_app_base equ 0x60400000
|
||||
|
||||
twdw equ (CURRENT_TASK-window_data)
|
||||
|
||||
std_application_base_address equ new_app_base
|
||||
|
||||
PAGES_USED equ 4
|
||||
|
||||
PG_UNMAP equ 0x000
|
||||
PG_MAP equ 0x001
|
||||
PG_WRITE equ 0x002
|
||||
PG_SW equ 0x003
|
||||
PG_USER equ 0x005
|
||||
PG_UW equ 0x007
|
||||
PG_NOCACHE equ 0x018
|
||||
PG_LARGE equ 0x080
|
||||
PG_GLOBAL equ 0x100
|
||||
|
||||
;;;;;;;;;;;boot time variables
|
||||
|
||||
;BOOT_BPP equ 0x9000 ;byte bits per pixel
|
||||
BOOT_SCANLINE equ 0x9001 ;word scanline length
|
||||
BOOT_VESA_MODE equ 0x9008 ;word vesa video mode
|
||||
;;BOOT_X_RES equ 0x900A ;word X res
|
||||
;;BOOT_Y_RES equ 0x900C ;word Y res
|
||||
;;BOOT_MOUSE_PORT equ 0x9010 ;byte mouse port - not used
|
||||
BOOT_BANK_SW equ 0x9014 ;dword Vesa 1.2 pm bank switch
|
||||
BOOT_LFB equ 0x9018 ;dword Vesa 2.0 LFB address
|
||||
BOOT_MTRR equ 0x901C ;byte 0 or 1 : enable MTRR graphics acceleration
|
||||
BOOT_LOG equ 0x901D ;byte not used anymore (0 or 1 : enable system log display)
|
||||
BOOT_DIRECT_LFB equ 0x901E ;byte 0 or 1 : enable direct lfb write, paging disabled
|
||||
BOOT_PCI_DATA equ 0x9020 ;8bytes pci data
|
||||
BOOT_VRR equ 0x9030 ;byte VRR start enabled 1, 2-no
|
||||
BOOT_IDE_BASE_ADDR equ 0x9031 ;word IDEContrRegsBaseAddr
|
||||
BOOT_MEM_AMOUNT equ 0x9034 ;dword memory amount
|
||||
|
||||
TMP_FILE_NAME equ 0
|
||||
TMP_CMD_LINE equ 1024
|
||||
TMP_ICON_OFFS equ 1280
|
||||
|
||||
|
||||
EVENT_REDRAW equ 0x00000001
|
||||
EVENT_KEY equ 0x00000002
|
||||
EVENT_BUTTON equ 0x00000004
|
||||
EVENT_BACKGROUND equ 0x00000010
|
||||
EVENT_MOUSE equ 0x00000020
|
||||
EVENT_IPC equ 0x00000040
|
||||
EVENT_NETWORK equ 0x00000080
|
||||
EVENT_DEBUG equ 0x00000100
|
||||
EVENT_NOTIFY equ 0x00000200
|
||||
|
||||
EV_INTR equ 1
|
||||
|
||||
struc SYS_VARS
|
||||
{ .bpp dd ?
|
||||
.scanline dd ?
|
||||
.vesa_mode dd ?
|
||||
.x_res dd ?
|
||||
.y_res dd ?
|
||||
.cpu_caps dd ?
|
||||
dd ?
|
||||
dd ?
|
||||
dd ?
|
||||
}
|
||||
|
||||
|
||||
struc BOOT_DATA
|
||||
{ .bpp dd ?
|
||||
.scanline dd ?
|
||||
.vesa_mode dd ?
|
||||
.x_res dd ?
|
||||
.y_res dd ?
|
||||
.mouse_port dd ?
|
||||
.bank_switch dd ?
|
||||
.lfb dd ?
|
||||
.vesa_mem dd ?
|
||||
.log dd ?
|
||||
.direct_lfb dd ?
|
||||
.pci_data dd ?
|
||||
; dd ?
|
||||
.vrr dd ?
|
||||
.ide_base dd ?
|
||||
.mem_amount dd ?
|
||||
.pages_count dd ?
|
||||
.pagemap_size dd ?
|
||||
.kernel_max dd ?
|
||||
.kernel_pages dd ?
|
||||
.kernel_tables dd ?
|
||||
|
||||
.cpu_vendor dd ?
|
||||
dd ?
|
||||
dd ?
|
||||
.cpu_sign dd ?
|
||||
.cpu_info dd ?
|
||||
.cpu_caps dd ?
|
||||
dd ?
|
||||
dd ?
|
||||
}
|
||||
|
||||
virtual at 0
|
||||
BOOT_DATA BOOT_DATA
|
||||
end virtual
|
||||
|
||||
struc PG_DATA
|
||||
{ .mem_amount dd ?
|
||||
.vesa_mem dd ?
|
||||
.pages_count dd ?
|
||||
.pages_free dd ?
|
||||
.pages_faults dd ?
|
||||
.pagemap_size dd ?
|
||||
.kernel_max dd ?
|
||||
.kernel_pages dd ?
|
||||
.kernel_tables dd ?
|
||||
.sys_page_dir dd ?
|
||||
.pg_mutex dd ?
|
||||
.tmp_task_mutex dd ?
|
||||
}
|
||||
|
||||
struc LIB
|
||||
{ .lib_name rb 16
|
||||
.lib_base dd ?
|
||||
.lib_start dd ?
|
||||
.export dd ?
|
||||
.import dd ?
|
||||
}
|
||||
|
||||
struc SRV
|
||||
{ .srv_name rb 16
|
||||
.magic dd ?
|
||||
.size dd ?
|
||||
.lib dd ?
|
||||
.srv_proc dd ?
|
||||
}
|
||||
|
||||
struc COFF_HEADER
|
||||
{ .machine dw ?
|
||||
.nSections dw ?
|
||||
.DataTime dd ?
|
||||
.pSymTable dd ?
|
||||
.nSymbols dd ?
|
||||
.optHeader dw ?
|
||||
.flags dw ?
|
||||
};
|
||||
|
||||
|
||||
struc COFF_SECTION
|
||||
{ .Name rb 8
|
||||
.VirtualSize dd ?
|
||||
.VirtualAddress dd ?
|
||||
.SizeOfRawData dd ?
|
||||
.PtrRawData dd ?
|
||||
.PtrReloc dd ?
|
||||
.PtrLinenumbers dd ?
|
||||
.NumReloc dw ?
|
||||
.NumLinenum dw ?
|
||||
.Characteristics dd ?
|
||||
}
|
||||
|
||||
struc COFF_RELOC
|
||||
{ .VirtualAddress dd ?
|
||||
.SymIndex dd ?
|
||||
.Type dw ?
|
||||
}
|
||||
|
||||
struc COFF_SYM
|
||||
{ .Name rb 8
|
||||
.Value dd ?
|
||||
.SectionNumber dw ?
|
||||
.Type dw ?
|
||||
.StorageClass db ?
|
||||
.NumAuxSymbols db ?
|
||||
}
|
||||
|
||||
struc IOCTL
|
||||
{ .handle dd ?
|
||||
.io_code dd ?
|
||||
.input dd ?
|
||||
.inp_size dd ?
|
||||
.output dd ?
|
||||
.out_size dd ?
|
||||
}
|
||||
|
||||
virtual at 0
|
||||
IOCTL IOCTL
|
||||
end virtual
|
||||
|
||||
|
||||
SRV_SIZE equ 32
|
||||
|
||||
virtual at 0
|
||||
LIB LIB
|
||||
end virtual
|
||||
|
||||
virtual at 0
|
||||
SRV SRV
|
||||
end virtual
|
||||
|
||||
virtual at 0
|
||||
CFS COFF_SECTION
|
||||
end virtual
|
||||
|
||||
virtual at 0
|
||||
CRELOC COFF_RELOC
|
||||
end virtual
|
||||
|
||||
virtual at 0
|
||||
CSYM COFF_SYM
|
||||
end virtual
|
||||
|
||||
virtual at 0
|
||||
CFH COFF_HEADER
|
||||
end virtual
|
||||
|
||||
|
616
kernel/trunk/core/dll.inc
Normal file
616
kernel/trunk/core/dll.inc
Normal file
@ -0,0 +1,616 @@
|
||||
;
|
||||
; This file is part of the Infinity sound AC97 driver.
|
||||
; (C) copyright Serge 2006
|
||||
; email: infinity_sound@mail.ru
|
||||
;
|
||||
; This program is free software; you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation; either version 2 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
|
||||
align 4
|
||||
proc attach_int_handler stdcall, irq:dword, handler:dword
|
||||
|
||||
mov ebx, [irq] ;irq num
|
||||
test ebx, ebx
|
||||
jz .err
|
||||
mov eax, [handler]
|
||||
test eax, eax
|
||||
jz .err
|
||||
mov [irq_tab+ebx*4], eax
|
||||
stdcall enable_irq, [irq]
|
||||
ret
|
||||
.err:
|
||||
xor eax, eax
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc detach_int_handler
|
||||
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc enable_irq stdcall, irq_line:dword
|
||||
mov ebx, [irq_line]
|
||||
mov edx, 0x21
|
||||
cmp ebx, 8
|
||||
jb @F
|
||||
mov edx, 0xA1
|
||||
sub ebx,8
|
||||
@@:
|
||||
in al,dx
|
||||
btr eax, ebx
|
||||
out dx, al
|
||||
ret
|
||||
endp
|
||||
|
||||
align 16
|
||||
;; proc irq_serv
|
||||
|
||||
irq_serv:
|
||||
|
||||
.irq_1:
|
||||
push eax
|
||||
mov eax, 1
|
||||
jmp .main
|
||||
align 4
|
||||
.irq_2:
|
||||
push eax
|
||||
mov eax, 2
|
||||
jmp .main
|
||||
align 4
|
||||
.irq_3:
|
||||
push eax
|
||||
mov eax, 3
|
||||
jmp .main
|
||||
align 4
|
||||
.irq_4:
|
||||
push eax
|
||||
mov eax, 4
|
||||
jmp .main
|
||||
align 4
|
||||
.irq_5:
|
||||
push eax
|
||||
mov eax, 5
|
||||
jmp .main
|
||||
align 4
|
||||
.irq_6:
|
||||
push eax
|
||||
mov eax, 6
|
||||
jmp .main
|
||||
align 4
|
||||
.irq_7:
|
||||
push eax
|
||||
mov eax, 7
|
||||
jmp .main
|
||||
align 4
|
||||
.irq_8:
|
||||
push eax
|
||||
mov eax, 8
|
||||
jmp .main
|
||||
align 4
|
||||
.irq_9:
|
||||
push eax
|
||||
mov eax, 9
|
||||
jmp .main
|
||||
align 4
|
||||
.irq_10:
|
||||
push eax
|
||||
mov eax, 10
|
||||
jmp .main
|
||||
align 4
|
||||
.irq_11:
|
||||
push eax
|
||||
mov eax, 11
|
||||
jmp .main
|
||||
align 4
|
||||
.irq_12:
|
||||
push eax
|
||||
mov eax, 12
|
||||
jmp .main
|
||||
align 4
|
||||
.irq_13:
|
||||
push eax
|
||||
mov eax, 13
|
||||
jmp .main
|
||||
align 4
|
||||
.irq_14:
|
||||
push eax
|
||||
mov eax, 14
|
||||
jmp .main
|
||||
align 4
|
||||
.irq_15:
|
||||
push eax
|
||||
mov eax, 15
|
||||
jmp .main
|
||||
|
||||
align 16
|
||||
.main:
|
||||
save_ring3_context
|
||||
mov bx, os_data
|
||||
mov ds, bx
|
||||
mov es, bx
|
||||
|
||||
mov ebx, [irq_tab+eax*4]
|
||||
test ebx, ebx
|
||||
jz .exit
|
||||
|
||||
call ebx
|
||||
|
||||
.exit:
|
||||
restore_ring3_context
|
||||
|
||||
cmp eax, 8
|
||||
mov al, 0x20
|
||||
jb @f
|
||||
out 0xa0, al
|
||||
@@:
|
||||
out 0x20, al
|
||||
|
||||
pop eax
|
||||
iret
|
||||
|
||||
align 4
|
||||
proc get_notify stdcall, p_ev:dword
|
||||
|
||||
.wait:
|
||||
mov ebx,[CURRENT_TASK]
|
||||
shl ebx,8
|
||||
test dword [ebx+PROC_BASE+0xA8],EVENT_NOTIFY
|
||||
jz @f
|
||||
and dword [ebx+PROC_BASE+0xA8], not EVENT_NOTIFY
|
||||
mov edi, [p_ev]
|
||||
mov dword [edi], EV_INTR
|
||||
mov eax, [ebx+PROC_BASE+APPDATA.event]
|
||||
mov dword [edi+4], eax
|
||||
ret
|
||||
@@:
|
||||
call change_task
|
||||
jmp .wait
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc pci_read32 stdcall, bus:dword, devfn:dword, reg:dword
|
||||
xor eax, eax
|
||||
xor ebx, ebx
|
||||
mov ah, byte [bus]
|
||||
mov al, 6
|
||||
mov bh, byte [devfn]
|
||||
mov bl, byte [reg]
|
||||
call pci_read_reg
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc pci_read8 stdcall, bus:dword, devfn:dword, reg:dword
|
||||
xor eax, eax
|
||||
xor ebx, ebx
|
||||
mov ah, byte [bus]
|
||||
mov al, 4
|
||||
mov bh, byte [devfn]
|
||||
mov bl, byte [reg]
|
||||
call pci_read_reg
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc pci_write8 stdcall, bus:dword, devfn:dword, reg:dword, val:dword
|
||||
xor eax, eax
|
||||
xor ebx, ebx
|
||||
mov ah, byte [bus]
|
||||
mov al, 8
|
||||
mov bh, byte [devfn]
|
||||
mov bl, byte [reg]
|
||||
mov ecx, [val]
|
||||
call pci_write_reg
|
||||
ret
|
||||
endp
|
||||
|
||||
handle equ IOCTL.handle
|
||||
io_code equ IOCTL.io_code
|
||||
input equ IOCTL.input
|
||||
inp_size equ IOCTL.inp_size
|
||||
output equ IOCTL.output
|
||||
out_size equ IOCTL.out_size
|
||||
|
||||
|
||||
align 4
|
||||
proc srv_handler stdcall, ioctl:dword
|
||||
mov esi, [ioctl]
|
||||
test esi, esi
|
||||
jz .err
|
||||
|
||||
mov edi, [esi+handle]
|
||||
cmp [edi+SRV.magic], ' SRV'
|
||||
jne .fail
|
||||
|
||||
cmp [edi+SRV.size], SRV_SIZE
|
||||
jne .fail
|
||||
|
||||
stdcall [edi+SRV.srv_proc], esi
|
||||
ret
|
||||
.fail:
|
||||
xor eax, eax
|
||||
not eax
|
||||
mov [esi+output], eax
|
||||
mov [esi+out_size], 4
|
||||
ret
|
||||
.err:
|
||||
xor eax, eax
|
||||
not eax
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc srv_handlerEx stdcall, ioctl:dword
|
||||
mov esi, [ioctl]
|
||||
test esi, esi
|
||||
jz .err
|
||||
add esi, new_app_base
|
||||
|
||||
mov edi, [esi+handle]
|
||||
cmp [edi+SRV.magic], ' SRV'
|
||||
jne .fail
|
||||
|
||||
cmp [edi+SRV.size], SRV_SIZE
|
||||
jne .fail
|
||||
|
||||
add [esi+input], new_app_base
|
||||
add [esi+output], new_app_base
|
||||
|
||||
stdcall [edi+SRV.srv_proc], esi
|
||||
ret
|
||||
.fail:
|
||||
xor eax, eax
|
||||
not eax
|
||||
mov [esi+output], eax
|
||||
mov [esi+out_size], 4
|
||||
ret
|
||||
.err:
|
||||
xor eax, eax
|
||||
not eax
|
||||
ret
|
||||
endp
|
||||
|
||||
restore handle
|
||||
restore io_code
|
||||
restore input
|
||||
restore inp_size
|
||||
restore output
|
||||
restore out_size
|
||||
|
||||
align 4
|
||||
proc get_service stdcall, sz_name:dword
|
||||
locals
|
||||
srv_ptr dd ?
|
||||
counter dd ?
|
||||
endl
|
||||
|
||||
mov eax, [sz_name]
|
||||
test eax, eax
|
||||
jz .fail
|
||||
|
||||
mov [srv_ptr], srv_tab
|
||||
mov [counter], 16
|
||||
@@:
|
||||
stdcall strncmp, [srv_ptr], [sz_name], 16
|
||||
test eax, eax
|
||||
je .ok
|
||||
|
||||
add [srv_ptr], SRV_SIZE
|
||||
dec [counter]
|
||||
jnz @B
|
||||
.not_load:
|
||||
|
||||
stdcall find_service, [sz_name]
|
||||
test eax, eax
|
||||
jz .fail
|
||||
|
||||
stdcall load_lib, eax
|
||||
test eax, eax
|
||||
jz .fail
|
||||
|
||||
mov [srv_ptr], srv_tab
|
||||
mov [counter], 16
|
||||
@@:
|
||||
stdcall strncmp, [srv_ptr], [sz_name], 16
|
||||
test eax, eax
|
||||
je .ok
|
||||
|
||||
add [srv_ptr], SRV_SIZE
|
||||
dec [counter]
|
||||
jnz @B
|
||||
.fail:
|
||||
xor eax, eax
|
||||
ret
|
||||
.ok:
|
||||
mov eax, [srv_ptr]
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc find_service stdcall ,sz_name:dword
|
||||
|
||||
mov eax, [sz_name]
|
||||
test eax, eax
|
||||
jz .fail
|
||||
|
||||
mov esi, services
|
||||
@@:
|
||||
mov eax, [esi]
|
||||
test eax, eax
|
||||
jz .fail
|
||||
push esi
|
||||
stdcall strncmp, eax, [sz_name], 16
|
||||
pop esi
|
||||
test eax, eax
|
||||
je .ok
|
||||
|
||||
add esi, 8
|
||||
jmp @B
|
||||
.ok:
|
||||
mov eax, [esi+4]
|
||||
ret
|
||||
.fail:
|
||||
xor eax, eax
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc reg_service stdcall, sz_name:dword, handler:dword
|
||||
locals
|
||||
srv dd ?
|
||||
endl
|
||||
|
||||
mov eax, [sz_name]
|
||||
test eax, eax
|
||||
jz .fail
|
||||
|
||||
mov ebx, [handler]
|
||||
test ebx, ebx
|
||||
jz .fail
|
||||
|
||||
call alloc_service
|
||||
test eax, eax
|
||||
jz .fail
|
||||
|
||||
mov [srv], eax
|
||||
mov edi, eax
|
||||
mov esi, [sz_name]
|
||||
mov ecx, 16
|
||||
rep movsb
|
||||
|
||||
mov edi, eax
|
||||
mov [edi+SRV.magic], ' SRV'
|
||||
mov [edi+SRV.size], SRV_SIZE
|
||||
mov ebx, [handler]
|
||||
mov [edi+SRV.srv_proc], ebx
|
||||
mov eax, [srv]
|
||||
ret
|
||||
.fail:
|
||||
xor eax, eax
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc get_proc stdcall, exp:dword, sz_name:dword
|
||||
|
||||
mov edx, [exp]
|
||||
.next:
|
||||
mov eax, [edx]
|
||||
test eax, eax
|
||||
jz .end
|
||||
|
||||
push edx
|
||||
stdcall strncmp, eax, [sz_name], 16
|
||||
pop edx
|
||||
test eax, eax
|
||||
jz .ok
|
||||
|
||||
add edx,8
|
||||
jmp .next
|
||||
.ok:
|
||||
mov eax, [edx+4]
|
||||
.end:
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc link_dll stdcall, exp:dword, imp:dword
|
||||
mov esi, [imp]
|
||||
.next:
|
||||
mov eax, [esi]
|
||||
test eax, eax
|
||||
jz .end
|
||||
|
||||
push esi
|
||||
stdcall get_proc, [exp], eax
|
||||
pop esi
|
||||
|
||||
test eax, eax
|
||||
jz @F
|
||||
|
||||
mov [esi], eax
|
||||
@@:
|
||||
add esi, 4
|
||||
jmp .next
|
||||
.end:
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc get_coff_sym stdcall, pSym:dword,count:dword, sz_sym:dword
|
||||
|
||||
@@:
|
||||
stdcall strncmp, [pSym], [sz_sym], 8
|
||||
test eax,eax
|
||||
jz .ok
|
||||
add [pSym], 18
|
||||
dec [count]
|
||||
jnz @b
|
||||
xor eax, eax
|
||||
ret
|
||||
.ok:
|
||||
mov ebx, [pSym]
|
||||
mov eax, [ebx+8]
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc load_lib stdcall, name:dword
|
||||
locals
|
||||
lib dd ?
|
||||
base dd ?
|
||||
pSym dd ?
|
||||
endl
|
||||
|
||||
mov eax, [name]
|
||||
mov ebx, 1 ;index of first block
|
||||
mov ecx, 32 ;number of blocks
|
||||
mov edx, TMP_BUFF ;temp area
|
||||
mov esi, 12 ;file name length
|
||||
|
||||
call fileread ;read file from RD
|
||||
|
||||
cmp eax,0
|
||||
jne .err
|
||||
|
||||
; mov eax, [TMP_BUFF+CFH.pSymTable]
|
||||
; add eax, TMP_BUFF
|
||||
; mov [pSym], eax
|
||||
|
||||
; mov [TMP_BUFF+20+CFS.VirtualAddress], eax
|
||||
|
||||
stdcall kernel_alloc, [TMP_BUFF+20+CFS.SizeOfRawData]
|
||||
mov [base], eax
|
||||
|
||||
test eax, eax
|
||||
jnz @f
|
||||
@@:
|
||||
mov [TMP_BUFF+20+CFS.VirtualAddress], eax
|
||||
mov ebx, [TMP_BUFF+CFH.pSymTable]
|
||||
add ebx, TMP_BUFF
|
||||
mov [pSym], ebx
|
||||
|
||||
stdcall LinkSection, TMP_BUFF, TMP_BUFF+20, ebx
|
||||
|
||||
mov edi, [base]
|
||||
test edi, edi
|
||||
jnz @f
|
||||
@@:
|
||||
mov esi, [TMP_BUFF+20+CFS.PtrRawData]
|
||||
add esi, TMP_BUFF
|
||||
mov ecx, [TMP_BUFF+20+CFS.SizeOfRawData]
|
||||
rep movsb
|
||||
|
||||
call alloc_dll
|
||||
test eax, eax
|
||||
jnz @f
|
||||
@@:
|
||||
mov [lib], eax
|
||||
|
||||
mov edi, eax
|
||||
mov esi, [name]
|
||||
mov ecx, 16
|
||||
rep movsb
|
||||
|
||||
stdcall get_coff_sym,[pSym],[TMP_BUFF+CFH.nSymbols],szSTART
|
||||
mov edi, [lib]
|
||||
add eax, [base]
|
||||
mov [edi+LIB.lib_start], eax
|
||||
mov ebx, [base]
|
||||
mov [edi+LIB.lib_base], ebx
|
||||
|
||||
stdcall get_coff_sym,[pSym],[TMP_BUFF+CFH.nSymbols], szEXPORTS
|
||||
mov edi, [lib]
|
||||
add eax, [base]
|
||||
mov [edi+LIB.export], eax
|
||||
|
||||
stdcall get_coff_sym,[pSym],[TMP_BUFF+CFH.nSymbols], szIMPORTS
|
||||
mov edi, [lib]
|
||||
add eax, [base]
|
||||
mov [edi+LIB.import], eax
|
||||
|
||||
stdcall link_dll, kernel_export, eax
|
||||
|
||||
mov edi, [lib]
|
||||
call [edi+LIB.lib_start]
|
||||
|
||||
mov eax, [lib]
|
||||
ret
|
||||
.err:
|
||||
xor eax, eax
|
||||
ret
|
||||
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc LinkSection stdcall, pCoff:dword, pSec:dword, pSym:dword
|
||||
locals
|
||||
pCode dd ?
|
||||
endl
|
||||
|
||||
mov esi, [pSec]
|
||||
mov eax, [esi+CFS.PtrRawData]
|
||||
add eax, [pCoff]
|
||||
mov [pCode], eax
|
||||
|
||||
mov edi, [esi+CFS.PtrReloc]
|
||||
add edi, [pCoff]
|
||||
|
||||
movzx edx, [esi+CFS.NumReloc]
|
||||
mov eax, edx
|
||||
lea edx, [edx+edx*8]
|
||||
add edx, eax
|
||||
add edx, edi
|
||||
.l_0:
|
||||
cmp edi, edx
|
||||
jae .exit
|
||||
|
||||
mov ebx, [edi+CRELOC.SymIndex]
|
||||
add ebx,ebx
|
||||
lea ebx,[ebx+ebx*8]
|
||||
|
||||
add ebx, [pSym]
|
||||
|
||||
mov ecx, [ebx+CSYM.Value]
|
||||
add ecx, [esi+CFS.VirtualAddress]
|
||||
|
||||
mov eax, [edi+CRELOC.VirtualAddress]
|
||||
add eax, [pCode]
|
||||
add [eax], ecx
|
||||
add edi, 10
|
||||
jmp .l_0
|
||||
|
||||
.exit:
|
||||
ret
|
||||
endp
|
||||
|
||||
proc get_curr_task
|
||||
mov eax,[CURRENT_TASK]
|
||||
shl eax, 8
|
||||
ret
|
||||
endp
|
||||
|
||||
drv_sound db 'UNISOUNDOBJ', 0
|
||||
drv_infinity db 'INFINITYOBJ', 0
|
||||
|
||||
szSound db 'SOUND',0
|
||||
szInfinity db 'INFINITY',0
|
||||
|
||||
szSTART db 'START',0
|
||||
szEXPORTS db 'EXPORTS',0
|
||||
szIMPORTS db 'IMPORTS',0
|
||||
|
||||
align 16
|
||||
services:
|
||||
dd szSound, drv_sound
|
||||
dd szInfinity, drv_infinity
|
||||
dd 0
|
64
kernel/trunk/core/except.inc
Normal file
64
kernel/trunk/core/except.inc
Normal file
@ -0,0 +1,64 @@
|
||||
|
||||
|
||||
reg_eip equ ebp+4
|
||||
reg_cs equ ebp+8
|
||||
reg_eflags equ ebp+12
|
||||
reg_esp equ ebp+16
|
||||
reg_ss equ ebp+20
|
||||
fpu_ctrl equ ebp-28
|
||||
|
||||
align 4
|
||||
except_16:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
sub esp, 28
|
||||
|
||||
push eax
|
||||
push ebx
|
||||
push ecx
|
||||
push edx
|
||||
|
||||
mov ebx, [ss:CURRENT_TASK]
|
||||
shl ebx, 8
|
||||
|
||||
mov eax, [ss:ebx+PROC_BASE+APPDATA.fpu_handler]
|
||||
test eax, eax
|
||||
jz .default
|
||||
|
||||
mov ecx, [reg_eip]
|
||||
mov edx, [reg_esp]
|
||||
sub edx, 4
|
||||
mov [ss:edx+new_app_base], ecx
|
||||
mov [reg_esp], edx
|
||||
mov dword [reg_eip], eax
|
||||
|
||||
pop edx
|
||||
pop ecx
|
||||
pop ebx
|
||||
pop eax
|
||||
|
||||
leave
|
||||
iretd
|
||||
|
||||
.default:
|
||||
|
||||
fnstenv [fpu_ctrl]
|
||||
fnclex
|
||||
or word [fpu_ctrl], 0111111b
|
||||
fldenv [fpu_ctrl]
|
||||
|
||||
pop edx
|
||||
pop ecx
|
||||
pop ebx
|
||||
pop eax
|
||||
|
||||
leave
|
||||
iretd
|
||||
|
||||
|
||||
restore reg_eip
|
||||
restore reg_cs
|
||||
restore reg_eflags
|
||||
restore reg_esp
|
||||
restore reg_ss
|
||||
restore fpu_ctrl
|
45
kernel/trunk/core/exports.inc
Normal file
45
kernel/trunk/core/exports.inc
Normal file
@ -0,0 +1,45 @@
|
||||
|
||||
iglobal
|
||||
|
||||
align 16
|
||||
kernel_export:
|
||||
dd szAttachIntHandler, attach_int_handler
|
||||
dd szSysMsgBoardStr , sys_msg_board_str
|
||||
dd szPciApi , pci_api
|
||||
dd szPciRead32 , pci_read32
|
||||
dd szPciRead8 , pci_read8
|
||||
dd szPciWrite8 , pci_write8
|
||||
dd szAllocKernelSpace, alloc_kernel_space
|
||||
dd szMapPage , map_page
|
||||
dd szRegService , reg_service
|
||||
dd szKernelAlloc , kernel_alloc
|
||||
dd szKernelFree , kernel_free
|
||||
dd szGetPgAddr , get_pg_addr
|
||||
dd szGetCurrentTask , get_curr_task
|
||||
dd szGetService , get_service
|
||||
dd szServiceHandler , srv_handler
|
||||
dd szFpuSave , fpu_save
|
||||
dd szFpuRestore , fpu_restore
|
||||
dd 0
|
||||
|
||||
szKernel db 'KERNEL', 0
|
||||
szAttachIntHandler db 'AttachIntHandler',0
|
||||
szSysMsgBoardStr db 'SysMsgBoardStr', 0
|
||||
szPciApi db 'PciApi', 0
|
||||
szPciRead32 db 'PciRead32', 0
|
||||
szPciRead8 db 'PciRead8', 0
|
||||
szPciWrite8 db 'PciWrite8',0
|
||||
szAllocKernelSpace db 'AllocKernelSpace',0
|
||||
szMapPage db 'MapPage',0
|
||||
szRegService db 'RegService',0
|
||||
szKernelAlloc db 'KernelAlloc',0
|
||||
szKernelFree db 'KernelFree',0
|
||||
szGetPgAddr db 'GetPgAddr',0
|
||||
szGetCurrentTask db 'GetCurrentTask ',0
|
||||
szGetService db 'GetService',0
|
||||
szServiceHandler db 'ServiceHandler',0
|
||||
szFpuSave db 'FpuSave',0
|
||||
szFpuRestore db 'FpuRestore',0
|
||||
|
||||
endg
|
||||
|
1117
kernel/trunk/core/heap.inc
Normal file
1117
kernel/trunk/core/heap.inc
Normal file
File diff suppressed because it is too large
Load Diff
1417
kernel/trunk/core/memory.inc
Normal file
1417
kernel/trunk/core/memory.inc
Normal file
File diff suppressed because it is too large
Load Diff
@ -54,18 +54,18 @@ apm_data_16:
|
||||
; -----------------------------------------
|
||||
|
||||
app_code_l:
|
||||
dw ((0x80000000-std_application_base_address) shr 12) and 0xffff
|
||||
dw 0xFFFF;((0x80000000-std_application_base_address) shr 12) and 0xffff
|
||||
dw 0
|
||||
db 0
|
||||
dw 11010000b*256+11111010b+256*((0x80000000-std_application_base_address) shr 28)
|
||||
db std_application_base_address shr 24
|
||||
db 0x40
|
||||
db cpl3
|
||||
dw G32+D32+0x6000+0x7;
|
||||
|
||||
app_data_l:
|
||||
dw (0x80000000-std_application_base_address) shr 12 and 0xffff
|
||||
dw 0xFFFF;(0x80000000-std_application_base_address) shr 12 and 0xffff
|
||||
dw 0
|
||||
db 0
|
||||
dw 11010000b*256+11110010b+256*((0x80000000-std_application_base_address) shr 28)
|
||||
db std_application_base_address shr 24
|
||||
db 0x40
|
||||
db drw3
|
||||
dw G32+D32+0x6000+0x7;
|
||||
|
||||
graph_data_l:
|
||||
|
||||
@ -81,11 +81,10 @@ tss0_l:
|
||||
gdte:
|
||||
|
||||
|
||||
|
||||
idtreg:
|
||||
dw 8*0x41-1
|
||||
dd idts+8
|
||||
label idts at 0xB100-8
|
||||
;label idts at 0xB100-8
|
||||
|
||||
|
||||
|
||||
@ -166,16 +165,20 @@ build_interrupt_table:
|
||||
|
||||
ret
|
||||
|
||||
|
||||
|
||||
iglobal
|
||||
sys_int:
|
||||
dd e0,debug_exc,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15
|
||||
dd e16,e17
|
||||
dd e0,debug_exc,e2,e3
|
||||
dd e4,e5,e6,e7
|
||||
dd e8,e9,e10,e11
|
||||
dd e12,e13,page_fault_handler,e15
|
||||
|
||||
dd except_16, e17
|
||||
times 14 dd unknown_interrupt
|
||||
|
||||
dd irq0 ,irq1 ,p_irq2 ,p_irq3 ,p_irq4 ,p_irq5,p_irq6 ,p_irq7
|
||||
dd p_irq8,p_irq9,p_irq10,p_irq11,p_irq12,irqD ,p_irq14,p_irq15
|
||||
dd irq0 , irq_serv.irq_1, p_irq2 ,irq_serv.irq_3
|
||||
dd p_irq4 ,irq_serv.irq_5,p_irq6,irq_serv.irq_7
|
||||
dd irq_serv.irq_8, irq_serv.irq_9, irq_serv.irq_10
|
||||
dd irq_serv.irq_11,p_irq12,irqD ,p_irq14,p_irq15
|
||||
|
||||
times 16 dd unknown_interrupt
|
||||
|
||||
@ -216,7 +219,7 @@ macro exc_w_code [num]
|
||||
jmp exc_c
|
||||
}
|
||||
|
||||
exc_wo_code 0, 1, 2, 3, 4, 5, 6, 9, 15, 16 ; 18, 19
|
||||
exc_wo_code 0, 1, 2, 3, 4, 5, 6, 9, 15 ; 18, 19
|
||||
exc_w_code 8, 10, 11, 12, 13, 14, 17
|
||||
|
||||
exc_c:
|
||||
@ -276,26 +279,47 @@ e7:
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
|
||||
mov eax, [prev_user_of_fpu]
|
||||
shl eax, 8
|
||||
add eax, 0x80000 + APPDATA.fpu_save_area
|
||||
fsave [eax]
|
||||
mov ebx, [fpu_owner]
|
||||
cmp ebx, [CURRENT_TASK]
|
||||
je .exit
|
||||
|
||||
mov eax, [0x3000]
|
||||
mov [prev_user_of_fpu], eax
|
||||
shl eax, 8
|
||||
add eax, 0x80000
|
||||
cmp [eax + APPDATA.is_fpu_saved], 0
|
||||
je @f
|
||||
frstor [eax+APPDATA.fpu_save_area]
|
||||
@@:
|
||||
mov [eax + APPDATA.is_fpu_saved], 1
|
||||
shl ebx, 8
|
||||
mov eax, [ebx+PROC_BASE+APPDATA.fpu_state]
|
||||
bt [cpu_caps], CAPS_FXSR
|
||||
jnc .no_SSE
|
||||
|
||||
fxsave [eax]
|
||||
mov ebx, [CURRENT_TASK]
|
||||
mov [fpu_owner], ebx
|
||||
shl ebx, 8
|
||||
cmp dword [ebx+PROC_BASE+APPDATA.fpu_init], 0
|
||||
je .init
|
||||
mov eax, [ebx+PROC_BASE+APPDATA.fpu_state]
|
||||
fxrstor [eax]
|
||||
restore_ring3_context
|
||||
iret
|
||||
.init:
|
||||
fninit ; ¬ ¥ ã¦ë ¥¬ ᪨஢ ë¥ ¨áª«î票ï
|
||||
mov dword [ebx+PROC_BASE+APPDATA.fpu_init], 1
|
||||
.exit:
|
||||
restore_ring3_context
|
||||
iret
|
||||
.no_SSE:
|
||||
fnsave [eax]
|
||||
mov ebx, [CURRENT_TASK]
|
||||
mov [fpu_owner], ebx
|
||||
shl ebx, 8
|
||||
cmp dword [ebx+PROC_BASE+APPDATA.fpu_init], 0
|
||||
je .init
|
||||
|
||||
mov eax, [ebx+PROC_BASE+APPDATA.fpu_state]
|
||||
frstor [eax]
|
||||
restore_ring3_context
|
||||
iret
|
||||
|
||||
iglobal
|
||||
prev_user_of_fpu dd 1
|
||||
endg
|
||||
fpu_owner dd 1
|
||||
endg
|
||||
|
||||
|
||||
writehex:
|
||||
@ -611,11 +635,11 @@ sys_resize_app_memory:
|
||||
cmp eax,1
|
||||
jne .no_application_mem_resize
|
||||
|
||||
jmp new_mem_resize ;resize for new type of processes
|
||||
|
||||
|
||||
.no_application_mem_resize:
|
||||
stdcall new_mem_resize, ebx
|
||||
mov [esp+36], eax
|
||||
ret
|
||||
|
||||
.no_application_mem_resize:
|
||||
ret
|
||||
|
||||
|
||||
@ -692,7 +716,7 @@ uglobal
|
||||
app_esp dd 0x0
|
||||
app_i_param dd 0x0
|
||||
app_i_icon dd 0x0
|
||||
;app_mem_pos dd 0x0
|
||||
; app_mem_pos dd 0x0
|
||||
appl_path dd 0x0
|
||||
appl_path_size dd 0x0
|
||||
endg
|
||||
@ -732,11 +756,16 @@ terminate: ; terminate application
|
||||
call set_application_table_status
|
||||
|
||||
mov eax,esi
|
||||
call dispose_app_cr3_table
|
||||
|
||||
cmp [prev_user_of_fpu],esi ; if user fpu last -> fpu user = 1
|
||||
pushad
|
||||
shl eax,8
|
||||
mov eax,[PROC_BASE+eax+0xB8]
|
||||
stdcall destroy_app_space, eax
|
||||
popad
|
||||
|
||||
cmp [fpu_owner],esi ; if user fpu last -> fpu user = 1
|
||||
jne fpu_ok_1
|
||||
mov [prev_user_of_fpu],1
|
||||
mov [fpu_owner],1
|
||||
fpu_ok_1:
|
||||
|
||||
mov [0xf400],byte 0 ; empty keyboard buffer
|
||||
|
@ -57,7 +57,7 @@ uglobal
|
||||
save_syscall_count dd 0x0
|
||||
endg
|
||||
|
||||
label save_syscall_data dword at 0x5000
|
||||
;label save_syscall_data dword at 0x5000
|
||||
|
||||
|
||||
iglobal
|
||||
@ -132,7 +132,7 @@ iglobal
|
||||
dd undefined_syscall ; 57-reserved
|
||||
dd file_system ; 58-Common file system interface
|
||||
dd sys_trace ; 59-System call trace
|
||||
dd new_sys_ipc ; 60-Inter Process Communication
|
||||
dd sys_IPC ; 60-Inter Process Communication
|
||||
dd sys_gs ; 61-Direct graphics access
|
||||
dd sys_pci ; 62-PCI functions
|
||||
dd sys_msg_board ; 63-System message board
|
||||
@ -140,7 +140,7 @@ iglobal
|
||||
dd undefined_syscall ; 65-UTF
|
||||
dd sys_process_def ; 66-Process definitions - keyboard
|
||||
dd sys_window_move ; 67-Window move or resize
|
||||
dd sys_internal_services ; 68-Some internal services
|
||||
dd new_services ; 68-Some internal services
|
||||
dd sys_debug_services ; 69-Debug
|
||||
dd file_system_lfn ; 70-Common file system interface, version 2
|
||||
dd syscall_windowsettings ; 71-Window settings
|
||||
|
1173
kernel/trunk/core/taskman.inc
Normal file
1173
kernel/trunk/core/taskman.inc
Normal file
File diff suppressed because it is too large
Load Diff
223
kernel/trunk/drivers/CODEC.INC
Normal file
223
kernel/trunk/drivers/CODEC.INC
Normal file
@ -0,0 +1,223 @@
|
||||
|
||||
align 4
|
||||
proc detect_codec
|
||||
locals
|
||||
codec_id dd ?
|
||||
endl
|
||||
|
||||
stdcall codec_read, dword 0x7C
|
||||
shl eax, 16
|
||||
mov [codec_id], eax
|
||||
|
||||
stdcall codec_read, dword 0x7E
|
||||
or eax, [codec_id]
|
||||
|
||||
mov [codec.chip_id], eax
|
||||
and eax, 0xFFFFFF00
|
||||
|
||||
mov edi, codecs
|
||||
@@:
|
||||
mov ebx, [edi]
|
||||
test ebx, ebx
|
||||
jz .unknown
|
||||
|
||||
cmp eax, ebx
|
||||
jne .next
|
||||
mov eax, [edi+4]
|
||||
mov [codec.ac_vendor_ids], eax
|
||||
stdcall detect_chip, [edi+8]
|
||||
ret
|
||||
.next:
|
||||
add edi, 12
|
||||
jmp @B
|
||||
.unknown:
|
||||
mov [codec.ac_vendor_ids], ac_unknown
|
||||
mov [codec.chip_ids], chip_unknown
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc detect_chip stdcall, chip_tab:dword
|
||||
|
||||
mov eax, [codec.chip_id]
|
||||
and eax, 0xFF
|
||||
|
||||
mov edi, [chip_tab]
|
||||
@@:
|
||||
mov ebx, [edi]
|
||||
test ebx, ebx
|
||||
jz .unknown
|
||||
|
||||
cmp eax,ebx
|
||||
jne .next
|
||||
mov eax, [edi+4]
|
||||
mov [codec.chip_ids], eax
|
||||
ret
|
||||
.next:
|
||||
add edi, 8
|
||||
jmp @b
|
||||
.unknown:
|
||||
mov [codec.chip_ids], chip_unknown
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc setup_codec
|
||||
|
||||
xor eax, eax
|
||||
stdcall codec_write, dword CODEC_AUX_VOL
|
||||
|
||||
mov eax, 0x1010
|
||||
stdcall codec_write, dword CODEC_MASTER_VOL_REG
|
||||
|
||||
mov ax, 0x08
|
||||
stdcall codec_write, dword 0x0C
|
||||
|
||||
mov ax, 0x0808
|
||||
stdcall codec_write, dword CODEC_PCM_OUT_REG
|
||||
|
||||
mov ax, 0x0808
|
||||
stdcall codec_write, dword 0x10
|
||||
|
||||
mov ax, 0x0808
|
||||
stdcall codec_write, dword 0x12
|
||||
|
||||
mov ax, 0x0808
|
||||
stdcall codec_write, dword 0x16
|
||||
|
||||
|
||||
stdcall codec_read, dword CODEC_EXT_AUDIO_CTRL_REG
|
||||
|
||||
and eax, 0FFFFh - BIT1 ; clear DRA (BIT1)
|
||||
or eax, BIT0 ; set VRA (BIT0)
|
||||
stdcall codec_write, dword CODEC_EXT_AUDIO_CTRL_REG
|
||||
|
||||
stdcall set_sample_rate, dword 48000
|
||||
|
||||
.init_error:
|
||||
|
||||
xor eax, eax ; exit with error
|
||||
ret
|
||||
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc set_master_vol stdcall, vol:dword
|
||||
|
||||
mov ebx, 63
|
||||
mov ecx, 20644
|
||||
mov eax, [vol]
|
||||
cmp eax, 90
|
||||
jna @f
|
||||
mov eax, 90
|
||||
@@:
|
||||
mul ecx
|
||||
shr eax, 15
|
||||
sub ebx, eax
|
||||
mov ah, bl
|
||||
mov al, bl
|
||||
stdcall codec_write, dword CODEC_MASTER_VOL_REG
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc get_master_vol stdcall, pvol:dword
|
||||
|
||||
stdcall codec_read, dword CODEC_MASTER_VOL_REG
|
||||
and eax, 0x3F
|
||||
mov ebx, 63
|
||||
mov ecx, 20644
|
||||
|
||||
xchg eax, ebx
|
||||
sub eax, ebx
|
||||
shl eax, 15
|
||||
xor edx, edx
|
||||
div ecx
|
||||
mov ebx, [pvol]
|
||||
mov [ebx], eax
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc set_sample_rate stdcall, rate:dword
|
||||
mov eax, [rate]
|
||||
stdcall codec_write, dword CODEC_PCM_FRONT_DACRATE_REG
|
||||
ret
|
||||
endp
|
||||
|
||||
align 16
|
||||
ac_unknown db 'unknown manufacturer',13,10,0
|
||||
ac_Realtek db 'Realtek Semiconductor',13,10,0
|
||||
ac_Analog db 'Analog Devices',13,10,0
|
||||
ac_CMedia db 'C-Media Electronics',13,10,0
|
||||
chip_unknown db 'unknown chip', 13,10,0
|
||||
|
||||
CHIP_ANALOG equ 0x41445300
|
||||
CHIP_REALTEK equ 0x414C4700
|
||||
CHIP_CMEDIA equ 0x434D4900
|
||||
|
||||
align 16
|
||||
codecs dd CHIP_ANALOG, ac_Analog, chips_Analog
|
||||
dd CHIP_CMEDIA, ac_CMedia, chips_CMedia
|
||||
dd CHIP_REALTEK,ac_Realtek, chips_Realtek
|
||||
dd 0
|
||||
|
||||
align 16
|
||||
chips_Analog dd 0x03, chip_AD1819
|
||||
dd 0x40, chip_AD1881
|
||||
dd 0x48, chip_AD1881A
|
||||
dd 0x60, chip_AD1884
|
||||
dd 0x61, chip_AD1886
|
||||
dd 0x62, chip_AD1887
|
||||
dd 0x63, chip_AD1886A
|
||||
dd 0x70, chip_AD1980
|
||||
dd 0x75, chip_AD1985
|
||||
dd 0
|
||||
|
||||
chips_Realtek dd 0x20, chip_ALC650
|
||||
dd 0x21, chip_ALC650D
|
||||
dd 0x22, chip_ALC650E
|
||||
dd 0x23, chip_ALC650F
|
||||
dd 0x60, chip_ALC655
|
||||
dd 0x80, chip_ALC658
|
||||
dd 0x81, chip_ALC658D
|
||||
dd 0x90, chip_ALC850
|
||||
dd 0
|
||||
|
||||
chips_CMedia dd 0x41, chip_CM9738
|
||||
dd 0x61, chip_CM9739
|
||||
dd 0x69, chip_CM9780
|
||||
dd 0x78, chip_CM9761
|
||||
dd 0x82, chip_CM9761
|
||||
dd 0x83, chip_CM9761
|
||||
dd 0
|
||||
|
||||
align 16
|
||||
;Analog Devices
|
||||
chip_AD1819 db 'AD1819 ',0dh,0ah,00h
|
||||
chip_AD1881 db 'AD1881 ',0dh,0ah,00h
|
||||
chip_AD1881A db 'AD1881A',0dh,0ah,00h
|
||||
chip_AD1884 db 'AD1885 ',0dh,0ah,00h
|
||||
chip_AD1885 db 'AD1885 ',0dh,0ah,00h
|
||||
chip_AD1886 db 'AD1886 ',0dh,0ah,00h
|
||||
chip_AD1886A db 'AD1886A',0dh,0ah,00h
|
||||
chip_AD1887 db 'AD1887 ',0dh,0ah,00h
|
||||
chip_AD1980 db 'AD1980 ',0dh,0ah,00h
|
||||
chip_AD1985 db 'AD1985 ',0dh,0ah,00h
|
||||
|
||||
;Realtek
|
||||
chip_ALC650 db 'ALC650 ',0dh,0ah,00h
|
||||
chip_ALC650D db 'ALC650D',0dh,0ah,00h
|
||||
chip_ALC650E db 'ALC650E',0dh,0ah,00h
|
||||
chip_ALC650F db 'ALC650F',0dh,0ah,00h
|
||||
chip_ALC655 db 'ALC655 ',0dh,0ah,00h
|
||||
chip_ALC658 db 'ALC658 ',0dh,0ah,00h
|
||||
chip_ALC658D db 'ALC658D',0dh,0ah,00h
|
||||
chip_ALC850 db 'ALC850 ',0dh,0ah,00h
|
||||
|
||||
;CMedia
|
||||
chip_CM9738 db 'CMI9738', 0dh,0ah,0
|
||||
chip_CM9739 db 'CMI9739', 0dh,0ah,0
|
||||
chip_CM9780 db 'CMI9780', 0dh,0ah,0
|
||||
chip_CM9761 db 'CMI9761', 0dh,0ah,0
|
||||
|
795
kernel/trunk/drivers/INFINITY.ASM
Normal file
795
kernel/trunk/drivers/INFINITY.ASM
Normal file
@ -0,0 +1,795 @@
|
||||
;
|
||||
; This file is part of the Infinity sound library.
|
||||
; (C) copyright Serge 2006
|
||||
; email: infinity_sound@mail.ru
|
||||
;
|
||||
; This program is free software; you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation; either version 2 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
|
||||
format MS COFF
|
||||
|
||||
include 'proc32.inc'
|
||||
include 'main.inc'
|
||||
|
||||
DEBUG equ 1
|
||||
|
||||
EVENT_NOTIFY equ 0x00000200
|
||||
|
||||
OS_BASE equ 0; 0x80400000
|
||||
new_app_base equ 0x60400000; 0x01000000
|
||||
PROC_BASE equ OS_BASE+0x0080000
|
||||
|
||||
public service_proc
|
||||
public START
|
||||
public IMPORTS
|
||||
|
||||
SND_CREATE_BUFF equ 2
|
||||
SND_PLAY equ 3
|
||||
SND_STOP equ 4
|
||||
SND_SETBUFF equ 5
|
||||
SND_DESTROY_BUFF equ 6
|
||||
|
||||
DEV_PLAY equ 1
|
||||
DEV_STOP equ 2
|
||||
DEV_CALLBACK equ 3
|
||||
|
||||
struc IOCTL
|
||||
{ .handle dd ?
|
||||
.io_code dd ?
|
||||
.input dd ?
|
||||
.inp_size dd ?
|
||||
.output dd ?
|
||||
.out_size dd ?
|
||||
}
|
||||
|
||||
virtual at 0
|
||||
IOCTL IOCTL
|
||||
end virtual
|
||||
|
||||
section '.flat' align 16
|
||||
|
||||
START:
|
||||
stdcall [GetService], szSound
|
||||
test eax, eax
|
||||
jz .fail
|
||||
mov [hSound], eax
|
||||
|
||||
stdcall [KernelAlloc], 16*512
|
||||
test eax, eax
|
||||
jz .out_of_mem
|
||||
mov [mix_buff], eax
|
||||
|
||||
mov edi, stream_list
|
||||
mov ecx, 17
|
||||
xor eax, eax
|
||||
cld
|
||||
rep stosd
|
||||
|
||||
mov edi, stream
|
||||
mov ecx, 4*STREAM_SIZE
|
||||
rep stosd
|
||||
|
||||
stdcall set_handler, [hSound], new_mix
|
||||
|
||||
stdcall [RegService], szInfinity, service_proc
|
||||
mov [stream_count],0
|
||||
|
||||
ret
|
||||
.fail:
|
||||
if DEBUG
|
||||
mov esi, msgFail
|
||||
call [SysMsgBoardStr]
|
||||
end if
|
||||
xor eax, eax
|
||||
ret
|
||||
|
||||
.out_of_mem:
|
||||
if DEBUG
|
||||
mov esi, msgMem
|
||||
call [SysMsgBoardStr]
|
||||
end if
|
||||
xor eax, eax
|
||||
ret
|
||||
|
||||
handle equ IOCTL.handle
|
||||
io_code equ IOCTL.io_code
|
||||
input equ IOCTL.input
|
||||
inp_size equ IOCTL.inp_size
|
||||
output equ IOCTL.output
|
||||
out_size equ IOCTL.out_size
|
||||
|
||||
align 4
|
||||
proc service_proc stdcall, ioctl:dword
|
||||
|
||||
mov edi, [ioctl]
|
||||
mov eax, [edi+io_code]
|
||||
|
||||
cmp eax, SND_CREATE_BUFF
|
||||
jne @F
|
||||
mov ebx, [edi+input]
|
||||
stdcall CreateBuffer,[ebx]
|
||||
ret
|
||||
@@:
|
||||
cmp eax, SND_PLAY
|
||||
jne @F
|
||||
|
||||
mov ebx, [edi+input]
|
||||
stdcall play_buffer, [ebx]
|
||||
ret
|
||||
@@:
|
||||
cmp eax, SND_STOP
|
||||
jne @F
|
||||
|
||||
; if DEBUG
|
||||
; mov esi, msgStop
|
||||
; call [SysMsgBoardStr]
|
||||
; end if
|
||||
|
||||
mov ebx, [edi+input]
|
||||
stdcall stop_buffer, [ebx]
|
||||
ret
|
||||
@@:
|
||||
cmp eax, SND_SETBUFF
|
||||
jne @F
|
||||
|
||||
mov ebx, [edi+input]
|
||||
mov eax, [ebx+4]
|
||||
add eax, new_app_base
|
||||
stdcall set_buffer, [ebx],eax,[ebx+8],[ebx+12]
|
||||
ret
|
||||
@@:
|
||||
cmp eax, SND_DESTROY_BUFF
|
||||
jne @F
|
||||
|
||||
mov ebx, [edi+input]
|
||||
stdcall DestroyBuffer, [ebx]
|
||||
ret
|
||||
@@:
|
||||
xor eax, eax
|
||||
ret
|
||||
endp
|
||||
|
||||
restore handle
|
||||
restore io_code
|
||||
restore input
|
||||
restore inp_size
|
||||
restore output
|
||||
restore out_size
|
||||
|
||||
TASK_COUNT equ 0x0003004
|
||||
CURRENT_TASK equ 0x0003000
|
||||
|
||||
|
||||
align 8
|
||||
proc CreateBuffer stdcall, format:dword
|
||||
locals
|
||||
str dd ?
|
||||
endl
|
||||
|
||||
call alloc_stream
|
||||
and eax, eax
|
||||
jz .fail
|
||||
mov [str], eax
|
||||
mov edi, eax
|
||||
|
||||
mov edx, [stream_count]
|
||||
mov [stream_list+edx*4], eax
|
||||
inc [stream_count]
|
||||
|
||||
mov [edi+STREAM.magic], 'WAVE'
|
||||
mov [edi+STREAM.size], STREAM_SIZE
|
||||
|
||||
stdcall [KernelAlloc], 180*1024
|
||||
|
||||
mov edi, [str]
|
||||
mov [edi+STREAM.base], eax
|
||||
mov [edi+STREAM.curr_seg], eax
|
||||
mov [edi+STREAM.notify_off1], eax
|
||||
add eax, 0x8000
|
||||
mov [edi+STREAM.notify_off2], eax
|
||||
add eax, 0x7FFF
|
||||
mov [edi+STREAM.limit], eax
|
||||
|
||||
inc eax
|
||||
|
||||
mov [edi+STREAM.work_buff], eax
|
||||
mov [edi+STREAM.work_read], eax
|
||||
mov [edi+STREAM.work_write], eax
|
||||
mov [edi+STREAM.work_count], 0
|
||||
add eax, 0x10000
|
||||
mov [edi+STREAM.work_top], eax
|
||||
add eax, 1024*32
|
||||
mov [edi+STREAM.r_buff], eax
|
||||
|
||||
mov ebx, [CURRENT_TASK]
|
||||
shl ebx, 5
|
||||
mov eax, [0x3000+ebx+4]
|
||||
|
||||
mov [edi+STREAM.notify_task], eax
|
||||
|
||||
mov eax, [format]
|
||||
mov [edi+STREAM.format], eax
|
||||
mov [edi+STREAM.flags], SND_STOP
|
||||
|
||||
xor ebx, ebx
|
||||
cmp eax, 19
|
||||
jb @f
|
||||
mov ebx, 0x80808080
|
||||
@@:
|
||||
mov [edi+STREAM.r_silence], ebx
|
||||
|
||||
shl eax, 4
|
||||
mov ebx, [resampler_params+eax]
|
||||
mov ecx, [resampler_params+eax+4]
|
||||
mov edx, [resampler_params+eax+8]
|
||||
|
||||
mov [edi+STREAM.r_size],ebx
|
||||
mov [edi+STREAM.r_end], ecx
|
||||
mov [edi+STREAM.r_dt], edx
|
||||
|
||||
mov ebx, [resampler_params+eax+12]
|
||||
mov [edi+STREAM.resample], ebx
|
||||
|
||||
mov edi, [edi+STREAM.base]
|
||||
mov ecx, 180*1024/4
|
||||
xor eax, eax
|
||||
rep stosd
|
||||
|
||||
mov eax, [str]
|
||||
ret
|
||||
|
||||
.fail:
|
||||
xor eax, eax
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
pid_to_slot:
|
||||
|
||||
push ebx
|
||||
push ecx
|
||||
mov ebx,[TASK_COUNT]
|
||||
shl ebx,5
|
||||
mov ecx,2*32
|
||||
.loop:
|
||||
cmp byte [CURRENT_TASK+ecx+0xa],9
|
||||
jz .endloop ;skip empty slots
|
||||
cmp [CURRENT_TASK+ecx+0x4],eax ;check PID
|
||||
jz .pid_found
|
||||
.endloop:
|
||||
add ecx,32
|
||||
cmp ecx,ebx
|
||||
jle .loop
|
||||
pop ecx
|
||||
pop ebx
|
||||
xor eax,eax
|
||||
ret
|
||||
|
||||
.pid_found:
|
||||
shr ecx,5
|
||||
mov eax,ecx
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret
|
||||
|
||||
|
||||
|
||||
align 4
|
||||
proc DestroyBuffer stdcall, str:dword
|
||||
|
||||
mov esi, [str]
|
||||
|
||||
cmp [esi+STREAM.magic], 'WAVE'
|
||||
jne .fail
|
||||
|
||||
cmp [esi+STREAM.size], STREAM_SIZE
|
||||
jne .fail
|
||||
|
||||
stdcall [KernelFree], [esi+STREAM.base]
|
||||
|
||||
mov eax, [str]
|
||||
call free_stream
|
||||
|
||||
mov edi, [str]
|
||||
mov ecx, STREAM_SIZE/4
|
||||
xor eax, eax
|
||||
cld
|
||||
rep stosd
|
||||
|
||||
mov eax, [str]
|
||||
mov esi, stream_list
|
||||
mov ecx, 16
|
||||
@@:
|
||||
cmp [esi], eax
|
||||
je .remove
|
||||
add esi, 4
|
||||
dec ecx
|
||||
jnz @B
|
||||
xor eax, eax
|
||||
inc eax
|
||||
ret
|
||||
.remove:
|
||||
mov edi, esi
|
||||
add esi, 4
|
||||
cld
|
||||
rep movsd
|
||||
dec [stream_count]
|
||||
xor eax, eax
|
||||
inc eax
|
||||
ret
|
||||
.fail:
|
||||
xor eax, eax
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc play_buffer stdcall, str:dword
|
||||
|
||||
mov ebx, [str]
|
||||
|
||||
cmp [ebx+STREAM.magic], 'WAVE'
|
||||
jne .fail
|
||||
|
||||
cmp [ebx+STREAM.size], STREAM_SIZE
|
||||
jne .fail
|
||||
|
||||
mov [ebx+STREAM.flags], SND_PLAY
|
||||
|
||||
mov eax,[ebx+STREAM.work_buff]
|
||||
mov [ebx+STREAM.work_read], eax
|
||||
mov [ebx+STREAM.work_write], eax
|
||||
mov [ebx+STREAM.work_count], 0
|
||||
|
||||
mov eax, [ebx+STREAM.base]
|
||||
mov [ebx+STREAM.curr_seg], eax
|
||||
|
||||
mov esi, [ebx+STREAM.curr_seg]
|
||||
mov edi, [ebx+STREAM.work_write]
|
||||
mov edx, [ebx+STREAM.r_buff]
|
||||
|
||||
mov ecx, 32
|
||||
mov eax, [ebx+STREAM.r_silence]
|
||||
@@:
|
||||
mov [edx], eax
|
||||
add edx, 4
|
||||
dec ecx
|
||||
jnz @B
|
||||
|
||||
mov edx, [ebx+STREAM.r_buff]
|
||||
|
||||
stdcall [ebx+STREAM.resample], edi, esi, edx,\
|
||||
[ebx+STREAM.r_dt],[ebx+STREAM.r_size],[ebx+STREAM.r_end]
|
||||
|
||||
mov ebx, [str]
|
||||
|
||||
add [ebx+STREAM.work_count], eax;
|
||||
add [ebx+STREAM.work_write], eax;
|
||||
|
||||
mov eax, [ebx+STREAM.r_size]
|
||||
add [ebx+STREAM.curr_seg], eax
|
||||
|
||||
; if DEBUG
|
||||
; mov esi, msgPlay
|
||||
; call [SysMsgBoardStr]
|
||||
; end if
|
||||
|
||||
stdcall dev_play, [hSound]
|
||||
|
||||
xor eax, eax
|
||||
inc eax
|
||||
ret
|
||||
|
||||
.fail:
|
||||
xor eax, eax
|
||||
ret
|
||||
|
||||
endp
|
||||
|
||||
|
||||
align 4
|
||||
proc stop_buffer stdcall, str:dword
|
||||
|
||||
mov edi, [str]
|
||||
|
||||
cmp [edi+STREAM.magic], 'WAVE'
|
||||
jne .fail
|
||||
|
||||
cmp [edi+STREAM.size], STREAM_SIZE
|
||||
jne .fail
|
||||
|
||||
mov [edi+STREAM.flags], SND_STOP
|
||||
|
||||
; stdcall [ServiceHandler], [hSound], dword DEV_STOP, 0
|
||||
|
||||
xor eax, eax
|
||||
inc eax
|
||||
ret
|
||||
|
||||
.fail:
|
||||
xor eax, eax
|
||||
ret
|
||||
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc set_buffer stdcall, str:dword,src:dword,offs:dword,size:dword
|
||||
|
||||
mov edx, [str]
|
||||
test edx, edx
|
||||
jz .fail
|
||||
|
||||
cmp [edx+STREAM.magic], 'WAVE'
|
||||
jne .fail
|
||||
|
||||
cmp [edx+STREAM.size], STREAM_SIZE
|
||||
jne .fail
|
||||
|
||||
mov esi,[src]
|
||||
test esi, esi
|
||||
jz .fail
|
||||
|
||||
cmp esi, new_app_base
|
||||
jb .fail
|
||||
|
||||
mov ecx, [size]
|
||||
test ecx, ecx
|
||||
jz .fail
|
||||
|
||||
mov eax, [edx+STREAM.base]
|
||||
add eax, [offs]
|
||||
|
||||
cmp eax, [edx+STREAM.base]
|
||||
jb .fail
|
||||
|
||||
mov edi, eax
|
||||
add eax, ecx
|
||||
sub eax, 1
|
||||
|
||||
cmp eax, [edx+STREAM.limit]
|
||||
ja .fail
|
||||
|
||||
shr ecx, 2
|
||||
cld
|
||||
rep movsd
|
||||
|
||||
xor eax, eax
|
||||
inc eax
|
||||
ret
|
||||
.fail:
|
||||
xor eax, eax
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc alloc_stream
|
||||
|
||||
mov esi, stream_map
|
||||
|
||||
pushf
|
||||
cli
|
||||
|
||||
bsf eax, [esi]
|
||||
jnz .find
|
||||
popf
|
||||
xor eax, eax
|
||||
ret
|
||||
|
||||
.find: btr [esi], eax
|
||||
popf
|
||||
mov ebx, STREAM_SIZE
|
||||
mul ebx
|
||||
add eax, stream
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc free_stream
|
||||
sub eax, stream
|
||||
mov ebx, STREAM_SIZE
|
||||
xor edx, edx
|
||||
div ebx
|
||||
|
||||
and edx, edx
|
||||
jnz .err
|
||||
|
||||
bts [stream_map], eax
|
||||
|
||||
ret
|
||||
.err:
|
||||
xor eax, eax
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc check_stream
|
||||
|
||||
xor edx, edx
|
||||
mov ecx, [play_count]
|
||||
.l1:
|
||||
mov esi, [play_list+edx]
|
||||
|
||||
mov eax, [esi+STR.curr_seg]
|
||||
cmp eax, [esi+STR.limit]
|
||||
jb .next
|
||||
|
||||
.m1: mov eax,[esi+STR.base]
|
||||
mov [esi+STR.curr_seg], eax
|
||||
.next:
|
||||
add edx, 4
|
||||
loop .l1
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
align 4
|
||||
proc prepare_playlist
|
||||
|
||||
.restart:
|
||||
xor ebx, ebx
|
||||
xor edx, edx
|
||||
mov [play_count], 0
|
||||
mov ecx, [stream_count]
|
||||
jcxz .exit
|
||||
.l1:
|
||||
mov esi, [stream_list+ebx]
|
||||
test esi, esi
|
||||
jz .next
|
||||
|
||||
cmp [esi+STREAM.magic], 'WAVE'
|
||||
jne .next
|
||||
|
||||
cmp [esi+STREAM.size], STREAM_SIZE
|
||||
jne .next
|
||||
|
||||
mov eax,[esi+STREAM.notify_task]
|
||||
cmp eax, -1
|
||||
je .fail
|
||||
|
||||
call pid_to_slot
|
||||
test eax, eax
|
||||
jz .fail
|
||||
|
||||
cmp [esi+STREAM.flags], SND_PLAY;
|
||||
jne .next
|
||||
cmp [esi+STREAM.work_count], 16384
|
||||
jb .next
|
||||
|
||||
mov [play_list+edx], esi
|
||||
inc [play_count]
|
||||
add edx, 4
|
||||
.next:
|
||||
add ebx, 4
|
||||
loop .l1
|
||||
.exit:
|
||||
ret
|
||||
|
||||
.fail:
|
||||
stdcall DestroyBuffer, esi
|
||||
jmp .restart
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc prepare_updatelist
|
||||
|
||||
xor ebx, ebx
|
||||
xor edx, edx
|
||||
mov [play_count], 0
|
||||
mov ecx, [stream_count]
|
||||
jcxz .exit
|
||||
.l1:
|
||||
mov eax, [stream_list+ebx]
|
||||
test eax, eax
|
||||
jz .next
|
||||
cmp [eax+STREAM.flags], SND_PLAY
|
||||
jne .next
|
||||
|
||||
mov [play_list+edx], eax
|
||||
inc [play_count]
|
||||
add edx, 4
|
||||
.next:
|
||||
add ebx, 4
|
||||
loop .l1
|
||||
.exit:
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
align 4
|
||||
proc set_handler stdcall, hsrv:dword, handler_proc:dword
|
||||
locals
|
||||
handler dd ?
|
||||
io_code dd ?
|
||||
input dd ?
|
||||
inp_size dd ?
|
||||
output dd ?
|
||||
out_size dd ?
|
||||
val dd ?
|
||||
endl
|
||||
|
||||
mov eax, [hsrv]
|
||||
lea ecx, [handler_proc]
|
||||
xor ebx, ebx
|
||||
|
||||
mov [handler], eax
|
||||
mov [io_code], DEV_CALLBACK
|
||||
mov [input], ecx
|
||||
mov [inp_size], 4
|
||||
mov [output], ebx
|
||||
mov [out_size], 0
|
||||
|
||||
lea eax, [handler]
|
||||
stdcall [ServiceHandler], eax
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc dev_play stdcall, hsrv:dword
|
||||
locals
|
||||
handle dd ?
|
||||
io_code dd ?
|
||||
input dd ?
|
||||
inp_size dd ?
|
||||
output dd ?
|
||||
out_size dd ?
|
||||
val dd ?
|
||||
endl
|
||||
|
||||
mov eax, [hsrv]
|
||||
xor ebx, ebx
|
||||
|
||||
mov [handle], eax
|
||||
mov [io_code], DEV_PLAY
|
||||
mov [input], ebx
|
||||
mov [inp_size], ebx
|
||||
mov [output], ebx
|
||||
mov [out_size], ebx
|
||||
|
||||
lea eax, [handle]
|
||||
stdcall [ServiceHandler], eax
|
||||
ret
|
||||
endp
|
||||
|
||||
include 'mixer.asm'
|
||||
|
||||
align 16
|
||||
play_list dd 16 dup(0)
|
||||
stream_list dd 17 dup(0)
|
||||
|
||||
align 16
|
||||
resampler_params:
|
||||
;r_size r_end r_dt resampler_func
|
||||
dd 0,0,0,0 ; 0 PCM_ALL
|
||||
dd 16384, 0, 0, copy_stream ; 1 PCM_2_16_48
|
||||
dd 16384, 0, 0, m16_stereo ; 2 PCM_1_16_48
|
||||
|
||||
dd 16384, 0x08000000, 30109, resample_2 ; 3 PCM_2_16_44
|
||||
dd 8192, 0x08000000, 30109, resample_1 ; 4 PCM_1_16_44
|
||||
|
||||
dd 16384, 0x08000000, 21846, resample_2 ; 5 PCM_2_16_32
|
||||
dd 8192, 0x08000000, 21846, resample_1 ; 6 PCM_1_16_32
|
||||
|
||||
dd 16384, 0x08000000, 16384, resample_2 ; 7 PCM_2_16_24
|
||||
dd 8192, 0x08000000, 16384, resample_1 ; 8 PCM_1_16_24
|
||||
|
||||
dd 8192, 0x04000000, 15052, resample_2 ; 9 PCM_2_16_22
|
||||
dd 4096, 0x04000000, 15052, resample_1 ;10 PCM_1_16_22
|
||||
|
||||
dd 8192, 0x04000000, 10923, resample_2 ;11 PCM_2_16_16
|
||||
dd 4096, 0x04000000, 10923, resample_1 ;12 PCM_1_16_16
|
||||
|
||||
dd 8192, 0x04000000, 8192, resample_2 ;13 PCM_2_16_12
|
||||
dd 4096, 0x04000000, 8192, resample_1 ;14 PCM_1_16_12
|
||||
|
||||
dd 4096, 0x02000000, 7527, resample_2 ;15 PCM_2_16_11
|
||||
dd 2048, 0x02000000, 7527, resample_1 ;16 PCM_1_16_11
|
||||
|
||||
dd 4096, 0x02000000, 5462, resample_2 ;17 PCM_2_16_8
|
||||
dd 2048, 0x02000000, 5462, resample_1 ;18 PCM_1_16_8
|
||||
|
||||
dd 16384, 0, 0, s8_stereo ;19 PCM_2_8_48
|
||||
dd 8192, 0, 0, m8_stereo ;20 PCM_1_8_48
|
||||
|
||||
dd 8192, 0x08000000, 30109, resample_28 ;21 PCM_2_8_44
|
||||
dd 4096, 0x08000000, 30109, resample_18 ;22 PCM_1_8_44
|
||||
|
||||
dd 8192, 0x08000000, 21846, resample_28 ;23 PCM_2_8_32
|
||||
dd 4096, 0x08000000, 21846, resample_18 ;24 PCM_1_8_32
|
||||
|
||||
dd 8192, 0x08000000, 16384, resample_28 ;25 PCM_2_8_24
|
||||
dd 4096, 0x08000000, 16384, resample_18 ;26 PCM_1_8_24
|
||||
|
||||
dd 4096, 0x04000000, 15052, resample_28 ;27 PCM_2_8_22
|
||||
dd 2048, 0x04000000, 15052, resample_18 ;28 PCM_1_8_22
|
||||
|
||||
dd 4096, 0x04000000, 10923, resample_28 ;29 PCM_2_8_16
|
||||
dd 2048, 0x04000000, 10923, resample_18 ;30 PCM_1_8_16
|
||||
|
||||
dd 4096, 0x04000000, 8192, resample_28 ;31 PCM_2_8_12
|
||||
dd 2048, 0x04000000, 8192, resample_18 ;32 PCM_1_8_12
|
||||
|
||||
dd 2048, 0x02000000, 7527, resample_28 ;33 PCM_2_8_11
|
||||
dd 1024, 0x02000000, 7527, resample_18 ;34 PCM_1_8_11
|
||||
|
||||
dd 2048, 0x02000000, 5462, resample_28 ;35 PCM_2_8_8
|
||||
dd 1024, 0x02000000, 5462, resample_18 ;36 PCM_1_8_8
|
||||
|
||||
|
||||
play_count dd 0
|
||||
|
||||
stream_count dd 0
|
||||
|
||||
align 8
|
||||
hSound dd 0
|
||||
|
||||
m7 dw 0x8000,0x8000,0x8000,0x8000
|
||||
mm80 dq 0x8080808080808080
|
||||
mm_mask dq 0xFF00FF00FF00FF00
|
||||
|
||||
mix_input dd 16 dup(0)
|
||||
|
||||
align 16
|
||||
;fpu_state db 512 dup(0)
|
||||
|
||||
align 16
|
||||
stream db STREAM_SIZE*16 dup(0)
|
||||
stream_map dd 0xFFFF ; 16
|
||||
mix_buff dd 0
|
||||
mix_buff_map dd 0
|
||||
|
||||
align 16
|
||||
IMPORTS:
|
||||
|
||||
AttachIntHandler dd szAttachIntHandler
|
||||
SysMsgBoardStr dd szSysMsgBoardStr
|
||||
PciApi dd szPciApi
|
||||
PciRead32 dd szPciRead32
|
||||
PciRead8 dd szPciRead8
|
||||
AllocKernelSpace dd szAllocKernelSpace
|
||||
MapPage dd szMapPage
|
||||
KernelAlloc dd szKernelAlloc
|
||||
KernelFree dd szKernelFree
|
||||
GetPgAddr dd szGetPgAddr
|
||||
RegService dd szRegService
|
||||
GetCurrentTask dd szGetCurrentTask
|
||||
GetService dd szGetService
|
||||
ServiceHandler dd szServiceHandler
|
||||
FpuSave dd szFpuSave
|
||||
FpuRestore dd szFpuRestore
|
||||
dd 0
|
||||
|
||||
szKernel db 'KERNEL', 0
|
||||
szAttachIntHandler db 'AttachIntHandler',0
|
||||
szSysMsgBoardStr db 'SysMsgBoardStr', 0
|
||||
szPciApi db 'PciApi', 0
|
||||
szPciRead32 db 'PciRead32', 0
|
||||
szPciRead8 db 'PciRead8', 0
|
||||
szAllocKernelSpace db 'AllocKernelSpace',0
|
||||
szMapPage db 'MapPage',0
|
||||
szRegService db 'RegService',0
|
||||
szKernelAlloc db 'KernelAlloc',0
|
||||
szGetPgAddr db 'GetPgAddr',0
|
||||
szGetCurrentTask db 'GetCurrentTask ',0
|
||||
szGetService db 'GetService',0
|
||||
szServiceHandler db 'ServiceHandler',0
|
||||
szKernelFree db 'KernelFree',0
|
||||
szFpuSave db 'FpuSave',0
|
||||
szFpuRestore db 'FpuRestore',0
|
||||
|
||||
|
||||
szInfinity db 'INFINITY',0
|
||||
szSound db 'SOUND',0
|
||||
|
||||
if DEBUG
|
||||
msgFail db 'Sound service not found',13,10,0
|
||||
msgPlay db 'Play buffer',13,10,0
|
||||
msgStop db 'Stop',13,10,0
|
||||
msgUser db 'User callback',13,10,0
|
||||
msgMem db 'Not enough memory',13,10,0
|
||||
end if
|
133
kernel/trunk/drivers/MAIN.INC
Normal file
133
kernel/trunk/drivers/MAIN.INC
Normal file
@ -0,0 +1,133 @@
|
||||
;
|
||||
; This file is part of the Infinity sound AC97 driver.
|
||||
; (C) copyright Serge 2006
|
||||
; email: infinity_sound@mail.ru
|
||||
;
|
||||
; This program is free software; you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation; either version 2 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
|
||||
PCM_2_16_48 equ 1
|
||||
PCM_1_16_48 equ 2
|
||||
|
||||
PCM_2_16_44 equ 3
|
||||
PCM_1_16_44 equ 4
|
||||
|
||||
PCM_2_16_32 equ 5
|
||||
PCM_1_16_32 equ 6
|
||||
|
||||
PCM_2_16_24 equ 7
|
||||
PCM_1_16_24 equ 8
|
||||
|
||||
PCM_2_16_22 equ 9
|
||||
PCM_1_16_22 equ 10
|
||||
|
||||
PCM_2_16_16 equ 11
|
||||
PCM_1_16_16 equ 12
|
||||
|
||||
PCM_2_16_12 equ 13
|
||||
PCM_1_16_12 equ 14
|
||||
|
||||
PCM_2_16_11 equ 15
|
||||
PCM_1_16_11 equ 16
|
||||
|
||||
PCM_2_8_48 equ 17
|
||||
PCM_1_8_48 equ 18
|
||||
|
||||
PCM_2_8_44 equ 19
|
||||
PCM_1_8_44 equ 20
|
||||
|
||||
PCM_2_8_32 equ 21
|
||||
PCM_1_8_32 equ 22
|
||||
|
||||
PCM_2_8_24 equ 23
|
||||
PCM_1_8_24 equ 24
|
||||
|
||||
PCM_2_8_22 equ 25
|
||||
PCM_1_8_22 equ 26
|
||||
|
||||
PCM_2_8_16 equ 27
|
||||
PCM_1_8_16 equ 28
|
||||
|
||||
PCM_2_8_12 equ 29
|
||||
PCM_1_8_12 equ 30
|
||||
|
||||
PCM_2_8_11 equ 31
|
||||
PCM_1_8_11 equ 32
|
||||
|
||||
SND_PLAY equ 1
|
||||
SND_STOP equ 2
|
||||
|
||||
; struc SND_DEV
|
||||
;{ .magic dd 0
|
||||
; .size dd 0
|
||||
; .count dd 0
|
||||
; dd 0
|
||||
; .snd_buff dd 16 dup (0)
|
||||
;}
|
||||
|
||||
;virtual at 0
|
||||
; SND_DEV SND_DEV
|
||||
;end virtual
|
||||
|
||||
;SND_DEV_SIZE equ 80
|
||||
|
||||
|
||||
struc STREAM
|
||||
{ .magic dd 0
|
||||
.size dd 0
|
||||
.device dd 0
|
||||
.format dd 0
|
||||
.flags dd 0
|
||||
|
||||
.work_buff dd 0
|
||||
.work_read dd 0
|
||||
.work_write dd 0
|
||||
.work_count dd 0
|
||||
.work_top dd 0
|
||||
.r_buff dd 0
|
||||
.r_size dd 0
|
||||
.r_end dd 0
|
||||
.r_dt dd 0
|
||||
.r_silence dd 0
|
||||
|
||||
.base dd 0
|
||||
.curr_seg dd 0
|
||||
.limit dd 0
|
||||
.buff_size dd 0
|
||||
.notify_off1 dd 0
|
||||
.notify_off2 dd 0
|
||||
.notify_task dd 0
|
||||
.resample dd 0
|
||||
}
|
||||
|
||||
STREAM_SIZE equ 23*4
|
||||
|
||||
virtual at 0
|
||||
STREAM STREAM
|
||||
end virtual
|
||||
|
||||
struc WAVE_HEADER
|
||||
{ .riff_id dd ?
|
||||
.riff_size dd ?
|
||||
.riff_format dd ?
|
||||
|
||||
.fmt_id dd ?
|
||||
.fmt_size dd ?
|
||||
.format_tag dw ?
|
||||
.channels dw ?
|
||||
.freq dd ?
|
||||
.bytes_sec dd ?
|
||||
.block_align dw ?
|
||||
.bits_sample dw ?
|
||||
|
||||
.data_id dd ?
|
||||
.data_size dd ?
|
||||
}
|
||||
|
1290
kernel/trunk/drivers/MIXER.ASM
Normal file
1290
kernel/trunk/drivers/MIXER.ASM
Normal file
File diff suppressed because it is too large
Load Diff
268
kernel/trunk/drivers/PROC32.INC
Normal file
268
kernel/trunk/drivers/PROC32.INC
Normal file
@ -0,0 +1,268 @@
|
||||
|
||||
; Macroinstructions for defining and calling procedures
|
||||
|
||||
macro stdcall proc,[arg] ; directly call STDCALL procedure
|
||||
{ common
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushd arg
|
||||
common
|
||||
end if
|
||||
call proc }
|
||||
|
||||
macro invoke proc,[arg] ; indirectly call STDCALL procedure
|
||||
{ common
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushd arg
|
||||
common
|
||||
end if
|
||||
call [proc] }
|
||||
|
||||
macro ccall proc,[arg] ; directly call CDECL procedure
|
||||
{ common
|
||||
size@ccall = 0
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushd arg
|
||||
size@ccall = size@ccall+4
|
||||
common
|
||||
end if
|
||||
call proc
|
||||
if size@ccall
|
||||
add esp,size@ccall
|
||||
end if }
|
||||
|
||||
macro cinvoke proc,[arg] ; indirectly call CDECL procedure
|
||||
{ common
|
||||
size@ccall = 0
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushd arg
|
||||
size@ccall = size@ccall+4
|
||||
common
|
||||
end if
|
||||
call [proc]
|
||||
if size@ccall
|
||||
add esp,size@ccall
|
||||
end if }
|
||||
|
||||
macro proc [args] ; define procedure
|
||||
{ common
|
||||
match name params, args>
|
||||
\{ define@proc name,<params \} }
|
||||
|
||||
prologue@proc equ prologuedef
|
||||
|
||||
macro prologuedef procname,flag,parmbytes,localbytes,reglist
|
||||
{ if parmbytes | localbytes
|
||||
push ebp
|
||||
mov ebp,esp
|
||||
if localbytes
|
||||
sub esp,localbytes
|
||||
end if
|
||||
end if
|
||||
irps reg, reglist \{ push reg \} }
|
||||
|
||||
epilogue@proc equ epiloguedef
|
||||
|
||||
macro epiloguedef procname,flag,parmbytes,localbytes,reglist
|
||||
{ irps reg, reglist \{ reverse pop reg \}
|
||||
if parmbytes | localbytes
|
||||
leave
|
||||
end if
|
||||
if flag and 10000b
|
||||
retn
|
||||
else
|
||||
retn parmbytes
|
||||
end if }
|
||||
|
||||
macro define@proc name,statement
|
||||
{ local params,flag,regs,parmbytes,localbytes,current
|
||||
if used name
|
||||
name:
|
||||
match =stdcall args, statement \{ params equ args
|
||||
flag = 11b \}
|
||||
match =stdcall, statement \{ params equ
|
||||
flag = 11b \}
|
||||
match =c args, statement \{ params equ args
|
||||
flag = 10001b \}
|
||||
match =c, statement \{ params equ
|
||||
flag = 10001b \}
|
||||
match =params, params \{ params equ statement
|
||||
flag = 0 \}
|
||||
virtual at ebp+8
|
||||
match =uses reglist=,args, params \{ regs equ reglist
|
||||
params equ args \}
|
||||
match =regs =uses reglist, regs params \{ regs equ reglist
|
||||
params equ \}
|
||||
match =regs, regs \{ regs equ \}
|
||||
match =,args, params \{ defargs@proc args \}
|
||||
match =args@proc args, args@proc params \{ defargs@proc args \}
|
||||
parmbytes = $ - (ebp+8)
|
||||
end virtual
|
||||
name # % = parmbytes/4
|
||||
all@vars equ
|
||||
current = 0
|
||||
match prologue:reglist, prologue@proc:<regs> \{ prologue name,flag,parmbytes,localbytes,reglist \}
|
||||
macro locals
|
||||
\{ virtual at ebp-localbytes+current
|
||||
macro label . \\{ deflocal@proc .,:, \\}
|
||||
struc db [val] \\{ \common deflocal@proc .,db,val \\}
|
||||
struc dw [val] \\{ \common deflocal@proc .,dw,val \\}
|
||||
struc dp [val] \\{ \common deflocal@proc .,dp,val \\}
|
||||
struc dd [val] \\{ \common deflocal@proc .,dd,val \\}
|
||||
struc dt [val] \\{ \common deflocal@proc .,dt,val \\}
|
||||
struc dq [val] \\{ \common deflocal@proc .,dq,val \\}
|
||||
struc rb cnt \\{ deflocal@proc .,rb cnt, \\}
|
||||
struc rw cnt \\{ deflocal@proc .,rw cnt, \\}
|
||||
struc rp cnt \\{ deflocal@proc .,rp cnt, \\}
|
||||
struc rd cnt \\{ deflocal@proc .,rd cnt, \\}
|
||||
struc rt cnt \\{ deflocal@proc .,rt cnt, \\}
|
||||
struc rq cnt \\{ deflocal@proc .,rq cnt, \\} \}
|
||||
macro endl
|
||||
\{ purge label
|
||||
restruc db,dw,dp,dd,dt,dq
|
||||
restruc rb,rw,rp,rd,rt,rq
|
||||
restruc byte,word,dword,pword,tword,qword
|
||||
current = $-(ebp-localbytes)
|
||||
end virtual \}
|
||||
macro ret operand
|
||||
\{ match any, operand \\{ retn operand \\}
|
||||
match , operand \\{ match epilogue:reglist, epilogue@proc:<regs>
|
||||
\\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \}
|
||||
macro finish@proc \{ localbytes = (((current-1) shr 2)+1) shl 2
|
||||
end if \} }
|
||||
|
||||
macro defargs@proc [arg]
|
||||
{ common
|
||||
if ~ arg eq
|
||||
forward
|
||||
local ..arg,current@arg
|
||||
match argname:type, arg
|
||||
\{ current@arg equ argname
|
||||
label ..arg type
|
||||
argname equ ..arg
|
||||
if dqword eq type
|
||||
dd ?,?,?,?
|
||||
else if tbyte eq type
|
||||
dd ?,?,?
|
||||
else if qword eq type | pword eq type
|
||||
dd ?,?
|
||||
else
|
||||
dd ?
|
||||
end if \}
|
||||
match =current@arg,current@arg
|
||||
\{ current@arg equ arg
|
||||
arg equ ..arg
|
||||
..arg dd ? \}
|
||||
common
|
||||
args@proc equ current@arg
|
||||
forward
|
||||
restore current@arg
|
||||
common
|
||||
end if }
|
||||
|
||||
macro deflocal@proc name,def,[val]
|
||||
{ common
|
||||
match vars, all@vars \{ all@vars equ all@vars, \}
|
||||
all@vars equ all@vars name
|
||||
forward
|
||||
local ..var,..tmp
|
||||
..var def val
|
||||
match =?, val \{ ..tmp equ \}
|
||||
match any =dup (=?), val \{ ..tmp equ \}
|
||||
match tmp : value, ..tmp : val
|
||||
\{ tmp: end virtual
|
||||
initlocal@proc ..var,def value
|
||||
virtual at tmp\}
|
||||
common
|
||||
match first rest, ..var, \{ name equ first \} }
|
||||
|
||||
macro initlocal@proc name,def
|
||||
{ virtual at name
|
||||
def
|
||||
size@initlocal = $ - name
|
||||
end virtual
|
||||
position@initlocal = 0
|
||||
while size@initlocal > position@initlocal
|
||||
virtual at name
|
||||
def
|
||||
if size@initlocal - position@initlocal < 2
|
||||
current@initlocal = 1
|
||||
load byte@initlocal byte from name+position@initlocal
|
||||
else if size@initlocal - position@initlocal < 4
|
||||
current@initlocal = 2
|
||||
load word@initlocal word from name+position@initlocal
|
||||
else
|
||||
current@initlocal = 4
|
||||
load dword@initlocal dword from name+position@initlocal
|
||||
end if
|
||||
end virtual
|
||||
if current@initlocal = 1
|
||||
mov byte [name+position@initlocal],byte@initlocal
|
||||
else if current@initlocal = 2
|
||||
mov word [name+position@initlocal],word@initlocal
|
||||
else
|
||||
mov dword [name+position@initlocal],dword@initlocal
|
||||
end if
|
||||
position@initlocal = position@initlocal + current@initlocal
|
||||
end while }
|
||||
|
||||
macro endp
|
||||
{ purge ret,locals,endl
|
||||
finish@proc
|
||||
purge finish@proc
|
||||
restore regs@proc
|
||||
match all,args@proc \{ restore all \}
|
||||
restore args@proc
|
||||
match all,all@vars \{ restore all \} }
|
||||
|
||||
macro local [var]
|
||||
{ common
|
||||
locals
|
||||
forward done@local equ
|
||||
match varname[count]:vartype, var
|
||||
\{ match =BYTE, vartype \\{ varname rb count
|
||||
restore done@local \\}
|
||||
match =WORD, vartype \\{ varname rw count
|
||||
restore done@local \\}
|
||||
match =DWORD, vartype \\{ varname rd count
|
||||
restore done@local \\}
|
||||
match =PWORD, vartype \\{ varname rp count
|
||||
restore done@local \\}
|
||||
match =QWORD, vartype \\{ varname rq count
|
||||
restore done@local \\}
|
||||
match =TBYTE, vartype \\{ varname rt count
|
||||
restore done@local \\}
|
||||
match =DQWORD, vartype \\{ label varname dqword
|
||||
rq count+count
|
||||
restore done@local \\}
|
||||
match , done@local \\{ virtual
|
||||
varname vartype
|
||||
end virtual
|
||||
rb count*sizeof.\#vartype
|
||||
restore done@local \\} \}
|
||||
match :varname:vartype, done@local:var
|
||||
\{ match =BYTE, vartype \\{ varname db ?
|
||||
restore done@local \\}
|
||||
match =WORD, vartype \\{ varname dw ?
|
||||
restore done@local \\}
|
||||
match =DWORD, vartype \\{ varname dd ?
|
||||
restore done@local \\}
|
||||
match =PWORD, vartype \\{ varname dp ?
|
||||
restore done@local \\}
|
||||
match =QWORD, vartype \\{ varname dq ?
|
||||
restore done@local \\}
|
||||
match =TBYTE, vartype \\{ varname dt ?
|
||||
restore done@local \\}
|
||||
match =DQWORD, vartype \\{ label varname dqword
|
||||
dq ?,?
|
||||
restore done@local \\}
|
||||
match , done@local \\{ varname vartype
|
||||
restore done@local \\} \}
|
||||
match ,done@local
|
||||
\{ var
|
||||
restore done@local \}
|
||||
common
|
||||
endl }
|
1177
kernel/trunk/drivers/SIS.ASM
Normal file
1177
kernel/trunk/drivers/SIS.ASM
Normal file
File diff suppressed because it is too large
Load Diff
1394
kernel/trunk/drivers/Unisound.asm
Normal file
1394
kernel/trunk/drivers/Unisound.asm
Normal file
File diff suppressed because it is too large
Load Diff
@ -86,12 +86,12 @@ hotkey_do_test:
|
||||
|
||||
align 4
|
||||
irq1:
|
||||
save_ring3_context
|
||||
mov ax, os_data
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
; save_ring3_context
|
||||
; mov ax, os_data
|
||||
; mov ds, ax
|
||||
; mov es, ax
|
||||
|
||||
mov eax, [0x3004] ; top window process
|
||||
movzx eax,word[0x3004] ; top window process
|
||||
movzx eax,word[0xC400+eax*2]
|
||||
shl eax,8
|
||||
mov al,[0x80000+eax+APPDATA.keyboard_mode]
|
||||
@ -277,11 +277,12 @@ irq1:
|
||||
.exit.irq1:
|
||||
mov [check_idle_semaphore],5
|
||||
|
||||
mov al,0x20 ; ready for next irq
|
||||
out 0x20,al
|
||||
; mov al,0x20 ; ready for next irq
|
||||
; out 0x20,al
|
||||
|
||||
restore_ring3_context
|
||||
iret
|
||||
; restore_ring3_context
|
||||
; iret
|
||||
ret
|
||||
|
||||
set_lights:
|
||||
mov al,0xED
|
||||
|
@ -10,23 +10,27 @@
|
||||
;; Compile with last version FASM
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
include "proc32.inc"
|
||||
include "kglobals.inc"
|
||||
include "lang.inc"
|
||||
|
||||
WinMapAddress equ 0x460000
|
||||
display_data = 0x460000
|
||||
include "const.inc"
|
||||
|
||||
NEW equ 0
|
||||
|
||||
;WinMapAddress equ 0x460000
|
||||
;display_data = 0x460000
|
||||
|
||||
max_processes equ 255
|
||||
|
||||
window_data equ 0x0000
|
||||
tss_data equ 0xD20000
|
||||
;window_data equ 0x0000
|
||||
;tss_data equ 0xD20000
|
||||
;tss_step equ (128+2048) ; tss & i/o - 16384 ports, * 256=557056
|
||||
tss_step equ (128+8192) ; tss & i/o - 65535 ports, * 256=557056*4
|
||||
draw_data equ 0xC00000
|
||||
sysint_stack_data equ 0xC03000
|
||||
;draw_data equ 0xC00000
|
||||
;sysint_stack_data equ 0xC03000
|
||||
|
||||
|
||||
twdw equ (0x3000-window_data)
|
||||
;twdw equ (0x3000-window_data)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
@ -116,17 +120,7 @@ app_data equ 3+app_data_l-gdts
|
||||
|
||||
; CR0 Flags - Protected mode and Paging
|
||||
|
||||
mov ecx,0x00000001
|
||||
;and ebx,65535
|
||||
;cmp ebx,00100000000000000b ; lfb -> paging
|
||||
;jb no_paging
|
||||
;mov ax,0x0000
|
||||
;mov es,ax
|
||||
;mov al,[es:0x901E]
|
||||
;cmp al,1
|
||||
;je no_paging
|
||||
;or ecx, 0x80000000
|
||||
;no_paging:
|
||||
mov ecx, 0x00000021
|
||||
|
||||
; Enabling 32 bit protected mode
|
||||
|
||||
@ -228,13 +222,6 @@ boot_log:
|
||||
|
||||
ret
|
||||
|
||||
uglobal
|
||||
cpuid_0 dd 0,0,0,0
|
||||
cpuid_1 dd 0,0,0,0
|
||||
cpuid_2 dd 0,0,0,0
|
||||
cpuid_3 dd 0,0,0,0
|
||||
endg
|
||||
|
||||
iglobal
|
||||
firstapp db '/rd/1/LAUNCHER',0
|
||||
char db 'CHAR MT '
|
||||
@ -335,7 +322,7 @@ B32:
|
||||
mov byte [0x2f0000+0x901e],0x0
|
||||
mov eax,[0x2f0000+0x9018]
|
||||
;no_d_lfb:
|
||||
mov [0xfe80],eax
|
||||
mov [LFBAddress],eax
|
||||
|
||||
cmp [0xfe0c],word 0100000000000000b
|
||||
jge setvesa20
|
||||
@ -366,47 +353,27 @@ B32:
|
||||
|
||||
; MEMORY MODEL
|
||||
|
||||
; mov [0xfe84],dword 0x100000*16 ; apps mem base address
|
||||
; movzx ecx,byte [0x2f0000+0x9030]
|
||||
; dec ecx
|
||||
; mov eax,16*0x100000 ; memory-16
|
||||
; shl eax,cl
|
||||
; mov [0xfe8c],eax ; memory for use
|
||||
; cmp eax,16*0x100000
|
||||
; jne no16mb
|
||||
; mov [0xfe84],dword 0xD80000 ; !!! 10 !!!
|
||||
; no16mb:
|
||||
call mem_test
|
||||
mov [MEM_AMOUNT], eax
|
||||
|
||||
; init:
|
||||
; 1) 0xFE84 - applications base
|
||||
; 2) 0xFE8C - total amount of memory
|
||||
mov [pg_data.mem_amount], eax
|
||||
mov [pg_data.kernel_max], eax
|
||||
|
||||
xor edi, edi
|
||||
m_GMS_loop:
|
||||
add edi, 0x400000
|
||||
mov eax, dword [edi]
|
||||
mov dword [edi], 'TEST'
|
||||
wbinvd
|
||||
cmp dword [edi], 'TEST'
|
||||
jne m_GMS_exit
|
||||
cmp dword [0], 'TEST'
|
||||
je m_GMS_exit
|
||||
mov dword [es:edi], eax
|
||||
jmp m_GMS_loop
|
||||
m_GMS_exit:
|
||||
mov [edi], eax
|
||||
; now edi contains the EXACT amount of memory
|
||||
shr eax, 12
|
||||
mov edx, eax
|
||||
mov [pg_data.pages_count], eax
|
||||
mov [pg_data.kernel_pages], eax
|
||||
|
||||
mov eax, 0x100000*16
|
||||
cmp edi, eax ;0x100000*16
|
||||
jb $ ; less than 16 Mb
|
||||
shr eax, 3
|
||||
mov [pg_data.pagemap_size], eax
|
||||
|
||||
shr edx, 10
|
||||
cmp edx, 4
|
||||
ja @f
|
||||
inc edx ;at least 4Mb for kernel heap
|
||||
@@:
|
||||
mov [pg_data.kernel_tables], edx
|
||||
|
||||
mov dword [0xFE84], eax ;0x100000*16
|
||||
cmp edi, eax ;0x100000*16
|
||||
jne @f
|
||||
mov dword [0xFE84], 0xD80000 ; =0x100000*13.5
|
||||
@@:
|
||||
mov dword [0xFE8C], edi
|
||||
|
||||
;!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
include 'detect/disks.inc'
|
||||
@ -414,42 +381,98 @@ include 'detect/disks.inc'
|
||||
|
||||
; CHECK EXTRA REGION
|
||||
; ENABLE PAGING
|
||||
|
||||
call test_cpu
|
||||
; btr [cpu_caps], CAPS_SSE ;test: dont't use sse code
|
||||
; btr [cpu_caps], CAPS_SSE2 ;test: don't use sse2
|
||||
|
||||
; btr [cpu_caps], CAPS_FXSR ;test: disable sse support
|
||||
;all sse commands rise #UD exption
|
||||
; btr [cpu_caps], CAPS_PSE ;test: don't use large pages
|
||||
; btr [cpu_caps], CAPS_PGE ;test: don't use global pages
|
||||
; btr [cpu_caps], CAPS_MTRR ;test: don't use MTRR
|
||||
; btr [cpu_caps], CAPS_TSC ;test: don't use TSC
|
||||
|
||||
call init_memEx
|
||||
call init_page_map
|
||||
|
||||
mov eax, sys_pgdir ;+PG_NOCACHE
|
||||
mov cr3, eax
|
||||
|
||||
mov eax,cr0
|
||||
or eax,0x80000000
|
||||
mov cr0,eax
|
||||
jmp $+2
|
||||
|
||||
call MEM_Init
|
||||
;add 0x800000-0xc00000 area
|
||||
cmp word [0xfe0c],0x13
|
||||
jle .less_memory
|
||||
mov eax,0x800000 ;linear address
|
||||
mov ebx,0x400000 shr 12 ;size in pages (4Mb)
|
||||
mov ecx,0x800000 ;physical address
|
||||
jmp .end_first_block
|
||||
.less_memory:
|
||||
mov eax,0x980000 ;linear address
|
||||
mov ebx,0x280000 shr 12 ;size in pages (2.5Mb)
|
||||
mov ecx,0x980000 ;physical address
|
||||
.end_first_block:
|
||||
call MEM_Add_Heap ;nobody can lock mutex yet
|
||||
call init_kernel_heap
|
||||
call init_LFB
|
||||
call init_mtrr
|
||||
|
||||
call create_general_page_table
|
||||
;add 0x1000000(0xd80000)-end_of_memory area
|
||||
mov eax,second_base_address
|
||||
mov ebx,[0xfe8c]
|
||||
mov ecx,[0xfe84]
|
||||
sub ebx,ecx
|
||||
shr ebx,12
|
||||
add eax,ecx
|
||||
call MEM_Add_Heap
|
||||
;init physical memory manager.
|
||||
call Init_Physical_Memory_Manager
|
||||
stdcall alloc_kernel_space, 0x50000
|
||||
mov [ipc_tmp], eax
|
||||
mov ebx, 0x1000
|
||||
|
||||
mov dword [0xfe80],0x80000000 ;0x800000
|
||||
add eax, 0x40000
|
||||
mov [proc_mem_map], eax
|
||||
|
||||
add eax, 0x8000
|
||||
mov [proc_mem_pdir], eax
|
||||
|
||||
add eax, ebx
|
||||
mov [proc_mem_tab], eax
|
||||
|
||||
add eax, ebx
|
||||
mov [current_pdir], eax
|
||||
|
||||
add eax, ebx
|
||||
mov [tmp_task_pdir], eax
|
||||
|
||||
add eax, ebx
|
||||
mov [tmp_task_ptab], eax
|
||||
|
||||
add eax, ebx
|
||||
mov [ipc_pdir], eax
|
||||
|
||||
add eax, ebx
|
||||
mov [ipc_ptab], eax
|
||||
|
||||
stdcall kernel_alloc, 0x1000
|
||||
mov [tmp_task_data], eax
|
||||
|
||||
mov [dll_map], 0xFFFFFFFF
|
||||
mov [srv_map], 0xFFFFFFFF
|
||||
|
||||
call alloc_dll
|
||||
mov edi, eax
|
||||
mov esi, szKernel
|
||||
mov ecx, 16
|
||||
rep movsb
|
||||
|
||||
bt [cpu_caps], CAPS_FXSR
|
||||
jnc .no_FXSR
|
||||
|
||||
stdcall kernel_alloc, 512*256
|
||||
mov [fpu_data], eax
|
||||
mov ebx, cr4
|
||||
or ebx, CR4_OSFXSR
|
||||
mov cr4, ebx
|
||||
jmp .clts
|
||||
.no_FXSR:
|
||||
stdcall kernel_alloc, 112*256
|
||||
mov [fpu_data], eax
|
||||
mov ebx, cr4
|
||||
and ebx, not (CR4_OSFXSR+CR4_OSXMMEXPT)
|
||||
mov cr4, ebx
|
||||
.clts:
|
||||
clts
|
||||
fninit
|
||||
|
||||
mov edi, irq_tab
|
||||
xor eax, eax
|
||||
mov ecx, 16
|
||||
rep stosd
|
||||
|
||||
;Set base of graphic segment to linear address of LFB
|
||||
mov eax,[0xfe80] ; set for gs
|
||||
mov eax,[LFBAddress] ; set for gs
|
||||
mov [graph_data_l+2],ax
|
||||
shr eax,16
|
||||
mov [graph_data_l+4],al
|
||||
@ -502,23 +525,12 @@ include 'vmodeld.inc'
|
||||
or ecx, (10+29*6) shl 16 ; "Determining amount of memory"
|
||||
sub ecx, 10
|
||||
mov edx, 0xFFFFFF
|
||||
mov ebx, [0xFE8C]
|
||||
mov ebx, [MEM_AMOUNT]
|
||||
shr ebx, 20
|
||||
mov edi, 1
|
||||
mov eax, 0x00040000
|
||||
call display_number
|
||||
|
||||
; CHECK EXTENDED REGION
|
||||
; mov dword [0x80000000],0x12345678
|
||||
; cmp dword [0x80000000],0x12345678
|
||||
; jz extended_region_found
|
||||
; mov esi,boot_ext_region
|
||||
; call boot_log
|
||||
; jmp $
|
||||
;extended_region_found:
|
||||
|
||||
|
||||
|
||||
; REDIRECT ALL IRQ'S TO INT'S 0x20-0x2f
|
||||
|
||||
mov esi,boot_irqs
|
||||
@ -535,64 +547,11 @@ include 'vmodeld.inc'
|
||||
; LOAD IDT
|
||||
lidt [cs:idtreg]
|
||||
|
||||
; READ CPUID RESULT
|
||||
|
||||
mov esi,boot_cpuid
|
||||
call boot_log
|
||||
pushfd ; get current flags
|
||||
pop eax
|
||||
mov ecx,eax
|
||||
xor eax,0x00200000 ; attempt to toggle ID bit
|
||||
push eax
|
||||
popfd
|
||||
pushfd ; get new EFLAGS
|
||||
pop eax
|
||||
push ecx ; restore original flags
|
||||
popfd
|
||||
and eax,0x00200000 ; if we couldn't toggle ID,
|
||||
and ecx,0x00200000 ; then this is i486
|
||||
cmp eax,ecx
|
||||
jz nopentium
|
||||
; It's Pentium or later. Use CPUID
|
||||
mov edi,cpuid_0
|
||||
mov esi,0
|
||||
cpuid_new_read:
|
||||
mov eax,esi
|
||||
cpuid
|
||||
call cpuid_save
|
||||
add edi,4*4
|
||||
cmp esi,3
|
||||
jge cpuid_done
|
||||
cmp esi,[cpuid_0]
|
||||
jge cpuid_done
|
||||
inc esi
|
||||
jmp cpuid_new_read
|
||||
cpuid_save:
|
||||
mov [edi+00],eax
|
||||
mov [edi+04],ebx
|
||||
mov [edi+8],ecx
|
||||
mov [edi+12],edx
|
||||
ret
|
||||
cpuid_done:
|
||||
nopentium:
|
||||
|
||||
; CR4 flags - enable fxsave / fxrstore
|
||||
;
|
||||
; finit
|
||||
; mov eax,1
|
||||
; cpuid
|
||||
; test edx,1000000h
|
||||
; jz fail_fpu
|
||||
; mov eax,cr4
|
||||
; or eax,200h ; Enable fxsave/fxstor
|
||||
; mov cr4,eax
|
||||
; fail_fpu:
|
||||
|
||||
;The CPU to this moment should be already in PM,
|
||||
;and bit MP of the register cr0 should be installed in 1.
|
||||
finit ;reset of the FPU (finit, instead of fninit)
|
||||
fsetpm ;enable PM of the FPU
|
||||
finit ;reset the registers, contents which are still equal RM
|
||||
;finit ;reset of the FPU (finit, instead of fninit)
|
||||
;fsetpm ;enable PM of the FPU
|
||||
;finit ;reset the registers, contents which are still equal RM
|
||||
;Now FPU too in PM
|
||||
; DETECT DEVICES
|
||||
|
||||
@ -648,6 +607,19 @@ finit ;reset the registers, contents which are still equal RM
|
||||
; name for OS/IDLE process
|
||||
mov dword [0x80000+256+APPDATA.app_name], dword 'OS/I'
|
||||
mov dword [0x80000+256+APPDATA.app_name+4], dword 'DLE '
|
||||
mov eax, [fpu_data]
|
||||
mov dword [0x80000+APPDATA.fpu_state], eax
|
||||
mov dword [0x80000+APPDATA.fpu_handler], 0
|
||||
mov dword [0x80000+APPDATA.sse_handler], 0
|
||||
|
||||
add eax, 112
|
||||
bt [cpu_caps], CAPS_FXSR
|
||||
jnc .no_sse
|
||||
add eax, 512-112
|
||||
.no_sse:
|
||||
mov dword [0x80000+256+APPDATA.fpu_state], eax
|
||||
mov dword [0x80000+256+APPDATA.fpu_handler], 0
|
||||
mov dword [0x80000+256+APPDATA.sse_handler], 0
|
||||
; task list
|
||||
mov [0x3020+TASKDATA.wnd_number], 1 ; on screen number
|
||||
mov [0x3020+TASKDATA.pid], 1 ; process id number
|
||||
@ -725,11 +697,6 @@ finit ;reset the registers, contents which are still equal RM
|
||||
movsd
|
||||
call load_skin
|
||||
|
||||
; MTRR'S
|
||||
|
||||
call enable_mtrr
|
||||
|
||||
|
||||
; LOAD FIRST APPLICATION
|
||||
mov [0x3000],dword 1
|
||||
mov [0x3004],dword 1
|
||||
@ -818,6 +785,8 @@ finit ;reset the registers, contents which are still equal RM
|
||||
|
||||
loop ready_for_irqs ; flush the queue
|
||||
|
||||
stdcall attach_int_handler, dword 1, irq1
|
||||
|
||||
; mov [dma_hdd],1
|
||||
cmp [IDEContrRegsBaseAddr], 0
|
||||
setnz [dma_hdd]
|
||||
@ -927,57 +896,6 @@ include "kernel32.inc"
|
||||
; ;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
enable_mtrr:
|
||||
|
||||
pushad
|
||||
|
||||
cmp [0x2f0000+0x901c],byte 2
|
||||
je no_mtrr
|
||||
mov eax,[0xFE0C] ; if no LFB then no MTRR
|
||||
test eax,0100000000000000b
|
||||
jz no_mtrr
|
||||
mov edx,[cpuid_1+3*4] ; edx - MTRR's supported ?
|
||||
test edx,1000000000000b
|
||||
jz no_mtrr
|
||||
call find_empty_mtrr
|
||||
cmp ecx,0
|
||||
jz no_mtrr
|
||||
mov esi,boot_mtrr ; 'setting mtrr'
|
||||
call boot_log
|
||||
mov edx,0x0 ; LFB , +8 M , write combine
|
||||
mov eax,[0x2f9018]
|
||||
or eax,1
|
||||
wrmsr
|
||||
inc ecx
|
||||
mov edx,0xf
|
||||
mov eax,0xff800800
|
||||
wrmsr
|
||||
mov ecx,0x2ff ; enable mtrr's
|
||||
rdmsr
|
||||
or eax,100000000000b ; set
|
||||
wrmsr
|
||||
no_mtrr:
|
||||
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
find_empty_mtrr: ; 8 pairs checked
|
||||
|
||||
mov ecx,0x201-2
|
||||
mtrr_find:
|
||||
add ecx,2
|
||||
cmp ecx,0x200+8*2
|
||||
jge no_free_mtrr
|
||||
rdmsr
|
||||
test eax,0x0800
|
||||
jnz mtrr_find
|
||||
dec ecx
|
||||
ret
|
||||
no_free_mtrr:
|
||||
mov ecx,0
|
||||
ret
|
||||
|
||||
reserve_irqs_ports:
|
||||
|
||||
pushad
|
||||
@ -3158,8 +3076,8 @@ sys_window_move:
|
||||
mov ebx, [edi + WDATA.box.top]
|
||||
mov ecx, [edi + WDATA.box.width]
|
||||
mov edx, [edi + WDATA.box.height]
|
||||
add ecx, eax
|
||||
add edx, ebx
|
||||
add ecx,eax
|
||||
add edx,ebx
|
||||
call calculatescreen
|
||||
popad
|
||||
|
||||
@ -3487,8 +3405,8 @@ redrawscreen:
|
||||
mov ebx, [edi + WDATA.box.top]
|
||||
mov ecx, [edi + WDATA.box.width]
|
||||
mov edx, [edi + WDATA.box.height]
|
||||
add ecx, eax
|
||||
add edx, ebx
|
||||
add ecx,eax
|
||||
add edx,ebx
|
||||
|
||||
mov ecx,[dlye] ; ecx = area y end ebx = window y start
|
||||
cmp ecx,ebx
|
||||
@ -4346,10 +4264,8 @@ setmouse: ; set mousepicture -pointer
|
||||
|
||||
|
||||
_rdtsc:
|
||||
|
||||
mov edx,[cpuid_1+3*4]
|
||||
test edx,00010000b
|
||||
jz ret_rdtsc
|
||||
bt [cpu_caps], CAPS_TSC
|
||||
jnc ret_rdtsc
|
||||
rdtsc
|
||||
ret
|
||||
ret_rdtsc:
|
||||
@ -4624,128 +4540,6 @@ no_del_keyboard_hotkey:
|
||||
ret
|
||||
|
||||
|
||||
sys_ipc:
|
||||
cmp eax,1 ; DEFINE IPC MEMORY
|
||||
jne no_ipc_def
|
||||
mov edi,[0x3000]
|
||||
shl edi,8
|
||||
add edi,0x80000
|
||||
mov [edi + APPDATA.ipc_start], ebx
|
||||
mov [edi + APPDATA.ipc_size], ecx
|
||||
mov [esp+36],dword 0
|
||||
ret
|
||||
no_ipc_def:
|
||||
|
||||
cmp eax,2 ; SEND IPC MESSAGE
|
||||
jne no_ipc_send
|
||||
mov esi,1
|
||||
mov edi,0x3020
|
||||
ipcs1:
|
||||
cmp [edi+TASKDATA.pid], ebx
|
||||
je ipcs2
|
||||
add edi,0x20
|
||||
inc esi
|
||||
cmp esi,[0x3004]
|
||||
jbe ipcs1
|
||||
mov [esp+36],dword 4
|
||||
ret
|
||||
ipcs2:
|
||||
|
||||
cli
|
||||
|
||||
push esi
|
||||
mov eax,esi
|
||||
shl eax,8
|
||||
mov ebx,[eax+0x80000 + APPDATA.ipc_start]
|
||||
test ebx,ebx ; ipc area not defined ?
|
||||
je ipc_err1
|
||||
|
||||
add ebx,[eax+0x80000 + APPDATA.ipc_size]
|
||||
mov eax,esi
|
||||
shl eax,5
|
||||
add ebx,[eax+0x3000 + TASKDATA.mem_start] ; ebx <- max data position
|
||||
|
||||
mov eax,esi ; to
|
||||
shl esi,8
|
||||
add esi,0x80000
|
||||
mov edi,[esi+APPDATA.ipc_start]
|
||||
shl eax,5
|
||||
add eax,0x3000
|
||||
add edi,[eax+TASKDATA.mem_start]
|
||||
|
||||
cmp [edi],byte 0 ; overrun ?
|
||||
jne ipc_err2
|
||||
|
||||
mov ebp,edi
|
||||
add edi,[edi+4]
|
||||
add edi,8
|
||||
|
||||
mov esi,ecx ; from
|
||||
mov eax,[0x3010]
|
||||
mov eax,[eax+TASKDATA.mem_start]
|
||||
add esi,eax
|
||||
|
||||
mov ecx,edx ; size
|
||||
|
||||
mov eax,edi
|
||||
add eax,ecx
|
||||
cmp eax,ebx
|
||||
jg ipc_err3 ; not enough room ?
|
||||
|
||||
push ecx
|
||||
|
||||
mov eax,[0x3010]
|
||||
mov eax,[eax+TASKDATA.pid]
|
||||
mov [edi-8],eax
|
||||
mov [edi-4],ecx
|
||||
cld
|
||||
rep movsb
|
||||
|
||||
pop ecx
|
||||
add ecx,8
|
||||
|
||||
mov edi,ebp ; increase memory position
|
||||
add dword [edi+4],ecx
|
||||
|
||||
mov edi,[esp]
|
||||
shl edi,8
|
||||
or dword [edi+0x80000+APPDATA.event_mask],dword 01000000b ; ipc message
|
||||
|
||||
cmp [check_idle_semaphore],dword 20
|
||||
jge ipc_no_cis
|
||||
mov [check_idle_semaphore],5
|
||||
ipc_no_cis:
|
||||
|
||||
xor eax, eax
|
||||
|
||||
ipc_err:
|
||||
add esp,4
|
||||
mov [esp+36],eax
|
||||
sti
|
||||
ret
|
||||
|
||||
ipc_err1:
|
||||
add esp,4
|
||||
mov [esp+36],dword 1
|
||||
sti
|
||||
ret
|
||||
ipc_err2:
|
||||
add esp,4
|
||||
mov [esp+36],dword 2
|
||||
sti
|
||||
ret
|
||||
ipc_err3:
|
||||
add esp,4
|
||||
mov [esp+36],dword 3
|
||||
sti
|
||||
ret
|
||||
|
||||
no_ipc_send:
|
||||
|
||||
mov [esp+36],dword -1
|
||||
ret
|
||||
|
||||
|
||||
align 4
|
||||
|
||||
sys_gs: ; direct screen access
|
||||
@ -4829,7 +4623,7 @@ syscall_openramdiskfile: ; OpenRamdiskFile
|
||||
|
||||
|
||||
mov edi,[0x3010]
|
||||
add edi, TASKDATA.mem_start
|
||||
add edi,TASKDATA.mem_start
|
||||
add eax,[edi]
|
||||
add edx,[edi]
|
||||
mov esi,12
|
||||
@ -4884,7 +4678,7 @@ align 4
|
||||
syscall_delramdiskfile: ; DelRamdiskFile
|
||||
|
||||
mov edi,[0x3010]
|
||||
add edi, TASKDATA.mem_start
|
||||
add edi,TASKDATA.mem_start
|
||||
add eax,[edi]
|
||||
call filedelete
|
||||
mov [esp+36],eax
|
||||
@ -4895,7 +4689,7 @@ align 4
|
||||
syscall_writeramdiskfile: ; WriteRamdiskFile
|
||||
|
||||
mov edi,[0x3010]
|
||||
add edi, TASKDATA.mem_start
|
||||
add edi,TASKDATA.mem_start
|
||||
add eax,[edi]
|
||||
add ebx,[edi]
|
||||
call filesave
|
||||
@ -4920,7 +4714,7 @@ align 4
|
||||
syscall_readstring: ; ReadString
|
||||
|
||||
mov edi,[0x3010]
|
||||
add edi, TASKDATA.mem_start
|
||||
add edi,TASKDATA.mem_start
|
||||
add eax,[edi]
|
||||
call read_string
|
||||
mov [esp+36],eax
|
||||
@ -5237,6 +5031,11 @@ wraw_bacground_select db 0
|
||||
|
||||
buttontype dd 0x0
|
||||
windowtypechanged dd 0x0
|
||||
|
||||
align 4
|
||||
pg_data PG_DATA
|
||||
heap_test dd ?
|
||||
cpu_caps dd 4 dup(0)
|
||||
endg
|
||||
|
||||
iglobal
|
||||
|
@ -171,10 +171,16 @@ struc APPDATA
|
||||
{
|
||||
.app_name db 11 dup(?)
|
||||
db 5 dup(?)
|
||||
.fpu_save_area: db 108 dup(?)
|
||||
db 3 dup(?)
|
||||
.is_fpu_saved db ?
|
||||
.wnd_shape dd ?
|
||||
|
||||
.fpu_state dd ? ;+16
|
||||
.fpu_init dd ? ;+20
|
||||
.fpu_handler dd ? ;+24
|
||||
.sse_handler dd ? ;+28
|
||||
.event dd ? ;+32
|
||||
|
||||
db 92 dup(?)
|
||||
|
||||
.wnd_shape dd ? ;+128
|
||||
.wnd_shape_scale dd ?
|
||||
dd ?
|
||||
.mem_size dd ?
|
||||
@ -209,9 +215,13 @@ include "core/sync.inc" ; macros for synhronization objects
|
||||
include "core/sys32.inc" ; process management
|
||||
include "core/sched.inc" ; process scheduling
|
||||
include "core/syscall.inc" ; system call
|
||||
include "core/mem.inc" ; high-level memory management
|
||||
include "core/newproce.inc" ;new process management
|
||||
include "core/physmem.inc" ; access to physical memory for applications
|
||||
include "core/memory.inc"
|
||||
include "core/heap.inc"
|
||||
include "core/taskman.inc"
|
||||
include "core/dll.inc"
|
||||
include "core/exports.inc"
|
||||
include "core/except.inc"
|
||||
|
||||
|
||||
; GUI stuff
|
||||
include "gui/window.inc"
|
||||
|
Loading…
Reference in New Issue
Block a user