Assert sizeof.APPDATA=256, use it instead of hardcoded 256 value.

git-svn-id: svn://kolibrios.org@8093 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Ivan Baravy 2020-10-12 02:54:44 +00:00
parent ab9b1ebb4a
commit aaf1ac4439
5 changed files with 27 additions and 22 deletions

View File

@ -536,8 +536,11 @@ struct APPDATA
wnd_clientbox BOX ;+216
priority dd ? ;+232
in_schedule LHEAD ;+236
rd 3 ;+244
ends
assert sizeof.APPDATA = 256
APP_OBJ_OFFSET = 48
APP_EV_OFFSET = 40

View File

@ -326,6 +326,8 @@ proc find_next_task
pop ecx
spin_unlock_irqrestore SchedulerLock
.found:
; the line below assumes APPDATA is 256 bytes long and SLOT_BASE is
; aligned on 0x10000
mov [CURRENT_TASK], bh
mov [TASK_BASE], edi
rdtsc ;call _rdtsc

View File

@ -467,7 +467,7 @@ destroy_thread:
jne @F
mov [fpu_owner], 2
mov eax, [256*2+SLOT_BASE+APPDATA.fpu_state]
mov eax, [sizeof.APPDATA*2+SLOT_BASE+APPDATA.fpu_state]
clts
bt [cpu_caps], CAPS_SSE
jnc .no_SSE
@ -611,12 +611,12 @@ destroy_thread:
add edi, SLOT_BASE
mov eax, [edi+APPDATA.io_map]
cmp eax, [SLOT_BASE+256+APPDATA.io_map]
cmp eax, [SLOT_BASE+sizeof.APPDATA+APPDATA.io_map]
je @F
call free_page
@@:
mov eax, [edi+APPDATA.io_map+4]
cmp eax, [SLOT_BASE+256+APPDATA.io_map+4]
cmp eax, [SLOT_BASE+sizeof.APPDATA+APPDATA.io_map+4]
je @F
call free_page
@@:
@ -822,7 +822,7 @@ proc unprotect_from_terminate
ret
endp
; Request termination of thread identified by edx = SLOT_BASE + slot*256.
; Request termination of thread identified by edx = SLOT_BASE + slot*sizeof.APPDATA.
; Called by anyone.
proc request_terminate
xor eax, eax ; set return value

View File

@ -128,7 +128,7 @@ proc fs_execute
lea edi, [SLOT_BASE+eax]
mov [slot_base], edi
; clean extended information about process
mov ecx, 256/4
mov ecx, sizeof.APPDATA/4
xor eax, eax
cld
rep stosd
@ -726,7 +726,7 @@ proc new_sys_threads
shl edi, 8
add edi, SLOT_BASE
mov edx, edi ;edx=edi - pointer to extended infomation about new thread
mov ecx, 256/4
mov ecx, sizeof.APPDATA/4
xor eax, eax
cld
rep stosd ;clean extended information about new thread
@ -918,9 +918,9 @@ proc set_app_params stdcall,slot:dword, params:dword, flags:dword
mov [eax+SLOT_BASE+APPDATA.terminate_protection], 80000001h
;set default io permission map
mov ecx, [SLOT_BASE+256+APPDATA.io_map]
mov ecx, [SLOT_BASE+sizeof.APPDATA+APPDATA.io_map]
mov [eax+SLOT_BASE+APPDATA.io_map], ecx
mov ecx, [SLOT_BASE+256+APPDATA.io_map+4]
mov ecx, [SLOT_BASE+sizeof.APPDATA+APPDATA.io_map+4]
mov [eax+SLOT_BASE+APPDATA.io_map+4], ecx
mov esi, fpu_data

View File

@ -599,7 +599,7 @@ high_code:
mov [current_process], sys_proc
mov edx, SLOT_BASE+256*1
mov edx, SLOT_BASE+sizeof.APPDATA*1
mov ebx, [os_stack_seg]
add ebx, RING0_STACK_SIZE
add ebx, [xsave_area_size]
@ -611,7 +611,7 @@ high_code:
mov ecx, IDLE_PRIORITY
call scheduler_add_thread
mov edx, SLOT_BASE+256*2
mov edx, SLOT_BASE+sizeof.APPDATA*2
mov ebx, [os_stack_seg]
call setup_os_slot
mov dword [edx], 'OS'
@ -620,8 +620,8 @@ high_code:
mov dword [CURRENT_TASK], 2
mov dword [TASK_COUNT], 2
mov dword [current_slot], SLOT_BASE + 256*2
mov dword [TASK_BASE], CURRENT_TASK + 32*2
mov dword [current_slot], SLOT_BASE + sizeof.APPDATA*2
mov dword [TASK_BASE], CURRENT_TASK + sizeof.TASKDATA*2
; Move other CPUs to deep sleep, if it is useful
uglobal
@ -880,8 +880,8 @@ include "detect/vortex86.inc" ; Vortex86 SoC detection code
call init_display
mov eax, [def_cursor]
mov [SLOT_BASE+APPDATA.cursor+256], eax
mov [SLOT_BASE+APPDATA.cursor+256*2], eax
mov [SLOT_BASE+APPDATA.cursor+sizeof.APPDATA], eax
mov [SLOT_BASE+APPDATA.cursor+sizeof.APPDATA*2], eax
; PRINT CPU FREQUENCY
@ -977,14 +977,14 @@ include "detect/vortex86.inc" ; Vortex86 SoC detection code
; Protect I/O permission map
mov esi, [default_io_map]
stdcall map_page, esi, [SLOT_BASE+256+APPDATA.io_map], PG_READ
stdcall map_page, esi, [SLOT_BASE+sizeof.APPDATA+APPDATA.io_map], PG_READ
add esi, 0x1000
stdcall map_page, esi, [SLOT_BASE+256+APPDATA.io_map+4], PG_READ
stdcall map_page, esi, [SLOT_BASE+sizeof.APPDATA+APPDATA.io_map+4], PG_READ
stdcall map_page, tss._io_map_0, \
[SLOT_BASE+256+APPDATA.io_map], PG_READ
[SLOT_BASE+sizeof.APPDATA+APPDATA.io_map], PG_READ
stdcall map_page, tss._io_map_1, \
[SLOT_BASE+256+APPDATA.io_map+4], PG_READ
[SLOT_BASE+sizeof.APPDATA+APPDATA.io_map+4], PG_READ
; SET KEYBOARD PARAMETERS
mov al, 0xf6 ; reset keyboard, scan enabled
@ -1122,7 +1122,7 @@ register_ramdisk:
; in: ebx = stack base
proc setup_os_slot
xor eax, eax
mov ecx, 256/4
mov ecx, sizeof.APPDATA/4
mov edi, edx
rep stosd
@ -3506,8 +3506,8 @@ nocpustart:
;--------------------------------------
align 4
.set_mouse_event:
add edi, 256
add ebx, 32
add edi, sizeof.APPDATA
add ebx, sizeof.TASKDATA
test [ebx+TASKDATA.event_mask], 0x80000000
jz .pos_filter
@ -3574,7 +3574,7 @@ backgr:
;--------------------------------------
align 4
set_bgr_event:
add edi, 256
add edi, sizeof.APPDATA
mov eax, [BG_Rect_X_left_right]
mov edx, [BG_Rect_Y_top_bottom]
cmp [edi+SLOT_BASE+APPDATA.draw_bgr_x], 0