synchronization with flat kernel

git-svn-id: svn://kolibrios.org@412 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2007-03-10 16:04:35 +00:00
parent 375088cf8f
commit 391818d48f
9 changed files with 163 additions and 283 deletions

View File

@ -1031,90 +1031,8 @@ end if
mov al,[preboot_vrrm-0x10000]
mov [es:0x9030],al
; MEMORY MODEL
; movzx eax,byte [es:preboot_memory-0x10000]
; cmp eax,0
; jne pre_mem
;;;;;;;;;;;;;;;;;;;;;;;;;
; mario79 - memory size ;
;;;;;;;;;;;;;;;;;;;;;;;;;
; mov ax,0E801h
;;; xor bx,bx ; thanks to Alexei for bugfix [18.07.2004]
; xor cx, cx
; xor dx, dx
; int 0x15
; movzx ebx, dx ;bx
; movzx eax, cx ;ax
; shl ebx,6 ; ïåðåâîä â êèëîáàéòû (x64)
; add eax,ebx
; add eax, 1000h ;440h
; cmp eax,40000h ; 256?
; jge mem_256_z
; cmp eax,20000h ; 128?
; jge mem_128_z
; cmp eax,10000h ; 64?
; jge mem_64_z
; cmp eax,8000h ; 32?
; jge mem_32_z
; jmp mem_16_z
;
;mem_256_z: mov si,memokz256-0x10000
; call printplain
; mov eax,5
; jmp pre_mem
;mem_128_z: mov si,memokz128-0x10000
; call printplain
; mov eax,4
; jmp pre_mem
;mem_64_z: mov si,memokz64-0x10000
; call printplain
; mov eax,3
; jmp pre_mem
;mem_32_z: mov si,memokz32-0x10000
; call printplain
; mov eax,2
; jmp pre_mem
;mem_16_z: mov si,memokz16-0x10000
; call printplain
; mov eax,1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; pre_mem:
; push word 0x0000
; pop es
; mov [es:0x9030],al
; push word 0x1000
; pop es
; mov si,linef-0x10000
; call printplain
; DIRECT WRITE TO LFB, PAGING DISABLED
; movzx eax,byte [es:preboot_lfb-0x10000]
; mov eax,1 ; paging disabled
; cmp eax,0
; jne pre_lfb
; mov si,gr_direct-0x10000
; call printplain
; mov ebx,'12'
; call getkey
; pre_lfb:
; push word 0x0000
; pop es
; mov [es:0x901E],al
; mov ax,0x1000
; mov es,ax
; mov si,linef-0x10000
; call printplain
mov [es:0x901E],byte 1
; BOOT DEVICE
mov al, [preboot_device-0x10000]
@ -1331,42 +1249,9 @@ sayerr_floppy:
mov al,0
out dx,al
push es
; PAGE TABLE
push dword [es:0x9018]
;
; mmap_mem equ 64 ; amount of memory to map
;
push 0x6000
pop es ; es:di = 6000:0
; 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]
; mov eax, 0x7F000 +8+16 ; Page directory and enable caches
; mov cr3, eax
; SET GRAPHICS
pop es
xor ax, ax
mov es, ax
@ -1405,7 +1290,6 @@ sayerr_floppy:
pop dx
out dx,al ; select GDC bit mask register
; for writes to 0x03cf
gmok2:
push ds
pop es

View File

