flat kernel

git-svn-id: svn://kolibrios.org@419 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2007-03-17 06:34:07 +00:00
parent 4c9dc158c8
commit 5f84f102c5
21 changed files with 217 additions and 158 deletions

View File

@ -2292,7 +2292,7 @@ fs_RamdiskExecute:
mov ebx, [ebx+4]
test ebx, ebx
jz @f
add ebx, std_application_base_address
; add ebx, std_application_base_address
@@:
;----------------------------------------------------------------

View File

@ -301,36 +301,17 @@ wait_loop: ; variant 2
push 0
pop es
mov [es:0x9040], ebx
mov [es:0x9050], ax
mov [es:0x9052], cx
mov [es:0x9040], dx
mov [es:0x9054], dx
; init selectors
; movzx eax, ax ; real-mode segment base address of protected-mode 32-bit code segment
; shl eax, 4
; mov [dword apm_code_32 + 2], ax
; shr eax, 16
; mov [dword apm_code_32 + 4], al
; movzx ecx, cx ; real-mode segment base address of protected-mode 16-bit code segment
; shl ecx, 4
; mov [dword apm_code_16 + 2], cx
; shr ecx, 16
; mov [dword apm_code_16 + 4], cl
; movzx edx, dx ; real-mode segment base address of protected-mode 16-bit data segment
; shl edx, 4
; mov [dword apm_data_16 + 2], dx
; shr edx, 16
; mov [dword apm_data_16 + 4], dl
; mov [es : 0x9040], ebx ; offset of APM entry point
apm_end:
; -----------------------------------------
; DISPLAY VESA INFORMATION
push 0
pop es
push 0
pop es
mov ax,0x4f00
mov di,0xa000
int 0x10

View File

@ -276,9 +276,22 @@ new_app_base equ 0; 0x01000000
twdw equ (CURRENT_TASK-window_data)
std_application_base_address equ new_app_base
RING0_STACK_SIZE equ 0x2000 - 512 ;512 áàéò äëÿ êîíòåêñòà FPU
RING0_STACK_SIZE equ (0x2000 - 512) ;512 áàéò äëÿ êîíòåêñòà FPU
;PAGES_USED equ 4
REG_SS equ (RING0_STACK_SIZE-4)
REG_ESP equ (RING0_STACK_SIZE-8)
REG_EFLAGS equ (RING0_STACK_SIZE-12)
REG_CS equ (RING0_STACK_SIZE-16)
REG_EIP equ (RING0_STACK_SIZE-20)
REG_EAX equ (RING0_STACK_SIZE-24)
REG_ECX equ (RING0_STACK_SIZE-28)
REG_EDX equ (RING0_STACK_SIZE-32)
REG_EBX equ (RING0_STACK_SIZE-36)
REG_ESP equ (RING0_STACK_SIZE-40) ;RING0_STACK_SIZE-20
REG_EBP equ (RING0_STACK_SIZE-44)
REG_ESI equ (RING0_STACK_SIZE-48)
REG_EDI equ (RING0_STACK_SIZE-52)
REG_RET equ (RING0_STACK_SIZE-56) ;irq0.return
PG_UNMAP equ 0x000
PG_MAP equ 0x001

View File

@ -115,7 +115,7 @@ debug_getcontext:
; destroys eax,ecx,edx,esi,edi
cmp ecx, 28h
jnz .ret
add edx, std_application_base_address
; add edx, std_application_base_address
push ebx
mov ebx, edx
call check_region
@ -174,7 +174,7 @@ debug_setcontext:
; destroys eax,ecx,edx,esi,edi
cmp ecx, 28h
jnz .ret
add edx, std_application_base_address
; add edx, std_application_base_address
push ebx
mov ebx, edx
call check_region
@ -230,7 +230,7 @@ debug_set_drx:
lea eax, [eax*8+SLOT_BASE+APPDATA.dbg_regs]
; [eax]=dr0, [eax+4]=dr1, [eax+8]=dr2, [eax+C]=dr3
; [eax+10]=dr7
add edx, std_application_base_address
; add edx, std_application_base_address
jc .errret
cmp cl, 3
ja .errret
@ -302,7 +302,7 @@ debug_read_process_memory:
; edx=address in debuggee
; out: [esp+36]=sizeof(read)
; destroys all
add esi, std_application_base_address
; add esi, std_application_base_address
push ebx
mov ebx, esi
call check_region
@ -329,7 +329,7 @@ debug_write_process_memory:
; edx=address in debuggee
; out: [esp+36]=sizeof(write)
; destroys all
add esi, std_application_base_address
; add esi, std_application_base_address
push ebx
mov ebx, esi
call check_region

