forked from KolibriOS/kolibrios
reduce kernel memory. single tss, copy_on_write io permission map
disabled debug git-svn-id: svn://kolibrios.org@430 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
e779187e24
commit
b26a2baf38
@ -6,7 +6,7 @@ cpl0 equ 10011010b ; code read dpl0
|
||||
cpl3 equ 11111010b ; code read dpl3
|
||||
|
||||
D32 equ 01000000b ; 32bit segment
|
||||
G32 equ 10000000b ; page gran
|
||||
G32 equ 10000000b ; page gran
|
||||
|
||||
|
||||
;;;;;;;;;;;;cpu_caps flags;;;;;;;;;;;;;;;;
|
||||
@ -173,6 +173,8 @@ virtual at 0
|
||||
TSS TSS
|
||||
end virtual
|
||||
|
||||
TSS_SIZE equ (128+8192)
|
||||
|
||||
OS_BASE equ 0x80000000
|
||||
|
||||
window_data equ OS_BASE
|
||||
@ -290,14 +292,16 @@ resendQ equ (OS_BASE+0x0770000)
|
||||
|
||||
skin_data equ (OS_BASE+0x0778000)
|
||||
|
||||
draw_data equ (OS_BASE+0x0780000);
|
||||
|
||||
tss_data equ (OS_BASE+0x780000)
|
||||
draw_data equ (OS_BASE+0x988000)
|
||||
virtual at (OS_BASE+0x0783F80)
|
||||
tss TSS
|
||||
end virtual
|
||||
|
||||
tmp_page_tab equ 0x98B000; draw_data+sizeof(drw_data)
|
||||
tmp_page_tab equ 0x0786000;
|
||||
|
||||
HEAP_BASE equ (OS_BASE+tmp_page_tab)
|
||||
|
||||
HEAP_MIN_SIZE equ 0x01000000
|
||||
|
||||
page_tabs equ 0xFDC00000
|
||||
app_page_tabs equ 0xFDC00000
|
||||
@ -310,7 +314,7 @@ sys_pgdir equ (OS_BASE+0x00050000)
|
||||
sys_pgmap equ (OS_BASE+0x00052000)
|
||||
|
||||
|
||||
new_app_base equ 0; 0x01000000
|
||||
new_app_base equ 0;
|
||||
|
||||
twdw equ (CURRENT_TASK-window_data)
|
||||
|
||||
@ -524,7 +528,6 @@ struc PG_DATA
|
||||
.pages_free dd ?
|
||||
.pages_faults dd ?
|
||||
.pagemap_size dd ?
|
||||
.kernel_max dd ?
|
||||
.kernel_pages dd ?
|
||||
.kernel_tables dd ?
|
||||
.sys_page_dir dd ?
|
||||
|
@ -123,19 +123,19 @@ debug_getcontext:
|
||||
jnz .ret
|
||||
call get_debuggee_slot
|
||||
jc .ret
|
||||
imul eax, tss_step/32
|
||||
add eax, tss_data
|
||||
mov edi, edx
|
||||
cmp [eax+TSS._cs], app_code
|
||||
jnz .ring0
|
||||
lea esi, [eax+TSS._eip]
|
||||
shr ecx, 2
|
||||
rep movsd
|
||||
jmp .ret
|
||||
; imul eax, tss_step/32
|
||||
; add eax, tss_data
|
||||
mov edi, edx
|
||||
; cmp [eax+TSS._cs], app_code
|
||||
; jnz .ring0
|
||||
; lea esi, [eax+TSS._eip]
|
||||
; shr ecx, 2
|
||||
; rep movsd
|
||||
; jmp .ret
|
||||
.ring0:
|
||||
; note that following code assumes that all interrupt/exception handlers
|
||||
; saves ring-3 context by pushad in this order
|
||||
mov esi, [eax+TSS._esp0]
|
||||
mov esi, [tss._esp0]
|
||||
; top of ring0 stack: ring3 stack ptr (ss+esp), iret data (cs+eip+eflags), pushad
|
||||
sub esi, 8+12+20h
|
||||
lodsd ;edi
|
||||
@ -182,17 +182,17 @@ debug_setcontext:
|
||||
jnz .ret
|
||||
call get_debuggee_slot
|
||||
jc .stiret
|
||||
imul eax, tss_step/32
|
||||
add eax, tss_data
|
||||
mov esi, edx
|
||||
cmp [eax+TSS._cs], app_code
|
||||
jnz .ring0
|
||||
lea edi, [eax+TSS._eip]
|
||||
shr ecx, 2
|
||||
rep movsd
|
||||
jmp .stiret
|
||||
; imul eax, tss_step/32
|
||||
; add eax, tss_data
|
||||
mov esi, edx
|
||||
; cmp [eax+TSS._cs], app_code
|
||||
; jnz .ring0
|
||||
; lea edi, [eax+TSS._eip]
|
||||
; shr ecx, 2
|
||||
; rep movsd
|
||||
; jmp .stiret
|
||||
.ring0:
|
||||
mov edi, [eax+TSS._esp0]
|
||||
mov edi, [tss._esp0]
|
||||
sub edi, 8+12+20h
|
||||
mov eax, [esi+24h] ;edi
|
||||
stosd
|
||||
@ -247,8 +247,8 @@ debug_set_drx:
|
||||
btr dword [eax+10h], ecx ; clear L<i> bit
|
||||
test byte [eax+10h], 55h
|
||||
jnz .okret
|
||||
imul eax, ebp, tss_step/32
|
||||
and byte [eax + tss_data + TSS._trap], not 1
|
||||
; imul eax, ebp, tss_step/32
|
||||
; and byte [eax + tss_data + TSS._trap], not 1
|
||||
.okret:
|
||||
and dword [esp+36], 0
|
||||
sti
|
||||
@ -289,8 +289,8 @@ debug_set_drx:
|
||||
not edx
|
||||
and [eax+10h+2], dx
|
||||
or [eax+10h+2], bx ; set R/W and LEN fields
|
||||
imul eax, ebp, tss_step/32
|
||||
or byte [eax + tss_data + TSS._trap], 1
|
||||
; imul eax, ebp, tss_step/32
|
||||
; or byte [eax + tss_data + TSS._trap], 1
|
||||
jmp .okret
|
||||
|
||||
debug_read_process_memory:
|
||||
|
@ -1,3 +1,4 @@
|
||||
; $Revision$
|
||||
|
||||
align 4
|
||||
proc alloc_page
|
||||
@ -544,6 +545,40 @@ align 4
|
||||
;в таблицах страниц. добавлено в P4/Xeon
|
||||
|
||||
;попытка записи в защищённую страницу ядра
|
||||
|
||||
cmp ebx, tss._io_map_0
|
||||
jb .fail
|
||||
|
||||
cmp ebx, tss._io_map_0+8192
|
||||
jae .fail
|
||||
|
||||
; io permission map
|
||||
; copy-on-write protection
|
||||
|
||||
call alloc_page
|
||||
and eax, eax
|
||||
jz .fail
|
||||
|
||||
push eax
|
||||
stdcall map_page,[ebp-4],eax,dword PG_SW
|
||||
pop eax
|
||||
mov edi, [.err_addr]
|
||||
and edi, -4096
|
||||
lea esi, [edi+(not tss._io_map_0)+1]; -tss._io_map_0
|
||||
|
||||
mov ebx, esi
|
||||
shr ebx, 12
|
||||
mov edx, [current_slot]
|
||||
or eax, PG_SW
|
||||
mov [edx+APPDATA.io_map+ebx*4], eax
|
||||
|
||||
add esi, [default_io_map]
|
||||
mov ecx, 4096/4
|
||||
cld
|
||||
rep movsd
|
||||
jmp .exit
|
||||
|
||||
|
||||
;не обрабатываем. Ошибка
|
||||
|
||||
.core_tabs:
|
||||
|
@ -180,8 +180,6 @@ find_next_task:
|
||||
sete al
|
||||
ret
|
||||
|
||||
; in: ebx = TSS selector index
|
||||
;
|
||||
; param
|
||||
; ebx = incoming task
|
||||
; esi = outcomig task
|
||||
@ -197,12 +195,18 @@ do_change_task:
|
||||
mov [esi+APPDATA.saved_esp], esp
|
||||
mov esp, [ebx+APPDATA.saved_esp]
|
||||
|
||||
; set thread io map
|
||||
|
||||
mov ecx, [ebx+APPDATA.io_map]
|
||||
mov edx, [ebx+APPDATA.io_map+4]
|
||||
mov dword [page_tabs+((tss._io_map_0 and -4096) shr 10)], ecx
|
||||
mov dword [page_tabs+((tss._io_map_1 and -4096) shr 10)], edx
|
||||
|
||||
mov eax, [ebx+APPDATA.dir_table]
|
||||
mov cr3, eax
|
||||
|
||||
mov ebx, [ebx+APPDATA.pl0_stack]
|
||||
add ebx, RING0_STACK_SIZE
|
||||
mov [tss_data+TSS._esp0], ebx
|
||||
mov [tss._esp0], ebx
|
||||
mov ecx, cr0
|
||||
or ecx, CR0_TS ;set task switch flag
|
||||
mov cr0, ecx
|
||||
|
@ -12,25 +12,6 @@ idtreg:
|
||||
dw 8*0x41-1
|
||||
dd idts+8
|
||||
|
||||
build_process_gdt_tss_pointer:
|
||||
|
||||
mov ecx,tss_data
|
||||
mov edi,0
|
||||
setgdtl2:
|
||||
mov [edi+gdts+ tss0 +0], word tss_step
|
||||
mov [edi+gdts+ tss0 +2], cx
|
||||
mov eax,ecx
|
||||
shr eax,16
|
||||
mov [edi+gdts+ tss0 +4], al
|
||||
mov [edi+gdts+ tss0 +7], ah
|
||||
mov [edi+gdts+ tss0 +5], word 01010000b *256 +11101001b
|
||||
add ecx,tss_step
|
||||
add edi,8
|
||||
cmp edi,8*(max_processes+5)
|
||||
jbe setgdtl2
|
||||
|
||||
ret
|
||||
|
||||
build_interrupt_table:
|
||||
|
||||
mov edi, idts+8
|
||||
@ -836,11 +817,10 @@ build_scheduler:
|
||||
|
||||
mov esi,boot_sched_1
|
||||
call boot_log
|
||||
call build_process_gdt_tss_pointer
|
||||
; call build_process_gdt_tss_pointer
|
||||
|
||||
mov esi,boot_sched_2
|
||||
call boot_log
|
||||
call build_interrupt_table
|
||||
; mov esi,boot_sched_2
|
||||
; call boot_log
|
||||
|
||||
ret
|
||||
|
||||
|
@ -454,15 +454,6 @@ set_cr3:
|
||||
mov ebx, [current_slot]
|
||||
mov [ebx+APPDATA.dir_table], eax
|
||||
mov cr3, eax
|
||||
|
||||
; mov esi, [CURRENT_TASK]
|
||||
; mov ebx, esi
|
||||
; shl esi,8
|
||||
; mov [SLOT_BASE+esi+0xB8],eax
|
||||
; imul ebx,tss_step
|
||||
; add ebx,tss_data
|
||||
; mov [ebx+28], eax
|
||||
; mov cr3, eax
|
||||
ret
|
||||
|
||||
align 4
|
||||
@ -923,6 +914,12 @@ proc set_app_params stdcall,slot:dword, params:dword,\
|
||||
mov [eax+SLOT_BASE+APPDATA.fpu_handler], 0
|
||||
mov [eax+SLOT_BASE+APPDATA.sse_handler], 0
|
||||
|
||||
;set default io permission map
|
||||
mov [eax+SLOT_BASE+APPDATA.io_map],\
|
||||
(tss._io_map_0-OS_BASE+PG_MAP)
|
||||
mov [eax+SLOT_BASE+APPDATA.io_map+4],\
|
||||
(tss._io_map_1-OS_BASE+PG_MAP)
|
||||
|
||||
mov esi, fpu_data
|
||||
mov ecx, 512/4
|
||||
rep movsd
|
||||
@ -1003,47 +1000,10 @@ proc set_app_params stdcall,slot:dword, params:dword,\
|
||||
mov eax,[ScreenHeight]
|
||||
mov [ecx+12],eax
|
||||
|
||||
mov edi,[slot]
|
||||
imul edi,tss_step
|
||||
add edi,tss_data
|
||||
mov ecx,128/4
|
||||
xor eax, eax
|
||||
cld
|
||||
rep stosd
|
||||
;Add IO access table - bit array of permitted ports
|
||||
not eax
|
||||
mov ecx,2048
|
||||
rep stosd ; access to 4096*8=65536 ports
|
||||
sub edi, tss_step
|
||||
|
||||
;set cr3 register in TSS of application
|
||||
mov ecx, [slot]
|
||||
shl ecx, 8
|
||||
mov eax,[SLOT_BASE+ecx+APPDATA.dir_table]
|
||||
mov [edi+TSS._cr3],eax
|
||||
|
||||
mov ebx, [pl0_stack]
|
||||
mov esi,[params]
|
||||
mov eax, [esi+0x08] ;app_eip
|
||||
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._cs],app_code ;selector of code segment
|
||||
mov [edi+TSS._ss],app_data
|
||||
mov [edi+TSS._ds],app_data
|
||||
mov [edi+TSS._es],app_data
|
||||
mov [edi+TSS._fs],app_data
|
||||
mov [edi+TSS._gs],graph_data ;selector of graphic segment
|
||||
mov [edi+TSS._io],word 128
|
||||
mov [edi+TSS._ss0], os_stack
|
||||
mov ebx, [pl0_stack]
|
||||
add ebx, RING0_STACK_SIZE
|
||||
mov [edi+TSS._esp0],ebx
|
||||
|
||||
xor eax, eax
|
||||
mov ebx, [pl0_stack]
|
||||
lea ecx, [ebx+REG_EIP]
|
||||
xor eax, eax
|
||||
|
||||
mov [ebx+REG_RET], dword irq0.return
|
||||
mov [ebx+REG_EDI], eax
|
||||
@ -1071,17 +1031,6 @@ proc set_app_params stdcall,slot:dword, params:dword,\
|
||||
shl ebx, 8
|
||||
mov [ebx+SLOT_BASE+APPDATA.saved_esp], ecx
|
||||
|
||||
mov ecx, edi ;ecx - address of application TSS
|
||||
mov ebx,[slot]
|
||||
shl ebx,3
|
||||
;set TSS descriptor
|
||||
mov [ebx+gdts+tss0+0],word tss_step ;limit (size)
|
||||
mov [ebx+gdts+tss0+2],cx ;part of offset
|
||||
shr ecx,16
|
||||
mov [ebx+gdts+tss0+4],cl ;part of offset
|
||||
mov [ebx+gdts+tss0+7],ch ;part of offset
|
||||
mov [ebx+gdts+tss0+5],word 01010000b*256+11101001b ;system flags
|
||||
|
||||
;flush keyboard and buttons queue
|
||||
mov [KEY_COUNT],byte 0
|
||||
mov [BTN_COUNT],byte 0
|
||||
@ -1108,37 +1057,6 @@ proc set_app_params stdcall,slot:dword, params:dword,\
|
||||
mov esi,new_process_running
|
||||
call sys_msg_board_str ;output information about succefull startup
|
||||
ret
|
||||
|
||||
if 0
|
||||
; set stack frame
|
||||
|
||||
xor eax, eax
|
||||
lea ecx, [ebx+REG_EIP]
|
||||
mov ebx, [pl0_stack]
|
||||
mov esi,[params]
|
||||
|
||||
mov [ebx+REG_RET], dword irq0.return
|
||||
mov [ebx+REG_EDI], eax
|
||||
mov [ebx+REG_ESI], eax
|
||||
mov [ebx+REG_EBP], eax
|
||||
mov [ebx+REG_ESP], ecx ;ebx+REG_EIP
|
||||
mov [ebx+REG_EBX], eax
|
||||
mov [ebx+REG_EDX], eax
|
||||
mov [ebx+REG_ECX], eax
|
||||
mov [ebx+REG_EAX], eax
|
||||
|
||||
mov [ebx+REG_EFL_2], dword 0x1002
|
||||
|
||||
mov eax, [esi+0x08] ;app_eip
|
||||
mov [ebx+REG_EIP], eax ;app_entry
|
||||
mov [ebx+REG_CS], dword app_code
|
||||
mov [ebx+REG_EFLAGS], dword 0x1202
|
||||
|
||||
mov eax, [esi+0x0C] ;app_esp
|
||||
mov [ebx+REG_ESP], eax ;app_stack
|
||||
mov [ebx+REG_SS], dword app_data
|
||||
end if
|
||||
|
||||
endp
|
||||
|
||||
include "debug.inc"
|
||||
|
@ -183,11 +183,13 @@ graph_data_l:
|
||||
db 0x00
|
||||
dw 11010000b *256 +11110010b
|
||||
db 0x00
|
||||
|
||||
endofcode:
|
||||
tss0_l:
|
||||
rq (max_processes+10)
|
||||
|
||||
dw TSS_SIZE-1
|
||||
dw tss and 0xFFFF
|
||||
db (tss shr 16) and 0xFF
|
||||
db 10001001b
|
||||
dw (tss shr 16) and 0xFF00
|
||||
endofcode:
|
||||
gdte:
|
||||
|
||||
align 16
|
||||
@ -276,6 +278,8 @@ proc_mem_tab rd 1
|
||||
tmp_task_pdir rd 1
|
||||
tmp_task_ptab rd 1
|
||||
|
||||
default_io_map rd 1
|
||||
|
||||
LFBSize rd 1
|
||||
|
||||
stall_mcs rd 1
|
||||
|
@ -15,7 +15,7 @@ proc mem_test
|
||||
xor edi, edi
|
||||
mov ebx, 'TEST'
|
||||
@@:
|
||||
add edi, 0x400000
|
||||
add edi, 0x100000
|
||||
xchg ebx, dword [edi]
|
||||
cmp dword [edi], 'TEST'
|
||||
xchg ebx, dword [edi]
|
||||
@ -32,21 +32,24 @@ align 4
|
||||
proc init_mem
|
||||
mov eax, [MEM_AMOUNT-OS_BASE]
|
||||
mov [pg_data.mem_amount-OS_BASE], eax
|
||||
mov [pg_data.kernel_max-OS_BASE], eax
|
||||
|
||||
shr eax, 12
|
||||
mov edx, eax
|
||||
mov [pg_data.pages_count-OS_BASE], eax
|
||||
mov [pg_data.kernel_pages-OS_BASE], eax
|
||||
|
||||
shr eax, 3
|
||||
mov [pg_data.pagemap_size-OS_BASE], eax
|
||||
|
||||
shr edx, 10
|
||||
cmp edx, 3
|
||||
ja @f
|
||||
inc edx ;at least 4Mb for kernel heap
|
||||
cmp edx, (OS_BASE/4096)
|
||||
jbe @F
|
||||
mov edx, (OS_BASE/4096)
|
||||
jmp .set
|
||||
@@:
|
||||
cmp edx, (HEAP_MIN_SIZE/4096)
|
||||
jae .set
|
||||
mov edx, (HEAP_MIN_SIZE/4096)
|
||||
.set:
|
||||
mov [pg_data.kernel_pages-OS_BASE], edx
|
||||
shr edx, 10
|
||||
mov [pg_data.kernel_tables-OS_BASE], edx
|
||||
|
||||
xor eax, eax
|
||||
@ -70,15 +73,15 @@ proc init_mem
|
||||
or ebx, CR4_PGE
|
||||
@@:
|
||||
mov cr4, ebx
|
||||
sub [pg_data.kernel_tables-OS_BASE], 2
|
||||
sub [pg_data.kernel_tables-OS_BASE], 1
|
||||
|
||||
mov [edx], eax
|
||||
add eax, 0x00400000
|
||||
mov [edx+4], eax
|
||||
add edx, 8
|
||||
; mov [edx+4], eax
|
||||
add edx, 4
|
||||
|
||||
mov eax, 0x800000+PG_SW
|
||||
mov ecx, (tmp_page_tab-0x800000)/4096
|
||||
mov eax, 0x400000+PG_SW
|
||||
mov ecx, (tmp_page_tab-0x400000)/4096
|
||||
jmp .map_low
|
||||
.no_PSE:
|
||||
mov eax, PG_SW
|
||||
|
@ -11,7 +11,7 @@
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
$Revision:$
|
||||
; $Revision$
|
||||
|
||||
include "proc32.inc"
|
||||
include "kglobals.inc"
|
||||
@ -203,7 +203,7 @@ B32:
|
||||
mov cr3, eax
|
||||
|
||||
mov eax,cr0
|
||||
or eax,CR0_PG
|
||||
or eax,CR0_PG+CR0_WP
|
||||
mov cr0,eax
|
||||
|
||||
lgdt [gdts]
|
||||
@ -372,12 +372,37 @@ high_code:
|
||||
.noSYSCALL:
|
||||
; -----------------------------------------
|
||||
|
||||
; LOAD IDT
|
||||
|
||||
call build_interrupt_table
|
||||
lidt [idtreg]
|
||||
|
||||
call init_kernel_heap
|
||||
stdcall kernel_alloc, 0x2000
|
||||
stdcall kernel_alloc, RING0_STACK_SIZE+512
|
||||
mov [os_stack_seg], eax
|
||||
|
||||
lea esp, [eax+RING0_STACK_SIZE]
|
||||
|
||||
mov [tss._ss0], os_stack
|
||||
mov [tss._esp0], esp
|
||||
mov [tss._esp], esp
|
||||
mov [tss._cs],os_code
|
||||
mov [tss._ss],os_stack
|
||||
mov [tss._ds],app_data
|
||||
mov [tss._es],app_data
|
||||
mov [tss._fs],app_data
|
||||
mov [tss._gs],app_data
|
||||
mov [tss._io],128
|
||||
;Add IO access table - bit array of permitted ports
|
||||
mov edi, tss._io_map_0
|
||||
xor eax, eax
|
||||
not eax
|
||||
mov ecx, 8192/4
|
||||
rep stosd ; access to 4096*8=65536 ports
|
||||
|
||||
mov ax,tss0
|
||||
ltr ax
|
||||
|
||||
mov [LFBSize], 0x800000
|
||||
call init_mtrr
|
||||
|
||||
@ -385,7 +410,10 @@ high_code:
|
||||
call init_fpu
|
||||
call init_malloc
|
||||
|
||||
stdcall alloc_kernel_space, 0x4F000
|
||||
stdcall alloc_kernel_space, 0x51000
|
||||
mov [default_io_map], eax
|
||||
|
||||
add eax, 0x2000
|
||||
mov [ipc_tmp], eax
|
||||
mov ebx, 0x1000
|
||||
|
||||
@ -497,9 +525,6 @@ include 'vmodeld.inc'
|
||||
|
||||
call build_scheduler ; sys32.inc
|
||||
|
||||
; LOAD IDT
|
||||
lidt [idtreg]
|
||||
|
||||
mov esi,boot_devices
|
||||
call boot_log
|
||||
call detect_devices
|
||||
@ -565,6 +590,10 @@ include 'vmodeld.inc'
|
||||
mov dword [SLOT_BASE+256+APPDATA.pl0_stack], edi
|
||||
add edi, 0x2000-512
|
||||
mov dword [SLOT_BASE+256+APPDATA.fpu_state], edi
|
||||
mov dword [SLOT_BASE+256+APPDATA.io_map],\
|
||||
(tss._io_map_0-OS_BASE+PG_MAP)
|
||||
mov dword [SLOT_BASE+256+APPDATA.io_map+4],\
|
||||
(tss._io_map_1-OS_BASE+PG_MAP)
|
||||
|
||||
mov esi, fpu_data
|
||||
mov ecx, 512/4
|
||||
@ -587,31 +616,6 @@ include 'vmodeld.inc'
|
||||
mov [TASK_DATA+TASKDATA.pid], 1 ; process id number
|
||||
mov [TASK_DATA+TASKDATA.mem_start], 0 ; process base address
|
||||
|
||||
mov edi,tss_data+tss_step
|
||||
mov ecx, (tss_step)/4
|
||||
xor eax, eax
|
||||
cld
|
||||
rep stosd
|
||||
|
||||
mov edi,tss_data
|
||||
mov [edi+TSS._ss0], os_stack
|
||||
mov eax,cr3
|
||||
mov [edi+TSS._cr3],eax
|
||||
mov [edi+TSS._eip],osloop
|
||||
mov [edi+TSS._eflags],dword 0x1202 ; sti and resume
|
||||
mov eax, [os_stack_seg]
|
||||
add eax, 0x2000-512
|
||||
mov [edi+TSS._esp], eax
|
||||
mov [edi+TSS._cs],os_code
|
||||
mov [edi+TSS._ss],os_stack ;os_stack
|
||||
mov [edi+TSS._ds],app_data ;os_data
|
||||
mov [edi+TSS._es],app_data ;os_data
|
||||
mov [edi+TSS._fs],app_data ;os_data
|
||||
mov [edi+TSS._gs],app_data ;os_data
|
||||
|
||||
mov ax,tss0
|
||||
ltr ax
|
||||
|
||||
call init_cursors
|
||||
mov eax, [def_cursor]
|
||||
mov [SLOT_BASE+APPDATA.cursor],eax
|
||||
@ -667,6 +671,18 @@ include 'vmodeld.inc'
|
||||
movsd
|
||||
call load_skin
|
||||
|
||||
;protect io permission map
|
||||
|
||||
mov esi, [default_io_map]
|
||||
stdcall map_page,esi,(tss._io_map_0-OS_BASE), PG_MAP
|
||||
add esi, 0x1000
|
||||
stdcall map_page,esi,(tss._io_map_1-OS_BASE), PG_MAP
|
||||
|
||||
stdcall map_page,tss._io_map_0,\
|
||||
(tss._io_map_0-OS_BASE), PG_MAP
|
||||
stdcall map_page,tss._io_map_1,\
|
||||
(tss._io_map_1-OS_BASE), PG_MAP
|
||||
|
||||
; LOAD FIRST APPLICATION
|
||||
cli
|
||||
cmp byte [BOOT_VAR+0x9030],1
|
||||
@ -3727,33 +3743,32 @@ set_io_access_rights:
|
||||
|
||||
pushad
|
||||
|
||||
mov edi,[CURRENT_TASK]
|
||||
imul edi,tss_step
|
||||
add edi,tss_data+128
|
||||
; add edi,128
|
||||
mov edi, tss._io_map_0
|
||||
|
||||
mov ecx,eax
|
||||
and ecx,7 ; offset in byte
|
||||
; mov ecx,eax
|
||||
; and ecx,7 ; offset in byte
|
||||
|
||||
shr eax,3 ; number of byte
|
||||
add edi,eax
|
||||
; shr eax,3 ; number of byte
|
||||
; add edi,eax
|
||||
|
||||
mov ebx,1
|
||||
shl ebx,cl
|
||||
; mov ebx,1
|
||||
; shl ebx,cl
|
||||
|
||||
cmp ebp,0 ; enable access - ebp = 0
|
||||
jne siar1
|
||||
|
||||
not ebx
|
||||
and [edi],byte bl
|
||||
; not ebx
|
||||
; and [edi],byte bl
|
||||
btr [edi], eax
|
||||
|
||||
popad
|
||||
|
||||
ret
|
||||
|
||||
siar1:
|
||||
siar1:
|
||||
|
||||
or [edi],byte bl ; disable access - ebp = 1
|
||||
bts [edi], eax
|
||||
; or [edi],byte bl ; disable access - ebp = 1
|
||||
|
||||
popad
|
||||
|
||||
@ -3779,7 +3794,7 @@ r_f_port_area:
|
||||
je rpal2
|
||||
cmp esi,255 ; max reserved
|
||||
jae rpal1
|
||||
rpal3:
|
||||
rpal3:
|
||||
mov edi,esi
|
||||
shl edi,4
|
||||
add edi,RESERVED_PORTS
|
||||
@ -3789,7 +3804,7 @@ r_f_port_area:
|
||||
jae rpal1
|
||||
; jb rpal4
|
||||
; jmp rpal1
|
||||
rpal4:
|
||||
rpal4:
|
||||
|
||||
dec esi
|
||||
jnz rpal3
|
||||
|
@ -185,8 +185,9 @@ struc APPDATA
|
||||
.fd_obj dd ? ;+56
|
||||
.bk_obj dd ? ;+60
|
||||
.saved_esp dd ? ;+64
|
||||
.io_map rd 2 ;+68
|
||||
|
||||
db 60 dup(?) ;+68
|
||||
db 52 dup(?) ;+76
|
||||
|
||||
.wnd_shape dd ? ;+128
|
||||
.wnd_shape_scale dd ? ;+132
|
||||
|
Loading…
Reference in New Issue
Block a user