@ -3,7 +3,7 @@
cmp [boot_dev],1
jne no_sys_on_hd
test [0x40001],byte 0x40
test [DRIVE_DATA+1],byte 0x40
jz position_2
mov [hdbase],0x1f0
mov [hdid],0x0
@ -14,11 +14,11 @@
call search_and_read_image
cmp [image_retrieved],1
je yes_sys_on_hd
movzx eax,byte [0x40002]
movzx eax,byte [DRIVE_DATA+2]
cmp [fat32part],eax
jle position_1_1
position_2:
test [0x40001],byte 0x10
test [DRIVE_DATA+1],byte 0x10
jz position_3
mov [hdbase],0x1f0
mov [hdid],0x10
@ -29,11 +29,11 @@
call search_and_read_image
cmp [image_retrieved],1
je yes_sys_on_hd
movzx eax,byte [0x40003]
movzx eax,byte [DRIVE_DATA+3]
cmp eax,[fat32part]
jle position_2_1
position_3:
test [0x40001],byte 0x4
test [DRIVE_DATA+1],byte 0x4
jz position_4
mov [hdbase],0x170
mov [hdid],0x0
@ -44,11 +44,11 @@
call search_and_read_image
cmp [image_retrieved],1
je yes_sys_on_hd
movzx eax,byte [0x40004]
movzx eax,byte [DRIVE_DATA+4]
cmp eax,[fat32part]
jle position_3_1
position_4:
test [0x40001],byte 0x1
test [DRIVE_DATA+1],byte 0x1
jz no_sys_on_hd
mov [hdbase],0x170
mov [hdid],0x10
@ -59,7 +59,7 @@
call search_and_read_image
cmp [image_retrieved],1
je yes_sys_on_hd
movzx eax,byte [0x40005]
movzx eax,byte [DRIVE_DATA+5]
cmp eax,[fat32part]
jle position_4_1
jmp yes_sys_on_hd

View File

@ -235,7 +235,7 @@ 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)
BOOT_VAR equ (OS_BASE+0x02f0000)
IMG_BACKGROUND equ (OS_BASE+0x0300000)
WinMapAddress equ (OS_BASE+0x0460000)
display_data equ (OS_BASE+0x0460000)

View File

@ -382,14 +382,14 @@ proc init_LFB
cmp dword [LFBAddress], -1
jne @f
mov [0x2f0000+0x901c],byte 2
mov [BOOT_VAR+0x901c],byte 2
stdcall kernel_alloc, 0x280000
mov [LFBAddress], eax
ret
@@:
test [SCR_MODE],word 0100000000000000b
jnz @f
mov [0x2f0000+0x901c],byte 2
mov [BOOT_VAR+0x901c],byte 2
ret
@@:
mov edx, LFB_BASE
@ -1229,7 +1229,7 @@ MEM_UC equ 0 ;uncached memory
align 4
proc init_mtrr
cmp [0x2f0000+0x901c],byte 2
cmp [BOOT_VAR+0x901c],byte 2
je .exit
bt [cpu_caps], CAPS_MTRR

View File

@ -50,13 +50,18 @@ align 32
SYSENTER_VAR equ 0
sysenter_entry:
; Íàñòðàèâàåì ñòåê
cli
push eax
mov eax, [ss:CURRENT_TASK]
shl eax, 8
mov eax, [ss:SLOT_BASE + eax + APPDATA.pl0_stack]
lea esp, [ss:eax + RING0_STACK_SIZE] ; configure ESP
mov eax, [ss:sysenter_stack - 4] ; eax - original eax, from app
; cli sysenter clear IF
; push eax
; mov eax, [ss:CURRENT_TASK]
; shl eax, 8
; mov eax, [ss:SLOT_BASE + eax + APPDATA.pl0_stack]
; lea esp, [eax + RING0_STACK_SIZE] ; configure ESP
; mov eax, [ss:sysenter_stack - 4] ; eax - original eax, from app
mov esp, [ss:CURRENT_TASK]
shl esp, 8
mov esp, [ss:SLOT_BASE + esp + APPDATA.pl0_stack]
add esp, RING0_STACK_SIZE ; configure ESP
sti
;------------------
push ds es
@ -93,15 +98,22 @@ sysenter_entry:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
align 32
syscall_entry:
cli
; cli syscall clear IF
xchg ecx, [esp]
mov [SYSENTER_VAR + 4], esp
mov [ss:sysenter_stack - 4], eax
mov eax, [ss:CURRENT_TASK]
shl eax, 8
mov eax, [ss:SLOT_BASE + eax + APPDATA.pl0_stack]
lea esp, [ss:eax + RING0_STACK_SIZE] ; configure ESP
mov eax, [ss:sysenter_stack - 4] ; eax - original eax, from app
; mov [ss:sysenter_stack - 4], eax
; mov eax, [ss:CURRENT_TASK]
; shl eax, 8
; mov eax, [ss:SLOT_BASE + eax + APPDATA.pl0_stack]
; lea esp, [eax + RING0_STACK_SIZE] ; configure ESP
; mov eax, [ss:sysenter_stack - 4] ; eax - original eax, from app
mov esp, [ss:CURRENT_TASK]
shl esp, 8
mov esp, [ss:SLOT_BASE + esp + APPDATA.pl0_stack]
add esp, RING0_STACK_SIZE ; configure ESP
sti
;------------------
push ds es
@ -127,6 +139,8 @@ syscall_entry:
popad
pop es ds
;------------------
cli
mov esp, [SYSENTER_VAR + 4]
xchg ecx, [esp]
sysret