View File

@ -249,7 +249,7 @@ align 4
srv_handlerEx:
test ebx, ebx
jz .fail
add ebx, new_app_base
; add ebx, new_app_base
mov eax, [ebx+handle]
cmp [eax+SRV.magic], ' SRV'
@ -258,8 +258,8 @@ srv_handlerEx:
cmp [eax+SRV.size], SRV_SIZE
jne .fail
add [ebx+input], new_app_base
add [ebx+output], new_app_base
; add [ebx+input], new_app_base
; add [ebx+output], new_app_base
stdcall [eax+SRV.srv_proc], ebx
ret
@ -401,9 +401,9 @@ proc get_fileinfo stdcall, file_name:dword, info:dword
xor eax, eax
mov ebx, [file_name]
sub ebx, new_app_base
; sub ebx, new_app_base
mov ecx, [info]
sub ecx, new_app_base
; sub ecx, new_app_base
mov [cmd], 5
mov [offset], eax
@ -415,7 +415,7 @@ proc get_fileinfo stdcall, file_name:dword, info:dword
mov eax, 70
lea ebx, [cmd]
sub ebx, new_app_base
; sub ebx, new_app_base
int 0x40
ret
endp
@ -438,8 +438,8 @@ proc read_file stdcall,file_name:dword, buffer:dword, off:dword,\
mov ecx, [off]
mov edx, [bytes]
mov esi, [buffer]
sub ebx, new_app_base
sub esi, new_app_base
; sub ebx, new_app_base
; sub esi, new_app_base
mov [cmd], eax
mov [offset], ecx
@ -451,7 +451,7 @@ proc read_file stdcall,file_name:dword, buffer:dword, off:dword,\
mov eax, 70
lea ebx, [cmd]
sub ebx, new_app_base
; sub ebx, new_app_base
int 0x40
ret
endp
@ -907,13 +907,13 @@ proc load_library stdcall, file_name:dword
jmp .next
.copy:
add esi, edx
add edi, new_app_base
; add edi, new_app_base
mov ecx, [eax+CFS.SizeOfRawData]
cld
rep movsb
.next:
add edi, 15-new_app_base
and edi, not 15
add edi, 15 ;-new_app_base
and edi, -16
add eax, COFF_SECTION_SIZE
dec ebx
jnz @B

View File

@ -193,7 +193,7 @@ except_16: ;fpu native exceptions handler
mov ecx, [reg_eip]
mov edx, [reg_esp]
sub edx, 4
mov [ss:edx+new_app_base], ecx
mov [ss:edx], ecx
mov [reg_esp], edx
mov dword [reg_eip], eax
@ -237,7 +237,7 @@ except_19: ;sse exceptions handler
mov ecx, [reg_eip]
mov edx, [reg_esp]
sub edx, 4
mov [ss:edx+new_app_base], ecx
mov [ss:edx], ecx
mov [reg_esp], edx
mov dword [reg_eip], eax

View File

@ -632,7 +632,7 @@ proc init_heap
mov [SLOT_BASE+APPDATA.heap_top+ebx], eax
sub eax, esi
add esi, new_app_base
; add esi, new_app_base
shr esi, 10
mov ecx, eax
sub eax, 4096
@ -655,8 +655,8 @@ proc user_alloc stdcall, alloc_size:dword
shl ebx, 8
mov esi, dword [ebx+SLOT_BASE+APPDATA.heap_base]; heap_base
mov edi, dword [ebx+SLOT_BASE+APPDATA.heap_top]; heap_top
add esi, new_app_base
add edi, new_app_base
; add esi, new_app_base
; add edi, new_app_base
l_0:
cmp esi, edi
jae m_exit
@ -700,7 +700,7 @@ l_0:
mov eax, esi
add eax, 4096
sub eax, new_app_base
; sub eax, new_app_base
ret
m_next:
add esi, eax
@ -757,8 +757,8 @@ proc user_free stdcall, base:dword
sub ebx, [edx+SLOT_BASE+APPDATA.mem_size]
neg ebx
call update_mem_size
add esi, new_app_base
add edi, new_app_base
; add esi, new_app_base
; add edi, new_app_base
shr esi, 12
shr edi, 12
@@:

