From 6b29296f2c3c82a80157c0db671d39d9424b19db Mon Sep 17 00:00:00 2001 From: "Evgeny Grechnikov (Diamond)" Date: Tue, 8 Dec 2009 20:32:13 +0000 Subject: [PATCH] IOPM in TSS for 4M page was broken, fixed. git-svn-id: svn://kolibrios.org@1310 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/const.inc | 6 +++--- kernel/trunk/core/sys32.inc | 4 ++-- kernel/trunk/core/taskman.inc | 8 ++++---- kernel/trunk/kernel.asm | 23 +++++++++++++++-------- 4 files changed, 24 insertions(+), 17 deletions(-) diff --git a/kernel/trunk/const.inc b/kernel/trunk/const.inc index f7c20ee947..8fbebc2b76 100644 --- a/kernel/trunk/const.inc +++ b/kernel/trunk/const.inc @@ -310,12 +310,12 @@ BgrDrawMode equ (OS_BASE+0x033BFF4) BgrDataWidth equ (OS_BASE+0x033BFF8) BgrDataHeight equ (OS_BASE+0x033BFFC) -virtual at (OS_BASE+0x033CF80) +sys_pgmap equ (OS_BASE+0x033C000) + +virtual at (OS_BASE+0x05FFF80) tss TSS end virtual -sys_pgmap equ (OS_BASE+0x033F000) - HEAP_BASE equ (OS_BASE+0x0800000) HEAP_MIN_SIZE equ 0x01000000 diff --git a/kernel/trunk/core/sys32.inc b/kernel/trunk/core/sys32.inc index b8b445efb2..26d1197233 100644 --- a/kernel/trunk/core/sys32.inc +++ b/kernel/trunk/core/sys32.inc @@ -652,12 +652,12 @@ term9: add edi,SLOT_BASE mov eax, [edi+APPDATA.io_map] - cmp eax, (tss._io_map_0-OS_BASE+PG_MAP) + cmp eax, [SLOT_BASE+256+APPDATA.io_map] je @F call free_page @@: mov eax, [edi+APPDATA.io_map+4] - cmp eax, (tss._io_map_1-OS_BASE+PG_MAP) + cmp eax, [SLOT_BASE+256+APPDATA.io_map+4] je @F call free_page @@: diff --git a/kernel/trunk/core/taskman.inc b/kernel/trunk/core/taskman.inc index 28d0caf904..b7a232f375 100644 --- a/kernel/trunk/core/taskman.inc +++ b/kernel/trunk/core/taskman.inc @@ -1000,10 +1000,10 @@ proc set_app_params stdcall,slot:dword, params:dword,\ mov [eax+SLOT_BASE+APPDATA.except_mask], 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 ecx, [SLOT_BASE+256+APPDATA.io_map] + mov [eax+SLOT_BASE+APPDATA.io_map], ecx + mov ecx, [SLOT_BASE+256+APPDATA.io_map+4] + mov [eax+SLOT_BASE+APPDATA.io_map+4], ecx mov esi, fpu_data mov ecx, 512/4 diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index 54f3271a4c..96fc2b15e4 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -465,6 +465,16 @@ high_code: wrmsr .noSYSCALL: ; ----------------------------------------- + stdcall alloc_page + stdcall map_page, tss-0xF80, eax, PG_SW + stdcall alloc_page + inc eax + mov [SLOT_BASE+256+APPDATA.io_map], eax + stdcall map_page, tss+0x80, eax, PG_SW + stdcall alloc_page + inc eax + mov dword [SLOT_BASE+256+APPDATA.io_map+4], eax + stdcall map_page, tss+0x1080, eax, PG_SW ; LOAD IDT @@ -714,10 +724,7 @@ end if add edi, 0x2000-512 mov dword [SLOT_BASE+256+APPDATA.fpu_state], edi mov dword [SLOT_BASE+256+APPDATA.saved_esp0], edi ; just for case - 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) + ; [SLOT_BASE+256+APPDATA.io_map] was set earlier mov esi, fpu_data mov ecx, 512/4 @@ -829,14 +836,14 @@ end if ;protect io permission map mov esi, [default_io_map] - stdcall map_page,esi,(tss._io_map_0-OS_BASE), PG_MAP + stdcall map_page,esi,[SLOT_BASE+256+APPDATA.io_map], PG_MAP add esi, 0x1000 - stdcall map_page,esi,(tss._io_map_1-OS_BASE), PG_MAP + stdcall map_page,esi,[SLOT_BASE+256+APPDATA.io_map+4], PG_MAP stdcall map_page,tss._io_map_0,\ - (tss._io_map_0-OS_BASE), PG_MAP + [SLOT_BASE+256+APPDATA.io_map], PG_MAP stdcall map_page,tss._io_map_1,\ - (tss._io_map_1-OS_BASE), PG_MAP + [SLOT_BASE+256+APPDATA.io_map+4], PG_MAP mov ax,[OS_BASE+0x10000+bx_from_load] cmp ax,'r1' ; if not rused ram disk - load network configuration from files {SPraid.simba}