View File

@ -226,7 +226,6 @@ end if
mov eax, [save_cr3]
call set_cr3
; popfd
xor ebx, ebx
mov [application_table_status],ebx ;unlock application_table_status mutex
mov eax,[process_number] ;set result
@ -235,7 +234,6 @@ end if
mov eax, [save_cr3]
call set_cr3
.err:
; popfd
.err_hdr:
stdcall kernel_free,[file_base]
.err_file:
@ -334,9 +332,7 @@ proc get_new_process_place
cmp eax,256
jge .failed ;it should be <256
mov word [ebx+0xa],9 ;set process state to 9 (for slot after hight boundary)
; mov [new_process_place], eax
ret
.failed:
xor eax,eax
ret
@ -471,7 +467,6 @@ else
add edx, 0x1000
dec [app_pages]
jnz .alloc
end if
.done:
@ -531,7 +526,6 @@ proc destroy_app_space stdcall, pg_dir:dword
xor edx,edx
mov eax,0x2
mov ebx, [pg_dir]
.loop:
;eax = current slot of process
mov ecx,eax

View File

@ -3,9 +3,9 @@
; è çàíåñåíèå äàííûõ â îáëàñòü òàáëèöû
; àâòîð Mario79
;****************************************************
mov [transfer_adress],0x4000a
mov [transfer_adress],DRIVE_DATA+0xa
search_partitions_ide0:
test [0x40001],byte 0x40
test [DRIVE_DATA+1],byte 0x40
jz search_partitions_ide1
mov [hdbase],0x1f0
mov [hdid],0x0
@ -15,14 +15,14 @@
call set_FAT32_variables
cmp [problem_partition],0
jne search_partitions_ide1
inc byte [0x40002]
inc byte [DRIVE_DATA+2]
call partition_data_transfer
add [transfer_adress],100
inc [fat32part]
jmp search_partitions_ide0_1
search_partitions_ide1:
test [0x40001],byte 0x10
test [DRIVE_DATA+1],byte 0x10
jz search_partitions_ide2
mov [hdbase],0x1f0
mov [hdid],0x10
@ -32,14 +32,14 @@
call set_FAT32_variables
cmp [problem_partition],0
jne search_partitions_ide2
inc byte [0x40003]
inc byte [DRIVE_DATA+3]
call partition_data_transfer
add [transfer_adress],100
inc [fat32part]
jmp search_partitions_ide1_1
search_partitions_ide2:
test [0x40001],byte 0x4
test [DRIVE_DATA+1],byte 0x4
jz search_partitions_ide3
mov [hdbase],0x170
mov [hdid],0x0
@ -49,14 +49,14 @@
call set_FAT32_variables
cmp [problem_partition],0
jne search_partitions_ide3
inc byte [0x40004]
inc byte [DRIVE_DATA+4]
call partition_data_transfer
add [transfer_adress],100
inc [fat32part]
jmp search_partitions_ide2_1
search_partitions_ide3:
test [0x40001],byte 0x1
test [DRIVE_DATA+1],byte 0x1
jz end_search_partitions_ide
mov [hdbase],0x170
mov [hdid],0x10
@ -66,7 +66,7 @@
call set_FAT32_variables
cmp [problem_partition],0
jne end_search_partitions_ide
inc byte [0x40005]
inc byte [DRIVE_DATA+5]
call partition_data_transfer
add [transfer_adress],100
inc [fat32part]