View File

@ -340,8 +340,8 @@ proc new_mem_resize stdcall, new_size:dword
ret
.expand:
add edi, new_app_base
add esi, new_app_base
; add edi, new_app_base
; add esi, new_app_base
push esi
push edi
@ -457,13 +457,13 @@ proc page_fault_handler
pushad
push eax
push edx
mov edx, 0x400 ;bocsh
mov al,0xff ;bocsh
out dx, al ;bocsh
pop edx
pop eax
; push eax
; push edx
; mov edx, 0x400 ;bocsh
; mov al,0xff ;bocsh
; out dx, al ;bocsh
; pop edx
; pop eax
mov ebp, esp
mov eax, cr2
@ -478,37 +478,48 @@ proc page_fault_handler
inc [pg_data.pages_faults]
mov ebx, [.err_addr]
mov eax, [.err_code]
cmp ebx, 0x80000000
jae .kernel_space
cmp ebx, OS_BASE
jb .user_space ;страница в памяти приложени
cmp ebx, page_tabs+0x200000
jae .tab_space
cmp ebx, page_tabs
jb .kernel_space ;страница в памяти ядра
cmp ebx, app_page_tabs
jae .alloc
cmp ebx, kernel_tabs
jb .alloc;.app_tabs ;таблицы страниц приложени
;просто создадим одну
cmp ebx, 0x7DC00000
jae .lfb_addr
; cmp ebx, 0x1000000
; jb .exit
cmp ebx, LFB_BASE
jb .core_tabs ;таблицы страниц ядра
;Ошибка
.lfb:
;область LFB
;Ошибка
jmp .fail
align 4
.user_space:
test eax, PG_MAP
jnz .err_access ;Страница присутствует
;Ошибка доступа ?
shr ebx, 12
mov ecx, ebx
shr ecx, 10
mov edx, [master_tab+ecx*4]
test edx, 1
jz .fail
test edx, PG_MAP
jz .fail ;таблица страниц не создана
;неверный адрес в программе
mov eax, [page_tabs+ebx*4]
test eax, 2
jz .fail
jz .fail ;адрес не зарезервирован дл
;использования. Ошибка
.alloc:
call alloc_page
and eax, eax
jz .exit
jz .fail
stdcall map_page,[ebp-4],eax,dword PG_UW
@ -525,6 +536,26 @@ proc page_fault_handler
popad
add esp, 4
iretd
.err_access:
;никогда не происходит
jmp .fail
.kernel_space:
test eax, PG_MAP
jz .fail ;страница не присутствует
test eax, 4 ;U/S
jnz .fail ;приложение обратилось к памяти
;ядра
test eax, 8
jnz .fail ;установлен зарезервированный бит
;в таблицах страниц. добавлено в P4/Xeon
;попытка записи в защищённую страницу ядра
;не обрабатываем. Ошибка
.core_tabs:
.fail:
pop es
pop ds
@ -539,30 +570,30 @@ proc page_fault_handler
jmp exc_c
iretd
.kernel_space:
;.kernel_space:
; shr ebx, 12
; mov eax, [page_tabs+ebx*4]
; shr ebx, 10
; mov eax, [master_tab+ebx*4]
jmp .exit
.old_addr:
;.old_addr:
; shr ebx, 12
; mov eax, [page_tabs+ebx*4]
; shr ebx, 10
; mov eax, [master_tab+ebx*4]
jmp .exit
.lfb_addr:
;.lfb_addr:
; shr ebx, 22
; ;mov ecx, [sys_page_dir]
; mov eax, [master_tab+ebx*4]
jmp .exit
.tab_space:
;.tab_space:
; shr ebx, 12
; mov eax, [page_tabs+ebx*4]
; shr ebx, 10
; ;mov ecx, [sys_page_dir]
; mov eax, [master_tab+ebx*4]
jmp .exit
; jmp .exit
endp
align 4
@ -706,7 +737,7 @@ proc set_ipc_buff
mov [eax+0xA0],ebx ;set fields in extended information area
mov [eax+0xA4],ecx
add ebx, new_app_base
; add ebx, new_app_base
add ecx, ebx
add ecx, 4095
and ecx, not 4095
@ -743,7 +774,7 @@ proc sys_ipc_send stdcall, PID:dword, msg_addr:dword, msg_size:dword
jz .no_ipc_area
mov ebx, edi
add edi, new_app_base
; add edi, new_app_base
and ebx, 0xFFF
mov [dst_offset], ebx
@ -777,7 +808,7 @@ proc sys_ipc_send stdcall, PID:dword, msg_addr:dword, msg_size:dword
mov [edi+4], ecx
add edi, 8
mov esi, [msg_addr]
add esi, new_app_base
; add esi, new_app_base
cld
rep movsb
@ -835,9 +866,9 @@ endp
align 4
sysfn_meminfo:
add ebx, new_app_base
cmp ebx, new_app_base
jb .fail
; add ebx, new_app_base
cmp ebx, OS_BASE
jae .fail
mov eax, [pg_data.pages_count]
mov [ebx], eax
@ -883,16 +914,16 @@ new_services:
@@:
cmp eax, 13
ja @f
add ebx, new_app_base
; add ebx, new_app_base
stdcall user_free, ebx
mov [esp+36], eax
ret
@@:
cmp eax, 14
ja @f
add ebx, new_app_base
cmp ebx, new_app_base
jb .fail
; add ebx, new_app_base
cmp ebx, OS_BASE
jae .fail
stdcall get_event_ex, ebx, ecx
mov [esp+36], eax
ret
@ -911,9 +942,9 @@ new_services:
test ebx, ebx
jz .fail
add ebx, new_app_base
cmp ebx, new_app_base
jb .fail
; add ebx, new_app_base
cmp ebx, OS_BASE
jae .fail
stdcall get_service, ebx
mov [esp+36], eax
ret
@ -935,9 +966,9 @@ new_services:
@@:
cmp eax, 19
ja .fail
add ebx, new_app_base
cmp ebx, new_app_base
jb .fail
; add ebx, new_app_base
cmp ebx, OS_BASE
jae .fail
stdcall load_library, ebx
mov [esp+36], eax
ret

View File

@ -206,7 +206,7 @@ else
jna @F
xor eax, eax
add edi, new_app_base
; add edi, new_app_base
cld
rep stosb
@@:
@ -733,7 +733,7 @@ proc read_process_memory
mov eax, [slot]
shl eax,8
mov ebx, [offset]
add ebx, new_app_base
; add ebx, new_app_base
push ecx
stdcall map_memEx, [proc_mem_map],\
[SLOT_BASE+eax+0xB8],\
@ -799,7 +799,7 @@ proc write_process_memory
mov eax, [slot]
shl eax,8
mov ebx, [offset]
add ebx, new_app_base
; add ebx, new_app_base
push ecx
stdcall map_memEx, [proc_mem_map],\
[SLOT_BASE+eax+0xB8],\
@ -879,6 +879,8 @@ proc new_sys_threads
rep stosd ;clean extended information about new thread
mov esi,ebx
mov edi,edx
mov byte [edi], '@'
inc edi
mov ecx,11
rep movsb ;copy process name
@ -991,7 +993,7 @@ proc set_app_params stdcall,slot:dword, params:dword,\
cmp eax, [SLOT_BASE+APPDATA.mem_size+ebx*8]
ja @f
add edx, new_app_base
; add edx, new_app_base
stdcall k_strncpy, edx, [cmd_line], 256
@@:
mov edx,[params]
@ -1003,7 +1005,7 @@ proc set_app_params stdcall,slot:dword, params:dword,\
jc @f
cmp eax, [SLOT_BASE+APPDATA.mem_size+ebx*8]
ja @f
add edx, new_app_base
; add edx, new_app_base
stdcall k_strncpy, edx, [app_path], 1024
@@:
mov ebx,[slot]
@ -1056,7 +1058,7 @@ proc set_app_params stdcall,slot:dword, params:dword,\
mov [edi+TSS._eip],eax ;set eip in TSS
mov eax, [esi+0x0C] ;app_esp
mov [edi+TSS._esp],eax ;set stack in TSS
mov [edi+TSS._eflags],dword 0x1202
mov [edi+TSS._eflags],dword 0x3202
mov [edi+TSS._cs],app_code ;selector of code segment
mov [edi+TSS._ss],app_data