View File

@ -285,8 +285,8 @@ proc START stdcall, state:dword
call init_controller
test eax, eax
jz .fail
jmp .fail ;force fail
jmp .fail ;force fail
if DEBUG
mov esi, msgInitCodec
@ -609,13 +609,13 @@ proc init_controller
call SysMsgBoardStr
stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x10
and eax,0xFFFE
mov [ctrl.codec_io_base], eax
; and eax, -16
mov [ctrl.ctrl_io_base], eax
call dword2str
call SysMsgBoardStr
mov esi, msgIntline
mov esi, msgIRQline
call SysMsgBoardStr
stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x3C
@ -646,10 +646,6 @@ proc set_ICH
ret
endp
PG_SW equ 0x003
PG_NOCACHE equ 0x018
align 4
proc reset_controller
@ -1057,60 +1053,52 @@ endp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
align 4
proc codec_io_r16
codec_io_r16:
add edx, [ctrl.codec_io_base]
in ax, dx
ret
endp
align 4
proc codec_io_w16
codec_io_w16:
add edx, [ctrl.codec_io_base]
out dx, ax
ret
endp
align 4
proc ctrl_io_r8
ctrl_io_r8:
add edx, [ctrl.ctrl_io_base]
in al, dx
ret
endp
align 4
proc ctrl_io_r16
ctrl_io_r16:
add edx, [ctrl.ctrl_io_base]
in ax, dx
ret
endp
align 4
proc ctrl_io_r32
ctrl_io_r32:
add edx, [ctrl.ctrl_io_base]
in eax, dx
ret
endp
align 4
proc ctrl_io_w8
ctrl_io_w8:
add edx, [ctrl.ctrl_io_base]
out dx, al
ret
endp
align 4
proc ctrl_io_w16
ctrl_io_w16:
add edx, [ctrl.ctrl_io_base]
out dx, ax
ret
endp
align 4
proc ctrl_io_w32
ctrl_io_w32:
add edx, [ctrl.ctrl_io_base]
out dx, eax
ret
endp
align 4
@ -1138,10 +1126,10 @@ devices dd (0x5000 shl 16)+0x1274,msgEnsoniq,set_ICH
dd (0x5880 shl 16)+0x1274,msgVibra128,set_ICH
dd 0 ;terminator
version dd 0x00040000
version dd 0x00040004
msgEnsoniq db 'Ensonic 1371',0
msgVibra128 db 'Sound Blaster AudioPCI Vibra 128',0
msgEnsoniq db 'Ensonic 1371',13,10,0
msgVibra128 db 'Sound Blaster AudioPCI Vibra 128',13,10,0
sz_sound_srv db 'SOUND',0
@ -1168,7 +1156,7 @@ msgStatus db 'global status ',0
msgControl db 'global control ',0
msgPCIcmd db 'PCI command ',0
msgIObase db 'IO base ',0
msgIntline db 'Interrupt line ',0
msgIRQline db 'IRQ line ',0
section '.data' data readable writable align 16

View File

@ -72,10 +72,10 @@ SOCKET_INTERFACE equ 53
; 128KB allocated for the stack and network driver buffers and other
; data requirements
stack_data_start equ 0x700000
eth_data_start equ 0x700000
stack_data equ 0x704000
stack_data_end equ 0x71ffff
;stack_data_start equ 0x700000
;eth_data_start equ 0x700000
;stack_data equ 0x704000
;stack_data_end equ 0x71ffff
; 32 bit word
stack_config equ stack_data
@ -123,7 +123,7 @@ last_1hsTick equ queueList + ( 2 * NUMQUEUEENTRIES )
resendQ equ 0x770000
;resendQ equ 0x770000
resendBuffer equ resendQ + ( 4 * NUMRESENDENTRIES ) ; for TCP