View File

@ -149,14 +149,14 @@ app_code_l:
dw 0
db 0
db cpl3
dw G32+D32+(new_app_base shr 16)+0x7;
dw G32+D32+(new_app_base shr 16)+0xF;
app_data_l:
dw 0xFFFF
dw 0
db 0
db drw3
dw G32+D32+(new_app_base shr 16)+0x7;
dw G32+D32+(new_app_base shr 16)+0xF;
; --------------- APM ---------------------
apm_code_32:

View File

@ -251,9 +251,9 @@ end virtual
EVENT_NOTIFY equ 0x00000200
OS_BASE equ 0;
OS_BASE equ 0x80000000
SLOT_BASE equ OS_BASE+0x0080000
new_app_base equ 0x80000000
new_app_base equ 0
public START
public service_proc
@ -385,7 +385,6 @@ proc service_proc stdcall, ioctl:dword
cmp eax, DEV_GET_MASTERVOL
jne @F
mov ebx, [edi+output]
add ebx, new_app_base
stdcall get_master_vol, ebx
ret
;@@:

View File

@ -376,17 +376,17 @@ proc CreateBuffer stdcall, format:dword, size:dword
; ring and waveout
mov eax, 0x10000
mov ebx, 0x10000
test [format], PCM_RING
jz .waveout
mov eax, [eax+STREAM.r_size]
add eax, 4095
and eax, -4096
add eax, eax
mov ebx, [eax+STREAM.r_size]
add ebx, 4095
and ebx, -4096
add ebx, ebx
.waveout:
mov [ring_size], eax
mov ebx, eax
mov [ring_size], ebx
mov eax, ebx
shr ebx, 12
mov [ring_pages], ebx

View File

@ -351,6 +351,7 @@ proc START stdcall, state:dword
jnc .fail
stdcall AttachIntHandler, ebx, ac97_irq
.reg:
stdcall RegService, sz_sound_srv, service_proc
ret
.fail:

View File

@ -2576,7 +2576,7 @@ fs_FloppyExecute:
mov ebx, [ebx+4]
test ebx, ebx
jz @f
add ebx, std_application_base_address
; add ebx, std_application_base_address
@@:
;----------------------------------------------------------------

View File

@ -3263,7 +3263,7 @@ fs_HdExecute:
mov ebx, [ebx+4]
test ebx, ebx
jz @f
add ebx, std_application_base_address
; add ebx, std_application_base_address
@@:
;----------------------------------------------------------------

View File

@ -80,7 +80,7 @@ file_system:
; \end{diamond}[18.03.2006]
; Extract parameters
add eax, std_application_base_address ; abs start of info block
; add eax, std_application_base_address ; abs start of info block
cmp dword [eax+0],15 ; GET_DISK_INFO
je fs_info
@ -91,7 +91,7 @@ file_system:
cmp dword [eax+0],1
jnz .usual_check
mov ebx,[eax+12]
add ebx,std_application_base_address
; add ebx,std_application_base_address
mov ecx,[eax+8]
call check_region
test eax,eax
@ -114,7 +114,7 @@ endg
shl ecx,9
.small_size:
mov ebx,[eax+12]
add ebx,std_application_base_address
; add ebx,std_application_base_address
call check_region
test eax,eax
jz .error_output
@ -142,7 +142,7 @@ endg
; \end{diamond}[18.03.2006]
mov esi,dir0
mov edi,[eax+12]
add edi,std_application_base_address
; add edi,std_application_base_address
mov ecx,11
push ecx
; cld ; already is
@ -196,12 +196,12 @@ endg
push dword [eax+4] ; 512 block number to read
push dword [eax+8] ; bytes to write/append or 512 blocks to read
mov ebx,[eax+12]
add ebx,std_application_base_address
; add ebx,std_application_base_address
push ebx ; abs start of return/save area
lea esi,[eax+20] ; abs start of dir + filename
mov edi,[eax+16]
add edi,std_application_base_address ; abs start of work area
; add edi,std_application_base_address ; abs start of work area
call expand_pathz

View File

@ -85,7 +85,7 @@ file_system_lfn:
; 8 : delete file
; 9 : create directory
add eax, std_application_base_address
; add eax, std_application_base_address
; parse file name
xchg ebx, eax
lea esi, [ebx+20]
@ -94,7 +94,7 @@ file_system_lfn:
test al, al
jnz @f
mov esi, [esi]
add esi, std_application_base_address
; add esi, std_application_base_address
mov ebp, esi
lodsb
@@:
@ -104,7 +104,7 @@ file_system_lfn:
mov ebx, [ebx+8]
test ebx, ebx
jz .l1
add ebx, new_app_base
; add ebx, new_app_base
.l1:
call fs_execute ; ebp, ebx, edx
mov [esp+36], eax
@ -149,7 +149,7 @@ file_system_lfn:
xor eax, eax
mov ebp, [ebx+12]
mov edx, [ebx+16]
add edx, std_application_base_address
; add edx, std_application_base_address
push dword [ebx+4] ; first block
mov ebx, [ebx+8] ; flags
mov esi, [edi+4]
@ -231,7 +231,7 @@ file_system_lfn:
mov esi, virtual_root_query
mov ebp, [ebx+12]
mov edx, [ebx+16]
add edx, std_application_base_address
; add edx, std_application_base_address
push dword [ebx+4] ; first block
mov ebx, [ebx+8] ; flags
xor eax, eax
@ -340,7 +340,7 @@ fs_OnRamdisk:
jae .not_impl
mov ecx, [ebx+12]
mov edx, [ebx+16]
add edx, std_application_base_address
; add edx, std_application_base_address
add ebx, 4
call dword [fs_RamdiskServices + eax*4]
mov [esp+36], eax
@ -377,7 +377,7 @@ fs_OnFloppy:
mov [flp_number], cl
mov ecx, [ebx+12]
mov edx, [ebx+16]
add edx, std_application_base_address
; add edx, std_application_base_address
add ebx, 4
call dword [fs_FloppyServices + eax*4]
and [flp_status], 0
@ -441,7 +441,7 @@ fs_OnHd:
pop esi ebx
mov ecx, [ebx+12]
mov edx, [ebx+16]
add edx, std_application_base_address
; add edx, std_application_base_address
mov eax, [ebx]
cmp eax, fs_NumHdServices
jae .not_impl
@ -517,7 +517,7 @@ fs_OnCd:
@@:
mov ecx, [ebx+12]
mov edx, [ebx+16]
add edx, std_application_base_address
; add edx, std_application_base_address
mov eax, [ebx]
cmp eax,fs_NumCdServices
jae .not_impl

View File

@ -499,7 +499,7 @@ fs_CdExecute:
mov ebx, [ebx+4]
test ebx, ebx
jz @f
add ebx, std_application_base_address
; add ebx, std_application_base_address
@@:
;----------------------------------------------------------------

View File

@ -227,15 +227,39 @@ high_code:
mov dword [sys_pgdir+8], 0
mov eax, cr3
mov cr3, eax
mov cr3, eax ; flush TLB
; SAVE REAL MODE VARIABLES
mov ax, [BOOT_VAR + 0x9031]
mov [IDEContrRegsBaseAddr], ax
; --------------- APM ---------------------
; mov eax, [BOOT_VAR + 0x9040] ; entry point
; mov dword[apm_entry], eax
; mov word [apm_entry + 4], apm_code_32 - gdts
; init selectors
mov ebx, [BOOT_VAR+0x9040] ; offset of APM entry point
movzx eax, word [BOOT_VAR+0x9050] ; real-mode segment base address of
; protected-mode 32-bit code segment
movzx ecx, word [BOOT_VAR+0x9052] ; real-mode segment base address of
; protected-mode 16-bit code segment
movzx edx, word [BOOT_VAR+0x9054] ; real-mode segment base address of
; protected-mode 16-bit data segment
shl eax, 4
mov [dword apm_code_32 + 2], ax
shr eax, 16
mov [dword apm_code_32 + 4], al
shl ecx, 4
mov [dword apm_code_16 + 2], cx
shr ecx, 16
mov [dword apm_code_16 + 4], cl
shl edx, 4
mov [dword apm_data_16 + 2], dx
shr edx, 16
mov [dword apm_data_16 + 4], dl
mov dword[apm_entry], ebx
mov word [apm_entry + 4], apm_code_32 - gdts
mov eax, [BOOT_VAR + 0x9044] ; version & flags
mov [apm_vf], eax
@ -1711,9 +1735,9 @@ msset:
ret
app_load_cursor:
add ebx, new_app_base
cmp ebx, new_app_base
jb msset
; add ebx, new_app_base
cmp ebx, OS_BASE
jae msset
stdcall load_cursor, ebx, ecx
mov [esp+36], eax
ret
@ -3942,7 +3966,7 @@ syscall_putimage: ; PutImage
mov edx,ecx
mov ecx,ebx
lea ebx, [eax+std_application_base_address]
mov ebx, eax
sys_putimage:
test ecx,0x80008000
@ -3984,11 +4008,11 @@ sys_putimage_bpp:
jmp [draw_pointer]
syscall_putimage_palette:
lea edi, [esi+std_application_base_address]
mov edi, esi
mov esi, edx
mov edx, ecx
mov ecx, ebx
lea ebx, [eax+std_application_base_address]
mov ebx, eax
sys_putimage_palette:
; ebx = pointer to image
; ecx = [xsize]*65536 + [ysize]
@ -4840,7 +4864,8 @@ sys_apm:
mov [esp + 36], dword 8 ; 32-bit protected-mode interface not supported
ret
@@: xchg eax, ecx
@@:
xchg eax, ecx
xchg ebx, ecx
cmp al, 3
@ -4852,7 +4877,22 @@ sys_apm:
mov [esp + 32], eax
ret
@@: call pword [apm_entry] ; call APM BIOS
@@:
mov esi, [master_tab+(OS_BASE shr 20)]
xchg [master_tab], esi
push esi
mov edi, cr3
mov cr3, edi ;flush TLB
call pword [apm_entry] ; call APM BIOS
xchg eax, [esp]
mov [master_tab], eax
mov eax, cr3
mov cr3, eax
pop eax
mov [esp + 8 ], edi
mov [esp + 12], esi
mov [esp + 24], ebx
@ -4862,6 +4902,8 @@ sys_apm:
setc al
and [esp + 56], byte 0xfe
or [esp + 56], al
ret
; -----------------------------------------
@ -4880,15 +4922,6 @@ system_shutdown: ; shut down the system
ret
@@:
call stop_all_services
push eax
push edx
mov edx, 0x400 ;bocsh
mov al,0xff ;bocsh
out dx, al ;bocsh
pop edx
pop eax
push 3 ; stop playing cd
pop eax
call sys_cd_audio

View File

@ -24,9 +24,7 @@
;
; Runtime:
;
; 0x00000000 -> 0x7FBFFFFF application 2Gb-4Mb
; 0x7FC00000 -> 0x7FFFFFFF page tables 4Mb
; 0x00000000 -> 0x7FFFFFFF application 2Gb
; 0x80000000 -> 1FFF window_data - 256 entries
;
@ -229,8 +227,9 @@
;
; 0x8098B000 -> kernel heap
; 0x81FFFFFF heap min limit
; 0xFDFFFFFF heap max limit
; 0xFDBFFFFF heap max limit
; 0xFDC00000 -> 0xFDFFFFFF page tables 4Mb
; 0xFE000000 -> 0xFFFFFFFF LFB 32Mb
; 0xFE000000 -> 0xFE7FFFFF application available LFB 8Mb
; 0xFE800000 -> 0xFFFFFFFF kernel LFB part 24 Mb

View File

@ -592,7 +592,7 @@ socket_read_packet:
.startcopy:
mov edi, ecx ;
add edi, std_application_base_address ; get data pointer to buffer in application
; add edi, std_application_base_address ; get data pointer to buffer in application
mov esi, ebx ;
add esi, SOCKETHEADERSIZE ; we dont need to copy the header