/kernel/trunk/kernel16.inc |
---|
File deleted |
Property changes: |
Deleted: svn:keywords |
-Rev |
\ No newline at end of property |
/kernel/trunk/blkdev/flp_drv.inc |
---|
12,10 → 12,10 |
; Àâòîð èñõîäíîãî òåêñòà Êóëàêîâ Âëàäèìèð Ãåííàäüåâè÷. |
; Àäàïòàöèÿ è äîðàáîòêà Mario79 |
give_back_application_data: ; ïåðåñëàòü ïðèëîæåíèþ |
mov edi,[TASK_BASE] |
mov edi,[edi+TASKDATA.mem_start] |
add edi,ecx |
;give_back_application_data: ; ïåðåñëàòü ïðèëîæåíèþ |
; mov edi,[TASK_BASE] |
; mov edi,[edi+TASKDATA.mem_start] |
; add edi,ecx |
give_back_application_data_1: |
mov esi,FDD_BUFF ;FDD_DataBuffer ;0x40000 |
xor ecx,ecx |
24,10 → 24,10 |
rep movsd |
ret |
take_data_from_application: ; âçÿòü èç ïðèëîæåíè |
mov esi,[TASK_BASE] |
mov esi,[esi+TASKDATA.mem_start] |
add esi,ecx |
;take_data_from_application: ; âçÿòü èç ïðèëîæåíè |
; mov esi,[TASK_BASE] |
; mov esi,[esi+TASKDATA.mem_start] |
; add esi,ecx |
take_data_from_application_1: |
mov edi,FDD_BUFF ;FDD_DataBuffer ;0x40000 |
xor ecx,ecx |
/kernel/trunk/blkdev/hd_drv.inc |
---|
400,7 → 400,7 |
save_hd_wait_timeout: |
push eax |
mov eax,[timer_ticks];[0xfdf0] |
mov eax,[timer_ticks] |
add eax,300 ; 3 sec timeout |
mov [hd_wait_timeout],eax |
pop eax |
411,7 → 411,7 |
push eax |
mov eax,[hd_wait_timeout] |
cmp [timer_ticks], eax ;[0xfdf0],eax |
cmp [timer_ticks], eax |
jg hd_timeout_error |
pop eax |
mov [hd_error],0 |
431,7 → 431,7 |
; mov esi,hd_timeout_str |
; call sys_msg_board_str |
DEBUGF 1,"K : FS - HD timeout\n" |
; jmp $ |
mov [hd_error],1 |
pop eax |
ret |
582,9 → 582,9 |
align 4 |
; note that IDE descriptor table must be 4-byte aligned and do not cross 4K boundary |
IDE_descriptor_table: |
dd OS_BASE+284000h |
dw 2000h |
dw 8000h |
dd 0x284000 |
dw 0x2000 |
dw 0x8000 |
dma_cur_sector dd not 40h |
irq14_func dd hdd_irq_null |
613,20 → 613,20 |
mov dx, [IDEContrRegsBaseAddr] |
mov al, 0 |
out dx, al |
call update_counters |
mov ebx, [dma_process] |
cmp [CURRENT_TASK], ebx |
jz .noswitch |
mov [dma_task_switched], 1 |
mov edi, [dma_slot_ptr] |
mov eax, [CURRENT_TASK] |
mov [dma_process], eax |
mov eax, [TASK_BASE] |
mov [dma_slot_ptr], eax |
mov [CURRENT_TASK], ebx |
mov [TASK_BASE], edi |
mov byte [0xFFFF], 1 |
call do_change_task |
; call update_counters |
; mov ebx, [dma_process] |
; cmp [CURRENT_TASK], ebx |
; jz .noswitch |
; mov [dma_task_switched], 1 |
; mov edi, [dma_slot_ptr] |
; mov eax, [CURRENT_TASK] |
; mov [dma_process], eax |
; mov eax, [TASK_BASE] |
; mov [dma_slot_ptr], eax |
; mov [CURRENT_TASK], ebx |
; mov [TASK_BASE], edi |
; mov byte [DONT_SWITCH], 1 |
; call do_change_task |
.noswitch: |
popad |
popfd |
644,20 → 644,20 |
add dx, 8 |
mov al, 0 |
out dx, al |
call update_counters |
mov ebx, [dma_process] |
cmp [CURRENT_TASK], ebx |
jz .noswitch |
mov [dma_task_switched], 1 |
mov edi, [dma_slot_ptr] |
mov eax, [CURRENT_TASK] |
mov [dma_process], eax |
mov eax, [TASK_BASE] |
mov [dma_slot_ptr], eax |
mov [CURRENT_TASK], ebx |
mov [TASK_BASE], edi |
mov byte [0xFFFF], 1 |
call do_change_task |
; call update_counters |
; mov ebx, [dma_process] |
; cmp [CURRENT_TASK], ebx |
; jz .noswitch |
; mov [dma_task_switched], 1 |
; mov edi, [dma_slot_ptr] |
; mov eax, [CURRENT_TASK] |
; mov [dma_process], eax |
; mov eax, [TASK_BASE] |
; mov [dma_slot_ptr], eax |
; mov [CURRENT_TASK], ebx |
; mov [TASK_BASE], edi |
; mov byte [DONT_SWITCH], 1 |
; call do_change_task |
.noswitch: |
popad |
popfd |
689,9 → 689,10 |
pop eax |
ret |
.notread: |
mov eax, IDE_descriptor_table-OS_BASE |
mov dword [eax+OS_BASE], 0x284000 |
mov word [eax+4+OS_BASE], 0x2000 |
mov eax, IDE_descriptor_table |
mov dword [eax], 0x284000 |
mov word [eax+4], 0x2000 |
sub eax, OS_BASE |
mov dx, [IDEContrRegsBaseAddr] |
cmp [hdbase], 0x1F0 |
jz @f |
774,7 → 775,7 |
mov eax, IDE_descriptor_table |
mov edx, [cache_chain_pos] |
shl edx, 9 |
add edx, OS_BASE+0x610000 |
add edx, 0x610000 |
mov [eax], edx |
movzx edx, [cache_chain_size] |
shl edx, 9 |
785,10 → 786,11 |
mov eax, IDE_descriptor_table |
mov edx, edi |
shl edx, 9 |
add edx, OS_BASE+0x610000 |
add edx, 0x610000 |
mov [eax], edx |
mov word [eax+4], 0x200 |
do_write_dma: |
sub eax, OS_BASE |
mov dx, [IDEContrRegsBaseAddr] |
cmp [hdbase], 0x1F0 |
jz @f |
/kernel/trunk/blkdev/rd.inc |
---|
1802,7 → 1802,12 |
jnz .disk_full2 |
dec edi |
dec edi |
lea eax, [edi-(RAMDISK_FAT)] |
; lea eax, [edi-(RAMDISK_FAT)] |
mov eax, edi |
sub eax, RAMDISK_FAT |
shr eax, 1 ; eax = cluster |
mov word [edi], 0xFFF ; mark as last cluster |
xchg edi, [esp] |
2294,7 → 2299,7 |
mov ebx, [ebx+4] |
test ebx, ebx |
jz @f |
add ebx, std_application_base_address |
; add ebx, std_application_base_address |
@@: |
;---------------------------------------------------------------- |
/kernel/trunk/boot/bootcode.inc |
---|
20,120 → 20,7 |
; |
;========================================================================== |
; 16-bit data |
org $+0x10000 |
old_ints_h: |
dw 0x400 |
dd 0 |
dw 0 |
kernel_restart_bootblock: |
db 1 ; version |
dw 1 ; floppy image is in memory |
dd 0 ; cannot save parameters |
align 32 |
; GDT TABLE |
gdts: |
dw gdte-$-1 |
dd gdts |
dw 0 |
; Attention! The order first four selectors not to change, is used in Fast System Call |
; must be : os_code, os_data, app_code, app_data, .... |
int_code_l: |
os_code_l: |
dw 0xffff |
dw 0x0000 |
db 0x00 |
dw 11011111b *256 +10011010b |
db 0x00 |
int_data_l: |
os_data_l: |
dw 0xffff |
dw 0x0000 |
db 0x00 |
dw 11011111b *256 +10010010b |
db 0x00 |
app_code_l: |
dw 0xFFFF |
dw 0 |
db 0 |
db cpl3 |
dw G32+D32+0x8000+0x7; |
app_data_l: |
dw 0xFFFF |
dw 0 |
db 0 |
db drw3 |
dw G32+D32+0x8000+0x7; |
; --------------- APM --------------------- |
apm_code_32: |
dw 0x0f ; limit 64kb |
db 0, 0, 0 |
dw 11010000b *256 +10011010b |
db 0x00 |
apm_code_16: |
dw 0x0f |
db 0, 0, 0 |
dw 10010000b *256 +10011010b |
db 0x00 |
apm_data_16: |
dw 0x0f |
db 0, 0, 0 |
dw 10010000b *256 +10010010b |
db 0x00 |
; ----------------------------------------- |
graph_data_l: |
dw 0x7ff |
dw 0x0000 |
db 0x00 |
dw 11010000b *256 +11110010b |
db 0x00 |
tss0_l: |
; times (max_processes+10) dd 0,0 |
gdte = $ + (max_processes+10)*8 |
; videomodes table |
gr_table: |
dw 0x112+0100000000000000b , 640 , 480 ; 1 |
dw 0x115+0100000000000000b , 800 , 600 ; 2 |
dw 0x118+0100000000000000b , 1024 , 768 ; 3 |
dw 0x11B+0100000000000000b , 1280 , 1024 ; 4 |
dw 0x112 , 640 , 480 ; 5 |
dw 0x115 , 800 , 600 ; 6 |
dw 0x118 , 1024 , 768 ; 7 |
dw 0x11B , 1280 ,1024 ; 8 |
dw 0x13, 640, 480 ; 9 |
dw 0x12, 640, 480 ; 0 |
; table for move to extended memory (int 15h, ah=87h) |
movedesc: |
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
db 0xff,0xff,0x0,0xa0,0x00,0x93,0x0,0x0 |
db 0xff,0xff,0x0,0x00,0x10,0x93,0x0,0x0 |
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
org $-0x10000 |
putchar: |
; in: al=character |
mov ah, 0Eh |
160,72 → 47,6 |
popa |
ret |
; Now int 16 is used for keyboard support. |
; This is shorter, simpler and more reliable. |
if 0 |
getkey: push ecx |
push edx |
add ebx,0x0101 |
xor eax,eax |
gk1: |
in al,0x60 |
mov cl,al |
gk0: |
in al,0x60 |
cmp al,cl |
je gk0 |
cmp ax,11 |
jg gk0 |
gk0_1: |
mov cl,al |
; add al,47 |
; mov [ds:keyinbs-0x10000],al |
; mov si,keyinbs-0x10000 |
; call printplain |
gk12: |
in al,0x60 |
cmp al,cl |
je gk12 |
cmp ax,240 |
jne gk13 |
mov al,cl |
jmp gk14 |
gk13: |
add cl,128 |
cmp al,cl |
jne gk1 |
sub al,128 |
gk14: |
movzx edx,bl |
cmp eax,edx |
jb gk1 |
movzx edx,bh |
cmp eax,edx |
jg gk1 |
test ebx,0x010000 |
jnz gk3 |
mov cx,0x1000 |
mov dx,cx |
add eax,47 |
mov cx,ax |
cmp cx,58 |
jb gk_nozero |
sub cx,10 |
gk_nozero: |
mov [ds:keyin-0x10000],cl |
mov si,keyin-0x10000 |
call printplain |
gk3: |
sub eax,48 |
pop edx |
pop ecx |
ret |
end if |
getkey: |
; get number in range [bl,bh] (bl,bh in ['0'..'9']) |
; in: bx=range |
258,17 → 79,6 |
call setcursor |
} |
;pagetable_set: |
;eax - physical address |
;es:di - page table |
;ecx - number of pages to map |
; or al, 7 |
;@@: |
; stosd |
; add eax, 1000h |
; loop @b |
; ret |
boot_read_floppy: |
push si |
xor si, si |
281,7 → 91,7 |
inc si |
cmp si, 10 |
jb @b |
mov si, badsect-0x10000 |
mov si, badsect |
sayerr_plain: |
call printplain |
jmp $ |
301,15 → 111,11 |
; \begin{diamond}[02.12.2005] |
cmp ax, 'KL' |
jnz @f |
mov word [cs:cfgmanager.loader_block-0x10000], si |
mov word [cs:cfgmanager.loader_block+2-0x10000], ds |
mov word [cs:cfgmanager.loader_block], si |
mov word [cs:cfgmanager.loader_block+2], ds |
@@: |
; \end{diamond}[02.12.2005] |
mov word [cs:bx_from_load - 0x10000], bx ; {SPraid}[13.03.2007] |
; set up stack |
mov ax, 3000h |
mov ss, ax |
326,7 → 132,7 |
if lang eq ru |
; Load & set russian VGA font (RU.INC) |
mov bp,RU_FNT1-10000h ; RU_FNT1 - First part |
mov bp, RU_FNT1 ; RU_FNT1 - First part |
mov bx,1000h ; 768 bytes |
mov cx,30h ; 48 symbols |
mov dx,80h ; 128 - position of first symbol |
333,7 → 139,7 |
mov ax,1100h |
int 10h |
mov bp,RU_FNT2-10000h ; RU_FNT2 -Second part |
mov bp,RU_FNT2 ; RU_FNT2 -Second part |
mov bx,1000h ; 512 bytes |
mov cx,20h ; 32 symbols |
mov dx,0E0h ; 224 - position of first symbol |
341,7 → 147,7 |
int 10h |
; End set VGA russian font |
else if lang eq et |
mov bp,ET_FNT-10000h ; ET_FNT1 |
mov bp,ET_FNT ; ET_FNT1 |
mov bx,1000h ; |
mov cx,255 ; 256 symbols |
mov dx,0h ; 0 - position of first symbol |
353,16 → 159,10 |
push 0xb800 |
pop es |
xor di, di |
; mov si,d80x25-0x10000 |
; mov cx,80*25 |
; mov ah,1*16+15 |
; dfl1: |
; lodsb |
; stosw |
; loop dfl1 |
mov ah, 1*16+15 |
; draw top |
mov si, d80x25_top - 0x10000 |
mov si, d80x25_top |
mov cx, d80x25_top_num * 80 |
@@: |
lodsb |
369,7 → 169,7 |
stosw |
loop @b |
; draw spaces |
mov si, space_msg - 0x10000 |
mov si, space_msg |
mov cx, 25 - d80x25_top_num - d80x25_bottom_num |
dfl1: |
push cx |
383,7 → 183,7 |
pop cx |
loop dfl1 |
; draw bottom |
mov si, d80x25_bottom - 0x10000 |
mov si, d80x25_bottom |
mov cx, d80x25_bottom_num * 80 |
@@: |
lodsb |
390,7 → 190,7 |
stosw |
loop @b |
mov byte [space_msg-0x10000+80], 0 ; now space_msg is null terminated |
mov byte [space_msg+80], 0 ; now space_msg is null terminated |
_setcursor d80x25_top_num,0 |
410,58 → 210,19 |
and dx,bx |
cmp ax,dx |
jnz cpugood |
mov si,not386-0x10000 |
mov si,not386 |
sayerr: |
call print |
jmp $ |
cpugood: |
push 0 |
popf |
sti |
; set up esp |
movzx esp, sp |
; FLUSH 8042 KEYBOARD CONTROLLER |
;// mike.dld [ |
; mov al,0xED |
; out 0x60,al |
; or cx,-1 |
; @@: |
; in al,0x64 |
; test al,2 |
; jz @f |
; loop @b |
; @@: |
; mov al,0 |
; out 0x60,al |
; or cx,-1 |
; @@: |
; in al,0x64 |
; test al,2 |
; jz @f |
; loop @b |
; @@: |
;// mike.dld ] |
; mov ecx,10000 |
; fl1: |
; in al,0x64 |
; loop fl1 |
; test al,1 |
; jz fl2 |
; in al,0x60 |
; jmp fl1 |
; fl2: |
;**************************************************************** |
; The function is modified Mario79 |
;***************************************************************** |
; wait_kbd: ; variant 1 |
; mov cx,2500h ;çàäåðæêà ïîðÿäêà 10 ìñåê |
; test_kbd: |
; in al,64h ;÷èòàåì ñîñòîÿíèå êëàâèàòóðû |
; test al,2 ;ïðîâåðêà áèòà ãîòîâíîñòè |
; loopnz test_kbd |
push 0 |
pop es |
and word [es:0x9031], 0 |
531,7 → 292,7 |
; Write APM ver ---- |
and ax, 0xf0f |
add ax, '00' |
mov si, msg_apm - 0x10000 |
mov si, msg_apm |
mov [si + 5], ah |
mov [si + 7], al |
_setcursor 0, 3 |
544,26 → 305,17 |
mov ax, 0x5303 ; Connect 32 bit mode interface |
xor bx, bx |
int 0x15 |
; init selectors |
movzx eax, ax ; real-mode segment base address of protected-mode 32-bit code segment |
shl eax, 4 |
mov [apm_code_32 - 0x10000 + 2], ax |
shr eax, 16 |
mov [apm_code_32 - 0x10000 + 4], al |
movzx ecx, cx ; real-mode segment base address of protected-mode 16-bit code segment |
shl ecx, 4 |
mov [apm_code_16 - 0x10000 + 2], cx |
shr ecx, 16 |
mov [apm_code_16 - 0x10000 + 4], cl |
movzx edx, dx ; real-mode segment base address of protected-mode 16-bit data segment |
shl edx, 4 |
mov [apm_data_16 - 0x10000 + 2], dx |
shr edx, 16 |
mov [apm_data_16 - 0x10000 + 4], dl |
mov [es : 0x9040], ebx ; offset of APM entry point |
push 0 |
pop es |
mov [es:0x9040], ebx |
mov [es:0x9050], ax |
mov [es:0x9052], cx |
mov [es:0x9054], dx |
apm_end: |
_setcursor d80x25_top_num, 0 |
; ----------------------------------------- |
; DISPLAY VESA INFORMATION |
573,7 → 325,7 |
mov di,0xa000 |
int 0x10 |
cmp ax,0x004f |
mov si, novesa-0x10000 |
mov si, novesa |
jnz @f |
mov bx, word [es:di+0x12] |
shl ebx,16 |
580,7 → 332,7 |
mov [es:0x9050], ebx |
mov ax,[es:di+4] |
add ax,'0'*256+'0' |
mov si,vervesa-0x10000 |
mov si,vervesa |
mov [si+vervesa_off], ah |
mov [si+vervesa_off+2], al |
@@: call print |
593,13 → 345,13 |
; b) preboot_dma_write = use DMA write? |
; c) preboot_vrrm = use VRR? |
; d) preboot_device = from what boot? |
mov di, preboot_graph-0x10000 |
mov di, preboot_graph |
; check bootloader block |
cmp [.loader_block-0x10000], -1 |
cmp [.loader_block], -1 |
jz .noloaderblock |
les bx, [.loader_block-0x10000] |
les bx, [.loader_block] |
cmp byte [es:bx], 1 |
mov si, loader_block_error-0x10000 |
mov si, loader_block_error |
jnz sayerr |
test byte [es:bx+1], 1 |
jz @f |
610,11 → 362,11 |
@@: |
.noloaderblock: |
; determine default settings |
mov [.bSettingsChanged-0x10000], 0 |
mov [.bSettingsChanged], 0 |
cmp byte [di], 0 |
jnz .preboot_gr_end |
mov [di+preboot_gprobe-preboot_graph], 0 |
mov al, [vervesa+vervesa_off-0x10000] |
mov al, [vervesa+vervesa_off] |
cmp al, 'x' |
jz .novesa |
cmp al, '1' |
637,42 → 389,42 |
cmp [di+preboot_device-preboot_graph], 1 |
adc [di+preboot_device-preboot_graph], 0 |
; notify user |
mov si, linef-0x10000 |
mov si, linef |
call print |
mov si, start_msg-0x10000 |
mov si, start_msg |
call print |
mov si, time_msg-0x10000 |
mov si, time_msg |
call print |
; get start time |
call .gettime |
mov [.starttime-0x10000], eax |
mov word [.timer-0x10000], .newtimer |
mov word [.timer-0x10000+2], cs |
mov [.starttime], eax |
mov word [.timer], .newtimer |
mov word [.timer+2], cs |
.printcfg: |
_setcursor 9,0 |
mov si, current_cfg_msg-0x10000 |
mov si, current_cfg_msg |
call print |
mov si, curvideo_msg-0x10000 |
mov si, curvideo_msg |
call print |
mov al, [preboot_graph-0x10000] |
mov al, [preboot_graph] |
cmp al, 8 |
ja .pnovesa |
mov dl, al |
and eax, 3 |
mov si, [modes_msg-0x10000+eax*2] |
mov si, [modes_msg+eax*2] |
call printplain |
mov si, modevesa20-0x10000 |
mov si, modevesa20 |
cmp dl, 4 |
jbe @f |
mov si, modevesa12-0x10000 |
mov si, modevesa12 |
@@: |
call printplain |
cmp dl, 4 |
ja .x |
mov si, probeno_msg-0x10000 |
cmp [preboot_gprobe-0x10000], 2 |
mov si, probeno_msg |
cmp [preboot_gprobe], 2 |
jnz @f |
mov si, probeok_msg-0x10000 |
mov si, probeok_msg |
@@: |
call printplain |
.x: |
679,24 → 431,24 |
jmp .c |
.pnovesa: |
cmp al, 9 |
mov si, mode9-0x10000 |
mov si, mode9 |
jz @b |
mov si, mode10-0x10000 |
mov si, mode10 |
jmp @b |
.c: |
mov si, linef-0x10000 |
mov si, linef |
call printplain |
mov si, dma_msg-0x10000 |
cmp [preboot_dma_write-0x10000], 1 |
mov si, dma_msg |
cmp [preboot_dma_write], 1 |
call .say_on_off |
mov si, vrrm_msg-0x10000 |
cmp [preboot_vrrm-0x10000], 1 |
mov si, vrrm_msg |
cmp [preboot_vrrm], 1 |
call .say_on_off |
mov si, preboot_device_msg-0x10000 |
mov si, preboot_device_msg |
call print |
mov al, [preboot_device-0x10000] |
mov al, [preboot_device] |
and eax, 3 |
mov si, [preboot_device_msgs-0x10000+eax*2] |
mov si, [preboot_device_msgs+eax*2] |
call printplain |
.wait: |
_setcursor 25,0 ; out of screen |
705,8 → 457,8 |
push 0 |
pop es |
mov eax, [es:8*4] |
mov [.oldtimer-0x10000], eax |
mov eax, [.timer-0x10000] |
mov [.oldtimer], eax |
mov eax, [.timer] |
mov [es:8*4], eax |
sti |
; wait for keypressed |
716,11 → 468,11 |
; restore timer interrupt |
push 0 |
pop es |
mov eax, [.oldtimer-0x10000] |
mov eax, [.oldtimer] |
mov [es:8*4], eax |
mov [.timer-0x10000], eax |
mov [.timer], eax |
_setcursor 7,0 |
mov si, space_msg-0x10000 |
mov si, space_msg |
call printplain |
pop ax |
; switch on key |
736,15 → 488,15 |
cmp al, 'd' |
jnz .wait |
_setcursor 15,0 |
mov si,bdev-0x10000 |
mov si,bdev |
call print |
mov bx,'13' |
call getkey |
mov [preboot_device-0x10000], al |
mov [preboot_device], al |
_setcursor 13,0 |
.d: |
mov [.bSettingsChanged-0x10000], 1 |
mov si, space_msg-0x10000 |
mov [.bSettingsChanged], 1 |
mov si, space_msg |
call printplain |
_setcursor 15,0 |
mov cx, 6 |
754,46 → 506,46 |
jmp .printcfg |
.change_a: |
_setcursor 15,0 |
mov si, gr_mode-0x10000 |
mov si, gr_mode |
call printplain |
mov bx, '09' |
call getkey |
mov [preboot_graph-0x10000], al |
mov [preboot_graph], al |
cmp al, 4 |
ja @f |
mov si, probetext-0x10000 |
mov si, probetext |
call printplain |
mov bx, '12' |
call getkey |
mov [preboot_gprobe-0x10000], al |
mov [preboot_gprobe], al |
@@: |
_setcursor 10,0 |
jmp .d |
.change_b: |
_setcursor 15,0 |
mov si, ask_dma-0x10000 |
mov si, ask_dma |
call print |
mov bx, '12' |
call getkey |
mov [preboot_dma_write-0x10000], al |
mov [preboot_dma_write], al |
_setcursor 11,0 |
jmp .d |
.change_c: |
_setcursor 15,0 |
mov si, vrrmprint-0x10000 |
mov si, vrrmprint |
call print |
mov bx, '12' |
call getkey |
mov [preboot_vrrm-0x10000], al |
mov [preboot_vrrm], al |
_setcursor 12,0 |
jmp .d |
.say_on_off: |
pushf |
call print |
mov si, on_msg-0x10000 |
mov si, on_msg |
popf |
jz @f |
mov si, off_msg-0x10000 |
mov si, off_msg |
@@: call printplain |
ret |
; novesa and vervesa strings are not used at the moment of executing this code |
803,9 → 555,7 |
.bSettingsChanged db ? |
.timer dd ? |
end virtual |
org $+0x10000 |
.loader_block dd -1 |
org $-0x10000 |
.gettime: |
mov ah, 0 |
int 1Ah |
818,10 → 568,10 |
push cs |
pop ds |
pushf |
call [.oldtimer-0x10000] |
call [.oldtimer] |
pushad |
call .gettime |
sub eax, [.starttime-0x10000] |
sub eax, [.starttime] |
sub ax, 18*5 |
jae .timergo |
neg ax |
838,12 → 588,12 |
mov cl, 'ã' |
jz @f |
mov cl, 'ë' |
@@: mov [time_str+9-0x10000], cl |
@@: mov [time_str+9], cl |
else if lang eq et |
cmp al, 1 |
ja @f |
mov [time_str+9-0x10000], ' ' |
mov [time_str+10-0x10000],' ' |
mov [time_str+9], ' ' |
mov [time_str+10],' ' |
@@: |
else |
; wait 5/4/3/2 seconds, 1 second |
851,11 → 601,11 |
mov cl, 's' |
ja @f |
mov cl, ' ' |
@@: mov [time_str+9-0x10000], cl |
@@: mov [time_str+9], cl |
end if |
add al, '0' |
mov [time_str+1-0x10000], al |
mov si, time_msg-0x10000 |
mov [time_str+1], al |
mov si, time_msg |
_setcursor 7,0 |
call print |
_setcursor 25,0 |
865,24 → 615,24 |
.timergo: |
push 0 |
pop es |
mov eax, [.oldtimer-0x10000] |
mov eax, [.oldtimer] |
mov [es:8*4], eax |
mov sp, 0EC00h |
.continue: |
sti |
_setcursor 6,0 |
mov si, space_msg-0x10000 |
mov si, space_msg |
call printplain |
call printplain |
_setcursor 6,0 |
mov si, loading_msg-0x10000 |
mov si, loading_msg |
call print |
_setcursor 15,0 |
cmp [.bSettingsChanged-0x10000], 0 |
cmp [.bSettingsChanged], 0 |
jz .load |
cmp [.loader_block-0x10000], -1 |
cmp [.loader_block], -1 |
jz .load |
les bx, [.loader_block-0x10000] |
les bx, [.loader_block] |
mov eax, [es:bx+3] |
push ds |
pop es |
889,7 → 639,7 |
test eax, eax |
jz .load |
push eax |
mov si, save_quest-0x10000 |
mov si, save_quest |
call print |
.waityn: |
mov ah, 0 |
900,7 → 650,7 |
cmp al, 'y' |
jnz .waityn |
call putchar |
mov byte [space_msg-0x10000+80], 186 |
mov byte [space_msg+80], 186 |
pop eax |
push cs |
push .cont |
911,7 → 661,7 |
.cont: |
push cs |
pop ds |
mov si, space_msg-0x10000 |
mov si, space_msg |
mov byte [si+80], 0 |
_setcursor 15,0 |
call printplain |
921,12 → 671,12 |
; ASK GRAPHICS MODE |
movzx ax, [preboot_graph-0x10000] |
movzx ax, [preboot_graph] |
push 0 |
pop es |
; address is gr_table+6*(ax-1)-0x10000 |
; address is gr_table+6*(ax-1) |
add ax, ax |
lea si, [gr_table-0x10000 + eax + eax*2 - 6] |
lea si, [gr_table + eax + eax*2 - 6] |
mov bx,[si+0] |
mov cx,[si+2] |
mov dx,[si+4] |
945,7 → 695,7 |
; USE DEFAULTS OR PROBE |
; bx - mode : cx - x size : dx - y size |
cmp [preboot_gprobe-0x10000], 1 |
cmp [preboot_gprobe], 1 |
jz noprobe |
mov bx,0x100 |
952,7 → 702,7 |
newprobe: |
inc bx |
cmp bx,0x17f |
mov si,prnotfnd-0x10000 |
mov si,prnotfnd |
jz sayerr |
probemore: |
999,12 → 749,12 |
mov [es:0x9000],al |
nov: |
cmp al,24 |
mov si,bt24-0x10000 |
mov si,bt24 |
jz bppl |
cmp al,32 |
mov si,bt32-0x10000 |
mov si,bt32 |
jz bppl |
mov si,btns-0x10000 |
mov si,btns |
jmp sayerr |
bppl: |
call print |
1033,26 → 783,26 |
; DMA WRITE |
mov al, [preboot_dma_write-0x10000] |
mov al, [preboot_dma_write] |
mov [es:0x901F],al |
; VRR_M USE |
mov al,[preboot_vrrm-0x10000] |
mov al,[preboot_vrrm] |
mov [es:0x9030],al |
mov [es:0x901E],byte 1 |
; BOOT DEVICE |
mov al, [preboot_device-0x10000] |
mov al, [preboot_device] |
dec al |
mov [boot_dev-0x10000],al |
mov [boot_dev],al |
; READ DISKETTE TO MEMORY |
; cmp [boot_dev-0x10000],0 |
; cmp [boot_dev],0 |
jne no_sys_on_floppy |
mov si,diskload-0x10000 |
mov si,diskload |
call print |
xor ax, ax ; reset drive |
xor dx, dx |
1065,7 → 815,7 |
mov bx, 0xB000 ; es:bx -> data area |
call boot_read_floppy |
; and copy them to extended memory |
mov si, movedesc-0x10000 |
mov si, movedesc |
mov [si+8*2+3], bh |
push es |
push ds |
1079,7 → 829,7 |
mov dx, 0x3f2 |
mov al, 0 |
out dx, al |
mov si, memmovefailed-0x10000 |
mov si, memmovefailed |
jmp sayerr_plain |
@@: |
add dword [si+8*3+2], 512*10 |
1168,7 → 918,7 |
aam |
xchg al, ah |
add ax, '00' |
mov si, pros-0x10000 |
mov si, pros |
cmp [si], ax |
jz @f |
mov [si], ax |
1246,9 → 996,10 |
; jnz reads |
; readdone: |
; pop ax |
mov si,backspace2-0x10000 |
mov si,backspace2 |
call printplain |
mov si,okt-0x10000 |
mov si,okt |
call printplain |
no_sys_on_floppy: |
xor ax, ax ; reset drive |
1274,7 → 1025,7 |
setgr: |
int 0x10 |
test ah,ah |
mov si, fatalsel-0x10000 |
mov si, fatalsel |
jnz sayerr |
; set mode 0x12 graphics registers: |
cmp bx,0x12 |
1302,4 → 1053,3 |
gmok2: |
push ds |
pop es |
/kernel/trunk/boot/booteng.inc |
---|
73,7 → 73,7 |
mode2 db "800x600",0 |
mode3 db "1024x768",0 |
mode4 db "1280x1024",0 |
modes_msg dw mode4-0x10000,mode1-0x10000,mode2-0x10000,mode3-0x10000 |
modes_msg dw mode4,mode1,mode2,mode3 |
modevesa20 db " with LFB",0 |
modevesa12 db ", VESA 1.2 Bnk",0 |
mode9 db "320x200, EGA/CGA 256 colors",0 |
85,7 → 85,7 |
off_msg db " off",13,10,0 |
vrrm_msg db " [c] Use VRR:",0 |
preboot_device_msg db " [d] Floppy image: ",0 |
preboot_device_msgs dw 0,pdm1-0x10000,pdm2-0x10000,pdm3-0x10000 |
preboot_device_msgs dw 0,pdm1,pdm2,pdm3 |
pdm1 db "real floppy",13,10,0 |
pdm2 db "C:\kolibri.img (FAT32)",13,10,0 |
pdm3 db "use already loaded image",13,10,0 |
/kernel/trunk/boot/bootet.inc |
---|
73,7 → 73,7 |
mode2 db "800x600",0 |
mode3 db "1024x768",0 |
mode4 db "1280x1024",0 |
modes_msg dw mode4-0x10000,mode1-0x10000,mode2-0x10000,mode3-0x10000 |
modes_msg dw mode4,mode1,mode2,mode3 |
modevesa20 db " koos LFB",0 |
modevesa12 db ", VESA 1.2 Bnk",0 |
mode9 db "320x200, EGA/CGA 256 värvi",0 |
85,7 → 85,7 |
off_msg db " väljas",13,10,0 |
vrrm_msg db " [c] Kasuta VRR:",0 |
preboot_device_msg db " [d] Disketi kujutis: ",0 |
preboot_device_msgs dw 0,pdm1-0x10000,pdm2-0x10000,pdm3-0x10000 |
preboot_device_msgs dw 0,pdm1,pdm2,pdm3 |
pdm1 db "reaalne diskett",13,10,0 |
pdm2 db "C:\kolibri.img (FAT32)",13,10,0 |
pdm3 db "kasuta juba laaditud kujutist",13,10,0 |
/kernel/trunk/boot/bootge.inc |
---|
78,7 → 78,7 |
mode2 db "800x600",0 |
mode3 db "1024x768",0 |
mode4 db "1280x1024",0 |
modes_msg dw mode4-0x10000,mode1-0x10000,mode2-0x10000,mode3-0x10000 |
modes_msg dw mode4,mode1,mode2,mode3 |
modevesa20 db " mit LFB",0 |
modevesa12 db ", VESA 1.2 Bnk",0 |
mode9 db "320x200, EGA/CGA 256 colors",0 |
90,7 → 90,7 |
off_msg db " aus",13,10,0 |
vrrm_msg db " [c] Nutze VRR:",0 |
preboot_device_msg db " [d] Diskettenimage: ",0 |
preboot_device_msgs dw 0,pdm1-0x10000,pdm2-0x10000,pdm3-0x10000 |
preboot_device_msgs dw 0,pdm1,pdm2,pdm3 |
pdm1 db "Echte Diskette",13,10,0 |
pdm2 db "C:\kolibri.img (FAT32)",13,10,0 |
pdm3 db "Nutze bereits geladenes Image",13,10,0 |
/kernel/trunk/boot/bootru.inc |
---|
17,7 → 17,6 |
vervesa db "¥àá¨ï VESA: Vesa x.x",13,10,0 |
vervesa_off=19 |
msg_apm db " APM x.x ", 0 |
gr_mode db 186," Vesa 2.0+ 16 M LFB: [1] 640x480, [2] 800x600, " |
db "[3] 1024x768, [4] 1280x1024",13,10 |
db 186," Vesa 1.2 16 M Bnk: [5] 640x480, [6] 800x600, " |
74,7 → 73,7 |
mode2 db "800x600",0 |
mode3 db "1024x768",0 |
mode4 db "1280x1024",0 |
modes_msg dw mode4-0x10000,mode1-0x10000,mode2-0x10000,mode3-0x10000 |
modes_msg dw mode4,mode1,mode2,mode3 |
modevesa20 db " á LFB",0 |
modevesa12 db ", VESA 1.2 Bnk",0 |
mode9 db "320x200, EGA/CGA 256 梥⮢",0 |
86,7 → 85,7 |
off_msg db " ¢ëª«",13,10,0 |
vrrm_msg db " [c] ᯮ«ì§®¢ ¨¥ VRR:",0 |
preboot_device_msg db " [d] ¡à § ¤¨áª¥âë: ",0 |
preboot_device_msgs dw 0,pdm1-0x10000,pdm2-0x10000,pdm3-0x10000 |
preboot_device_msgs dw 0,pdm1,pdm2,pdm3 |
pdm1 db " áâ®ïé ï ¤¨áª¥â ",13,10,0 |
pdm2 db "C:\kolibri.img (FAT32)",13,10,0 |
pdm3 db "¨á¯®«ì§®¢ âì 㦥 § £àã¦¥ë© ®¡à §",13,10,0 |
/kernel/trunk/boot/preboot.inc |
---|
24,7 → 24,7 |
;!!!! 0 - autodetect !!!! |
preboot_blogesc db 1 ; start immediately after bootlog |
if $>10200h |
if $>0x200 |
ERROR: prebooting parameters must fit in first sector!!! |
end if |
hdsysimage db 'KOLIBRI IMG' ; load from |
/kernel/trunk/boot/rdload.inc |
---|
8,7 → 8,7 |
; READ RAMDISK IMAGE FROM HD |
cmp [boot_dev],1 |
cmp [boot_dev+OS_BASE+0x10000],1 |
jne no_sys_on_hd |
test [DRIVE_DATA+1],byte 0x40 |
88,7 → 88,7 |
ret |
read_image: |
mov eax, hdsysimage |
mov eax, hdsysimage+OS_BASE+0x10000 |
mov ebx, 1474560/512 |
mov ecx, RAMDISK |
mov esi, 0 |
/kernel/trunk/boot/shutdown.inc |
---|
12,205 → 12,18 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
system_shutdown: ; shut down the system |
call stop_all_services |
push 3 ; stop playing cd |
pop eax |
call sys_cd_audio |
cld |
mov al,[0x2f0000+0x9030] |
cmp al,1 |
jl no_shutdown_parameter |
cmp al,4 |
jle yes_shutdown_param |
no_shutdown_parameter: |
; movzx ecx,word [0x2f0000+0x900A] |
; movzx esi,word [0x2f0000+0x900C] |
; imul ecx,esi ;[0xfe04] |
;; mov ecx,0x500000/4 ;3fff00/4 ; darken screen |
; push ecx |
; mov esi,[0xfe80] |
; cmp esi,32*0x100000 |
; jbe no_darken_screen |
; mov edi,16*0x100000 |
; push esi edi |
; sdnewpix: |
; lodsd |
; shr eax,1 |
; and eax,0x7f7f7f7f |
; stosd |
; loop sdnewpix |
; pop ecx |
; pop esi edi |
; rep movsd |
; no_darken_screen: |
; read shutdown code: |
; 1) display shutdown "window" |
mov eax,[0xfe00] |
shr eax,1 |
lea esi,[eax+220] ; x end |
sub eax,220 ; x start |
mov ebx,[ScreenHeight] |
shr ebx,1 |
mov [shutdownpos],ebx |
lea ebp,[ebx+105] ; y end |
sub ebx,120 ; y start |
xor edi,edi |
inc edi ; force putpixel & dtext |
mov ecx,0x0000ff |
; vertical loop begin |
sdnewpix1: |
push eax ; save x start |
; horizontal loop begin |
sdnewpix2: |
call [putpixel] |
inc eax |
cmp eax,esi |
jnz sdnewpix2 |
; horizontal loop end |
dec ecx ; color |
pop eax ; restore x start |
inc ebx ; advance y pos |
cmp ebx,ebp |
jnz sdnewpix1 |
; vertical loop end |
; 2) display text strings |
; a) version |
mov eax,[0xfe00] |
shr eax,1 |
shl eax,16 |
mov ax,word [shutdownpos] |
push eax |
sub eax,(220-27)*10000h + 105 |
mov ebx,0xffff00 |
mov ecx,version |
push 34 |
pop edx |
call dtext |
; b) variants |
add eax,105+33 |
push 6 |
pop esi |
; mov ebx,0xffffff |
mov bl,0xFF |
mov ecx,shutdowntext |
mov dl,40 |
newsdt: |
call dtext |
add eax,10 |
add ecx,edx |
dec esi |
jnz newsdt |
; 3) load & display rose.txt |
mov eax,rosef-std_application_base_address ; load rose.txt |
xor ebx,ebx |
push 2 |
pop ecx |
mov edx,0x90000 |
push edx |
push 12 |
pop esi |
push edi ; may be destroyed |
pushad |
push eax |
call file_system_lfn ; by SPraid fileread |
pop eax |
popad |
pop edi |
pop ecx |
inc ecx ; do not display stars from rose.txt |
pop eax |
add eax,20*10000h - 110 |
mov ebx,0x00ff00 |
push 27 |
pop edx |
nrl: |
call dtext |
; sub ebx,0x050000 |
ror ebx, 16 |
sub bl, 0x05 |
ror ebx, 16 |
add eax,8 |
add ecx,31 |
cmp cx,word 0x0001+25*31 |
jnz nrl |
call checkVga_N13 |
yes_shutdown_param: |
cli |
mov eax,kernel ; load kernel.mnt to 0x8000:0 |
push 12 |
pop esi |
xor ebx,ebx |
or ecx,-1 |
mov edx,0x80000 |
call fileread |
mov esi,restart_kernel_4000+0x10000 ; move kernel re-starter to 0x4000:0 |
mov edi,0x40000 |
mov ecx,1000 |
rep movsb |
mov eax,0x2F0000 ; restore 0x0 - 0xffff |
xor ebx,ebx |
mov ecx,0x10000 |
call memmove |
call restorefatchain |
mov al, 0xFF |
out 0x21, al |
out 0xA1, al |
mov word [0x467+0],pr_mode_exit-0x10000 |
mov word [0x467+2],0x1000 |
mov al,0x0F |
out 0x70,al |
mov al,0x05 |
out 0x71,al |
mov al,0xFE |
out 0x64,al |
hlt |
use16 |
align 4 |
pr_mode_exit: |
org $-0x10000 |
; setup stack |
mov ax, 3000h |
mov ax, 0x3000 |
mov ss, ax |
mov esp, 0EC00h |
mov esp, 0x0EC00 |
; setup ds |
push cs |
pop ds |
lidt [old_ints_h-0x10000] |
lidt [old_ints_h] |
;remap IRQs |
mov al,0x11 |
out 0x20,al |
307,90 → 120,64 |
rdelay: |
ret |
iglobal |
kernel db 'KERNEL MNT' |
; shutdown_parameter db 0 |
endg |
floppy_write: ; write diskette image to physical floppy |
restart_kernel: |
cmp [flm],byte 1 |
je fwwritedone |
mov [flm],byte 1 |
mov ax,0x0003 ; set text mode for screen |
int 0x10 |
xor ax, ax ; reset drive |
xor dx, dx |
int 0x13 |
jmp 0x4000:0000 |
mov cx,0x0001 ; startcyl,startsector |
xor dx, dx ; starthead,drive |
mov ax, 80*2 ; read no of sect |
fwwrites: |
push ax |
restart_kernel_4000: |
cli |
; move 1mb+ -> 0:a000 |
; mov di,0x1000 ; load kernel image from 0x8000:0 -> 0x1000:0 |
; |
; new_kernel_block_move: |
; |
; mov ebx,0 |
; |
; new_kernel_byte_move: |
; |
; mov ax,di |
; add ax,0x7000 |
; mov es,ax |
; mov dl,[es:bx] |
; mov es,di |
; mov [es:bx],dl |
; |
; inc ebx |
; cmp ebx,65536 |
; jbe new_kernel_byte_move |
; |
; add di,0x1000 |
; cmp di,0x2000 |
; jbe new_kernel_block_move |
pusha |
mov si, fwmovedesc |
mov cx,256*18 |
mov ah,0x87 |
push ds |
pop es |
mov cx, 0x8000 |
push cx |
mov ds, cx |
int 0x15 |
add dword [fwmovedesc+0x12], 512*18 |
popa |
xor si, si |
xor di, di |
rep movsw |
push 0x9000 |
pop ds |
push 0x2000 |
pop es |
pop cx |
rep movsw |
mov es,si |
fwnewwrite: |
mov bx,0xa000 ; es:bx -> data area |
mov ax,0x0300+18 ; read, no of sectors to read |
int 0x13 |
wbinvd ; write and invalidate cache |
test ah, ah |
jz fwgoodwrite |
; mov ax,0x1000 |
; mov es,ax |
; mov ax,0x3000 |
; mov ss,ax |
; mov sp,0xec00 |
; restore timer |
mov al, 00110100b |
out 43h, al |
jcxz $+2 |
mov al, 0xFF |
out 40h, al |
jcxz $+2 |
out 40h, al |
jcxz $+2 |
sti |
inc si |
cmp si,10 |
jnz fwnewwrite |
; (hint by Black_mirror) |
; We must read data from keyboard port, |
; because there may be situation when previous keyboard interrupt is lost |
; (due to return to real mode and IRQ reprogramming) |
; and next interrupt will not be generated (as keyboard waits for handling) |
in al, 0x60 |
; can't access diskette - return |
pop ax |
ret |
; bootloader interface |
push 0x1000 |
pop ds |
mov si, kernel_restart_bootblock-0x10000 |
mov ax, 'KL' |
jmp 0x1000:0000 |
fwgoodwrite: |
inc dh |
cmp dh,2 |
jnz fwbb2 |
mov dh,0 |
inc ch |
fwbb2: |
pop ax |
dec ax |
jnz fwwrites |
ret |
APM_PowerOff: |
mov ax, 5304h |
433,113 → 220,55 |
;!!!!!!!!!!!!!!!!!!!!!!!! |
fwwritedone: |
ret |
org $+0x10000 |
flm db 0 |
org $-0x10000 |
floppy_write: ; write diskette image to physical floppy |
restart_kernel: |
cmp [flm-0x10000],byte 1 |
je fwwritedone |
mov [flm-0x10000],byte 1 |
mov ax,0x0003 ; set text mode for screen |
int 0x10 |
jmp 0x4000:0000 |
xor ax, ax ; reset drive |
xor dx, dx |
int 0x13 |
restart_kernel_4000: |
cli |
mov cx,0x0001 ; startcyl,startsector |
; mov dx,0x0000 ; starthead,drive |
xor dx, dx |
mov ax, 80*2 ; read no of sect |
fwwrites: |
push ax |
; move 1mb+ -> 0:a000 |
pusha |
mov si,fwmovedesc -0x10000 |
mov cx,256*18 |
mov ah,0x87 |
push ds |
pop es |
int 0x15 |
add dword [fwmovedesc-0x10000+0x12], 512*18 |
popa |
mov cx, 0x8000 |
push cx |
mov ds, cx |
xor si,si |
mov es,si |
fwnewwrite: |
mov bx,0xa000 ; es:bx -> data area |
mov ax,0x0300+18 ; read, no of sectors to read |
int 0x13 |
xor di, di |
rep movsw |
push 0x9000 |
pop ds |
push 0x2000 |
pop es |
pop cx |
rep movsw |
test ah, ah |
jz fwgoodwrite |
wbinvd ; write and invalidate cache |
inc si |
cmp si,10 |
jnz fwnewwrite |
mov al, 00110100b |
out 43h, al |
jcxz $+2 |
mov al, 0xFF |
out 40h, al |
jcxz $+2 |
out 40h, al |
jcxz $+2 |
sti |
; can't access diskette - return |
pop ax |
ret |
; (hint by Black_mirror) |
; We must read data from keyboard port, |
; because there may be situation when previous keyboard interrupt is lost |
; (due to return to real mode and IRQ reprogramming) |
; and next interrupt will not be generated (as keyboard waits for handling) |
in al, 0x60 |
fwgoodwrite: |
inc dh |
cmp dh,2 |
jnz fwbb2 |
mov dh,0 |
inc ch |
fwbb2: |
pop ax |
dec ax |
jnz fwwrites |
ret |
org $+0x10000 |
fwmovedesc: |
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
db 0xff,0xff,0x0,0x00,0x10,0x93,0x0,0x0 |
db 0xff,0xff,0x0,0xa0,0x00,0x93,0x0,0x0 |
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
org $-0x10000 |
use32 |
org $+0x10000 |
uglobal |
shutdownpos dd 0x0 |
endg |
; bootloader interface |
push 0x1000 |
pop ds |
mov si, kernel_restart_bootblock |
mov ax, 'KL' |
jmp 0x1000:0000 |
iglobal |
if lang eq en |
shutdowntext: |
db "IT'S SAFE TO POWER OFF COMPUTER OR " |
db ' ' |
db '1) SAVE RAMDISK TO FLOPPY ' |
db '2) APM - POWEROFF ' |
db '3) REBOOT ' |
db '4) RESTART KERNEL ' |
else if lang eq ru |
shutdowntext: |
db "¥§®¯ ᮥ ¢ëª«î票¥ ª®¬¯ìîâ¥à ¨«¨ " |
db ' ' |
db '1) ®åà ¨âì à ¬¤¨áª ¤¨áª¥âã ' |
db '2) APM - ¢ëª«î票¥ ¯¨â ¨ï ' |
db '3) ¥à¥§ £à㧪 á¨á⥬ë ' |
db '4) ¥áâ àâ ï¤à ¨§ ' |
else |
shutdowntext: |
db "SIE KOENNEN DEN COMPUTER NUN AUSSCHALTEN" |
db ' ' |
db '1) RAMDISK AUF DISK SPEICHERN ' |
db '2) APM - AUSSCHALTEN ' |
db '3) NEUSTARTEN ' |
db '4) KERNEL NEU STARTEN ' |
end if |
rosef: |
dd 0,0,0,1024,0x90000-std_application_base_address |
db '/rd/1/ROSE.TXT',0 |
endg |
/kernel/trunk/bus/pci/pci32.inc |
---|
39,7 → 39,7 |
or al,al |
jnz pci_fn_1 |
; PCI function 0: get pci version (AH.AL) |
movzx eax,word [0x2F0000+0x9022] |
movzx eax,word [BOOT_VAR+0x9022] |
ret |
pci_fn_1: |
47,7 → 47,7 |
jnz pci_fn_2 |
; PCI function 1: get last bus in AL |
mov al,[0x2F0000+0x9021] |
mov al,[BOOT_VAR+0x9021] |
ret |
pci_fn_2: |
54,7 → 54,7 |
cmp al,2 |
jne pci_fn_3 |
; PCI function 2: get pci access mechanism |
mov al,[0x2F0000+0x9020] |
mov al,[BOOT_VAR+0x9020] |
ret |
pci_fn_3: |
113,7 → 113,7 |
align 4 |
pci_read_reg: |
cmp byte [0x2F0000+0x9020],2 ;what mechanism will we use? |
cmp byte [BOOT_VAR+0x9020],2 ;what mechanism will we use? |
je pci_read_reg_2 |
; mechanism 1 |
243,7 → 243,7 |
align 4 |
pci_write_reg: |
cmp byte [0x2F0000+0x9020],2 ;what mechanism will we use? |
cmp byte [BOOT_VAR+0x9020],2 ;what mechanism will we use? |
je pci_write_reg_2 |
; mechanism 1 |
/kernel/trunk/const.inc |
---|
140,13 → 140,53 |
SSE_INIT equ (SSE_IM+SSE_DM+SSE_ZM+SSE_OM+SSE_UM+SSE_PM) |
OS_BASE equ 0 |
window_data equ (OS_BASE+0x0000000) |
struc TSS |
{ |
._back rw 2 |
._esp0 rd 1 |
._ss0 rw 2 |
._esp1 rd 1 |
._ss1 rw 2 |
._esp2 rd 1 |
._ss2 rw 2 |
._cr3 rd 1 |
._eip rd 1 |
._eflags rd 1 |
._eax rd 1 |
._ecx rd 1 |
._edx rd 1 |
._ebx rd 1 |
._esp rd 1 |
._ebp rd 1 |
._esi rd 1 |
._edi rd 1 |
._es rw 2 |
._cs rw 2 |
._ss rw 2 |
._ds rw 2 |
._fs rw 2 |
._gs rw 2 |
._ldt rw 2 |
._trap rw 1 |
._io rw 1 |
rb 24 |
._io_map_0 rb 4096 |
._io_map_1 rb 4096 |
} |
virtual at 0 |
TSS TSS |
end virtual |
TSS_SIZE equ (128+8192) |
OS_BASE equ 0x80000000 |
window_data equ OS_BASE |
CURRENT_TASK equ (OS_BASE+0x0003000) |
TASK_COUNT equ (OS_BASE+0x0003004) |
CURRENT_RING0_ESP equ (OS_BASE+0x0003008) |
TASK_BASE equ (OS_BASE+0x0003010) |
TASK_DATA equ (OS_BASE+0x0003020) |
TASK_EVENT equ (OS_BASE+0x0003020) |
203,7 → 243,6 |
LFBAddress equ (OS_BASE+0x000FE80) |
MEM_AMOUNT equ (OS_BASE+0x000FE8C) |
;LFBSize equ (OS_BASE+0x02f9050) |
ScreenWidth equ (OS_BASE+0x000FE00) |
ScreenHeight equ (OS_BASE+0x000FE04) |
247,7 → 286,6 |
WinMapAddress equ (OS_BASE+0x0460000) |
display_data equ (OS_BASE+0x0460000) |
;unused ? |
HD_CACHE equ (OS_BASE+0x0600000) |
stack_data_start equ (OS_BASE+0x0700000) |
259,33 → 297,69 |
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 |
HEAP_BASE equ (OS_BASE+0x98B000) |
tmp_page_tab equ 0x0786000; |
LFB_BASE equ 0x7DC00000 |
HEAP_BASE equ (OS_BASE+tmp_page_tab) |
HEAP_MIN_SIZE equ 0x01000000 |
page_tabs equ 0x7FC00000 |
master_tab equ 0x7FDFF000 |
app_page_tabs equ 0x7FE00000 |
page_tabs equ 0xFDC00000 |
app_page_tabs equ 0xFDC00000 |
kernel_tabs equ (page_tabs+ (OS_BASE shr 10)) ;0xFDE00000 |
master_tab equ (page_tabs+ (page_tabs shr 10)) ;0xFDFF70000 |
sys_pgdir equ OS_BASE+0x00050000 |
sys_master_tab equ OS_BASE+0x00051000 |
sys_pgmap equ OS_BASE+0x00052000 |
LFB_BASE equ 0xFE000000 |
sys_pgdir equ (OS_BASE+0x00050000) |
sys_pgmap equ (OS_BASE+0x00052000) |
new_app_base equ 0x80000000 |
new_app_base equ 0; |
twdw equ (CURRENT_TASK-window_data) |
twdw equ 0x3000 ;(CURRENT_TASK-window_data) |
std_application_base_address equ new_app_base |
RING0_STACK_SIZE equ (0x2000-512) ;512 áàéò äëÿ êîíòåêñòà FPU |
;PAGES_USED equ 4 |
if 0 |
REG_SS equ (RING0_STACK_SIZE-4) |
REG_APP_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_EFL_2 equ (RING0_STACK_SIZE-24) |
REG_EAX equ (RING0_STACK_SIZE-28) |
REG_ECX equ (RING0_STACK_SIZE-32) |
REG_EDX equ (RING0_STACK_SIZE-36) |
REG_EBX equ (RING0_STACK_SIZE-40) |
REG_ESP equ (RING0_STACK_SIZE-44) ;RING0_STACK_SIZE-20 |
REG_EBP equ (RING0_STACK_SIZE-48) |
REG_ESI equ (RING0_STACK_SIZE-52) |
REG_EDI equ (RING0_STACK_SIZE-56) |
REG_RET equ (RING0_STACK_SIZE-60) ;irq0.return |
end if |
REG_SS equ (RING0_STACK_SIZE-4) |
REG_APP_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 |
PG_WRITE equ 0x002 |
331,6 → 405,21 |
EV_INTR equ 1 |
struc THR_DATA |
{ |
rb (8192-512) |
.pl0_stack: |
.fpu_state rb 512 |
.tls_page rb 4096 |
.pdbr rb 4096 |
} |
THR_DATA_SIZE equ 4096*4 |
virtual at (OS_BASE-THR_DATA_SIZE) |
thr_data THR_DATA |
end virtual |
struc SYS_VARS |
{ .bpp dd ? |
.scanline dd ? |
337,10 → 426,6 |
.vesa_mode dd ? |
.x_res dd ? |
.y_res dd ? |
.cpu_caps dd ? |
dd ? |
dd ? |
dd ? |
} |
struc APPOBJ ;common object header |
467,7 → 552,6 |
.pages_free dd ? |
.pages_faults dd ? |
.pagemap_size dd ? |
.kernel_max dd ? |
.kernel_pages dd ? |
.kernel_tables dd ? |
.sys_page_dir dd ? |
496,6 → 580,9 |
SRV_FD_OFFSET equ 0x18 |
SRV_SIZE equ 44 |
DRV_ENTRY equ 1 |
DRV_EXIT equ -1 |
struc COFF_HEADER |
{ .machine dw ? |
.nSections dw ? |
/kernel/trunk/core/debug.inc |
---|
27,9 → 27,8 |
debug_set_event_data: |
; in: ebx = pointer |
; destroys eax |
mov eax, [CURRENT_TASK] |
shl eax, 8 |
mov [eax+SLOT_BASE+APPDATA.dbg_event_mem], ebx |
mov eax, [current_slot] |
mov [eax+APPDATA.dbg_event_mem], ebx |
ret |
get_debuggee_slot: |
123,7 → 122,6 |
; destroys eax,ecx,edx,esi,edi |
cmp ecx, 28h |
jnz .ret |
add edx, std_application_base_address |
push ebx |
mov ebx, edx |
call check_region |
132,43 → 130,35 |
jnz .ret |
call get_debuggee_slot |
jc .ret |
imul eax, tss_step/32 |
add eax, tss_data |
mov eax, [eax*8+SLOT_BASE+APPDATA.pl0_stack] |
lea esi, [eax+RING0_STACK_SIZE] |
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 push ds es, pushad in this order |
mov esi, [eax+TSS._esp0] |
; top of ring0 stack: ring3 stack ptr (ss+esp), iret data (cs+eip+eflags), ds, es, pushad |
sub esi, 8+12+8+20h |
lodsd |
; saves ring-3 context by pushad in this order |
; top of ring0 stack: ring3 stack ptr (ss+esp), iret data (cs+eip+eflags), pushad |
sub esi, 8+12+20h |
lodsd ;edi |
mov [edi+24h], eax |
lodsd |
lodsd ;esi |
mov [edi+20h], eax |
lodsd |
lodsd ; ebp |
mov [edi+1Ch], eax |
lodsd |
lodsd |
lodsd ;esp |
lodsd ;ebx |
mov [edi+14h], eax |
lodsd |
lodsd ;edx |
mov [edi+10h], eax |
lodsd |
lodsd ;ecx |
mov [edi+0Ch], eax |
lodsd |
lodsd ;eax |
mov [edi+8], eax |
add esi, 8 |
lodsd |
lodsd ;eip |
mov [edi], eax |
lodsd |
lodsd |
lodsd ;cs |
lodsd ;eflags |
mov [edi+4], eax |
lodsd |
lodsd ;esp |
mov [edi+18h], eax |
.ret: |
sti |
182,7 → 172,6 |
; destroys eax,ecx,edx,esi,edi |
cmp ecx, 28h |
jnz .ret |
add edx, std_application_base_address |
push ebx |
mov ebx, edx |
call check_region |
191,40 → 180,32 |
jnz .ret |
call get_debuggee_slot |
jc .stiret |
imul eax, tss_step/32 |
add eax, tss_data |
mov eax, [eax*8+SLOT_BASE+APPDATA.pl0_stack] |
lea edi, [eax+RING0_STACK_SIZE] |
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] |
sub edi, 8+12+8+20h |
mov eax, [esi+24h] |
sub edi, 8+12+20h |
mov eax, [esi+24h] ;edi |
stosd |
mov eax, [esi+20h] |
mov eax, [esi+20h] ;esi |
stosd |
mov eax, [esi+1Ch] |
mov eax, [esi+1Ch] ;ebp |
stosd |
scasd |
mov eax, [esi+14h] |
mov eax, [esi+14h] ;ebx |
stosd |
mov eax, [esi+10h] |
mov eax, [esi+10h] ;edx |
stosd |
mov eax, [esi+0Ch] |
mov eax, [esi+0Ch] ;ecx |
stosd |
mov eax, [esi+8] |
mov eax, [esi+8] ;eax |
stosd |
add edi, 8 |
mov eax, [esi] |
mov eax, [esi] ;eip |
stosd |
scasd |
mov eax, [esi+4] |
mov eax, [esi+4] ;eflags |
stosd |
mov eax, [esi+18h] |
mov eax, [esi+18h] ;esp |
stosd |
.stiret: |
sti |
238,8 → 219,8 |
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 |
jc .errret |
cmp edx, OS_BASE |
jae .errret |
cmp cl, 3 |
ja .errret |
mov ebx, dr7 |
256,8 → 237,9 |
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 |
and [ebp*8 + SLOT_BASE+APPDATA.dbg_state], not 1 |
.okret: |
and dword [esp+36], 0 |
sti |
298,8 → 280,9 |
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 |
or [ebp*8 + SLOT_BASE+APPDATA.dbg_state], 1 |
jmp .okret |
debug_read_process_memory: |
310,7 → 293,6 |
; edx=address in debuggee |
; out: [esp+36]=sizeof(read) |
; destroys all |
add esi, std_application_base_address |
push ebx |
mov ebx, esi |
call check_region |
337,7 → 319,6 |
; edx=address in debuggee |
; out: [esp+36]=sizeof(write) |
; destroys all |
add esi, std_application_base_address |
push ebx |
mov ebx, esi |
call check_region |
430,45 → 411,22 |
; int 1 = #DB |
save_ring3_context |
cld |
mov ax, os_data |
mov ax, app_data ;os_data |
mov ds, ax |
mov es, ax |
mov eax, dr6 |
test ax, ax |
jns @f |
; this is exception from task switch |
; set DRx registers for task and continue |
mov eax, [CURRENT_TASK] |
shl eax, 8 |
add eax, SLOT_BASE+APPDATA.dbg_regs |
mov ecx, [eax+0] |
mov dr0, ecx |
mov ecx, [eax+4] |
mov dr1, ecx |
mov ecx, [eax+8] |
mov dr2, ecx |
mov ecx, [eax+0Ch] |
mov dr3, ecx |
xor ecx, ecx |
mov dr6, ecx |
mov ecx, [eax+10h] |
mov dr7, ecx |
restore_ring3_context |
iretd |
@@: |
push eax |
xor eax, eax |
mov dr6, eax |
; test if debugging |
cli |
mov eax, [CURRENT_TASK] |
shl eax, 8 |
mov eax, [SLOT_BASE+eax+APPDATA.debugger_slot] |
mov eax, [current_slot] |
mov eax, [eax+APPDATA.debugger_slot] |
test eax, eax |
jnz .debug |
sti |
; not debuggee => say error and terminate |
add esp, 28h+4 |
add esp, 0x20+4 |
mov [error_interrupt], 1 |
call show_error_parameters |
mov edx, [TASK_BASE] |
/kernel/trunk/core/dll.inc |
---|
6,10 → 6,8 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
DRV_ENTRY equ 1 |
DRV_EXIT equ -1 |
DRV_COMPAT equ 4 ;minimal required drivers version |
DRV_CURRENT equ 4 ;current drivers model version |
DRV_COMPAT equ 5 ;minimal required drivers version |
DRV_CURRENT equ 5 ;current drivers model version |
DRV_VERSION equ (DRV_COMPAT shl 16) or DRV_CURRENT |
134,7 → 132,7 |
align 16 |
.main: |
save_ring3_context |
mov bx, os_data |
mov bx, app_data ;os_data |
mov ds, bx |
mov es, bx |
161,14 → 159,13 |
proc get_notify stdcall, p_ev:dword |
.wait: |
mov ebx,[CURRENT_TASK] |
shl ebx,8 |
test dword [ebx+SLOT_BASE+0xA8],EVENT_NOTIFY |
mov ebx,[current_slot] |
test dword [ebx+APPDATA.event_mask],EVENT_NOTIFY |
jz @f |
and dword [ebx+SLOT_BASE+0xA8], not EVENT_NOTIFY |
and dword [ebx+APPDATA.event_mask], not EVENT_NOTIFY |
mov edi, [p_ev] |
mov dword [edi], EV_INTR |
mov eax, [ebx+SLOT_BASE+APPDATA.event] |
mov eax, [ebx+APPDATA.event] |
mov dword [edi+4], eax |
ret |
@@: |
256,9 → 253,8 |
align 4 |
srv_handlerEx: |
test ebx, ebx |
jz .fail |
add ebx, new_app_base |
cmp ebx, OS_BASE |
jae .fail |
mov eax, [ebx+handle] |
cmp [eax+SRV.magic], ' SRV' |
267,9 → 263,6 |
cmp [eax+SRV.size], SRV_SIZE |
jne .fail |
add [ebx+input], new_app_base |
add [ebx+output], new_app_base |
stdcall [eax+SRV.srv_proc], ebx |
ret |
.fail: |
410,9 → 403,9 |
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 |
424,7 → 417,7 |
mov eax, 70 |
lea ebx, [cmd] |
sub ebx, new_app_base |
; sub ebx, new_app_base |
int 0x40 |
ret |
endp |
447,8 → 440,6 |
mov ecx, [off] |
mov edx, [bytes] |
mov esi, [buffer] |
sub ebx, new_app_base |
sub esi, new_app_base |
mov [cmd], eax |
mov [offset], ecx |
461,7 → 452,6 |
pushad |
push eax |
lea eax, [cmd] |
sub eax, new_app_base |
call file_system_lfn |
pop eax |
popad |
919,13 → 909,13 |
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 |
1006,9 → 996,8 |
test eax, eax |
jz .fail |
mov ecx,[CURRENT_TASK] |
shl ecx,8 |
add ecx, SLOT_BASE+APP_OBJ_OFFSET |
mov ecx,[current_slot] |
add ecx, APP_OBJ_OFFSET |
pushfd |
cli |
1048,21 → 1037,68 |
ret |
;szSound db 'SOUND',0 |
;szInfinity db 'INFINITY',0 |
szHwMouse db 'ATI2D',0 |
szSTART db 'START',0 |
szEXPORTS db 'EXPORTS',0 |
szIMPORTS db 'IMPORTS',0 |
if 0 |
msg_unresolved db 'unresolved ',0 |
msg_module db 'in module ',0 |
msg_version db 'incompatible driver version',13,10,0 |
msg_www db 'please visit www.kolibrios.org',13,10,0 |
msg_CR db 13,10,0 |
irq: |
align 4 |
create_cursor dd 0 |
set_hw_cursor dd 0 |
hw_restore dd 0 |
.irq0: |
pusfd |
pushad |
push IRQ_0 |
jmp .master |
.irq_1: |
pusfd |
pushad |
push IRQ_1 |
jmp .master |
.master: |
mov ax, app_data |
mov ds, eax |
mov es, eax |
mov ebx, [esp+4] ;IRQ_xx |
mov eax, [irq_handlers+ebx+4] |
call intr_handler |
mov ecx, [esp+4] |
cmp [irq_actids+ecx*4], 0 |
je @F |
in al, 0x21 |
bts eax, ecx |
out 0x21, al |
mov al, 0x20 |
out 0x20, al |
jmp .restart |
.slave: |
mov ax, app_data |
mov ds, eax |
mov es, eax |
mov ebx, [esp+4] ;IRQ_xx |
mov eax, [irq_handlers+ebx+4] |
call intr_handler |
mov ecx, [esp+4] |
sub ecx, 8 |
cmp [irq_actids+ecx*4], 0 |
je @F |
in al, 0xA1 |
bts eax, ecx |
out 0xA1, al |
mov al, 0x20 |
out 0xA0, al |
out 0x20, al |
.restart: |
mov ebx, [next_slot] |
test ebx, ebx |
jz @F |
mov [next_task],0 |
mov esi, [prev_slot] |
call do_change_task |
add esp, 4 |
iretd |
end if |
/kernel/trunk/core/fpu.inc |
---|
143,7 → 143,7 |
e7: ;#NM exception handler |
save_ring3_context |
clts |
mov ax, os_data |
mov ax, app_data ; |
mov ds, ax |
mov es, ax |
196,10 → 196,10 |
push ecx |
push edx |
mov ebx, [ss:CURRENT_TASK] |
mov ebx, [CURRENT_TASK] |
shl ebx, 8 |
mov eax, [ss:ebx+SLOT_BASE+APPDATA.fpu_handler] |
mov eax, [ebx+SLOT_BASE+APPDATA.fpu_handler] |
test eax, eax |
jz .default |
206,7 → 206,7 |
mov ecx, [reg_eip] |
mov edx, [reg_esp] |
sub edx, 4 |
mov [ss:edx+new_app_base], ecx |
mov [edx], ecx |
mov [reg_esp], edx |
mov dword [reg_eip], eax |
240,10 → 240,9 |
push ecx |
push edx |
mov ebx, [ss:CURRENT_TASK] |
shl ebx, 8 |
mov ebx, [current_slot] |
mov eax, [ss:ebx+SLOT_BASE+APPDATA.sse_handler] |
mov eax, [ebx+APPDATA.sse_handler] |
test eax, eax |
jz .default |
250,7 → 249,7 |
mov ecx, [reg_eip] |
mov edx, [reg_esp] |
sub edx, 4 |
mov [ss:edx+new_app_base], ecx |
mov [edx], ecx |
mov [reg_esp], edx |
mov dword [reg_eip], eax |
/kernel/trunk/core/heap.inc |
---|
621,25 → 621,24 |
align 4 |
proc init_heap |
mov ebx,[CURRENT_TASK] |
shl ebx,8 |
mov eax, [SLOT_BASE+APPDATA.heap_top+ebx] |
mov ebx,[current_slot] |
mov eax, [ebx+APPDATA.heap_top] |
test eax, eax |
jz @F |
sub eax,[SLOT_BASE+APPDATA.heap_base+ebx] |
sub eax,[ebx+APPDATA.heap_base] |
sub eax, 4096 |
ret |
@@: |
mov esi, [SLOT_BASE+APPDATA.mem_size+ebx] |
mov esi, [ebx+APPDATA.mem_size] |
add esi, 4095 |
and esi, not 4095 |
mov [SLOT_BASE+APPDATA.mem_size+ebx], esi |
mov [ebx+APPDATA.mem_size], esi |
mov eax, HEAP_TOP |
mov [SLOT_BASE+APPDATA.heap_base+ebx], esi |
mov [SLOT_BASE+APPDATA.heap_top+ebx], eax |
mov [ebx+APPDATA.heap_base], esi |
mov [ebx+APPDATA.heap_top], eax |
sub eax, esi |
add esi, new_app_base |
; add esi, new_app_base |
shr esi, 10 |
mov ecx, eax |
sub eax, 4096 |
658,12 → 657,9 |
add ecx, (4095+4096) |
and ecx, not 4095 |
mov ebx, [CURRENT_TASK] |
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 |
mov ebx, [current_slot] |
mov esi, dword [ebx+APPDATA.heap_base] ; heap_base |
mov edi, dword [ebx+APPDATA.heap_top] ; heap_top |
l_0: |
cmp esi, edi |
jae m_exit |
684,7 → 680,6 |
or eax, FREE_BLOCK |
shr edx, 12 |
mov [page_tabs+edx*4], eax |
@@: |
or ecx, USED_BLOCK |
mov [page_tabs+ebx*4], ecx |
697,17 → 692,15 |
dec ecx |
jnz @B |
mov edx, [CURRENT_TASK] |
shl edx, 8 |
mov edx, [current_slot] |
mov ebx, [alloc_size] |
add ebx, 0xFFF |
and ebx, not 0xFFF |
add ebx, [SLOT_BASE+APPDATA.mem_size+edx] |
add ebx, [edx+APPDATA.mem_size] |
call update_mem_size |
mov eax, esi |
add eax, 4096 |
sub eax, new_app_base |
ret |
m_next: |
add esi, eax |
760,11 → 753,10 |
dec ecx |
jnz .release |
.not_used: |
mov edx, [CURRENT_TASK] |
shl edx, 8 |
mov esi, dword [edx+SLOT_BASE+APPDATA.heap_base]; heap_base |
mov edi, dword [edx+SLOT_BASE+APPDATA.heap_top]; heap_top |
sub ebx, [edx+SLOT_BASE+APPDATA.mem_size] |
mov edx, [current_slot] |
mov esi, dword [edx+APPDATA.heap_base] |
mov edi, dword [edx+APPDATA.heap_top] |
sub ebx, [edx+APPDATA.mem_size] |
neg ebx |
call update_mem_size |
call user_normalize |
779,8 → 771,6 |
; in: esi=heap_base, edi=heap_top |
; out: eax=0 <=> OK |
; destroys: ebx,edx,esi,edi |
add esi, new_app_base |
add edi, new_app_base |
shr esi, 12 |
shr edi, 12 |
@@: |
835,7 → 825,7 |
ret |
@@: |
push ecx edx |
lea ecx, [eax + new_app_base - 0x1000] |
lea ecx, [eax - 0x1000] |
shr ecx, 12 |
mov edx, [page_tabs+ecx*4] |
test edx, USED_BLOCK |
874,16 → 864,15 |
jnz .nofreeall |
mov eax, [page_tabs+ecx*4] |
and eax, not 0xFFF |
mov edx, [CURRENT_TASK] |
shl edx, 8 |
mov ebx, [SLOT_BASE+APPDATA.mem_size+edx] |
mov edx, [current_slot] |
mov ebx, [APPDATA.mem_size+edx] |
sub ebx, eax |
add ebx, 0x1000 |
or al, FREE_BLOCK |
mov [page_tabs+ecx*4], eax |
push esi edi |
mov esi, [SLOT_BASE+APPDATA.heap_base+edx] |
mov edi, [SLOT_BASE+APPDATA.heap_top+edx] |
mov esi, [APPDATA.heap_base+edx] |
mov edi, [APPDATA.heap_top+edx] |
call update_mem_size |
call user_normalize |
pop edi esi |
896,14 → 885,13 |
shr ebx, 12 |
sub ebx, edx |
push ebx ecx edx |
mov edx, [CURRENT_TASK] |
shl edx, 8 |
mov edx, [current_slot] |
shl ebx, 12 |
sub ebx, [SLOT_BASE+APPDATA.mem_size+edx] |
sub ebx, [APPDATA.mem_size+edx] |
neg ebx |
call update_mem_size |
pop edx ecx ebx |
lea eax, [ecx+1-(new_app_base shr 12)] |
lea eax, [ecx+1] |
shl eax, 12 |
push eax |
add ecx, ebx |
911,9 → 899,8 |
shl ebx, 12 |
jz .ret |
push esi |
mov esi, [CURRENT_TASK] |
shl esi, 8 |
mov esi, [SLOT_BASE+APPDATA.heap_top+esi] |
mov esi, [current_slot] |
mov esi, [APPDATA.heap_top+esi] |
shr esi, 12 |
@@: |
cmp edx, esi |
935,10 → 922,8 |
ret |
.realloc_add: |
; get some additional memory |
mov eax, [CURRENT_TASK] |
shl eax, 8 |
mov eax, [SLOT_BASE+APPDATA.heap_top+eax] |
add eax, new_app_base |
mov eax, [current_slot] |
mov eax, [APPDATA.heap_top+eax] |
shr eax, 12 |
cmp edx, eax |
jae .cant_inplace |
958,7 → 943,7 |
shl eax, 12 |
or al, USED_BLOCK |
mov [page_tabs+ecx*4], eax |
lea eax, [ecx+1-(new_app_base shr 12)] |
lea eax, [ecx+1] |
shl eax, 12 |
push eax |
push edi |
969,21 → 954,17 |
cld |
rep stosd |
pop edi |
mov edx, [CURRENT_TASK] |
shl edx, 8 |
mov edx, [current_slot] |
shl ebx, 12 |
add ebx, [SLOT_BASE+APPDATA.mem_size+edx] |
add ebx, [APPDATA.mem_size+edx] |
call update_mem_size |
pop eax edx ecx |
ret |
.cant_inplace: |
push esi edi |
mov eax, [CURRENT_TASK] |
shl eax, 8 |
mov esi, [SLOT_BASE+APPDATA.heap_base+eax] |
mov edi, [SLOT_BASE+APPDATA.heap_top+eax] |
add esi, new_app_base |
add edi, new_app_base |
mov eax, [current_slot] |
mov esi, [APPDATA.heap_base+eax] |
mov edi, [APPDATA.heap_top+eax] |
shr esi, 12 |
shr edi, 12 |
sub ebx, ecx |
1022,7 → 1003,6 |
inc esi |
mov eax, esi |
shl eax, 12 |
sub eax, new_app_base |
push eax |
mov eax, [page_tabs+ecx*4] |
and eax, not 0xFFF |
1043,10 → 1023,9 |
dec edx |
jnz @b |
push ebx |
mov edx, [CURRENT_TASK] |
shl edx, 8 |
mov edx, [current_slot] |
shl ebx, 12 |
add ebx, [SLOT_BASE+APPDATA.mem_size+edx] |
add ebx, [APPDATA.mem_size+edx] |
call update_mem_size |
pop ebx |
@@: |
/kernel/trunk/core/malloc.inc |
---|
992,7 → 992,7 |
mov [eax+12], eax |
add eax, 16 |
cmp eax, mst.smallbins+512 |
jl @B |
jb @B |
ret |
/kernel/trunk/core/memory.inc |
---|
6,163 → 6,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
tmp_page_tab equ HEAP_BASE |
align 4 |
proc mem_test |
mov eax, cr0 |
and eax, not (CR0_CD+CR0_NW) |
or eax, CR0_CD ;disable caching |
mov cr0, eax |
wbinvd ;invalidate cache |
xor edi, edi |
mov ebx, 'TEST' |
@@: |
add edi, 0x400000 |
xchg ebx, dword [edi] |
cmp dword [edi], 'TEST' |
xchg ebx, dword [edi] |
je @b |
mov [MEM_AMOUNT], edi |
and eax, not (CR0_CD+CR0_NW) ;enable caching |
mov cr0, eax |
mov eax, edi |
mov [LFBSize], 0x00800000 |
ret |
endp |
align 4 |
proc init_mem |
mov eax, [MEM_AMOUNT] |
mov [pg_data.mem_amount], eax |
mov [pg_data.kernel_max], eax |
shr eax, 12 |
mov edx, eax |
mov [pg_data.pages_count], eax |
mov [pg_data.kernel_pages], eax |
shr eax, 3 |
mov [pg_data.pagemap_size], eax |
shr edx, 10 |
cmp edx, 3 |
ja @f |
inc edx ;at least 4Mb for kernel heap |
@@: |
mov [pg_data.kernel_tables], edx |
xor eax, eax |
mov edi, sys_pgdir |
mov ecx, 2048 |
cld |
rep stosd |
mov edx, sys_pgdir |
bt [cpu_caps], CAPS_PSE |
jnc .no_PSE |
mov ebx, cr4 |
or ebx, CR4_PSE |
mov eax, PG_LARGE+PG_SW |
bt [cpu_caps], CAPS_PGE |
jnc @F |
or eax, PG_GLOBAL |
or ebx, CR4_PGE |
@@: |
mov cr4, ebx |
sub [pg_data.kernel_tables], 2 |
mov [edx], eax |
add eax, 0x00400000 |
mov [edx+4], eax |
add edx, 8 |
mov eax, 0x800000+PG_SW |
mov ecx, (HEAP_BASE-0x800000)/4096 |
jmp .map_low |
.no_PSE: |
mov eax, PG_SW |
mov ecx, HEAP_BASE/4096 |
.map_low: |
mov edi, tmp_page_tab |
@@: ; |
stosd |
add eax, 0x1000 |
dec ecx |
jnz @B |
mov ecx, [pg_data.kernel_tables] |
shl ecx, 10 |
xor eax, eax |
rep stosd |
mov ecx, [pg_data.kernel_tables] |
mov eax, tmp_page_tab+PG_SW |
mov edi, edx |
.map_kernel_tabs: |
stosd |
add eax, 0x1000 |
dec ecx |
jnz .map_kernel_tabs |
mov dword [sys_pgdir+(page_tabs shr 20)], sys_pgdir+PG_SW |
ret |
endp |
align 4 |
proc init_page_map |
mov edi, sys_pgmap |
mov ecx, (HEAP_BASE/4096)/32 ;384/4 |
mov ebx, ecx |
xor eax,eax |
cld |
rep stosd |
not eax |
mov ecx, [pg_data.pagemap_size] |
sub ecx, ebx |
shr ecx, 2 |
rep stosd |
lea edi, [sys_pgmap+ebx*4] ;+384 |
mov edx, [pg_data.pages_count] |
mov ecx, [pg_data.kernel_tables] |
add ecx, (HEAP_BASE/4096) and 31 |
sub edx, HEAP_BASE/4096 |
sub edx, ecx |
mov [pg_data.pages_free], edx |
xor eax, eax |
mov ebx, ecx |
shr ecx, 5 |
rep stosd |
not eax |
mov ecx, ebx |
and ecx, 31 |
shl eax, cl |
mov [page_start], edi; sys_pgmap+384 |
stosd |
mov ebx, sys_pgmap |
add ebx, [pg_data.pagemap_size] |
mov [page_end], ebx |
mov [pg_data.pg_mutex], 0 |
ret |
endp |
align 4 |
proc alloc_page |
pushfd |
400,7 → 244,7 |
@@: |
mov edx, LFB_BASE |
mov esi, [LFBAddress] |
mov edi, [LFBSize] |
mov edi, 0x00800000 |
mov dword [exp_lfb+4], edx |
shr edi, 12 |
410,10 → 254,9 |
bt [cpu_caps], CAPS_PSE |
jnc .map_page_tables |
or esi, PG_LARGE+PG_UW |
shr edx, 20 |
mov ecx, edx |
mov edx, sys_pgdir+(LFB_BASE shr 20) |
@@: |
mov [sys_pgdir+edx], esi |
mov [edx], esi |
add edx, 4 |
add esi, 0x00400000 |
dec edi |
421,7 → 264,7 |
bt [cpu_caps], CAPS_PGE |
jnc @F |
or dword [sys_pgdir+ecx], PG_GLOBAL |
or dword [sys_pgdir+(LFB_BASE shr 20)], PG_GLOBAL |
@@: |
mov dword [LFBAddress], LFB_BASE |
mov eax, cr3 ;flush TLB |
430,11 → 273,12 |
.map_page_tables: |
@@: |
call alloc_page |
stdcall map_page_table, edx, eax |
add edx, 0x00400000 |
dec edi |
jnz .map_page_tables |
jnz @B |
mov eax, [LFBAddress] |
mov edi, page_tabs + (LFB_BASE shr 10) |
465,12 → 309,11 |
and edi,not 4095 |
mov [new_size], edi |
mov edx,[CURRENT_TASK] |
shl edx,8 |
cmp [SLOT_BASE+APPDATA.heap_base+edx],0 |
mov edx,[current_slot] |
cmp [edx+APPDATA.heap_base],0 |
jne .exit |
mov esi, [SLOT_BASE+APPDATA.mem_size+edx] |
mov esi, [edx+APPDATA.mem_size] |
add esi, 4095 |
and esi, not 4095 |
500,10 → 343,7 |
xor eax, eax |
dec [pg_data.pg_mutex] |
ret |
.expand: |
add edi, new_app_base |
add esi, new_app_base |
push esi |
push edi |
567,14 → 407,14 |
endp |
update_mem_size: |
; in: edx = slot shl 8 |
; in: edx = slot base |
; ebx = new memory size |
; destroys eax,ecx,edx |
mov [SLOT_BASE+APPDATA.mem_size+edx],ebx |
mov [APPDATA.mem_size+edx],ebx |
;search threads and update |
;application memory size infomation |
mov ecx,[SLOT_BASE+APPDATA.dir_table+edx] |
mov ecx,[APPDATA.dir_table+edx] |
mov eax,2 |
.search_threads: |
610,53 → 450,75 |
and eax, 0xFFFFF000 |
ret |
align 4 |
proc page_fault_handler |
.err_code equ ebp+32 |
.err_addr equ ebp-4 |
pushad |
mov ebp, esp |
mov eax, cr2 |
push eax |
push ds |
push es |
mov ax, 0x10 |
mov ax, app_data |
mov ds, ax |
mov es, ax |
inc [pg_data.pages_faults] |
mov ebx, [ebp-4] |
; push eax |
; push edx |
; mov edx, 0x400 ;bochs |
; mov al,0xff ;bochs |
; out dx, al ;bochs |
; pop edx |
; pop eax |
cmp ebx, 0x80000000 |
jae .user_space |
mov ebx, [.err_addr] |
mov eax, [.err_code] |
cmp ebx, app_page_tabs |
jae .alloc |
cmp ebx, OS_BASE |
jb .user_space ;ñòðàíèöà â ïàìÿòè ïðèëîæåíèÿ ; |
cmp ebx, page_tabs |
jae .tab_space |
jb .kernel_space ;ñòðàíèöà â ïàìÿòè ÿäðà |
cmp ebx, 0x7DC00000 |
jae .lfb_addr |
cmp ebx, kernel_tabs |
jb .alloc;.app_tabs ;òàáëèöû ñòðàíèö ïðèëîæåíèÿ ; |
;ïðîñòî ñîçäàäèì îäíó |
jmp .kernel_space |
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 |
667,49 → 529,76 |
cld |
rep stosd |
.exit: |
pop es |
pop ds |
mov esp, ebp |
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 |
;ïîïûòêà çàïèñè â çàùèù¸ííóþ ñòðàíèöó ÿäðà |
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: |
.fail: |
pop es |
pop ds |
mov esp, ebp |
popad |
add esp, 4 |
; iretd |
save_ring3_context ;debugger support |
mov bl, 14 |
jmp exc_c |
iretd |
.kernel_space: |
; shr ebx, 12 |
; mov eax, [page_tabs+ebx*4] |
; shr ebx, 10 |
; mov eax, [master_tab+ebx*4] |
jmp .exit |
.old_addr: |
; shr ebx, 12 |
; mov eax, [page_tabs+ebx*4] |
; shr ebx, 10 |
; mov eax, [master_tab+ebx*4] |
jmp .exit |
.lfb_addr: |
; shr ebx, 22 |
; ;mov ecx, [sys_page_dir] |
; mov eax, [master_tab+ebx*4] |
jmp .exit |
.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 |
endp |
align 4 |
845,15 → 734,12 |
align 4 |
proc set_ipc_buff |
mov eax,[CURRENT_TASK] |
shl eax,8 |
add eax, SLOT_BASE |
mov eax,[current_slot] |
pushf |
cli |
mov [eax+0xA0],ebx ;set fields in extended information area |
mov [eax+0xA4],ecx |
mov [eax+APPDATA.ipc_start],ebx ;set fields in extended information area |
mov [eax+APPDATA.ipc_size],ecx |
add ebx, new_app_base |
add ecx, ebx |
add ecx, 4095 |
and ecx, not 4095 |
890,7 → 776,7 |
jz .no_ipc_area |
mov ebx, edi |
add edi, new_app_base |
; add edi, new_app_base |
and ebx, 0xFFF |
mov [dst_offset], ebx |
924,7 → 810,7 |
mov [edi+4], ecx |
add edi, 8 |
mov esi, [msg_addr] |
add esi, new_app_base |
; add esi, new_app_base |
cld |
rep movsb |
982,9 → 868,9 |
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 |
1030,7 → 916,6 |
@@: |
cmp eax, 13 |
ja @f |
add ebx, new_app_base |
stdcall user_free, ebx |
mov [esp+36], eax |
ret |
1037,9 → 922,8 |
@@: |
cmp eax, 14 |
ja @f |
add ebx, new_app_base |
cmp ebx, new_app_base |
jb .fail |
cmp ebx, OS_BASE |
jae .fail |
stdcall get_event_ex, ebx, ecx |
mov [esp+36], eax |
ret |
1046,10 → 930,9 |
@@: |
cmp eax, 15 |
ja @f |
mov ecx, [CURRENT_TASK] |
shl ecx, 8 |
mov eax, [ecx+SLOT_BASE+APPDATA.fpu_handler] |
mov [ecx+SLOT_BASE+APPDATA.fpu_handler], ebx |
mov ecx, [current_slot] |
mov eax, [ecx+APPDATA.fpu_handler] |
mov [ecx+APPDATA.fpu_handler], ebx |
mov [esp+36], eax |
ret |
@@: |
1058,9 → 941,8 |
test ebx, ebx |
jz .fail |
add ebx, new_app_base |
cmp ebx, new_app_base |
jb .fail |
cmp ebx, OS_BASE |
jae .fail |
stdcall get_service, ebx |
mov [esp+36], eax |
ret |
1073,18 → 955,16 |
@@: |
cmp eax, 18 |
ja @f |
mov ecx, [CURRENT_TASK] |
shl ecx, 8 |
mov eax, [ecx+SLOT_BASE+APPDATA.sse_handler] |
mov [ecx+SLOT_BASE+APPDATA.sse_handler], ebx |
mov ecx, [current_slot] |
mov eax, [ecx+APPDATA.sse_handler] |
mov [ecx+APPDATA.sse_handler], ebx |
mov [esp+36], eax |
ret |
@@: |
cmp eax, 19 |
ja @f |
add ebx, new_app_base |
cmp ebx, new_app_base |
jb .fail |
cmp ebx, OS_BASE |
jae .fail |
stdcall load_library, ebx |
mov [esp+36], eax |
ret |
1103,144 → 983,6 |
ret |
align 4 |
proc strncmp stdcall, str1:dword, str2:dword, count:dword |
mov ecx,[count] |
jecxz .end |
mov ebx,ecx |
mov edi,[str1] |
mov esi,edi |
xor eax,eax |
repne scasb |
neg ecx ; cx = count - strlen |
add ecx,ebx ; strlen + count - strlen |
.okay: |
mov edi,esi |
mov esi,[str2] |
repe cmpsb |
mov al,[esi-1] |
xor ecx,ecx |
cmp al,[edi-1] |
ja .str2_big |
je .end |
.str1_big: |
sub ecx,2 |
.str2_big: |
not ecx |
.end: |
mov eax,ecx |
ret |
endp |
align 4 |
proc test_cpu |
locals |
cpu_type dd ? |
cpu_id dd ? |
cpu_Intel dd ? |
cpu_AMD dd ? |
endl |
mov [cpu_type], 0 |
xor eax, eax |
mov [cpu_caps], eax |
mov [cpu_caps+4], eax |
pushfd |
pop eax |
mov ecx, eax |
xor eax, 0x40000 |
push eax |
popfd |
pushfd |
pop eax |
xor eax, ecx |
mov [cpu_type], CPU_386 |
jz .end_cpuid |
push ecx |
popfd |
mov [cpu_type], CPU_486 |
mov eax, ecx |
xor eax, 0x200000 |
push eax |
popfd |
pushfd |
pop eax |
xor eax, ecx |
je .end_cpuid |
mov [cpu_id], 1 |
xor eax, eax |
cpuid |
mov [cpu_vendor], ebx |
mov [cpu_vendor+4], edx |
mov [cpu_vendor+8], ecx |
cmp ebx, dword [intel_str] |
jne .check_AMD |
cmp edx, dword [intel_str+4] |
jne .check_AMD |
cmp ecx, dword [intel_str+8] |
jne .check_AMD |
mov [cpu_Intel], 1 |
cmp eax, 1 |
jl .end_cpuid |
mov eax, 1 |
cpuid |
mov [cpu_sign], eax |
mov [cpu_info], ebx |
mov [cpu_caps], edx |
mov [cpu_caps+4],ecx |
shr eax, 8 |
and eax, 0x0f |
ret |
.end_cpuid: |
mov eax, [cpu_type] |
ret |
.check_AMD: |
cmp ebx, dword [AMD_str] |
jne .unknown |
cmp edx, dword [AMD_str+4] |
jne .unknown |
cmp ecx, dword [AMD_str+8] |
jne .unknown |
mov [cpu_AMD], 1 |
cmp eax, 1 |
jl .unknown |
mov eax, 1 |
cpuid |
mov [cpu_sign], eax |
mov [cpu_info], ebx |
mov [cpu_caps], edx |
mov [cpu_caps+4],ecx |
shr eax, 8 |
and eax, 0x0f |
ret |
.unknown: |
mov eax, 1 |
cpuid |
mov [cpu_sign], eax |
mov [cpu_info], ebx |
mov [cpu_caps], edx |
mov [cpu_caps+4],ecx |
shr eax, 8 |
and eax, 0x0f |
ret |
endp |
MEM_WB equ 6 ;write-back memory |
MEM_WC equ 1 ;write combined memory |
MEM_UC equ 0 ;uncached memory |
align 4 |
proc init_mtrr |
cmp [BOOT_VAR+0x901c],byte 2 |
1314,7 → 1056,44 |
ret |
endp |
align 4 |
proc strncmp stdcall, str1:dword, str2:dword, count:dword |
mov ecx,[count] |
jecxz .end |
mov ebx,ecx |
mov edi,[str1] |
mov esi,edi |
xor eax,eax |
repne scasb |
neg ecx ; cx = count - strlen |
add ecx,ebx ; strlen + count - strlen |
.okay: |
mov edi,esi |
mov esi,[str2] |
repe cmpsb |
mov al,[esi-1] |
xor ecx,ecx |
cmp al,[edi-1] |
ja .str2_big |
je .end |
.str1_big: |
sub ecx,2 |
.str2_big: |
not ecx |
.end: |
mov eax,ecx |
ret |
endp |
align 4 |
proc stall stdcall, delay:dword |
push ecx |
push edx |
1341,107 → 1120,7 |
ret |
endp |
iglobal |
align 4 |
intel_str db "GenuineIntel",0 |
AMD_str db "AuthenticAMD",0 |
endg |
uglobal |
align 16 |
irq_tab rd 16 |
MEM_FreeSpace rd 1 |
ipc_tmp rd 1 |
ipc_pdir rd 1 |
ipc_ptab rd 1 |
proc_mem_map rd 1 |
proc_mem_pdir rd 1 |
proc_mem_tab rd 1 |
tmp_task_pdir rd 1 |
tmp_task_ptab rd 1 |
fdd_buff rd 1 |
LFBSize rd 1 |
stall_mcs rd 1 |
;;CPUID information |
cpu_vendor rd 3 |
cpu_sign rd 1 |
cpu_info rd 1 |
;;;;; cursors data |
align 16 |
cur_saved_data rb 4096 |
def_cursor rd 1 |
hw_cursor rd 1 |
scr_width rd 1 |
scr_height rd 1 |
cur_def_interl rd 1 |
cur_saved_base rd 1 |
cur_saved_interl rd 1 |
cur_saved_w rd 1 |
cur_saved_h rd 1 |
endg |
uglobal |
align 16 |
fpu_data: |
rb 512 |
mst MEM_STATE |
mem_block_map rb 512 |
event_map rb 64 |
mem_block_list rd 64 |
mem_block_mask rd 2 |
srv.fd rd 1 |
srv.bk rd 1 |
mem_used.fd rd 1 |
mem_used.bk rd 1 |
mem_block_arr rd 1 |
mem_block_start rd 1 |
mem_block_end rd 1 |
heap_mutex rd 1 |
heap_size rd 1 |
heap_free rd 1 |
heap_blocks rd 1 |
free_blocks rd 1 |
page_start rd 1 |
page_end rd 1 |
events rd 1 |
event_start rd 1 |
event_end rd 1 |
event_uid rd 1 |
sys_page_map rd 1 |
os_stack rd 1 |
endg |
if 0 |
push eax |
push edx |
mov edx, 0x400 ;bocsh |
mov al,0xff ;bocsh |
out dx, al ;bocsh |
pop edx |
pop eax |
end if |
align 4 |
k_strrchr: |
push eax |
xor eax,eax |
1660,3 → 1339,15 |
ret |
end if |
if 0 |
push eax |
push edx |
mov edx, 0x400 ;bochs |
mov al,0xff ;bochs |
out dx, al ;bochs |
pop edx |
pop eax |
end if |
/kernel/trunk/core/sched.inc |
---|
10,10 → 10,12 |
;; IRQ0 HANDLER (TIMER INTERRUPT) ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
align 32 |
irq0: |
save_ring3_context |
mov ax, os_data |
; pushfd |
pushad |
mov ax, app_data ; |
mov ds, ax |
mov es, ax |
28,7 → 30,6 |
mov [next_usage_update],eax |
call updatecputimes |
.nocounter: |
cmp [DONT_SWITCH], byte 1 |
jne .change_task |
38,8 → 39,9 |
mov [DONT_SWITCH], byte 0 |
restore_ring3_context |
iret |
popad |
; popfd |
iretd |
.change_task: |
call update_counters |
57,8 → 59,9 |
call do_change_task |
.return: |
restore_ring3_context |
iret |
popad |
; popfd |
iretd |
align 4 |
69,6 → 72,9 |
pushad |
call update_counters |
if 0 |
; \begin{Mario79} |
cmp [dma_task_switched], 1 |
jne .find_next_task |
82,6 → 88,9 |
jmp @f |
.find_next_task: |
; \end{Mario79} |
end if |
call find_next_task |
test eax, eax ; the same task -> skip switch |
jnz .return |
92,7 → 101,6 |
.return: |
popad |
popfd |
ret |
112,7 → 120,7 |
update_counters: |
mov edi, [TASK_BASE] |
mov ebx, [edi+TASKDATA.counter_add] ; time stamp counter add |
call _rdtsc |
rdtsc |
sub eax, ebx |
add eax, [edi+TASKDATA.counter_sum] ; counter sum |
mov [edi+TASKDATA.counter_sum], eax |
159,12 → 167,6 |
mov [CURRENT_TASK],ebx |
mov [TASK_BASE],edi |
push ebx |
shl ebx, 8 |
mov ebx, [SLOT_BASE + ebx + APPDATA.pl0_stack] |
add ebx, RING0_STACK_SIZE |
mov [CURRENT_RING0_ESP], ebx |
pop ebx |
cmp al, 5 |
jne .noevents |
177,27 → 179,66 |
.found: |
mov [CURRENT_TASK],ebx |
mov [TASK_BASE],edi |
call _rdtsc |
rdtsc ;call _rdtsc |
mov [edi+TASKDATA.counter_add],eax |
mov esi, [prev_slot] |
xor eax, eax |
cmp ebx, [prev_slot] |
cmp ebx, esi |
sete al |
ret |
; in: ebx = TSS selector index |
; param |
; ebx = incoming task |
; esi = outcomig task |
do_change_task: |
shl ebx, 3 |
xor eax, eax |
add ebx, tss0 |
mov [far_jump.sel], bx ; selector |
mov [far_jump.offs], eax ; offset |
jmp pword [far_jump] |
shl ebx, 8 |
add ebx, SLOT_BASE |
mov [current_slot], ebx |
shl esi, 8 |
add esi, SLOT_BASE |
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._esp0], ebx |
mov ecx, cr0 |
or ecx, CR0_TS ;set task switch flag |
mov cr0, ecx |
inc [context_counter] ;noname & halyavin |
test [ebx+APPDATA.dbg_state], 1 |
jnz @F |
ret |
@@: |
mov eax, [ebx+APPDATA.dbg_regs.dr0] |
mov dr0, eax |
mov eax, [ebx+APPDATA.dbg_regs.dr1] |
mov dr1, eax |
mov eax, [ebx+APPDATA.dbg_regs.dr2] |
mov dr2, eax |
mov eax, [ebx+APPDATA.dbg_regs.dr3] |
mov dr3, eax |
xor eax, eax |
mov dr6, eax |
mov eax, [ebx+APPDATA.dbg_regs.dr7] |
mov dr7, eax |
ret |
align 4 |
updatecputimes: |
215,3 → 256,108 |
jnz .newupdate |
ret |
if 0 |
struc TIMER |
{ |
.next dd ? |
.exp_time dd ? |
.func dd ? |
.arg dd ? |
} |
MAX_PROIRITY 0 ; highest, used for kernel tasks |
MAX_USER_PRIORITY 0 ; highest priority for user processes |
USER_PRIORITY 7 ; default (should correspond to nice 0) |
MIN_USER_PRIORITY 14 ; minimum priority for user processes |
IDLE_PRIORITY 15 ; lowest, only IDLE process goes here |
NR_SCHED_QUEUES 16 ; MUST equal IDLE_PRIORYTY + 1 |
rdy_head rd 16 |
align 4 |
pick_task: |
xor eax, eax |
.pick: |
mov ebx, [rdy_head+eax*4] |
test ebx, ebx |
jz .next |
mov [next_task], ebx |
test [ebx+flags.billable] |
jz @F |
mov [bill_task], ebx |
@@: |
ret |
.next: |
inc eax |
jmp .pick |
; param |
; eax= task |
; |
; retval |
; eax= task |
; ebx= queue |
; ecx= front if 1 or back if 0 |
align 4 |
shed: |
cmp [eax+.tics_left], 0 ;signed compare |
mov ebx, [eax+.priority] |
setg ecx |
jg @F |
mov edx, [eax+.tics_quantum] |
mov [eax+.ticks_left], edx |
cmp ebx, (IDLE_PRIORITY-1) |
je @F |
inc ebx |
@@: |
ret |
; param |
; eax= task |
align 4 |
enqueue: |
call shed ;eax |
cmp [rdy_head+ebx*4],0 |
jnz @F |
mov [rdy_head+ebx*4], eax |
mov [rdy_tail+ebx*4], eax |
mov [eax+.next_ready], 0 |
jmp .pick |
@@: |
test ecx, ecx |
jz .back |
mov ecx, [rdy_head+ebx*4] |
mov [eax+.next_ready], ecx |
mov [rdy_head+ebx*4], eax |
jmp .pick |
.back: |
mov ecx, [rdy_tail+ebx*4] |
mov [ecx+.next_ready], eax |
mov [rdy_tail+ebx*4], eax |
mov [eax+.next_ready], 0 |
.pick: |
call pick_proc ;select next task |
ret |
end if |
/kernel/trunk/core/sys32.inc |
---|
17,25 → 17,6 |
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 |
67,7 → 48,7 |
times 12 dd unknown_interrupt |
dd irq0 , irq_serv.irq_1, p_irq2 , p_irq3 ;irq_serv.irq_3 |
dd p_irq4 ,irq_serv.irq_5,p_irq6,irq_serv.irq_7 |
dd irq_serv.irq_4 ,irq_serv.irq_5,p_irq6,irq_serv.irq_7 |
dd irq_serv.irq_8, irq_serv.irq_9, irq_serv.irq_10 |
dd irq_serv.irq_11,p_irq12,irqD ,p_irq14,p_irq15 |
78,13 → 59,11 |
macro save_ring3_context |
{ |
push ds es |
pushad |
} |
macro restore_ring3_context |
{ |
popad |
pop es ds |
} |
; simply return control to interrupted process |
114,20 → 93,19 |
exc_w_code 8, 10, 11, 12, 13, 14, 17 |
exc_c: |
mov ax, os_data |
mov ds, ax |
mov es, ax |
mov ax, app_data ;èñêëþ÷åíèå |
mov ds, ax ;çàãðóçèì ïðàâèëüíûå çíà÷åíè |
mov es, ax ;â ðåãèñòðû |
; test if debugging |
cli |
mov eax, [CURRENT_TASK] |
shl eax, 8 |
mov eax, [SLOT_BASE+eax+APPDATA.debugger_slot] |
mov eax, [current_slot] |
mov eax, [eax+APPDATA.debugger_slot] |
test eax, eax |
jnz .debug |
sti |
; not debuggee => say error and terminate |
add esp, 28h |
add esp, 0x20 ;28h |
movzx eax, bl |
mov [error_interrupt], eax |
call show_error_parameters |
243,7 → 221,7 |
irqh 2,5,7,8,9,10,11 |
irq_c: |
mov ax, os_data |
mov ax, app_data ;os_data |
mov ds, ax |
mov es, ax |
call irqhandler |
252,7 → 230,7 |
p_irq6: |
save_ring3_context |
mov ax, os_data |
mov ax, app_data ;os_data |
mov ds, ax |
mov es, ax |
call fdc_irq |
262,7 → 240,7 |
p_irq3: |
save_ring3_context |
mov ax, os_data |
mov ax, app_data ;os_data |
mov ds, ax |
mov es, ax |
cmp [com2_mouse_detected],0 |
278,7 → 256,7 |
p_irq4: |
save_ring3_context |
mov ax, os_data |
mov ax, app_data ;os_data |
mov ds, ax |
mov es, ax |
cmp [com1_mouse_detected],0 |
294,7 → 272,7 |
p_irq12: |
save_ring3_context |
mov ax, os_data |
mov ax, app_data ;os_data |
mov ds, ax |
mov es, ax |
call check_mouse_data_ps2 |
303,7 → 281,7 |
p_irq14: |
save_ring3_context |
mov ax, os_data |
mov ax, app_data ;os_data |
mov ds, ax |
mov es, ax |
call [irq14_func] |
312,7 → 290,7 |
iret |
p_irq15: |
save_ring3_context |
mov ax, os_data |
mov ax, app_data ;os_data |
mov ds, ax |
mov es, ax |
call [irq15_func] |
335,7 → 313,7 |
irqD: |
save_ring3_context |
mov ax, os_data |
mov ax, app_data ;os_data |
mov ds, ax |
mov es, ax |
674,6 → 652,17 |
mov edi, [.slot] |
shl edi,8 |
add edi,SLOT_BASE |
mov eax, [edi+APPDATA.io_map] |
cmp eax, (tss._io_map_0-OS_BASE+PG_MAP) |
je @F |
call free_page |
@@: |
mov eax, [edi+APPDATA.io_map+4] |
cmp eax, (tss._io_map_1-OS_BASE+PG_MAP) |
je @F |
call free_page |
@@: |
mov eax, 0x20202020 |
stosd |
stosd |
837,13 → 826,12 |
build_scheduler: |
; mov esi,boot_sched_1 |
; call boot_log |
call build_process_gdt_tss_pointer |
mov esi,boot_sched_1 |
call boot_log |
; call build_process_gdt_tss_pointer |
; mov esi,boot_sched_2 |
; call boot_log |
call build_interrupt_table |
ret |
/kernel/trunk/core/syscall.inc |
---|
12,17 → 12,16 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
align 32 |
align 16 |
i40: |
; diamond, 27.03.2007: handler does not require disabled interrupts |
; so interrupts remain enabled when calling int 0x40 |
push ds es |
pushad |
cld |
mov ax,word os_data |
mov ds,ax |
mov es,ax |
; mov ax, word app_data |
; mov ds, ax |
; mov es, ax |
; load all registers in crossed order |
mov eax, ebx |
38,10 → 37,8 |
and edi,0xff |
call dword [servetable+edi*4] |
pop eax |
; cli |
popad |
pop es ds |
iretd |
67,18 → 64,13 |
; 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_RING0_ESP] |
mov esp, [ss:tss._esp0] |
sti |
;------------------ |
push ds es |
pushad |
cld |
mov ax, word os_data |
mov ds, ax |
mov es, ax |
mov eax, ebx |
mov ebx, ecx |
mov ecx, edx |
92,7 → 84,6 |
pop eax |
popad |
pop es ds |
;------------------ |
mov edx, [SYSENTER_VAR] ; eip |
mov ecx, [SYSENTER_VAR + 4] ; esp |
105,12 → 96,11 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
align 32 |
syscall_entry: |
; cli syscall clear IF |
xchg esp, [ss:CURRENT_RING0_ESP] |
xchg esp, [ss:tss._esp0] |
push ecx |
lea ecx, [esp+4] |
xchg ecx, [ss:CURRENT_RING0_ESP] |
xchg ecx, [ss:tss._esp0] |
sti |
push ecx |
mov ecx, [ecx] |
123,13 → 113,12 |
; mov eax, [ss:sysenter_stack - 4] ; eax - original eax, from app |
;------------------ |
push ds es |
pushad |
cld |
mov ax, word os_data |
mov ds, ax |
mov es, ax |
; mov ax, word app_data |
; mov ds, ax |
; mov es, ax |
mov eax, ebx |
mov ebx, ecx |
144,13 → 133,11 |
pop eax |
popad |
pop es ds |
;------------------ |
mov ecx, [ss:esp+4] |
pop esp |
sysret |
iglobal |
;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; SYSTEM FUNCTIONS TABLE ;; |
/kernel/trunk/core/taskman.inc |
---|
28,41 → 28,7 |
.i_icon dd ? ;+32 |
} |
struc TSS |
{ |
._back rw 2 |
._esp0 rd 1 |
._ss0 rw 2 |
._esp1 rd 1 |
._ss1 rw 2 |
._esp2 rd 1 |
._ss2 rw 2 |
._cr3 rd 1 |
._eip rd 1 |
._eflags rd 1 |
._eax rd 1 |
._ecx rd 1 |
._edx rd 1 |
._ebx rd 1 |
._esp rd 1 |
._ebp rd 1 |
._esi rd 1 |
._edi rd 1 |
._es rw 2 |
._cs rw 2 |
._ss rw 2 |
._ds rw 2 |
._fs rw 2 |
._gs rw 2 |
._ldt rw 2 |
._trap rw 1 |
._io rw 1 |
} |
virtual at 0 |
TSS TSS |
end virtual |
struc APP_PARAMS |
{ .app_cmdline ;0x00 |
.app_path ;0x04 |
154,9 → 120,6 |
cmp eax, 0 |
jne .wait_lock |
; pushfd |
; cli |
call set_application_table_status |
call get_new_process_place |
216,7 → 179,7 |
jna @F |
xor eax, eax |
add edi, new_app_base |
; add edi, new_app_base |
cld |
rep stosb |
@@: |
395,21 → 358,21 |
mov [dir_addr], eax |
stdcall map_page,[tmp_task_pdir],eax,dword PG_SW |
mov esi, sys_pgdir |
mov edi, [tmp_task_pdir] |
mov ecx, (page_tabs shr 20)/4 |
mov ecx, (OS_BASE shr 20)/4 |
xor eax, eax |
cld |
rep stosd |
mov ecx, (OS_BASE shr 20)/4 |
mov esi, sys_pgdir+(OS_BASE shr 20) |
rep movsd |
mov eax, [dir_addr] |
or eax, PG_SW |
stosd ; [(page_tabs shr 20)]= eax |
mov [edi-4096+(page_tabs shr 20)], eax |
mov ecx, 0x800/4 |
xor eax, eax |
rep stosd |
mov eax, [dir_addr] |
and eax, -4096 |
call set_cr3 |
mov edx, [app_tabs] |
494,13 → 457,9 |
align 4 |
set_cr3: |
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 ebx, [current_slot] |
mov [ebx+APPDATA.dir_table], eax |
mov cr3, eax |
ret |
558,8 → 517,7 |
and eax, not 0xFFF |
stdcall map_page,[tmp_task_pdir],eax,dword PG_SW |
mov esi, [tmp_task_pdir] |
add esi, 0x800 |
mov edi, 0x800/4 |
mov edi, (OS_BASE shr 20)/4 |
.destroy: |
mov eax, [esi] |
test eax, 1 |
744,7 → 702,7 |
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],\ |
810,7 → 768,7 |
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],\ |
875,9 → 833,7 |
mov [slot], eax |
mov esi,[CURRENT_TASK] |
shl esi,8 |
add esi,SLOT_BASE |
mov esi,[current_slot] |
mov ebx,esi ;ebx=esi - pointer to extended information about current thread |
mov edi, eax |
942,6 → 898,12 |
pop eax |
ret |
EFL_IF equ 0x0200 |
EFL_IOPL1 equ 0x1000 |
EFL_IOPL2 equ 0x2000 |
EFL_IOPL3 equ 0x3000 |
align 4 |
proc set_app_params stdcall,slot:dword, params:dword,\ |
cmd_line:dword, app_path:dword, flags:dword |
963,9 → 925,14 |
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 |
cld |
rep movsd |
cmp ebx,[TASK_COUNT] |
1003,7 → 970,6 |
cmp eax, [SLOT_BASE+APPDATA.mem_size+ebx*8] |
ja @f |
add edx, new_app_base |
stdcall k_strncpy, edx, [cmd_line], 256 |
@@: |
mov edx,[params] |
1015,12 → 981,13 |
jc @f |
cmp eax, [SLOT_BASE+APPDATA.mem_size+ebx*8] |
ja @f |
add edx, new_app_base |
stdcall k_strncpy, edx, [app_path], 1024 |
@@: |
mov ebx,[slot] |
mov eax,ebx |
shl ebx,5 |
lea ecx,[draw_data+ebx] ;ecx - pointer to draw data |
; set window state to 'normal' (non-minimized/maximized/rolled-up) state |
mov [ebx+window_data+WDATA.fl_wstate], WSTATE_NORMAL |
mov [ebx+window_data+WDATA.fl_redraw], 1 |
1033,8 → 1000,6 |
mov eax,[process_number] |
mov [ebx+4],eax ;set PID |
mov ecx,ebx |
add ecx,(draw_data-CURRENT_TASK) ;ecx - pointer to draw data |
;set draw data to full screen |
mov [ecx+0],dword 0 |
1044,54 → 1009,34 |
mov eax,[ScreenHeight] |
mov [ecx+12],eax |
mov edi,[slot] |
imul edi,tss_step |
add edi,tss_data |
mov ecx,128/4 |
mov ebx, [pl0_stack] |
mov esi,[params] |
lea ecx, [ebx+REG_EIP] |
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+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 esi,[params] |
mov eax, [esi+0x08] ;app_eip |
mov [edi+TSS._eip],eax ;set eip in TSS |
mov [ebx+REG_EIP], eax ;app_entry |
mov [ebx+REG_CS], dword app_code |
mov [ebx+REG_EFLAGS], dword EFL_IOPL1+EFL_IF |
mov eax, [esi+0x0C] ;app_esp |
mov [edi+TSS._esp],eax ;set stack in TSS |
mov [edi+TSS._eflags],dword 0x1202 |
mov [ebx+REG_APP_ESP], eax ;app_stack |
mov [ebx+REG_SS], dword app_data |
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_data |
mov ebx, [pl0_stack] |
add ebx, RING0_STACK_SIZE |
mov [edi+TSS._esp0],ebx |
mov ecx, edi ;ecx - address of application TSS |
lea ecx, [ebx+REG_RET] |
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 |
shl ebx, 8 |
mov [ebx+SLOT_BASE+APPDATA.saved_esp], ecx |
;flush keyboard and buttons queue |
mov [KEY_COUNT],byte 0 |
1121,13 → 1066,5 |
ret |
endp |
include "debug.inc" |
iglobal |
new_process_loading db 'K : New Process - loading',13,10,0 |
new_process_running db 'K : New Process - done',13,10,0 |
start_not_enough_memory db 'K : New Process - not enough memory',13,10,0 |
endg |
/kernel/trunk/data16.inc |
---|
0,0 → 1,58 |
$Revision$ |
flm db 0 |
preboot_lfb db 0 |
preboot_bootlog db 0 |
align 4 |
old_ints_h: |
dw 0x400 |
dd 0 |
dw 0 |
kernel_restart_bootblock: |
db 1 ; version |
dw 1 ; floppy image is in memory |
dd 0 ; cannot save parameters |
align 4 |
; videomodes table |
gr_table: |
dw 0x112+0100000000000000b , 640 , 480 ; 1 |
dw 0x115+0100000000000000b , 800 , 600 ; 2 |
dw 0x118+0100000000000000b , 1024 , 768 ; 3 |
dw 0x11B+0100000000000000b , 1280 , 1024 ; 4 |
dw 0x112 , 640 , 480 ; 5 |
dw 0x115 , 800 , 600 ; 6 |
dw 0x118 , 1024 , 768 ; 7 |
dw 0x11B , 1280 ,1024 ; 8 |
dw 0x13, 640, 480 ; 9 |
dw 0x12, 640, 480 ; 0 |
; table for move to extended memory (int 15h, ah=87h) |
align 8 |
movedesc: |
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
db 0xff,0xff,0x0,0xa0,0x00,0x93,0x0,0x0 |
db 0xff,0xff,0x0,0x00,0x10,0x93,0x0,0x0 |
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
fwmovedesc: |
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
db 0xff,0xff,0x0,0x00,0x10,0x93,0x0,0x0 |
db 0xff,0xff,0x0,0xa0,0x00,0x93,0x0,0x0 |
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
Property changes: |
Added: svn:keywords |
+Rev |
\ No newline at end of property |
/kernel/trunk/data32.inc |
---|
0,0 → 1,338 |
$Revision$ |
keymap: |
db '6',27 |
db '1234567890-=',8,9 |
db 'qwertyuiop[]',13 |
db '~asdfghjkl;',39,96,0,'\zxcvbnm,./',0,'45 ' |
db '@234567890123',180,178,184,'6',176,'7' |
db 179,'8',181,177,183,185,182 |
db 'AB<D',255,'FGHIJKLMNOPQRSTUVWXYZ' |
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
keymap_shift: |
db '6',27 |
db '!@#$%^&*()_+',8,9 |
db 'QWERTYUIOP{}',13 |
db '~ASDFGHJKL:"~',0,'|ZXCVBNM<>?',0,'45 ' |
db '@234567890123',180,178,184,'6',176,'7' |
db 179,'8',181,177,183,185,182 |
db 'AB>D',255,'FGHIJKLMNOPQRSTUVWXYZ' |
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
keymap_alt: |
db ' ',27 |
db ' @ $ {[]}\ ',8,9 |
db ' ',13 |
db ' ',0,' ',0,'4',0,' ' |
db ' ',180,178,184,'6',176,'7' |
db 179,'8',181,177,183,185,182 |
db 'ABCD',255,'FGHIJKLMNOPQRSTUVWXYZ' |
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
boot_memdetect db 'Determining amount of memory',0 |
boot_fonts db 'Fonts loaded',0 |
boot_tss db 'Setting TSSs',0 |
boot_cpuid db 'Reading CPUIDs',0 |
boot_devices db 'Detecting devices',0 |
boot_timer db 'Setting timer',0 |
boot_irqs db 'Reprogramming IRQs',0 |
boot_setmouse db 'Setting mouse',0 |
boot_windefs db 'Setting window defaults',0 |
boot_bgr db 'Calculating background',0 |
boot_resirqports db 'Reserving IRQs & ports',0 |
boot_setrports db 'Setting addresses for IRQs',0 |
boot_setostask db 'Setting OS task',0 |
boot_allirqs db 'Unmasking all IRQs',0 |
boot_tsc db 'Reading TSC',0 |
boot_pal_ega db 'Setting EGA/CGA 320x200 palette',0 |
boot_pal_vga db 'Setting VGA 640x480 palette',0 |
boot_mtrr db 'Setting MTRR',0 |
boot_tasking db 'All set - press ESC to start',0 |
new_process_loading db 'K : New Process - loading',13,10,0 |
new_process_running db 'K : New Process - done',13,10,0 |
start_not_enough_memory db 'K : New Process - not enough memory',13,10,0 |
msg_unresolved db 'unresolved ',0 |
msg_module db 'in module ',0 |
msg_version db 'incompatible driver version',13,10,0 |
msg_www db 'please visit www.kolibrios.org',13,10,0 |
msg_CR db 13,10,0 |
intel_str db "GenuineIntel",0 |
AMD_str db "AuthenticAMD",0 |
;szSound db 'SOUND',0 |
;szInfinity db 'INFINITY',0 |
szHwMouse db 'ATI2D',0 |
szSTART db 'START',0 |
szEXPORTS db 'EXPORTS',0 |
szIMPORTS db 'IMPORTS',0 |
firstapp db '/rd/1/LAUNCHER',0 |
char db 'FONTS/CHAR.MT',0 |
char2 db 'FONTS/CHAR2.MT',0 |
bootpath db '/KOLIBRI ' |
bootpath2 db 0 |
vmode db 'drivers/VMODE.MDR',0 |
vrr_m db '/rd/1/VRR_M',0 |
kernel_file db 'KERNEL MNT' |
; mike.dld { |
db 0 |
dd servetable-0x10000 |
draw_line dd __sys_draw_line |
disable_mouse dd __sys_disable_mouse |
draw_pointer dd __sys_draw_pointer |
;//mike.dld, 2006-08-02 [ |
;drawbar dd __sys_drawbar |
drawbar dd __sys_drawbar.forced |
;//mike.dld, 2006-08-02 ] |
putpixel dd __sys_putpixel |
; } mike.dld |
align 4 |
keyboard dd 1 |
sound_dma dd 1 |
syslang dd 1 |
boot_y dd 10 |
if __DEBUG__ eq 1 |
include_debug_strings |
end if |
IncludeIGlobals |
align 16 |
gdts: |
dw gdte-$-1 |
dd gdts |
dw 0 |
; Attention! The order first four selectors not to change, is used in Fast System Call |
; must be : os_code, os_data, app_code, app_data, .... |
int_code_l: |
os_code_l: |
dw 0xffff |
dw 0x0000 |
db 0x00 |
dw 11011111b *256 +10011010b |
db 0x00 |
int_data_l: |
os_data_l: |
dw 0xffff |
dw 0x0000 |
db 0x00 |
dw 11011111b *256 +10010010b |
db 0x00 |
app_code_l: |
dw 0xFFFF |
dw 0 |
db 0 |
db cpl3 |
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)+0xF; |
; --------------- APM --------------------- |
apm_code_32: |
dw 0x0f ; limit 64kb |
db 0, 0, 0 |
dw 11010000b *256 +10011010b |
db 0x00 |
apm_code_16: |
dw 0x0f |
db 0, 0, 0 |
dw 10010000b *256 +10011010b |
db 0x00 |
apm_data_16: |
dw 0x0f |
db 0, 0, 0 |
dw 10010000b *256 +10010010b |
db 0x00 |
; ----------------------------------------- |
graph_data_l: |
dw 0x7ff |
dw 0x0000 |
db 0x00 |
dw 11010000b *256 +11110010b |
db 0x00 |
tss0_l: |
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 |
cur_saved_data rb 4096 |
fpu_data: rb 512 |
; device irq owners |
irq_owner rd 16 ; process id |
; on irq read ports |
irq00read rd 16 |
irq01read rd 16 |
irq02read rd 16 |
irq03read rd 16 |
irq04read rd 16 |
irq05read rd 16 |
irq06read rd 16 |
irq07read rd 16 |
irq08read rd 16 |
irq09read rd 16 |
irq10read rd 16 |
irq11read rd 16 |
irq12read rd 16 |
irq13read rd 16 |
irq14read rd 16 |
irq15read rd 16 |
irq_tab rd 16 |
mem_block_map rb 512 |
event_map rb 64 |
mem_block_list rd 64 |
mem_block_mask rd 2 |
mem_used.fd rd 1 |
mem_used.bk rd 1 |
mem_block_arr rd 1 |
mem_block_start rd 1 |
mem_block_end rd 1 |
heap_mutex rd 1 |
heap_size rd 1 |
heap_free rd 1 |
heap_blocks rd 1 |
free_blocks rd 1 |
mst MEM_STATE |
page_start rd 1 |
page_end rd 1 |
events rd 1 |
event_start rd 1 |
event_end rd 1 |
event_uid rd 1 |
sys_page_map rd 1 |
os_stack_seg rd 1 |
srv.fd rd 1 |
srv.bk rd 1 |
scr_width rd 1 |
scr_height rd 1 |
create_cursor rd 1 |
set_hw_cursor rd 1 |
hw_restore rd 1 |
def_cursor rd 1 |
hw_cursor rd 1 |
cur_def_interl rd 1 |
cur_saved_base rd 1 |
cur_saved_interl rd 1 |
cur_saved_w rd 1 |
cur_saved_h rd 1 |
ipc_tmp rd 1 |
ipc_pdir rd 1 |
ipc_ptab rd 1 |
proc_mem_map rd 1 |
proc_mem_pdir rd 1 |
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 |
current_slot rd 1 |
; status |
hd1_status rd 1 ; 0 - free : other - pid |
application_table_status rd 1 ; 0 - free : other - pid |
; device addresses |
mididp rd 1 |
midisp rd 1 |
cdbase rd 1 |
cdid rd 1 |
hdbase rd 1 ; for boot 0x1f0 |
hdid rd 1 |
hdpos rd 1 ; for boot 0x1 |
fat32part rd 1 ; for boot 0x1 |
sb16 rd 1 |
;CPUID information |
cpu_vendor rd 3 |
cpu_sign rd 1 |
cpu_info rd 1 |
cpu_caps rd 4 |
pg_data PG_DATA |
heap_test rd 1 |
buttontype rd 1 |
windowtypechanged rd 1 |
hd_entries rd 1 ;unused ? 0xfe10 |
;* start code - Mario79 |
mouse_active rd 1 |
mouse_pause rd 1 |
MouseTickCounter rd 1 |
ps2_mouse_detected rb 1 |
com1_mouse_detected rb 1 |
com2_mouse_detected rb 1 |
;* end code - Mario79 |
wraw_bacground_select rb 1 |
lba_read_enabled rd 1 ; 0 = disabled , 1 = enabled |
pci_access_enabled rd 1 ; 0 = disabled , 1 = enabled |
IncludeUGlobals |
Property changes: |
Added: svn:keywords |
+Rev |
\ No newline at end of property |
/kernel/trunk/detect/commouse.inc |
---|
25,7 → 25,7 |
mov eax,4 |
shl eax,2 |
mov [irq_owner+eax],byte 1 |
mov [irq_owner+eax], 1 |
inc dword [RESERVED_PORTS] |
mov edi,[RESERVED_PORTS] |
47,7 → 47,7 |
mov eax,3 |
shl eax,2 |
mov [irq_owner+eax],byte 1 |
mov [irq_owner+eax], 1 |
inc dword [RESERVED_PORTS] |
mov edi,[RESERVED_PORTS] |
/kernel/trunk/drivers/ati2d.asm |
---|
10,6 → 10,8 |
include 'proc32.inc' |
include 'imports.inc' |
API_VERSION equ 0x01000100 |
DEBUG equ 1 |
VID_ATI equ 0x1002 |
19,7 → 21,7 |
LOAD_INDIRECT equ 2 |
LOAD_SYSTEM equ 3 |
VIDEO_FREE equ 2 |
SRV_GETVERSION equ 0 |
struc BITMAPINFOHEADER { |
.biSize dd ? ; DWORD |
71,9 → 73,8 |
R9800P equ 0x4E48 ;R350 |
R9800XT equ 0x4E4A ;R360 |
OS_BASE equ 0 |
new_app_base equ 0x80000000 |
SLOT_BASE equ 0x0080000 |
OS_BASE equ 0x80000000 |
SLOT_BASE equ (OS_BASE+0x0080000) |
PG_SW equ 0x003 |
PG_NOCACHE equ 0x018 |
230,13 → 231,16 |
align 4 |
proc service_proc stdcall, ioctl:dword |
mov edi, [ioctl] |
mov ebx, [edi+io_code] |
cmp ebx, VIDEO_FREE |
mov ebx, [ioctl] |
cmp [ebx+io_code], SRV_GETVERSION |
jne .fail |
mov eax, [edi+input] |
call video_free |
mov eax, [ebx+output] |
cmp [ebx+out_size], 4 |
jne .fail |
mov [eax], dword API_VERSION |
xor eax, eax |
ret |
.fail: |
or eax, -1 |
ret |
987,7 → 991,7 |
dd (R9800XT shl 16)+VID_ATI |
dd 0 ;terminator |
version dd 0x00040004 |
version dd (5 shl 16) or (API_VERSION and 0xFFFF) |
sz_ati_srv db 'HWCURSOR',0 |
/kernel/trunk/drivers/ensoniq.asm |
---|
257,9 → 257,9 |
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 |
391,7 → 391,6 |
cmp eax, DEV_GET_MASTERVOL |
jne @F |
mov ebx, [edi+output] |
add ebx, new_app_base |
stdcall get_master_vol, ebx |
ret |
;@@: |
/kernel/trunk/drivers/infinity.asm |
---|
10,6 → 10,10 |
format MS COFF |
API_VERSION equ 0x01000100 |
SOUND_VERSION equ API_VERSION |
include 'proc32.inc' |
include 'main.inc' |
include 'imports.inc' |
22,9 → 26,10 |
DEBUG equ 1 |
OS_BASE equ 0 |
new_app_base equ 0x80000000 |
SLOT_BASE equ OS_BASE+0x0080000 |
OS_BASE equ 0x80000000 |
SLOT_BASE equ (OS_BASE+0x0080000) |
TASK_COUNT equ (OS_BASE+0x0003004) |
CURRENT_TASK equ (OS_BASE+0x0003000) |
CAPS_SSE2 equ 26 |
PG_SW equ 0x003 |
159,8 → 164,10 |
cmp eax, SRV_GETVERSION |
jne @F |
mov eax, [edi+output] |
cmp [edi+out_size], 4 |
jne .fail |
mov eax, [eax] |
mov [eax+new_app_base], dword SOUND_VERSION |
mov [eax], dword SOUND_VERSION |
xor eax, eax |
ret |
@@: |
172,7 → 179,7 |
pop edi |
mov ecx, [edi+output] |
mov ecx, [ecx] |
mov [ecx+new_app_base], ebx |
mov [ecx], ebx |
ret |
@@: |
mov ebx, [edi+input] |
201,7 → 208,7 |
movzx eax, word [edx+STREAM.format] |
mov ecx, [edi+output] |
mov ecx, [ecx] |
mov [ecx+new_app_base], eax |
mov [ecx], eax |
xor eax, eax |
ret |
@@: |
222,13 → 229,12 |
pop edi |
mov ecx, [edi+output] |
mov ecx, [ecx] |
mov [ecx+new_app_base], ebx |
mov [ecx], ebx |
ret |
@@: |
cmp eax, SND_SETBUFF |
jne @F |
mov eax, [ebx+4] |
add eax, new_app_base |
stdcall set_buffer, [ebx],eax,[ebx+8],[ebx+12] |
ret |
@@: |
243,8 → 249,6 |
mov eax, [edi+output] |
mov ecx, [eax] |
mov eax, [eax+4] |
add ecx, new_app_base |
add eax, new_app_base |
stdcall GetBufferVol,[ebx],ecx,eax |
ret |
@@: |
258,7 → 262,7 |
mov eax, [edx+STREAM.pan] |
mov ebx, [edi+output] |
mov ebx, [ebx] |
mov [ebx+new_app_base], eax |
mov [ebx], eax |
xor eax, eax |
ret |
@@: |
266,7 → 270,6 |
jne @F |
mov eax, [ebx+4] |
add eax, new_app_base |
stdcall wave_out, [ebx],eax,[ebx+8] |
ret |
@@: |
287,7 → 290,7 |
mov eax, [edx+STREAM.in_size] |
mov ecx, [edi+output] |
mov ecx, [ecx] |
mov [ecx+new_app_base], eax |
mov [ecx], eax |
xor eax, eax |
ret |
@@: |
303,10 → 306,6 |
restore output |
restore out_size |
TASK_COUNT equ 0x0003004 |
CURRENT_TASK equ 0x0003000 |
align 4 |
proc CreateBuffer stdcall, format:dword, size:dword |
locals |
377,17 → 376,17 |
; 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 |
648,8 → 647,8 |
test esi, esi |
jz .fail |
cmp esi, new_app_base |
jb .fail |
cmp esi, OS_BASE |
ja .fail |
mov [state_saved], 0 |
1252,7 → 1251,7 |
pan_max dd 0x00002710,0x00002710 |
;stream_map dd 0xFFFF ; 16 |
version dd (4 shl 16) or (SOUND_VERSION and 0xFFFF) |
version dd (5 shl 16) or (SOUND_VERSION and 0xFFFF) |
szInfinity db 'INFINITY',0 |
szSound db 'SOUND',0 |
1284,3 → 1283,8 |
mix_3_core rd 1 |
mix_4_core rd 1 |
/kernel/trunk/drivers/main.inc |
---|
8,11 → 8,9 |
; (C) copyright Serge 2006-2007 |
; email: infinity_sound@mail.ru |
SOUND_VERSION equ 0x01000100 |
PLAY_SYNC equ 0x80000000 |
PCM_ALL equ 0 |
PCM_OUT equ 0x08000000 |
/kernel/trunk/drivers/sceletone.asm |
---|
9,6 → 9,8 |
format MS COFF |
API_VERSION equ 0 ;debug |
include 'proc32.inc' |
include 'imports.inc' |
39,6 → 41,8 |
DRV_EXIT equ -1 |
STRIDE equ 4 ;size of row in devices table |
SRV_GETVERSION equ 0 |
section '.flat' code readable align 16 |
proc START stdcall, state:dword |
70,11 → 74,21 |
align 4 |
proc service_proc stdcall, ioctl:dword |
; mov edi, [ioctl] |
; mov eax, [edi+io_code] |
mov ebx, [ioctl] |
mov eax, [ebx+io_code] |
cmp eax, SRV_GETVERSION |
jne @F |
mov eax, [ebx+output] |
cmp [ebx+out_size], 4 |
jne .fail |
mov [eax], dword API_VERSION |
xor eax, eax |
ret |
@@: |
.fail: |
or eax, -1 |
ret |
endp |
restore handle |
116,10 → 130,11 |
cmp eax, ebx |
je .found |
add edi, STRIDE |
jmp @B |
.next: inc [devfn] |
.next: |
inc [devfn] |
cmp [devfn], 256 |
jb .next_dev |
mov eax, [bus] |
138,11 → 153,10 |
ret |
endp |
DEVICE_ID equ 1234; pci device id |
VENDOR_ID equ 5678; device vendor id |
;DEVICE_ID equ ; pci device id |
;VENDOR_ID equ ; device vendor id |
;all initialized data place here |
align 4 |
149,7 → 163,7 |
devices dd (DEVICE_ID shl 16)+VENDOR_ID |
dd 0 ;terminator |
version dd 0x00030003 |
version dd (5 shl 16) or (API_VERSION and 0xFFFF) |
my_service db 'MY_SERVICE',0 ;max 16 chars include zero |
/kernel/trunk/drivers/sis.asm |
---|
10,6 → 10,8 |
include 'proc32.inc' |
include 'imports.inc' |
API_VERSION equ 0x01000100 |
DEBUG equ 1 |
CPU_FREQ equ 2000d ;cpu freq in MHz |
90,7 → 92,7 |
CODEC_REG_POWERDOWN equ 0x26 |
CODEC_REG_ST equ 0x26 |
SRV_GETVERSION equ 0 |
DEV_PLAY equ 1 |
DEV_STOP equ 2 |
DEV_CALLBACK equ 3 |
249,9 → 251,8 |
EVENT_NOTIFY equ 0x00000200 |
OS_BASE equ 0; 0x80400000 |
OS_BASE equ 0x80000000 |
SLOT_BASE equ OS_BASE+0x0080000 |
new_app_base equ 0x80000000 |
public START |
public service_proc |
341,6 → 342,18 |
mov edi, [ioctl] |
mov eax, [edi+io_code] |
cmp eax, SRV_GETVERSION |
jne @F |
mov eax, [edi+output] |
cmp [edi+out_size], 4 |
jne .fail |
mov [eax], dword API_VERSION |
xor eax, eax |
ret |
@@: |
cmp eax, DEV_PLAY |
jne @F |
if DEBUG |
375,16 → 388,15 |
cmp eax, DEV_GET_MASTERVOL |
jne @F |
mov ebx, [edi+output] |
add ebx, new_app_base |
stdcall get_master_vol, ebx |
ret |
;@@: |
; cmp eax, DEV_GET_INFO |
; jne @F |
; mov ebx, [edi+output] |
; stdcall get_dev_info, ebx |
; ret |
@@: |
cmp eax, DEV_GET_INFO |
jne @F |
mov ebx, [edi+output] |
stdcall get_dev_info, ebx |
ret |
@@: |
.fail: |
or eax, -1 |
ret |
1138,7 → 1150,7 |
devices dd (CTRL_SIS shl 16)+VID_SIS,msg_AC, set_SIS |
dd 0 |
version dd 0x00040004 |
version dd (5 shl 16) or (API_VERSION and 0xFFFF) |
msg_AC db '7012 AC97 controller',13,10, 0 |
msg_SIS db 'Silicon Integrated Systems',13,10, 0 |
/kernel/trunk/drivers/sound.asm |
---|
11,6 → 11,8 |
include 'proc32.inc' |
include 'imports.inc' |
API_VERSION equ 0x01000100 |
DEBUG equ 1 |
REMAP_IRQ equ 0 |
57,6 → 59,9 |
BIT30 EQU 0x40000000 |
BIT31 EQU 0x80000000 |
PCM_4 equ BIT20 |
PCM_6 equ BIT21 |
VID_INTEL equ 0x8086 |
VID_NVIDIA equ 0x10DE |
92,12 → 97,12 |
CODEC_MASTER_VOL_REG equ 0x02 |
CODEC_AUX_VOL equ 0x04 ; |
CODEC_PCM_OUT_REG equ 18h ; PCM output volume |
CODEC_EXT_AUDIO_REG equ 28h ; extended audio |
CODEC_EXT_AUDIO_CTRL_REG equ 2ah ; extended audio control |
CODEC_PCM_FRONT_DACRATE_REG equ 2ch ; PCM out sample rate |
CODEC_PCM_SURND_DACRATE_REG equ 2eh ; surround sound sample rate |
CODEC_PCM_LFE_DACRATE_REG equ 30h ; LFE sample rate |
CODEC_PCM_OUT_REG equ 0x18 ; PCM output volume |
CODEC_EXT_AUDIO_REG equ 0x28 ; extended audio |
CODEC_EXT_AUDIO_CTRL_REG equ 0x2a ; extended audio control |
CODEC_PCM_FRONT_DACRATE_REG equ 0x2c ; PCM out sample rate |
CODEC_PCM_SURND_DACRATE_REG equ 0x2e ; surround sound sample rate |
CODEC_PCM_LFE_DACRATE_REG equ 0x30 ; LFE sample rate |
GLOB_CTRL equ 0x2C ; Global Control |
CTRL_STAT equ 0x30 ; Global Status |
118,6 → 123,7 |
CODEC_REG_POWERDOWN equ 0x26 |
CODEC_REG_ST equ 0x26 |
SRV_GETVERSION equ 0 |
DEV_PLAY equ 1 |
DEV_STOP equ 2 |
DEV_CALLBACK equ 3 |
276,9 → 282,8 |
EVENT_NOTIFY equ 0x00000200 |
OS_BASE equ 0; |
OS_BASE equ 0x80000000 |
SLOT_BASE equ OS_BASE+0x0080000 |
new_app_base equ 0x80000000 |
public START |
public service_proc |
358,6 → 363,7 |
jnc .fail |
stdcall AttachIntHandler, ebx, ac97_irq |
.reg: |
stdcall RegService, sz_sound_srv, service_proc |
ret |
.fail: |
385,6 → 391,18 |
mov edi, [ioctl] |
mov eax, [edi+io_code] |
cmp eax, SRV_GETVERSION |
jne @F |
mov eax, [edi+output] |
cmp [edi+out_size], 4 |
jne .fail |
mov [eax], dword API_VERSION |
xor eax, eax |
ret |
@@: |
cmp eax, DEV_PLAY |
jne @F |
if DEBUG |
419,7 → 437,6 |
cmp eax, DEV_GET_MASTERVOL |
jne @F |
mov ebx, [edi+output] |
add ebx, new_app_base |
stdcall get_master_vol, ebx |
ret |
;@@: |
872,6 → 889,12 |
xor eax, eax ; timeout error |
ret |
.ready: |
mov eax, 2 ;force set 16-bit 2-channel PCM |
mov edx, GLOB_CTRL |
call [ctrl.ctrl_write32] |
mov eax, 5000 ; wait 5 ms |
call StallExec |
call detect_codec |
xor eax, eax |
1357,8 → 1380,9 |
dd 0 ;terminator |
version dd 0x00040004 |
version dd (5 shl 16) or (API_VERSION and 0xFFFF) |
msg_ICH db 'Intel ICH', 13,10, 0 |
msg_ICH0 db 'Intel ICH0', 13,10, 0 |
msg_ICH2 db 'Intel ICH2', 13,10, 0 |
1415,5 → 1439,3 |
lpc_bus rd 1 |
civ_val rd 1 |
/kernel/trunk/drivers/uart.asm |
---|
0,0 → 1,972 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
format MS COFF |
include 'proc32.inc' |
include 'imports.inc' |
API_VERSION equ 0 |
UART_VERSION equ API_VERSION |
PG_SW equ 0x003 |
page_tabs equ 0xFDC00000 ;hack |
OS_BASE equ 0x80000000 |
SLOT_BASE equ (OS_BASE+0x0080000) |
TASK_COUNT equ (OS_BASE+0x0003004) |
CURRENT_TASK equ (OS_BASE+0x0003000) |
struc APPOBJ ;common object header |
{ |
.magic dd ? ; |
.destroy dd ? ;internal destructor |
.fd dd ? ;next object in list |
.bk dd ? ;prev object in list |
.pid dd ? ;owner id |
}; |
virtual at 0 |
APPOBJ APPOBJ |
end virtual |
struc IOCTL |
{ .handle dd ? |
.io_code dd ? |
.input dd ? |
.inp_size dd ? |
.output dd ? |
.out_size dd ? |
} |
virtual at 0 |
IOCTL IOCTL |
end virtual |
DEBUG equ 1 |
DRV_ENTRY equ 1 |
DRV_EXIT equ -1 |
THR_REG equ 0; x3f8 ;transtitter/reciever |
IER_REG equ 1; x3f9 ;interrupt enable |
IIR_REG equ 2; x3fA ;interrupt info |
LCR_REG equ 3; x3FB ;line control |
MCR_REG equ 4; x3FC ;modem control |
LSR_REG equ 5; x3FD ;line status |
MSR_REG equ 6; x3FE ;modem status |
LCR_5BIT equ 0x00 |
LCR_6BIT equ 0x01 |
LCR_7BIT equ 0x02 |
LCR_8BIT equ 0x03 |
LCR_STOP_1 equ 0x00 |
LCR_STOP_2 equ 0x04 |
LCR_PARITY equ 0x08 |
LCR_EVEN equ 0x10 |
LCR_STICK equ 0x20 |
LCR_BREAK equ 0x40 |
LCR_DLAB equ 0x80 |
LSR_DR equ 0x01 ;data ready |
LSR_OE equ 0x02 ;overrun error |
LSR_PE equ 0x04 ;parity error |
LSR_FE equ 0x08 ;framing error |
LSR_BI equ 0x10 ;break interrupt |
LSR_THRE equ 0x20 ;transmitter holding empty |
LSR_TEMT equ 0x40 ;transmitter empty |
LSR_FER equ 0x80 ;FIFO error |
FCR_EFIFO equ 0x01 ;enable FIFO |
FCR_CRB equ 0x02 ;clear reciever FIFO |
FCR_CXMIT equ 0x04 ;clear transmitter FIFO |
FCR_RDY equ 0x08 ;set RXRDY and TXRDY pins |
FCR_FIFO_1 equ 0x00 ;1 byte trigger |
FCR_FIFO_4 equ 0x40 ;4 bytes trigger |
FCR_FIFO_8 equ 0x80 ;8 bytes trigger |
FCR_FIFO_14 equ 0xC0 ;14 bytes trigger |
IIR_INTR equ 0x01 ;1= no interrupts |
IER_RDAI equ 0x01 ;reciever data interrupt |
IER_THRI equ 0x02 ;transmitter empty interrupt |
IER_LSI equ 0x04 ;line status interrupt |
IER_MSI equ 0x08 ;modem status interrupt |
MCR_DTR equ 0x01 ;0-> DTR=1, 1-> DTR=0 |
MCR_RTS equ 0x02 ;0-> RTS=1, 1-> RTS=0 |
MCR_OUT_1 equ 0x04 ;0-> OUT1=1, 1-> OUT1=0 |
MCR_OUT_2 equ 0x08 ;0-> OUT2=1, 1-> OUT2=0; enable intr |
MCR_LOOP equ 0x10 ;lopback mode |
MSR_DCTS equ 0x01 ;delta clear to send |
MSR_DDSR equ 0x02 ;delta data set redy |
MSR_TERI equ 0x04 ;trailinh edge of ring |
MSR_DDCD equ 0x08 ;delta carrier detect |
RATE_50 equ 0 |
RATE_75 equ 1 |
RATE_110 equ 2 |
RATE_134 equ 3 |
RATE_150 equ 4 |
RATE_300 equ 5 |
RATE_600 equ 6 |
RATE_1200 equ 7 |
RATE_1800 equ 8 |
RATE_2000 equ 9 |
RATE_2400 equ 10 |
RATE_3600 equ 11 |
RATE_4800 equ 12 |
RATE_7200 equ 13 |
RATE_9600 equ 14 |
RATE_19200 equ 15 |
RATE_38400 equ 16 |
RATE_57600 equ 17 |
RATE_115200 equ 18 |
COM_1 equ 1 |
COM_2 equ 2 |
COM_3 equ 3 |
COM_4 equ 4 |
COM_MAX equ 2 ;only two port supported |
COM_1_BASE equ 0x3F8 |
COM_2_BASE equ 0x2F8 |
COM_1_IRQ equ 4 |
COM_2_IRQ equ 3 |
UART_CLOSED equ 0 |
UART_TRANSMIT equ 1 |
UART_STOP equ 2 |
struc UART |
{ |
.lock dd ? |
.base dd ? |
.lcr_reg dd ? |
.mcr_reg dd ? |
.rate dd ? |
.mode dd ? |
.state dd ? |
.rcvr_buff dd ? |
.rcvr_rp dd ? |
.rcvr_wp dd ? |
.rcvr_count dd ? |
.rcvr_top dd ? |
.xmit_buff dd ? |
.xmit_rp dd ? |
.xmit_wp dd ? |
.xmit_count dd ? |
.xmit_free dd ? |
.xmit_top dd ? |
} |
virtual at 0 |
UART UART |
end virtual |
UART_SIZE equ 18*4 |
struc CONNECTION |
{ |
.magic dd ? ;'CNCT' |
.destroy dd ? ;internal destructor |
.fd dd ? ;next object in list |
.bk dd ? ;prev object in list |
.pid dd ? ;owner id |
.id dd ? ;reserved |
.uart dd ? ;uart pointer |
} |
virtual at 0 |
CONNECTION CONNECTION |
end virtual |
CONNECTION_SIZE equ 7*4 |
public START |
public service_proc |
public version |
section '.flat' code readable align 16 |
proc START stdcall, state:dword |
cmp [state], 1 |
jne .stop |
mov eax, UART_SIZE |
call Kmalloc |
test eax, eax |
jz .fail |
mov [com1], eax |
mov edi, eax |
mov ecx, UART_SIZE/4 |
xor eax, eax |
cld |
rep stosd |
mov eax, [com1] |
mov [eax+UART.base], COM_1_BASE |
stdcall AllocKernelSpace, 32768 |
mov edi, [com1] |
mov edx, eax |
mov [edi+UART.rcvr_buff], eax |
add eax, 8192 |
mov [edi+UART.rcvr_top], eax |
add eax, 8192 |
mov [edi+UART.xmit_buff], eax |
add eax, 8192 |
mov [edi+UART.xmit_top], eax |
call AllocPage |
test eax, eax |
jz .fail |
shr edx, 12 |
or eax, PG_SW |
mov [page_tabs+edx*4], eax |
mov [page_tabs+edx*4+8], eax |
call AllocPage |
test eax, eax |
jz .fail |
or eax, PG_SW |
mov [page_tabs+edx*4+4], eax |
mov [page_tabs+edx*4+12], eax |
call AllocPage |
test eax, eax |
jz .fail |
or eax, PG_SW |
mov [page_tabs+edx*4+16], eax |
mov [page_tabs+edx*4+24], eax |
call AllocPage |
test eax, eax |
jz .fail |
or eax, PG_SW |
mov [page_tabs+edx*4+20], eax |
mov [page_tabs+edx*4+28], eax |
mov eax, [edi+UART.rcvr_buff] |
invlpg [eax] |
invlpg [eax+0x1000] |
invlpg [eax+0x2000] |
invlpg [eax+0x3000] |
invlpg [eax+0x4000] |
invlpg [eax+0x5000] |
invlpg [eax+0x6000] |
invlpg [eax+0x7000] |
mov eax, edi |
call uart_reset.internal ;eax= uart |
stdcall AttachIntHandler, COM_1_IRQ, com_1_isr |
stdcall RegService, sz_uart_srv, service_proc |
ret |
.fail: |
.stop: |
xor eax, eax |
ret |
endp |
handle equ IOCTL.handle |
io_code equ IOCTL.io_code |
input equ IOCTL.input |
inp_size equ IOCTL.inp_size |
output equ IOCTL.output |
out_size equ IOCTL.out_size |
SRV_GETVERSION equ 0 |
PORT_OPEN equ 1 |
PORT_CLOSE equ 2 |
PORT_RESET equ 3 |
PORT_SETMODE equ 4 |
PORT_GETMODE equ 5 |
PORT_SETMCR equ 6 |
PORT_GETMCR equ 7 |
PORT_READ equ 8 |
PORT_WRITE equ 9 |
align 4 |
proc service_proc stdcall, ioctl:dword |
mov ebx, [ioctl] |
mov eax, [ebx+io_code] |
cmp eax, PORT_WRITE |
ja .fail |
cmp eax, SRV_GETVERSION |
jne @F |
mov eax, [ebx+output] |
cmp [ebx+out_size], 4 |
jne .fail |
mov [eax], dword UART_VERSION |
xor eax, eax |
ret |
@@: |
cmp eax, PORT_OPEN |
jne @F |
cmp [ebx+out_size], 4 |
jne .fail |
mov ebx, [ebx+input] |
mov eax, [ebx] |
call uart_open |
mov ebx, [ioctl] |
mov ebx, [ebx+output] |
mov [ebx], ecx |
ret |
@@: |
mov esi, [ebx+input] ;input buffer |
mov edi, [ebx+output] |
call [uart_func+eax*4] |
ret |
.fail: |
or eax, -1 |
ret |
endp |
restore handle |
restore io_code |
restore input |
restore inp_size |
restore output |
restore out_size |
; param |
; esi= input buffer |
; +0 connection |
; |
; retval |
; eax= error code |
align 4 |
uart_reset: |
mov eax, [esi] |
cmp [eax+APPOBJ.magic], 'CNCT' |
jne .fail |
cmp [eax+APPOBJ.destroy], uart_close.destroy |
jne .fail |
mov eax, [eax+CONNECTION.uart] |
test eax, eax |
jz .fail |
; set mode 2400 bod 8-bit |
; disable DTR & RTS |
; clear FIFO |
; clear pending interrupts |
; |
; param |
; eax= uart |
align 4 |
.internal: |
mov esi, eax |
mov [eax+UART.state], UART_CLOSED |
mov edx, [eax+UART.base] |
add edx, MCR_REG |
xor eax, eax |
out dx, al ;clear DTR & RTS |
mov eax, esi |
mov ebx, RATE_2400 |
mov ecx, LCR_8BIT+LCR_STOP_1 |
call uart_set_mode.internal |
mov edx, [esi+UART.base] |
add edx, IIR_REG |
mov eax,FCR_EFIFO+FCR_CRB+FCR_CXMIT+FCR_FIFO_14 |
out dx, al |
.clear_RB: |
mov edx, [esi+UART.base] |
add edx, LSR_REG |
in al, dx |
test eax, LSR_DR |
jz @F |
mov edx, [esi+UART.base] |
in al, dx |
jmp .clear_RB |
@@: |
mov edx, [esi+UART.base] |
add edx, IER_REG |
mov eax,IER_RDAI+IER_THRI+IER_LSI |
out dx, al |
.clear_IIR: |
mov edx, [esi+UART.base] |
add edx, IIR_REG |
in al, dx |
test al, IIR_INTR |
jnz .done |
shr eax, 1 |
and eax, 3 |
jnz @F |
mov edx, [esi+UART.base] |
add edx, MSR_REG |
in al, dx |
jmp .clear_IIR |
@@: |
cmp eax, 1 |
je .clear_IIR |
cmp eax, 2 |
jne @F |
mov edx, [esi+UART.base] |
in al, dx |
jmp .clear_IIR |
@@: |
mov edx, [esi+UART.base] |
add edx, LSR_REG |
in al, dx |
jmp .clear_IIR |
.done: |
mov edi, [esi+UART.rcvr_buff] |
mov ecx, 8192/4 |
xor eax, eax |
mov [esi+UART.rcvr_rp], edi |
mov [esi+UART.rcvr_wp], edi |
mov [esi+UART.rcvr_count], eax |
cld |
rep stosd |
mov edi, [esi+UART.xmit_buff] |
mov ecx, 8192/4 |
mov [esi+UART.xmit_rp], edi |
mov [esi+UART.xmit_wp], edi |
mov [esi+UART.xmit_count], eax |
mov [esi+UART.xmit_free], 8192 |
rep stosd |
ret ;eax= 0 |
.fail: |
or eax, -1 |
ret |
; param |
; esi= input buffer |
; +0 connection |
; +4 rate |
; +8 mode |
; |
; retval |
; eax= error code |
align 4 |
uart_set_mode: |
mov eax, [esi] |
cmp [eax+APPOBJ.magic], 'CNCT' |
jne .fail |
cmp [eax+APPOBJ.destroy], uart_close.destroy |
jne .fail |
mov eax, [eax+CONNECTION.uart] |
test eax, eax |
jz .fail |
mov ebx, [esi+4] |
mov ecx, [esi+8] |
; param |
; eax= uart |
; ebx= baud rate |
; ecx= mode |
align 4 |
.internal: |
cmp ebx, RATE_115200 |
ja .fail |
cmp ecx, LCR_BREAK |
jae .fail |
mov [eax+UART.rate], ebx |
mov [eax+UART.mode], ecx |
mov esi, eax |
mov bx, [divisor+ebx*2] |
mov edx, [esi+UART.base] |
push edx |
add edx, LCR_REG |
in al, dx |
or al, 0x80 |
out dx, al |
pop edx |
mov al, bl |
out dx, al |
inc dx |
mov al, bh |
out dx, al |
add edx, LCR_REG-1 |
mov eax, ecx |
out dx, al |
xor eax, eax |
ret |
.fail: |
or eax, -1 |
ret |
; param |
; esi= input buffer |
; +0 connection |
; +4 modem control reg valie |
; |
; retval |
; eax= error code |
align 4 |
uart_set_mcr: |
mov eax, [esi] |
cmp [eax+APPOBJ.magic], 'CNCT' |
jne .fail |
cmp [eax+APPOBJ.destroy], uart_close.destroy |
jne .fail |
mov eax, [eax+CONNECTION.uart] |
test eax, eax |
jz .fail |
mov ebx, [esi+4] |
mov [eax+UART.mcr_reg], ebx |
mov edx, [eax+UART.base] |
add edx, MCR_REG |
mov al, bl |
out dx, al |
xor eax, eax |
ret |
.fail: |
or eax, -1 |
ret |
; param |
; eax= port |
; |
; retval |
; ecx= connection |
; eax= error code |
align 4 |
uart_open: |
dec eax |
cmp eax, COM_MAX |
jae .fail |
mov esi, [com1+eax*4] ;uart |
push esi |
.do_wait: |
cmp dword [esi+UART.lock],0 |
je .get_lock |
; call change_task |
jmp .do_wait |
.get_lock: |
mov eax, 1 |
xchg eax, [esi+UART.lock] |
test eax, eax |
jnz .do_wait |
mov eax, esi ;uart |
call uart_reset.internal |
mov ebx, [CURRENT_TASK] |
shl ebx, 5 |
mov ebx, [CURRENT_TASK+ebx+4] |
mov eax, CONNECTION_SIZE |
call CreateObject |
pop esi ;uart |
test eax, eax |
jz .fail |
mov [eax+APPOBJ.magic], 'CNCT' |
mov [eax+APPOBJ.destroy], uart_close.destroy |
mov [eax+CONNECTION.uart], esi |
mov ecx, eax |
xor eax, eax |
ret |
.fail: |
or eax, -1 |
ret |
restore .uart |
; param |
; esi= input buffer |
align 4 |
uart_close: |
mov eax, [esi] |
cmp [eax+APPOBJ.magic], 'CNCT' |
jne .fail |
cmp [eax+APPOBJ.destroy], uart_close.destroy |
jne .fail |
.destroy: |
push [eax+CONNECTION.uart] |
call DestroyObject ;eax= object |
pop eax ;eax= uart |
test eax, eax |
jz .fail |
mov [eax+UART.state], UART_CLOSED |
mov [eax+UART.lock], 0 ;release port |
xor eax, eax |
ret |
.fail: |
or eax, -1 |
ret |
; param |
; eax= uart |
; ebx= baud rate |
align 4 |
set_rate: |
cmp ebx, RATE_115200 |
ja .fail |
mov [eax+UART.rate], ebx |
mov bx, [divisor+ebx*2] |
mov edx, [eax+UART.base] |
add edx, LCR_REG |
in al, dx |
push eax |
or al, 0x80 |
out dx, al |
sub edx, LCR_REG |
mov al, bl |
out dx, al |
inc edx |
mov al, bh |
out dx, al |
pop eax |
add edx, LCR_REG-1 |
out dx, al |
.fail: |
ret |
; param |
; ebx= uart |
align 4 |
transmit: |
push esi |
push edi |
mov edx, [ebx+UART.base] |
pushfd |
cli |
mov esi, [ebx+UART.xmit_rp] |
mov ecx, [ebx+UART.xmit_count] |
test ecx, ecx |
je .stop |
cmp ecx, 16 |
jbe @F |
mov ecx, 16 |
@@: |
sub [ebx+UART.xmit_count], ecx |
add [ebx+UART.xmit_free], ecx |
cld |
@@: |
lodsb |
out dx, al |
dec ecx |
jnz @B |
cmp esi,[ebx+UART.xmit_top] |
jb @F |
sub esi, 8192 |
@@: |
mov [ebx+UART.xmit_rp], esi |
cmp [ebx+UART.xmit_count], 0 |
je .stop |
mov [ebx+UART.state], UART_TRANSMIT |
jmp @F |
.stop: |
mov [ebx+UART.state], UART_STOP |
@@: |
popfd |
pop edi |
pop esi |
ret |
; param |
; esi= input buffer |
; +0 connection |
; +4 dst buffer |
; +8 dst size |
; edi= output buffer |
; +0 bytes read |
; retval |
; eax= error code |
align 4 |
uart_read: |
mov eax, [esi] |
cmp [eax+APPOBJ.magic], 'CNCT' |
jne .fail |
cmp [eax+APPOBJ.destroy], uart_close.destroy |
jne .fail |
mov eax, [eax+CONNECTION.uart] |
test eax, eax |
jz .fail |
mov ebx, [esi+8] ;dst size |
mov ecx, [eax+UART.rcvr_count] |
cmp ecx, ebx |
jbe @F |
mov ecx, ebx |
@@: |
mov [edi], ecx ;bytes read |
test ecx, ecx |
jz .done |
push ecx |
mov edi, [esi+4] ;dst |
mov esi, [eax+UART.rcvr_rp] |
cld |
rep movsb |
pop ecx |
cmp esi, [eax+UART.rcvr_top] |
jb @F |
sub esi, 8192 |
@@: |
mov [eax+UART.rcvr_rp], esi |
sub [eax+UART.rcvr_count], ecx |
.done: |
xor eax, eax |
ret |
.fail: |
or eax, -1 |
ret |
; param |
; esi= input buffer |
; +0 connection |
; +4 src buffer |
; +8 src size |
; |
; retval |
; eax= error code |
align 4 |
uart_write: |
mov eax, [esi] |
cmp [eax+APPOBJ.magic], 'CNCT' |
jne .fail |
cmp [eax+APPOBJ.destroy], uart_close.destroy |
jne .fail |
mov eax, [eax+CONNECTION.uart] |
test eax, eax |
jz .fail |
mov ebx, [esi+4] |
mov edx, [esi+8] |
; param |
; eax= uart |
; ebx= src |
; edx= count |
align 4 |
.internal: |
mov esi, ebx |
mov edi, [eax+UART.xmit_wp] |
.write: |
test edx, edx |
jz .fail |
.wait: |
cmp [eax+UART.xmit_free], 0 |
jne .fill |
cmp [eax+UART.state], UART_TRANSMIT |
je .wait |
mov ebx, eax |
push edx |
call transmit |
pop edx |
mov eax, ebx |
jmp .write |
.fill: |
mov ecx, [eax+UART.xmit_free] |
cmp ecx, edx |
jbe @F |
mov ecx, edx |
@@: |
push ecx |
cld |
rep movsb |
pop ecx |
sub [eax+UART.xmit_free], ecx |
add [eax+UART.xmit_count], ecx |
sub edx, ecx |
jnz .wait |
.done: |
cmp edi, [eax+UART.xmit_top] |
jb @F |
sub edi, 8192 |
@@: |
mov [eax+UART.xmit_wp], edi |
cmp [eax+UART.state], UART_TRANSMIT |
je @F |
mov ebx, eax |
call transmit |
@@: |
xor eax, eax |
ret |
.fail: |
or eax, -1 |
ret |
align 4 |
com_2_isr: |
mov ebx, [com2] |
jmp com_1_isr.get_info |
align 4 |
com_1_isr: |
mov ebx, [com1] |
.get_info: |
mov edx, [ebx+UART.base] |
add edx, IIR_REG |
in al, dx |
test al, IIR_INTR |
jnz .done |
shr eax, 1 |
and eax, 3 |
call [isr_action+eax*4] |
jmp .get_info |
.done: |
ret |
align 4 |
isr_line: |
mov edx, [ebx+UART.base] |
add edx, LSR_REG |
in al, dx |
ret |
align 4 |
isr_recieve: |
mov esi, [ebx+UART.base] |
add esi, LSR_REG |
mov edi, [ebx+UART.rcvr_wp] |
xor ecx, ecx |
cld |
.read: |
mov edx, esi |
in al, dx |
test eax, LSR_DR |
jz .done |
mov edx, [ebx+UART.base] |
in al, dx |
stosb |
inc ecx |
jmp .read |
.done: |
cmp edi, [ebx+UART.rcvr_top] |
jb @F |
sub edi, 8192 |
@@: |
mov [ebx+UART.rcvr_wp], edi |
add [ebx+UART.rcvr_count], ecx |
ret |
align 4 |
isr_modem: |
mov edx, [ebx+UART.base] |
add edx, MSR_REG |
in al, dx |
ret |
align 4 |
divisor dw 2304, 1536, 1047, 857, 768, 384 |
dw 192, 96, 64, 58, 48, 32 |
dw 24, 16, 12, 6, 3, 2, 1 |
align 4 |
uart_func dd 0 ;SRV_GETVERSION |
dd 0 ;PORT_OPEN |
dd uart_close ;PORT_CLOSE |
dd uart_reset ;PORT_RESET |
dd uart_set_mode ;PORT_SETMODE |
dd 0 ;PORT_GETMODE |
dd uart_set_mcr ;PORT_SETMODEM |
dd 0 ;PORT_GETMODEM |
dd uart_read ;PORT_READ |
dd uart_write ;PORT_WRITE |
isr_action dd isr_modem |
dd transmit |
dd isr_recieve |
dd isr_line |
version dd (5 shl 16) or (UART_VERSION and 0xFFFF) |
sz_uart_srv db 'UART',0 |
align 4 |
com1 rd 1 |
com2 rd 1 |
/kernel/trunk/drivers/vmode.asm |
---|
0,0 → 1,736 |
; |
; MenuetOS Driver (vmode.mdr) |
; Target: Vertical Refresh Rate programming and videomode changing |
; |
; Author: Trans <<<<<13>>>>> |
; Date: 20.07.2003 |
; |
; Version: 1.0 |
; OS: MenuetOS |
; Compiler: FASM |
; |
OS_BASE equ 0x80000000 |
use32 |
macro align value { rb (value-1) - ($ + value-1) mod value } |
org 0x80760000 |
headerstart=$ |
mdid db 'MDAZ' ; 4 byte id |
mdhver dd 0x00 ; header version |
mdcode dd MDSTART ; start of code |
mdver dd 0x00000001 ; driver version (subversion*65536+version) |
mdname db 'Trans VideoDriver' ; 32 bytes of full driver name |
times (32-($-mdname)) db ' ' ; |
headerlen=$-headerstart |
times (256-headerlen) db 0 ; reserved area for future |
MDSTART: ; start of driver code ( base_adr+256 bytes) |
; ebx(=ecx in program): |
; 1 - Get DriverInfo and Driver Initial Set |
; 2 - Get Current Video Mode With Vertical Refresh Rate |
; 3 - Change Video Mode |
; 4 - Return at Start System Video Mode |
; 5 - Change vertical and horizontal size of visible screen area |
; 6 - Change Vert/Hor position visible area on screen (not complete yet) |
; |
; MAXF - ... |
MAXF=5 |
;-------Main Manager------------- |
pushad |
cmp ebx,1 |
jb mdvm_00 |
cmp ebx,MAXF |
ja mdvm_00 |
shl ebx,2 |
add ebx,mdvm_func_table |
call dword [ebx] |
mov [esp+28],eax |
mov [esp+24],ecx |
mov [esp+20],edx |
mov [esp+16],ebx |
popad |
retn |
mdvm_00: |
popad |
xor eax,eax |
dec eax |
retn |
; ------Drivers Functions---------- |
align 4 |
; EBX=1 (in applications ECX=1)- Get DriverInfo and Driver Initial Set |
; |
; IN: ecx (in app. edx) - pointer to 512-bytes info area in application |
; OUT: |
; |
vm_info_init: |
push ecx |
cmp [mdrvm],dword 0 |
jnz .vmii_00 |
call vm_safe_reg |
call vm_get_initial_videomode |
mov eax,[initvm] |
mov [currvm],eax |
call vm_search_sys_func_table |
call vm_get_cur_vert_rate |
mov [initrr],eax |
call vm_calc_pixelclock |
call vm_calc_refrate |
inc [mdrvm] |
.vmii_00: |
pop ecx |
call vm_transfer_drv_info |
mov ebx,dword [refrate] |
mov eax,dword [mdid] ;dword [systlb] |
retn |
align 4 |
; EBX=2 (in applications ECX=2)- Get Current Video Mode |
; |
; OUT: eax = X_screen*65536+Y_screen |
; ebx = current vertical rate |
; ecx = current video mode (number) |
vm_get_cur_mode: |
cmp [mdrvm],dword 0 |
jz .vmgcm_00 |
call vm_get_cur_vert_rate |
mov eax,[OS_BASE+0FE00h] |
mov ebx,[OS_BASE+0FE04h] |
shl eax,16 |
add eax,ebx |
add eax,00010001h |
mov ebx,[refrate] |
mov ecx,[currvm] |
retn |
.vmgcm_00: |
xor eax,eax |
dec eax |
retn |
align 4 |
; EBX=3 (in applications ECX=3)- Change Video Mode |
; |
; IN: ecx = VertRate*65536+VideoMode |
; OUT: eax = 0 if no error |
; |
vm_set_video_mode: |
cmp [mdrvm],dword 0 |
jz .vmsvm_00 |
call vm_set_selected_mode |
; xor eax,eax |
retn |
.vmsvm_00: |
xor eax,eax |
dec eax |
retn |
align 4 |
; EBX=4 (in applications ECX=4)- Return at Start System Video Mode |
; |
; IN: |
; OUT: eax = = 0 if no error |
; |
vm_restore_init_video_mode: |
cmp [mdrvm],dword 0 |
jz .vmrivm_00 |
call vm_restore_reg |
xor eax,eax |
retn |
.vmrivm_00: |
xor eax,eax |
dec eax |
retn |
align 4 |
; EBX=5 (in applications ECX=5)- Change vertical and horizontal size |
; of visible screen area |
; IN: ecx (in app. edx) = 0/1 - -/+ horizontal size on 1 position |
; = 2/3 - -/+ vertical size on 1 position (8 pixels) |
; ^-^----- not complete yet |
; OUT: eax = = 0 if no error |
; |
vm_change_screen_size: |
cmp [mdrvm],dword 0 |
jz .vmcss_00 |
cmp cl,1 |
ja .vmcss_01 |
mov eax,ecx |
call vm_inc_dec_width |
xor eax,eax |
retn |
.vmcss_01: |
and ecx,01h |
mov eax,ecx |
; call vm_inc_dec_high ; not complete yet |
xor eax,eax |
retn |
.vmcss_00: |
xor eax,eax |
dec eax |
retn |
align 4 |
; EBX=6 (in applications ECX=6)- Change Vert/Hor position visible area on screen |
; |
; IN: ecx (in app. edx) = 0/1 - -/+ horizontal position on 1 point |
; = 2/3 - -/+ vertical position on 1 pixel |
; ^-^----- not complete yet |
; OUT: eax = 0 if no error |
; |
vm_change_position_screen: |
cmp [mdrvm],dword 0 |
jz .vmcps_00 |
; ... |
xor eax,eax |
retn |
.vmcps_00: |
xor eax,eax |
dec eax |
retn |
;-----Drivers Subfunctions--------- |
; |
; Searching i40 system functions pointer table in kernel area location |
; |
vm_search_sys_func_table: |
push eax ; eax - current value |
push ecx ; ecx - will be counter of equevalent value |
push edx ; edx - last value |
push esi ; esi - current address |
xor ecx,ecx |
mov esi,OS_BASE+010000h ; Start address of kernel location |
lodsd |
mov edx,eax |
cld |
.vmssft_00: |
cmp esi,OS_BASE+30000h |
ja .vmssft_03 |
inc ecx |
lodsd |
cmp edx,eax |
mov edx,eax |
je .vmssft_00 |
cmp ecx,128 |
ja .vmssft_02 |
.vmssft_01: |
xor ecx,ecx |
jmp .vmssft_00 |
.vmssft_02: |
cmp edx,0 |
je .vmssft_01 |
sub esi,256*4-1 |
mov [systlb],esi |
xor ecx,ecx |
.vmssft_03_0: |
inc ecx |
lodsd |
cmp edx,eax |
mov edx,eax |
jne .vmssft_03_0 |
mov esi,dword [systlb] |
cmp cx,60 |
jae .vmssft_03 |
add esi,256*4-4 |
lodsb |
mov edx,eax |
jmp .vmssft_01 |
.vmssft_03: |
mov [systlb],esi |
pop esi |
pop edx |
pop ecx |
pop eax |
retn |
; IN: |
; OUT: eax= vertical rate in Hz |
vm_get_cur_vert_rate: |
push edx |
push ebx |
xor eax,eax |
mov edx,eax |
mov ebx,eax |
mov dx,03DAh |
.vmgcvt_00: |
in al,dx |
test al,8 |
jz .vmgcvt_00 |
.vmgcvt_01: |
in al,dx |
test al,8 |
jnz .vmgcvt_01 |
mov ebx,edx |
rdtsc |
mov edx,ebx |
mov ebx,eax |
.vmgcvt_02: |
in al,dx |
test al,8 |
jz .vmgcvt_02 |
.vmgcvt_03: |
in al,dx |
test al,8 |
jnz .vmgcvt_03 |
rdtsc |
sub eax,ebx |
mov ebx,eax |
mov eax,[OS_BASE+0F600h] |
xor edx,edx |
div ebx |
inc eax |
mov [refrate],eax |
pop ebx |
pop edx |
retn |
vm_calc_pixelclock: |
push ebx |
push edx |
xor eax,eax |
mov al,[_00] |
add ax,5 |
shl eax,3 |
xor ebx,ebx |
mov bl,[_06] |
mov bh,[_07] |
and bh,00100001b |
btr bx,13 |
jnc .vmcpc_00 |
or bh,2 |
.vmcpc_00: |
xor edx,edx |
mul ebx |
xor edx,edx |
mul [initrr] |
mov [pclock],eax |
pop edx |
pop ebx |
retn |
; |
; Safe of initial CRTC state |
; |
vm_safe_reg: |
push edx |
push ebx |
push ecx |
push edi |
cli |
mov dx,3d4h ; CRTC |
mov al,11h |
out dx,al |
inc dx |
in al,dx |
and al,7fh |
out dx,al ; Clear protection bit |
dec dx |
xor ecx,ecx |
mov cl,19h |
xor bl,bl |
mov edi,CRTCreg |
.vmsr_00: |
mov al,bl |
out dx,al |
inc dx |
in al,dx |
dec dx |
stosb |
inc bl |
loop .vmsr_00 |
sti |
pop edi |
pop ecx |
pop ebx |
pop edx |
retn |
; |
; Restore of initial CRTC state |
; |
vm_restore_reg: |
push eax |
push ebx |
push edx |
push esi |
mov eax,[oldX] |
mov [OS_BASE+0FE00h],eax |
mov eax,[oldY] |
mov [OS_BASE+0FE04h],eax |
mov dx,03dah |
.vmrr_00: |
in al,dx |
test al,8 |
jnz .vmrr_00 |
.vmrr_01: |
in al,dx |
test al,8 |
jnz .vmrr_01 |
cli |
mov dx,03c4h |
mov ax,0101h |
out dx,ax |
mov dx,3d4h ; CRTC |
mov al,11h |
out dx,al |
inc dx |
in al,dx |
and al,7fh ; Clear Protection bit |
out dx,al |
dec dx |
xor ecx,ecx |
mov cl,19h |
mov esi,CRTCreg |
xor bl,bl |
.vmrr_02: |
lodsb |
mov ah,al |
mov al,bl |
out dx,ax |
inc bl |
loop .vmrr_02 |
sti |
; call ref_screen |
pop esi |
pop edx |
pop ecx |
pop eax |
retn |
; Calculate of possible vertical refrash rate |
; (light version of function) |
vm_calc_refrate: |
push ebx |
push ecx |
push edx |
push edi |
push esi |
mov eax,[pclock] |
xor edx,edx |
mov edi,_m1 |
mov ebx,eax |
mov ecx,(1696*1065) |
div ecx |
xor edx,edx |
stosw |
add edi,8 |
mov eax,ebx |
mov ecx,(1344*804) |
div ecx |
xor edx,edx |
stosw |
add edi,8 |
mov eax,ebx |
mov ecx,(1056*636) |
div ecx |
xor edx,edx |
stosw |
add edi,8 |
mov eax,ebx |
mov ecx,(800*524) |
div ecx |
xor edx,edx |
stosw |
mov edi,_m1 |
mov esi,edi |
mov ecx,5*4 |
.vmcrr_00: |
lodsw |
cmp ax,55 |
jb .vmcrr_01 |
stosw |
loop .vmcrr_00 |
pop esi |
pop edi |
pop edx |
pop ecx |
pop ebx |
retn |
.vmcrr_01: |
xor ax,ax |
stosw |
loop .vmcrr_00 |
pop esi |
pop edi |
pop edx |
pop ecx |
pop ebx |
retn |
vm_get_initial_videomode: |
push eax |
mov eax,dword [OS_BASE+0FE00h] |
mov [oldX],eax |
mov eax,dword [OS_BASE+0FE04h] |
mov [oldY],eax |
mov eax,dword [OS_BASE+0FE0Ch] ; initial video mode |
and ax,01FFh |
mov dword [initvm],eax |
pop eax |
retn |
; IN: eax = 0/1 - -/+ 1 position of width |
vm_inc_dec_width: |
push ebx |
push edx |
mov ebx,eax |
mov dx,3d4h ; CRTC |
mov al,11h |
out dx,al |
inc dx |
in al,dx |
and al,7fh ; Clear Protection bit |
out dx,al |
dec dx |
xor al,al |
out dx,al |
inc dx |
in al,dx |
dec al |
cmp bl,0 |
jnz .vmidr_00 |
inc al |
inc al |
.vmidr_00: |
out dx,al |
pop edx |
pop ebx |
retn |
; |
; Copy driver info to application area |
; |
; IN: ecx (in app. edx) - pointer to 512-bytes info area in application |
; OUT: |
vm_transfer_drv_info: |
push ecx |
push edi |
push esi |
mov eax,ecx |
xor ecx,ecx |
mov cl,32/4 |
mov esi,mdname |
mov edi,drvname |
rep movsd |
mov ecx,eax |
mov eax,[mdver] |
mov [drvver],eax |
mov edi,[OS_BASE+3010h] |
mov edi,[edi+10h] |
add edi,ecx |
mov esi,drvinfo |
xor ecx,ecx |
mov cx,512 |
rep movsb |
pop esi |
pop edi |
pop ecx |
retn |
; |
; Set selected video mode |
; (light version) |
; |
; IN: ecx = VertRate*65536+VideoMode |
; |
vm_set_selected_mode: |
push edx |
push ecx |
push esi |
ror ecx,16 |
cmp cx,00h |
je .vmssm_03 |
rol ecx,16 |
mov eax,ecx |
shl eax,16 |
shr eax,16 |
mov [currvm],eax |
cmp cx,112h |
jne .vmssm_00 |
mov esi,mode0 |
mov ecx,639 |
mov edx,479 |
jmp .vmssm_st00 |
.vmssm_00: |
cmp cx,115h |
jne .vmssm_01 |
mov esi,mode1 |
mov ecx,799 |
mov edx,599 |
jmp .vmssm_st00 |
.vmssm_01: |
cmp cx,118h |
jne .vmssm_02 |
mov esi,mode2 |
mov ecx,1023 |
mov edx,767 |
jmp .vmssm_st00 |
.vmssm_02: |
cmp cx,11Bh |
jne .vmssm_03 |
mov esi,mode2 |
mov ecx,1279 |
mov edx,1023 |
jmp .vmssm_st00 |
.vmssm_03: |
xor eax,eax |
dec eax |
pop esi |
pop ecx |
pop edx |
retn |
.vmssm_st00: |
mov [OS_BASE+0FE00h],ecx |
mov [OS_BASE+0FE04h],edx |
cli |
mov dx,03c4h |
lodsw |
out dx,ax |
mov dx,03d4h |
mov al,11h |
out dx,al |
inc dx |
in al,dx |
and al,7fh |
out dx,al |
dec dx |
mov ecx,13 |
.vmssm_st01: |
lodsw |
out dx,ax |
loop .vmssm_st01 |
sti |
xor eax,eax |
pop esi |
pop ecx |
pop edx |
retn |
;------------DATA AREA--------------- |
align 4 |
mdvm_func_table: |
dd MDSTART |
dd vm_info_init, vm_get_cur_mode |
dd vm_set_video_mode, vm_restore_init_video_mode |
dd vm_change_screen_size, vm_change_position_screen |
CRTCreg: |
_00 db ? |
_01 db ? |
_02 db ? |
_03 db ? |
_04 db ? |
_05 db ? |
_06 db ? |
_07 db ? |
_08 db ? |
_09 db ? |
_0a db ? |
_0b db ? |
_0c db ? |
_0d db ? |
_0e db ? |
_0f db ? |
_10 db ? |
_11 db ? |
_12 db ? |
_13 db ? |
_14 db ? |
_15 db ? |
_16 db ? |
_17 db ? |
_18 db ? |
_19 db ? |
align 4 |
oldX dd ? |
oldY dd ? |
initvm dd ? |
currvm dd 0 |
refrate dd 0 |
initrr dd 0 |
systlb dd 0 |
pclock dd ? |
mdrvm dd 0 ; 0 - not drv init yet, 1 - already drv init |
drvinfo: |
drvname: times 32 db ' ' |
drvver dd 0 |
times (32-($-drvver))/4 dd 0 |
drvmode dw 011Bh,0118h,0115h,0112h |
times (64-($-drvmode))/2 dw 00h |
_m1 dw 0,0,0,0,0 |
_m2 dw 0,0,0,0,0 |
_m3 dw 0,0,0,0,0 |
_m4 dw 0,0,0,0,0 |
_m5 dw 0,0,0,0,0 |
times (512-($-drvinfo)) db 0 |
drvinfoend: |
;1280x1024 - 11Bh |
mode3: |
dw 0101h |
dw 0d000h,9f01h,9f02h,9303h,0a904h,1905h,2806h,5a07h |
dw 0110h,8411h,0ff12h,0ff15h,2916h |
;1024x768 - 118h |
mode2: |
dw 0101h |
dw 0a400h,7f01h,7f02h,8703h,8404h,9505h,2406h,0f507h |
dw 0310h,8911h,0ff12h,0ff15h,2516h |
;800x600 - 115h |
mode1: |
dw 0101h |
dw 8000h,6301h,6302h,8303h,6a04h,1a05h,7206h,0f007h |
dw 5910h,8d11h,5712h,5715h,7316h |
;640x480 - 112h, 12h |
mode0: |
dw 0101h |
dw 6000h,4f01h,4f02h,8303h,5304h,9f05h,00b06h,3e07h |
dw 0ea10h,8c11h,0df12h,0df15h,0c16h |
; 640x400 |
;mymode0: |
; dw 0101h |
;_0_7 dw 5f00h,4f01h,4f02h,8303h,5304h,9f05h,0BF06h,1f07h |
; dw 9c10h,8e11h,8f12h,9615h,0B916h ;,4013h |
; 640x800 |
;mymode1: |
; dw 0101h |
; dw 5f00h,4f01h,4f02h,8003h,5004h,9f05h,06006h,0FF07h |
; dw 2d10h,8f11h,2012h,2615h,05716h ;,4013h |
DRVM_END: |
/kernel/trunk/fdo.inc |
---|
236,7 → 236,7 |
pushad |
movzx ebx,al |
mov eax,1 |
call sys_msg_board |
; call sys_msg_board |
popad |
ret |
debug_endf |
249,7 → 249,7 |
movzx ebx,byte[edx] |
or bl,bl |
jz .l2 |
call sys_msg_board |
; call sys_msg_board |
inc edx |
jmp .l1 |
.l2: ret |
/kernel/trunk/fs/fat12.inc |
---|
1125,7 → 1125,7 |
endg |
flp_root_next: |
cmp edi, 0xD200-0x20 |
cmp edi, OS_BASE+0xD200-0x20 |
jae @f |
add edi, 0x20 |
ret ; CF=0 |
1172,7 → 1172,7 |
ret |
flp_notroot_next: |
cmp edi, 0xD200-0x20 |
cmp edi, OS_BASE+0xD200-0x20 |
jae flp_notroot_next_sector |
add edi, 0x20 |
ret ; CF=0 |
1223,7 → 1223,7 |
popa |
ret |
flp_notroot_next_write: |
cmp edi, 0xD200 |
cmp edi, OS_BASE+0xD200 |
jae @f |
ret |
@@: |
1464,7 → 1464,7 |
cmp byte [edi+11], 0xF |
jnz .do_bdfe |
add edi, 0x20 |
cmp edi, 0xD200 |
cmp edi, OS_BASE+0xD200 |
jb .do_bdfe |
pop eax |
inc eax |
1496,7 → 1496,7 |
call fat_entry_to_bdfe |
.l2: |
add edi, 0x20 |
cmp edi, 0xD200 |
cmp edi, OS_BASE+0xD200 |
jb .l1 |
pop eax |
inc eax |
1895,7 → 1895,10 |
jnz .ret |
dec edi |
dec edi |
lea eax, [edi-(FLOPPY_FAT)] |
mov eax, edi |
sub eax, FLOPPY_FAT |
shr eax, 1 ; eax = cluster |
mov word [edi], 0xFFF ; mark as last cluster |
xchg edi, [esp+4] |
2576,7 → 2579,7 |
mov ebx, [ebx+4] |
test ebx, ebx |
jz @f |
add ebx, std_application_base_address |
; add ebx, std_application_base_address |
@@: |
;---------------------------------------------------------------- |
/kernel/trunk/fs/fat32.inc |
---|
3267,7 → 3267,7 |
mov ebx, [ebx+4] |
test ebx, ebx |
jz @f |
add ebx, std_application_base_address |
; add ebx, std_application_base_address |
@@: |
;---------------------------------------------------------------- |
/kernel/trunk/fs/fs.inc |
---|
86,7 → 86,7 |
; \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 |
97,7 → 97,7 |
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 |
120,7 → 120,7 |
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 |
148,7 → 148,7 |
; \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 |
202,12 → 202,12 |
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 |
/kernel/trunk/fs/fs_lfn.inc |
---|
93,7 → 93,7 |
; 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] |
102,7 → 102,7 |
test al, al |
jnz @f |
mov esi, [esi] |
add esi, std_application_base_address |
; add esi, std_application_base_address |
mov ebp, esi |
lodsb |
@@: |
112,7 → 112,7 |
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 |
157,7 → 157,7 |
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] |
239,7 → 239,7 |
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 |
348,7 → 348,7 |
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 |
385,7 → 385,7 |
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 |
449,7 → 449,7 |
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 |
525,7 → 525,7 |
@@: |
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 |
/kernel/trunk/fs/iso9660.inc |
---|
506,7 → 506,7 |
mov ebx, [ebx+4] |
test ebx, ebx |
jz @f |
add ebx, std_application_base_address |
; add ebx, std_application_base_address |
@@: |
;---------------------------------------------------------------- |
/kernel/trunk/gui/button.inc |
---|
172,13 → 172,12 |
sys_button: |
push edi |
mov edi,[CURRENT_TASK] |
shl edi,8 |
mov edi,[current_slot] |
rol eax,16 |
add ax,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.left] |
add ax,word[edi+APPDATA.wnd_clientbox.left] |
rol eax,16 |
rol ebx,16 |
add bx,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.top] |
add bx,word[edi+APPDATA.wnd_clientbox.top] |
rol ebx,16 |
pop edi |
.forced: |
/kernel/trunk/gui/event.inc |
---|
121,9 → 121,8 |
cld |
rep movsd |
@@: |
mov ecx, [CURRENT_TASK] |
shl ecx,8 |
add ecx, SLOT_BASE+APP_OBJ_OFFSET |
mov ecx, [current_slot] |
add ecx, APP_OBJ_OFFSET |
pushfd |
cli |
224,12 → 223,11 |
proc get_event_ex stdcall, p_ev:dword, timeout:dword |
.wait: |
mov edx,[CURRENT_TASK] |
shl edx,8 |
mov edx,[current_slot] |
; cmp [SLOT_BASE+edx+APPDATA.ev_count], 0 |
; je .switch |
add edx, SLOT_BASE+APP_EV_OFFSET |
add edx, APP_EV_OFFSET |
mov eax, [edx+APPOBJ.fd] |
cmp eax, edx |
307,9 → 305,7 |
test [eax+EVENT.state], MANUAL_RESET |
jnz .done |
mov edx,[CURRENT_TASK] |
shl edx,8 |
add edx, SLOT_BASE |
mov edx,[current_slot] |
pushfd |
cli ;remove event from events |
578,21 → 574,20 |
no_eventoccur3: |
;mov edi,[TASK_BASE] ; mouse event |
test [edi+TASKDATA.event_mask],dword 00100000b |
jz no_mouse_event |
mov eax,[CURRENT_TASK] |
shl eax,8 |
test [eax+SLOT_BASE+APPDATA.event_mask],dword 00100000b |
jz no_mouse_event |
and [eax+SLOT_BASE+APPDATA.event_mask],dword 0xffffffff-00100000b |
and [eax+SLOT_BASE+APPDATA.event_mask],dword (not 00100000b) |
popad |
mov eax,6 |
ret |
no_mouse_event: |
;mov edi,[TASK_BASE] ; DESKTOP BACKGROUND REDRAW |
test [edi+TASKDATA.event_mask],dword 16 |
jz no_eventoccur5 |
616,7 → 611,6 |
ret |
no_ipc: |
;mov edi,[TASK_BASE] ; STACK |
test [edi+TASKDATA.event_mask],dword 10000000b |
jz no_stack_event |
/kernel/trunk/gui/skincode.inc |
---|
16,35 → 16,9 |
mov ebx,1 |
or ecx,-1 |
mov esi,12 |
; call fileread |
pushad |
push eax |
sub edx,std_application_base_address |
mov [skin_to_load.adr],edx |
;sub eax,std_application_base_address |
;mov [skin_to_load.stradr],eax |
mov [skin_to_load.stradr],_skin_file_default - std_application_base_address |
mov eax,skin_to_load - std_application_base_address |
call file_system_lfn |
;call fileread |
pop eax |
popad |
call fileread |
ret |
ret |
skin_to_load: |
dd 0,0,0 |
dd 64*1024 |
.adr dd 0 |
db 0 |
.stradr dd 0 |
struct SKIN_HEADER |
.ident dd ? |
.version dd ? |
/kernel/trunk/gui/skindata.inc |
---|
11,7 → 11,7 |
; |
iglobal |
_skin_file_default db '/rd/1/DEFAULT.SKN',0 |
_skin_file_default db 'DEFAULT SKN',0 |
endg |
struct SKIN_DATA |
/kernel/trunk/gui/window.inc |
---|
1781,17 → 1781,14 |
test eax, eax |
jne rsw_no_address |
mov eax,[CURRENT_TASK] |
shl eax,8 |
mov [eax+SLOT_BASE+APPDATA.wnd_shape],ebx |
mov eax,[current_slot] |
mov [eax+APPDATA.wnd_shape],ebx |
rsw_no_address: |
cmp eax,1 |
jne rsw_no_scale |
mov eax,[CURRENT_TASK] |
shl eax,8 |
mov byte [eax+SLOT_BASE+APPDATA.wnd_shape_scale], bl |
mov eax,[current_slot] |
mov byte [eax+APPDATA.wnd_shape_scale], bl |
rsw_no_scale: |
ret |
/kernel/trunk/init.inc |
---|
0,0 → 1,274 |
$Revision$ |
MEM_WB equ 6 ;write-back memory |
MEM_WC equ 1 ;write combined memory |
MEM_UC equ 0 ;uncached memory |
align 4 |
proc mem_test |
mov eax, cr0 |
and eax, not (CR0_CD+CR0_NW) |
or eax, CR0_CD ;disable caching |
mov cr0, eax |
wbinvd ;invalidate cache |
xor edi, edi |
mov ebx, 'TEST' |
@@: |
add edi, 0x100000 |
xchg ebx, dword [edi] |
cmp dword [edi], 'TEST' |
xchg ebx, dword [edi] |
je @b |
mov [MEM_AMOUNT-OS_BASE], edi |
and eax, not (CR0_CD+CR0_NW) ;enable caching |
mov cr0, eax |
mov eax, edi |
ret |
endp |
align 4 |
proc init_mem |
mov eax, [MEM_AMOUNT-OS_BASE] |
mov [pg_data.mem_amount-OS_BASE], eax |
shr eax, 12 |
mov edx, eax |
mov [pg_data.pages_count-OS_BASE], eax |
shr eax, 3 |
mov [pg_data.pagemap_size-OS_BASE], eax |
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 |
mov edi, sys_pgdir-OS_BASE |
mov ecx, 4096/4 |
cld |
rep stosd |
mov edx, (sys_pgdir-OS_BASE)+ 0x800; (OS_BASE shr 20) |
bt [cpu_caps-OS_BASE], CAPS_PSE |
jnc .no_PSE |
mov ebx, cr4 |
or ebx, CR4_PSE |
mov eax, PG_LARGE+PG_SW |
bt [cpu_caps-OS_BASE], CAPS_PGE |
jnc @F |
or eax, PG_GLOBAL |
or ebx, CR4_PGE |
@@: |
mov cr4, ebx |
sub [pg_data.kernel_tables-OS_BASE], 1 |
mov [edx], eax |
add eax, 0x00400000 |
; mov [edx+4], eax |
add edx, 4 |
mov eax, 0x400000+PG_SW |
mov ecx, (tmp_page_tab-0x400000)/4096 |
jmp .map_low |
.no_PSE: |
mov eax, PG_SW |
mov ecx, tmp_page_tab/4096 |
.map_low: |
mov edi, tmp_page_tab |
@@: ; |
stosd |
add eax, 0x1000 |
dec ecx |
jnz @B |
mov ecx, [pg_data.kernel_tables-OS_BASE] |
shl ecx, 10 |
xor eax, eax |
rep stosd |
mov ecx, [pg_data.kernel_tables-OS_BASE] |
mov eax, tmp_page_tab+PG_SW |
mov edi, edx |
.map_kernel_tabs: |
stosd |
add eax, 0x1000 |
dec ecx |
jnz .map_kernel_tabs |
mov dword [sys_pgdir-OS_BASE+(page_tabs shr 20)], sys_pgdir+PG_SW-OS_BASE |
mov edi, (sys_pgdir-OS_BASE) |
lea esi, [edi+(OS_BASE shr 20)] |
lodsd |
and eax, not PG_GLOBAL |
stosd |
lodsd |
and eax, not PG_GLOBAL |
stosd |
lodsd |
and eax, not PG_GLOBAL |
stosd |
ret |
endp |
align 4 |
proc init_page_map |
mov edi, sys_pgmap-OS_BASE |
mov ecx, ((HEAP_BASE-OS_BASE)/4096)/32 ;384/4 |
mov ebx, ecx |
xor eax,eax |
cld |
rep stosd |
not eax |
mov ecx, [pg_data.pagemap_size-OS_BASE] |
sub ecx, ebx |
shr ecx, 2 |
rep stosd |
lea edi, [sys_pgmap-OS_BASE+ebx*4] ;+384 |
mov edx, [pg_data.pages_count-OS_BASE] |
mov ecx, [pg_data.kernel_tables-OS_BASE] |
add ecx, ((HEAP_BASE-OS_BASE)/4096) and 31 |
sub edx, (HEAP_BASE-OS_BASE)/4096 |
sub edx, ecx |
mov [pg_data.pages_free-OS_BASE], edx |
xor eax, eax |
mov ebx, ecx |
shr ecx, 5 |
rep stosd |
not eax |
mov ecx, ebx |
and ecx, 31 |
shl eax, cl |
mov [edi], eax |
add edi, OS_BASE |
mov [page_start-OS_BASE], edi; |
mov ebx, sys_pgmap |
add ebx, [pg_data.pagemap_size-OS_BASE] |
mov [page_end-OS_BASE], ebx |
mov [pg_data.pg_mutex-OS_BASE], 0 |
ret |
endp |
align 4 |
proc test_cpu |
locals |
cpu_type dd ? |
cpu_id dd ? |
cpu_Intel dd ? |
cpu_AMD dd ? |
endl |
mov [cpu_type], 0 |
xor eax, eax |
mov [cpu_caps-OS_BASE], eax |
mov [cpu_caps+4-OS_BASE], eax |
pushfd |
pop eax |
mov ecx, eax |
xor eax, 0x40000 |
push eax |
popfd |
pushfd |
pop eax |
xor eax, ecx |
mov [cpu_type], CPU_386 |
jz .end_cpuid |
push ecx |
popfd |
mov [cpu_type], CPU_486 |
mov eax, ecx |
xor eax, 0x200000 |
push eax |
popfd |
pushfd |
pop eax |
xor eax, ecx |
je .end_cpuid |
mov [cpu_id], 1 |
xor eax, eax |
cpuid |
mov [cpu_vendor-OS_BASE], ebx |
mov [cpu_vendor+4-OS_BASE], edx |
mov [cpu_vendor+8-OS_BASE], ecx |
cmp ebx, dword [intel_str-OS_BASE] |
jne .check_AMD |
cmp edx, dword [intel_str+4-OS_BASE] |
jne .check_AMD |
cmp ecx, dword [intel_str+8-OS_BASE] |
jne .check_AMD |
mov [cpu_Intel], 1 |
cmp eax, 1 |
jl .end_cpuid |
mov eax, 1 |
cpuid |
mov [cpu_sign-OS_BASE], eax |
mov [cpu_info-OS_BASE], ebx |
mov [cpu_caps-OS_BASE], edx |
mov [cpu_caps+4-OS_BASE],ecx |
shr eax, 8 |
and eax, 0x0f |
ret |
.end_cpuid: |
mov eax, [cpu_type] |
ret |
.check_AMD: |
cmp ebx, dword [AMD_str-OS_BASE] |
jne .unknown |
cmp edx, dword [AMD_str+4-OS_BASE] |
jne .unknown |
cmp ecx, dword [AMD_str+8-OS_BASE] |
jne .unknown |
mov [cpu_AMD], 1 |
cmp eax, 1 |
jl .unknown |
mov eax, 1 |
cpuid |
mov [cpu_sign-OS_BASE], eax |
mov [cpu_info-OS_BASE], ebx |
mov [cpu_caps-OS_BASE], edx |
mov [cpu_caps+4-OS_BASE],ecx |
shr eax, 8 |
and eax, 0x0f |
ret |
.unknown: |
mov eax, 1 |
cpuid |
mov [cpu_sign-OS_BASE], eax |
mov [cpu_info-OS_BASE], ebx |
mov [cpu_caps-OS_BASE], edx |
mov [cpu_caps+4-OS_BASE],ecx |
shr eax, 8 |
and eax, 0x0f |
ret |
endp |
Property changes: |
Added: svn:keywords |
+Rev |
\ No newline at end of property |
/kernel/trunk/kernel.asm |
---|
61,20 → 61,18 |
include "lang.inc" |
include "const.inc" |
max_processes equ 255 |
tss_step equ (128+8192) ; tss & i/o - 65535 ports, * 256=557056*4 |
;WinMapAddress equ 0x460000 |
;display_data = 0x460000 |
max_processes equ 255 |
os_stack equ (os_data_l-gdts) ; GDTs |
os_code equ (os_code_l-gdts) |
graph_data equ (3+graph_data_l-gdts) |
tss0 equ (tss0_l-gdts) |
app_code equ (3+app_code_l-gdts) |
app_data equ (3+app_data_l-gdts) |
;window_data equ 0x0000 |
;tss_data equ 0xD20000 |
tss_step equ (128+8192) ; tss & i/o - 65535 ports, * 256=557056*4 |
;draw_data equ 0xC00000 |
;sysint_stack_data equ 0xC03000 |
;twdw equ (0x3000-window_data) |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; |
;; Included files: |
109,58 → 107,33 |
org 0x0 |
jmp start_of_code |
; mike.dld { |
org $+0x10000 |
db 0 |
dd servetable-0x10000 |
draw_line dd __sys_draw_line |
disable_mouse dd __sys_disable_mouse |
draw_pointer dd __sys_draw_pointer |
;//mike.dld, 2006-08-02 [ |
;drawbar dd __sys_drawbar |
drawbar dd __sys_drawbar.forced |
;//mike.dld, 2006-08-02 ] |
putpixel dd __sys_putpixel |
; } mike.dld |
version db 'Kolibri OS version 0.6.5.0 ',13,10,13,10,0 |
;dd endofcode-0x10000 |
;db 'Boot02' |
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
include "boot/bootstr.inc" ; language-independent boot messages |
include "boot/preboot.inc" |
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
preboot_lfb db 0 |
preboot_bootlog db 0 |
if lang eq en |
include "boot/booteng.inc" ; english system boot messages |
else if lang eq ru |
include "boot/bootru.inc" ; russian system boot messages |
include "boot/ru.inc" ; Russian font |
else if lang eq et |
include "boot/bootet.inc" ; estonian system boot messages |
include "boot/et.inc" ; Estonian font |
else |
include "boot/bootge.inc" ; german system boot messages |
end if |
include "boot/bootcode.inc" ; 16 bit system boot code |
include "bus/pci/pci16.inc" |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; 16 BIT INCLUDED FILES ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
include "kernel16.inc" |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; SWITCH TO 32 BIT PROTECTED MODE ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
os_data = os_data_l-gdts ; GDTs |
os_code = os_code_l-gdts |
int_code equ int_code_l-gdts |
int_data equ int_data_l-gdts |
tss0sys equ tss0sys_l-gdts |
graph_data equ 3+graph_data_l-gdts |
tss0 equ tss0_l-gdts |
app_code equ 3+app_code_l-gdts |
app_data equ 3+app_data_l-gdts |
; CR0 Flags - Protected mode and Paging |
mov ecx, CR0_PE |
167,7 → 140,7 |
; Enabling 32 bit protected mode |
sidt [cs:old_ints_h-0x10000] |
sidt [cs:old_ints_h] |
cli ; disable all irqs |
cld |
189,187 → 162,174 |
jnz l.7 |
mov al, 0xFF |
out 0x64, al |
lgdt [cs:gdts-0x10000] ; Load GDT |
mov eax, cr0 ; Turn on paging // protected mode |
lgdt [cs:tmp_gdt] ; Load GDT |
mov eax, cr0 ; protected mode |
or eax, ecx |
and eax, 10011111b *65536*256 + 0xffffff ; caching enabled |
mov cr0, eax |
jmp $+2 |
org $+0x10000 |
mov ax,os_data ; Selector for os |
mov ds,ax |
mov es,ax |
mov fs,ax |
mov gs,ax |
mov ss,ax |
mov esp,0x3ec00 ; Set stack |
jmp pword os_code:B32 ; jmp to enable 32 bit mode |
if gdte >= $ |
error 'GDT overlaps with used code!' |
end if |
include "boot/shutdown.inc" ; shutdown or restart |
use32 |
align 8 |
tmp_gdt: |
include 'unpacker.inc' |
dw 23 |
dd tmp_gdt+0x10000 |
dw 0 |
__DEBUG__ fix 1 |
__DEBUG_LEVEL__ fix 1 |
include 'fdo.inc' |
dw 0xffff |
dw 0x0000 |
db 0x00 |
dw 11011111b *256 +10011010b |
db 0x00 |
iglobal |
boot_memdetect db 'Determining amount of memory',0 |
boot_fonts db 'Fonts loaded',0 |
boot_tss db 'Setting TSSs',0 |
boot_cpuid db 'Reading CPUIDs',0 |
boot_devices db 'Detecting devices',0 |
boot_timer db 'Setting timer',0 |
boot_irqs db 'Reprogramming IRQs',0 |
boot_setmouse db 'Setting mouse',0 |
boot_windefs db 'Setting window defaults',0 |
boot_bgr db 'Calculating background',0 |
boot_resirqports db 'Reserving IRQs & ports',0 |
boot_setrports db 'Setting addresses for IRQs',0 |
boot_setostask db 'Setting OS task',0 |
boot_allirqs db 'Unmasking all IRQs',0 |
boot_tsc db 'Reading TSC',0 |
boot_pal_ega db 'Setting EGA/CGA 320x200 palette',0 |
boot_pal_vga db 'Setting VGA 640x480 palette',0 |
boot_mtrr db 'Setting MTRR',0 |
boot_tasking db 'All set - press ESC to start',0 |
endg |
dw 0xffff |
dw 0x0000 |
db 0x00 |
dw 11011111b *256 +10010010b |
db 0x00 |
iglobal |
boot_y dd 10 |
endg |
include "data16.inc" |
boot_log: |
pushad |
use32 |
org $+0x10000 |
mov eax,10*65536 |
mov ax,word [boot_y] |
add [boot_y],dword 10 |
mov ebx,0x80ffffff ; ASCIIZ string with white color |
mov ecx,esi |
mov edi,1 |
call dtext |
mov [novesachecksum],1000 |
call checkVga_N13 |
cmp [preboot_blogesc],byte 1 |
je .bll2 |
cmp esi,boot_tasking |
jne .bll2 |
; begin ealex 04.08.05 |
; in al,0x61 |
; and al,01111111b |
; out 0x61,al |
; end ealex 04.08.05 |
.bll1: in al,0x60 ; wait for ESC key press |
cmp al,129 |
jne .bll1 |
.bll2: popad |
ret |
iglobal |
firstapp db '/rd/1/LAUNCHER',0 |
vrr_m db '/rd/1/VRR_M',0 |
char dd 0,0,0 |
dd 2560 |
dd 0x3F600 - std_application_base_address |
db '/RD/1/FONTS/CHAR.MT',0 |
char2 dd 0,0,0 |
dd 2560 |
dd 0x3EC00 - std_application_base_address |
db '/RD/1/FONTS/CHAR2.MT',0 |
;char db 'FONTS/CHAR.MT',0 |
;char2 db 'FONTS/CHAR2.MT',0 |
bootpath db '/KOLIBRI ' |
bootpath2 db 0 |
; vmode db 'drivers/VMODE.MDR',0 |
vmode dd 0,0,0 |
dd 0x8000 |
dd 0x760000 - std_application_base_address |
db '/RD/1/drivers/VMODE.MDR',0 |
endg |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; 32 BIT ENTRY ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
align 4 |
B32: |
; CLEAR 0x280000-0xF00000 |
mov ax,os_stack ; Selector for os |
mov ds,ax |
mov es,ax |
mov fs,ax |
mov gs,ax |
mov ss,ax |
mov esp,0x3ec00 ; Set stack |
; CLEAR 0x280000 - HEAP_BASE |
xor eax,eax |
mov edi,0x280000 |
mov ecx,(0x100000*0xF-0x280000) / 4 |
mov ecx,(HEAP_BASE-OS_BASE-0x280000) / 4 |
cld |
rep stosd |
; CLEAR 0x80000-0x90000 |
; xor eax,eax |
mov edi,0x80000 |
mov ecx,(0x90000-0x80000)/4 |
; cld |
mov edi,0x40000 |
mov ecx,(0x90000-0x40000)/4 |
rep stosd |
; CLEAR KERNEL UNDEFINED GLOBALS |
mov edi, endofcode |
mov edi, endofcode-OS_BASE |
mov ecx, (uglobals_size/4)+4 |
rep stosd |
; SAVE & CLEAR 0-0xffff |
mov esi,0x0000 |
xor esi, esi |
mov edi,0x2F0000 |
mov ecx,0x10000 / 4 |
cld |
rep movsd |
xor eax,eax |
mov edi,0 |
xor edi, edi |
mov ecx,0x10000 / 4 |
cld |
rep stosd |
call test_cpu |
bts [cpu_caps-OS_BASE], CAPS_TSC ;force use rdtsc |
; MEMORY MODEL |
call mem_test |
call init_mem |
call init_page_map |
; ENABLE PAGING |
mov eax, sys_pgdir-OS_BASE |
mov cr3, eax |
mov eax,cr0 |
or eax,CR0_PG+CR0_WP |
mov cr0,eax |
lgdt [gdts] |
jmp pword os_code:high_code |
__DEBUG__ fix 1 |
__DEBUG_LEVEL__ fix 1 |
include 'init.inc' |
org OS_BASE+$ |
align 4 |
high_code: |
mov ax,os_stack |
mov bx,app_data |
mov ss,ax |
add esp, OS_BASE |
mov ds,bx |
mov es,bx |
mov fs,bx |
mov gs,bx |
mov dword [sys_pgdir], 0 |
mov dword [sys_pgdir+4], 0 |
mov dword [sys_pgdir+8], 0 |
mov eax, cr3 |
mov cr3, eax ; flush TLB |
; SAVE REAL MODE VARIABLES |
mov ax, [0x2f0000 + 0x9031] |
mov ax, [BOOT_VAR + 0x9031] |
mov [IDEContrRegsBaseAddr], ax |
; --------------- APM --------------------- |
mov eax, [0x2f0000 + 0x9040] ; entry point |
mov dword[apm_entry], eax |
; 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, [0x2f0000 + 0x9044] ; version & flags |
mov eax, [BOOT_VAR + 0x9044] ; version & flags |
mov [apm_vf], eax |
; ----------------------------------------- |
; movzx eax,byte [0x2f0000+0x9010] ; mouse port |
; movzx eax,byte [BOOT_VAR+0x9010] ; mouse port |
; mov [0xF604],byte 1 ;al |
mov al, [0x2F0000+0x901F] ; DMA writing |
mov al, [BOOT_VAR+0x901F] ; DMA writing |
mov [allow_dma_write], al |
mov al,[0x2f0000+0x9000] ; bpp |
mov al,[BOOT_VAR+0x9000] ; bpp |
mov [ScreenBPP],al |
movzx eax,word [0x2f0000+0x900A] ; X max |
movzx eax,word [BOOT_VAR+0x900A] ; X max |
dec eax |
mov [ScreenWidth],eax |
mov [screen_workarea.right],eax |
movzx eax,word [0x2f0000+0x900C] ; Y max |
movzx eax,word [BOOT_VAR+0x900C] ; Y max |
dec eax |
mov [ScreenHeight],eax |
mov [screen_workarea.bottom],eax |
movzx eax,word [0x2f0000+0x9008] ; screen mode |
movzx eax,word [BOOT_VAR+0x9008] ; screen mode |
mov [SCR_MODE],eax |
mov eax,[0x2f0000+0x9014] ; Vesa 1.2 bnk sw add |
mov eax,[BOOT_VAR+0x9014] ; Vesa 1.2 bnk sw add |
mov [BANK_SWITCH],eax |
mov [BytesPerScanLine],word 640*4 ; Bytes PerScanLine |
cmp [SCR_MODE],word 0x13 ; 320x200 |
376,22 → 336,14 |
je @f |
cmp [SCR_MODE],word 0x12 ; VGA 640x480 |
je @f |
mov ax,[0x2f0000+0x9001] ; for other modes |
mov ax,[BOOT_VAR+0x9001] ; for other modes |
mov [BytesPerScanLine],ax |
@@: |
; GRAPHICS ADDRESSES |
;mov eax,0x100000*8 ; LFB address |
;cmp [0xfe0c],word 0x13 |
;je no_d_lfb |
;cmp [0xfe0c],word 0x12 |
;je no_d_lfb |
;cmp [0x2f0000+0x901e],byte 1 |
;jne no_d_lfb |
mov byte [0x2f0000+0x901e],0x0 |
mov eax,[0x2f0000+0x9018] |
;no_d_lfb: |
mov byte [BOOT_VAR+0x901e],0x0 |
mov eax,[BOOT_VAR+0x9018] |
mov [LFBAddress],eax |
cmp [SCR_MODE],word 0100000000000000b |
399,39 → 351,28 |
cmp [SCR_MODE],word 0x13 |
je v20ga32 |
mov [PUTPIXEL],dword Vesa12_putpixel24 ; Vesa 1.2 |
mov [0xe024],dword Vesa12_getpixel24 |
mov [GETPIXEL],dword Vesa12_getpixel24 |
cmp [ScreenBPP],byte 24 |
jz ga24 |
mov [PUTPIXEL],dword Vesa12_putpixel32 |
mov [0xe024],dword Vesa12_getpixel32 |
mov [GETPIXEL],dword Vesa12_getpixel32 |
ga24: |
jmp v20ga24 |
setvesa20: |
mov [PUTPIXEL],dword Vesa20_putpixel24 ; Vesa 2.0 |
mov [0xe024],dword Vesa20_getpixel24 |
mov [GETPIXEL],dword Vesa20_getpixel24 |
cmp [ScreenBPP],byte 24 |
jz v20ga24 |
v20ga32: |
mov [PUTPIXEL],dword Vesa20_putpixel32 |
mov [0xe024],dword Vesa20_getpixel32 |
mov [GETPIXEL],dword Vesa20_getpixel32 |
v20ga24: |
cmp [SCR_MODE],word 0x12 ; 16 C VGA 640x480 |
jne no_mode_0x12 |
mov [PUTPIXEL],dword VGA_putpixel |
mov [0xe024],dword Vesa20_getpixel32 |
mov [GETPIXEL],dword Vesa20_getpixel32 |
no_mode_0x12: |
call test_cpu |
; btr [cpu_caps], CAPS_SSE ;test: dont't use sse code |
; btr [cpu_caps], CAPS_SSE2 ;test: don't use sse2 |
; btr [cpu_caps], CAPS_FXSR ;test: disable sse support |
;all sse commands rise #UD exption |
; btr [cpu_caps], CAPS_PSE ;test: don't use large pages |
; btr [cpu_caps], CAPS_PGE ;test: don't use global pages |
; btr [cpu_caps], CAPS_MTRR ;test: don't use MTRR |
bts [cpu_caps], CAPS_TSC ;force use rdtsc |
; -------- Fast System Call init ---------- |
; Intel SYSENTER/SYSEXIT (AMD CPU support it too) |
bt [cpu_caps], CAPS_SEP |
468,7 → 409,7 |
; and the contents of this field, plus 8, are copied into the SS register. |
; mov edx, (os_code + 16) * 65536 + os_code |
mov edx, 0x1B0013 |
mov edx, 0x1B0008 |
mov eax, syscall_entry |
mov ecx, MSR_AMD_STAR |
476,32 → 417,48 |
.noSYSCALL: |
; ----------------------------------------- |
; LOAD IDT |
call build_interrupt_table |
lidt [idtreg] |
; MEMORY MODEL |
call mem_test |
call init_mtrr |
call init_mem |
call init_page_map |
call init_kernel_heap |
stdcall kernel_alloc, RING0_STACK_SIZE+512 |
mov [os_stack_seg], eax |
; ENABLE PAGING |
mov eax, sys_pgdir |
mov cr3, eax |
lea esp, [eax+RING0_STACK_SIZE] |
mov eax,cr0 |
or eax,CR0_PG |
mov cr0,eax |
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 |
call init_kernel_heap |
stdcall kernel_alloc, RING0_STACK_SIZE+512 |
mov [os_stack], eax |
mov ax,tss0 |
ltr ax |
mov [LFBSize], 0x800000 |
call init_mtrr |
call init_LFB |
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 |
527,7 → 484,6 |
mov [ipc_ptab], eax |
call init_events |
mov eax, srv.fd-SRV_FD_OFFSET |
mov [srv.fd], eax |
mov [srv.bk], eax |
545,14 → 501,11 |
mov [graph_data_l+7],ah |
; BUILD SCHEDULER |
mov [CURRENT_TASK],dword 1 |
mov [TASK_COUNT],dword 1 |
mov [TASK_BASE],dword TASK_DATA |
mov [current_slot], SLOT_BASE+256 |
call build_scheduler ; sys32.inc |
; LOAD IDT |
lidt [cs:idtreg] |
cli |
;!!!!!!!!!!!!!!!!!!!!!!!!!! |
include 'detect/disks.inc' |
;!!!!!!!!!!!!!!!!!!!!!!!!!! |
575,32 → 528,18 |
; LOAD FONTS I and II |
mov [CURRENT_TASK],dword 1 |
mov [TASK_COUNT],dword 1 |
mov [TASK_BASE],dword TASK_DATA |
mov esi,char |
xor ebx,ebx |
mov ecx,2560 |
mov edx,FONT_I |
call fs_RamdiskRead |
pushad |
push eax |
mov eax,char - std_application_base_address |
call file_system_lfn |
mov eax,char2 - std_application_base_address |
call file_system_lfn |
pop eax |
popad |
mov esi,char2 |
xor ebx,ebx |
mov ecx,2560;26000 |
mov edx,FONT_II |
call fs_RamdiskRead |
; mov esi,char |
; xor ebx,ebx |
; mov ecx,2560;26000 |
; mov edx,FONT_I |
; call fs_RamdiskRead |
; mov esi,char2 |
; xor ebx,ebx |
; mov ecx,2560;26000 |
; mov edx,FONT_II |
; call fs_RamdiskRead |
mov esi,boot_fonts |
call boot_log |
627,6 → 566,10 |
mov esi,boot_tss |
call boot_log |
; BUILD SCHEDULER |
call build_scheduler ; sys32.inc |
mov esi,boot_devices |
call boot_log |
call detect_devices |
679,19 → 622,23 |
mov esi,boot_setostask |
call boot_log |
; mov eax, fpu_data |
; mov dword [SLOT_BASE+APPDATA.fpu_state], eax |
; mov dword [SLOT_BASE+APPDATA.fpu_handler], 0 |
; mov dword [SLOT_BASE+APPDATA.sse_handler], 0 |
mov eax, fpu_data |
mov dword [SLOT_BASE+APPDATA.fpu_state], eax |
mov dword [SLOT_BASE+APPDATA.fpu_handler], 0 |
mov dword [SLOT_BASE+APPDATA.sse_handler], 0 |
; name for OS/IDLE process |
mov dword [SLOT_BASE+256+APPDATA.app_name], dword 'OS/I' |
mov dword [SLOT_BASE+256+APPDATA.app_name+4], dword 'DLE ' |
mov edi, [os_stack] |
mov edi, [os_stack_seg] |
mov dword [SLOT_BASE+256+APPDATA.pl0_stack], edi |
add edi, RING0_STACK_SIZE |
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 |
700,8 → 647,6 |
mov dword [SLOT_BASE+256+APPDATA.fpu_handler], 0 |
mov dword [SLOT_BASE+256+APPDATA.sse_handler], 0 |
mov ebx, [def_cursor] |
mov dword [SLOT_BASE+256+APPDATA.cursor], ebx |
mov ebx, SLOT_BASE+256+APP_OBJ_OFFSET |
709,38 → 654,19 |
mov dword [SLOT_BASE+256+APPDATA.bk_obj], ebx |
; task list |
mov [CURRENT_TASK],dword 1 |
mov [TASK_COUNT],dword 1 |
mov [current_slot], SLOT_BASE+256 |
mov [TASK_BASE],dword TASK_DATA |
mov [TASK_DATA+TASKDATA.wnd_number], 1 ; on screen number |
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+tss_step |
mov [edi+TSS._ss0], os_data |
mov eax,cr3 |
mov [edi+TSS._cr3],eax |
mov [edi+TSS._eip],osloop |
mov [edi+TSS._eflags],dword 0x11202 ; sti and resume |
mov eax, [os_stack] |
add eax, RING0_STACK_SIZE |
mov [edi+TSS._esp], eax |
mov [edi+TSS._cs],os_code |
mov [edi+TSS._ss],os_data |
mov [edi+TSS._ds],os_data |
mov [edi+TSS._es],os_data |
mov [edi+TSS._fs],os_data |
mov [edi+TSS._gs],os_data |
mov ax,tss0 |
ltr ax |
call init_cursors |
mov eax, [def_cursor] |
mov [SLOT_BASE+APPDATA.cursor],eax |
mov [SLOT_BASE+APPDATA.cursor+256],eax |
; READ TSC / SECOND |
mov esi,boot_tsc |
791,11 → 717,21 |
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 |
mov [CURRENT_TASK],dword 1 |
mov [TASK_COUNT],dword 1 |
cli |
cmp byte [0x2f0000+0x9030],1 |
cmp byte [BOOT_VAR+0x9030],1 |
jne no_load_vrr_m |
mov ebp, vrr_m |
820,7 → 756,6 |
;mov [TASK_COUNT],dword 2 |
mov [CURRENT_TASK],dword 1 ; set OS task fisrt |
; SET KEYBOARD PARAMETERS |
mov al, 0xf6 ; reset keyboard, scan enabled |
call kb_write |
882,11 → 817,54 |
cmp [IDEContrRegsBaseAddr], 0 |
setnz [dma_hdd] |
; stdcall init_uart_service, DRV_ENTRY |
sti |
call change_task |
jmp osloop |
jmp $ ; wait here for timer to take control |
; Fly :) |
include 'unpacker.inc' |
include 'fdo.inc' |
align 4 |
boot_log: |
pushad |
mov eax,10*65536 |
mov ax,word [boot_y] |
add [boot_y],dword 10 |
mov ebx,0x80ffffff ; ASCIIZ string with white color |
mov ecx,esi |
mov edi,1 |
call dtext |
mov [novesachecksum],1000 |
call checkVga_N13 |
cmp [preboot_blogesc+OS_BASE+0x10000],byte 1 |
je .bll2 |
cmp esi,boot_tasking |
jne .bll2 |
; begin ealex 04.08.05 |
; in al,0x61 |
; and al,01111111b |
; out 0x61,al |
; end ealex 04.08.05 |
.bll1: in al,0x60 ; wait for ESC key press |
cmp al,129 |
jne .bll1 |
.bll2: popad |
ret |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
; ; |
; MAIN OS LOOP START ; |
990,13 → 968,14 |
pushad |
mov [irq_owner+4*0],byte 1 ; timer |
mov [irq_owner+4*1],byte 1 ; keyboard |
mov [irq_owner+4*5],byte 1 ; sound blaster |
mov [irq_owner+4*6],byte 1 ; floppy diskette |
mov [irq_owner+4*13],byte 1 ; math co-pros |
mov [irq_owner+4*14],byte 1 ; ide I |
mov [irq_owner+4*15],byte 1 ; ide II |
mov [irq_owner+4*0], 1 ; timer |
mov [irq_owner+4*1], 1 ; keyboard |
mov [irq_owner+4*5], 1 ; sound blaster |
mov [irq_owner+4*6], 1 ; floppy diskette |
mov [irq_owner+4*13], 1 ; math co-pros |
mov [irq_owner+4*14], 1 ; ide I |
mov [irq_owner+4*15], 1 ; ide II |
; movzx eax,byte [0xf604] ; mouse irq |
; dec eax |
; add eax,mouseirqtable |
1089,10 → 1068,10 |
; mov [MOUSE_X],dword 100*65536+100 ; mouse x/y |
push eax |
mov ax,[0x2f0000+0x900c] |
mov ax,[BOOT_VAR+0x900c] |
shr ax,1 |
shl eax,16 |
mov ax,[0x2f0000+0x900A] |
mov ax,[BOOT_VAR+0x900A] |
shr ax,1 |
mov [MOUSE_X],eax |
pop eax |
1103,7 → 1082,7 |
;!! IP 04.02.2005: |
mov [next_usage_update], 100 |
mov byte [0xFFFF], 0 ; change task if possible |
mov byte [DONT_SWITCH], 0 ; change task if possible |
ret |
1413,11 → 1392,15 |
mov eax,[esp+64+32-8+4] |
push edx ; add window start x & y |
mov edx,[TASK_BASE] |
mov edi,[CURRENT_TASK] |
shl edi,8 |
mov ebx,[edx-twdw+WDATA.box.left] |
add ebx, [(edx-CURRENT_TASK)*8+SLOT_BASE+APPDATA.wnd_clientbox.left] |
add ebx,[edi+SLOT_BASE+APPDATA.wnd_clientbox.left] |
shl ebx,16 |
add ebx,[edx-twdw+WDATA.box.top] |
add ebx, [(edx-CURRENT_TASK)*8+SLOT_BASE+APPDATA.wnd_clientbox.top] |
add ebx,[edi+SLOT_BASE+APPDATA.wnd_clientbox.top] |
add eax,ebx |
pop edx |
mov ebx,[esp+64+32-12+4] |
1656,7 → 1639,6 |
mov [esp+36],dword -1 |
ret |
align 4 |
sys_getsetup: |
1828,9 → 1810,9 |
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 |
2001,7 → 1983,7 |
ret |
sysfn_shutdown: ; 18.1 = BOOT |
mov [0x2f0000+0x9030],byte 0 |
mov [BOOT_VAR+0x9030],byte 0 |
for_shutdown_parameter: |
mov eax,[TASK_COUNT] |
2125,7 → 2107,7 |
jl exit_for_anyone |
cmp ebx,4 |
jg exit_for_anyone |
mov [0x2f0000+0x9030],bl |
mov [BOOT_VAR+0x9030],bl |
jmp for_shutdown_parameter |
sysfn_minimize: ; 18.10 = minimize window |
2596,7 → 2578,7 |
mov esi,[esp] |
shl esi,5 |
add esi,window_data + WDATA.box |
mov al,[esi+window_data+WDATA.fl_wstate] |
mov al,[esi+WDATA.fl_wstate] |
mov [edi],al |
pop ebx |
2608,9 → 2590,6 |
mov [esp+36],eax |
ret |
align 4 |
sys_clock: |
cli |
2870,7 → 2849,7 |
mov ecx,[edi*8+SLOT_BASE+APPDATA.wnd_caption] |
or ecx,ecx |
jz @f |
add ecx,[edi+twdw+TASKDATA.mem_start] |
add ecx,[edi+CURRENT_TASK+TASKDATA.mem_start] |
movzx eax,[edi+window_data+WDATA.fl_wstyle] |
and al,0x0F |
3343,9 → 3322,6 |
pop edx eax |
ret |
uglobal |
mouse_active db 0 |
endg |
iglobal |
cpustring db '/RD/1/CPU',0 |
endg |
3362,12 → 3338,12 |
cmp [ctrl_alt_del], 1 |
jne nocpustart |
mov ebp, cpustring |
call fs_execute ; SPraid 8.03.2007 |
;lea esi,[ebp+6] |
;xor ebx,ebx ; no parameters |
;xor edx,edx ; no flags |
;call fs_RamdiskExecute.flags |
lea esi,[ebp+6] |
xor ebx,ebx ; no parameters |
xor edx,edx ; no flags |
call fs_RamdiskExecute.flags |
mov [ctrl_alt_del], 0 |
nocpustart: |
cmp [mouse_active], 1 |
jne mouse_not_active |
3376,11 → 3352,10 |
mov ecx, [TASK_COUNT] |
set_mouse_event: |
add edi, 256 |
or [edi+SLOT_BASE+APPDATA.event_mask], dword 00100000b |
or [edi+SLOT_BASE+APPDATA.event_mask], dword 100000b |
loop set_mouse_event |
mouse_not_active: |
cmp [REDRAW_BACKGROUND],byte 0 ; background update ? |
jz nobackgr |
cmp [background_defined], 0 |
3399,7 → 3374,6 |
nobackgr: |
; system shutdown request |
cmp [SYS_SHUTDOWN],byte 0 |
3411,7 → 3385,7 |
cmp [SYS_SHUTDOWN],dl |
jne no_mark_system_shutdown |
mov edx,0x3040 |
mov edx,OS_BASE+0x3040 |
movzx ecx,byte [SYS_SHUTDOWN] |
add ecx,5 |
markz: |
3450,8 → 3424,6 |
ret |
; redraw screen |
redrawscreen: |
3810,25 → 3782,23 |
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 |
3836,7 → 3806,8 |
siar1: |
or [edi],byte bl ; disable access - ebp = 1 |
bts [edi], eax |
; or [edi],byte bl ; disable access - ebp = 1 |
popad |
4063,7 → 4034,7 |
mov edx,ecx |
mov ecx,ebx |
lea ebx, [eax+std_application_base_address] |
mov ebx, eax |
sys_putimage: |
test ecx,0x80008000 |
4075,11 → 4046,10 |
.exit: |
ret |
@@: |
mov edi,[CURRENT_TASK] |
shl edi,8 |
add dx,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.top] |
mov edi,[current_slot] |
add dx,word[edi+APPDATA.wnd_clientbox.top] |
rol edx,16 |
add dx,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.left] |
add dx,word[edi+APPDATA.wnd_clientbox.left] |
rol edx,16 |
.forced: |
push ebp esi 0 |
4105,11 → 4075,11 |
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] |
4178,12 → 4148,11 |
; edi color |
__sys_drawbar: |
mov esi,[CURRENT_TASK] |
shl esi,8 |
add eax,[esi+SLOT_BASE+APPDATA.wnd_clientbox.left] |
add ecx,[esi+SLOT_BASE+APPDATA.wnd_clientbox.left] |
add ebx,[esi+SLOT_BASE+APPDATA.wnd_clientbox.top] |
add edx,[esi+SLOT_BASE+APPDATA.wnd_clientbox.top] |
mov esi,[current_slot] |
add eax,[esi+APPDATA.wnd_clientbox.left] |
add ecx,[esi+APPDATA.wnd_clientbox.left] |
add ebx,[esi+APPDATA.wnd_clientbox.top] |
add edx,[esi+APPDATA.wnd_clientbox.top] |
.forced: |
inc [mouse_pause] |
; call [disable_mouse] |
4712,10 → 4681,9 |
mov edx,[TASK_BASE] |
add eax,[edx-twdw+WDATA.box.left] |
add ebx,[edx-twdw+WDATA.box.top] |
mov edi,[CURRENT_TASK] |
shl edi,8 |
add eax,[edi+SLOT_BASE+APPDATA.wnd_clientbox.left] |
add ebx,[edi+SLOT_BASE+APPDATA.wnd_clientbox.top] |
mov edi,[current_slot] |
add eax,[edi+APPDATA.wnd_clientbox.left] |
add ebx,[edi+APPDATA.wnd_clientbox.top] |
xor edi,edi ; no force |
; mov edi,1 |
call [disable_mouse] |
4728,12 → 4696,11 |
mov edi,[TASK_BASE] |
mov ebp,[edi-twdw+WDATA.box.left] |
push esi |
mov esi,[CURRENT_TASK] |
shl esi,8 |
add ebp,[esi+SLOT_BASE+APPDATA.wnd_clientbox.left] |
mov esi,[current_slot] |
add ebp,[esi+APPDATA.wnd_clientbox.left] |
shl ebp,16 |
add ebp,[edi-twdw+WDATA.box.top] |
add bp,word[esi+SLOT_BASE+APPDATA.wnd_clientbox.top] |
add bp,word[esi+APPDATA.wnd_clientbox.top] |
pop esi |
add ecx,[edi+TASKDATA.mem_start] |
add eax,ebp |
4768,10 → 4735,9 |
shr eax,16 |
movzx edx,bx |
shr ebx,16 |
mov esi,[CURRENT_TASK] |
shl esi,8 |
add eax,[esi+SLOT_BASE+APPDATA.wnd_clientbox.left] |
add ebx,[esi+SLOT_BASE+APPDATA.wnd_clientbox.top] |
mov esi,[current_slot] |
add eax,[esi+APPDATA.wnd_clientbox.left] |
add ebx,[esi+APPDATA.wnd_clientbox.top] |
add ecx,eax |
add edx,ebx |
jmp [drawbar] |
4828,7 → 4794,7 |
div ecx |
mov ebx,edx |
xchg eax,ebx |
call dword [0xe024] |
call dword [GETPIXEL] |
mov [esp+36],ecx |
ret |
4850,17 → 4816,16 |
mov edi,[TASK_BASE] |
movzx edx,word[edi-twdw+WDATA.box.left] |
mov ebp,edx |
mov esi,[CURRENT_TASK] |
shl esi,8 |
add ebp,[esi+SLOT_BASE+APPDATA.wnd_clientbox.left] |
add dx,word[esi+SLOT_BASE+APPDATA.wnd_clientbox.left] |
mov esi,[current_slot] |
add ebp,[esi+APPDATA.wnd_clientbox.left] |
add dx,word[esi+APPDATA.wnd_clientbox.left] |
shl edx,16 |
add ebp,edx |
movzx edx,word[edi-twdw+WDATA.box.top] |
add eax,ebp |
mov ebp,edx |
add ebp,[esi+SLOT_BASE+APPDATA.wnd_clientbox.top] |
add dx,word[esi+SLOT_BASE+APPDATA.wnd_clientbox.top] |
add ebp,[esi+APPDATA.wnd_clientbox.top] |
add dx,word[esi+APPDATA.wnd_clientbox.top] |
shl edx,16 |
xor edi,edi |
add edx,ebp |
4961,7 → 4926,8 |
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 |
4973,7 → 4939,22 |
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 |
4983,6 → 4964,8 |
setc al |
and [esp + 56], byte 0xfe |
or [esp + 56], al |
ret |
; ----------------------------------------- |
4993,166 → 4976,63 |
mov [esp+36],dword -1 |
ret |
align 4 |
system_shutdown: ; shut down the system |
;clear_busy_flag_at_caller: |
cmp byte [BOOT_VAR+0x9030], 1 |
jne @F |
ret |
@@: |
call stop_all_services |
push 3 ; stop playing cd |
pop eax |
call sys_cd_audio |
; push edi |
yes_shutdown_param: |
cli |
; mov edi,[CURRENT_TASK] ; restore processes tss pointer in gdt, busyfl? |
; imul edi,8 |
; mov [edi+gdts+ tss0 +5], word 01010000b *256 +11101001b |
mov eax, kernel_file ; load kernel.mnt to 0x8000:0 |
push 12 |
pop esi |
xor ebx,ebx |
or ecx,-1 |
mov edx, OS_BASE+0x80000 |
call fileread |
; pop edi |
mov esi, restart_kernel_4000+OS_BASE+0x10000 ; move kernel re-starter to 0x4000:0 |
mov edi,OS_BASE+0x40000 |
mov ecx,1000 |
rep movsb |
; ret |
mov esi,OS_BASE+0x2F0000 ; restore 0x0 - 0xffff |
mov edi, OS_BASE |
mov ecx,0x10000/4 |
cld |
rep movsd |
call restorefatchain |
keymap: |
mov al, 0xFF |
out 0x21, al |
out 0xA1, al |
db '6',27 |
db '1234567890-=',8,9 |
db 'qwertyuiop[]',13 |
db '~asdfghjkl;',39,96,0,'\zxcvbnm,./',0,'45 ' |
db '@234567890123',180,178,184,'6',176,'7' |
db 179,'8',181,177,183,185,182 |
db 'AB<D',255,'FGHIJKLMNOPQRSTUVWXYZ' |
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
mov word [OS_BASE+0x467+0],pr_mode_exit |
mov word [OS_BASE+0x467+2],0x1000 |
mov al,0x0F |
out 0x70,al |
mov al,0x05 |
out 0x71,al |
keymap_shift: |
mov al,0xFE |
out 0x64,al |
hlt |
db '6',27 |
db '!@#$%^&*()_+',8,9 |
db 'QWERTYUIOP{}',13 |
db '~ASDFGHJKL:"~',0,'|ZXCVBNM<>?',0,'45 ' |
db '@234567890123',180,178,184,'6',176,'7' |
db 179,'8',181,177,183,185,182 |
db 'AB>D',255,'FGHIJKLMNOPQRSTUVWXYZ' |
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
include "data32.inc" |
keymap_alt: |
__REV__ = __REV |
db ' ',27 |
db ' @ $ {[]}\ ',8,9 |
db ' ',13 |
db ' ',0,' ',0,'4',0,' ' |
db ' ',180,178,184,'6',176,'7' |
db 179,'8',181,177,183,185,182 |
db 'ABCD',255,'FGHIJKLMNOPQRSTUVWXYZ' |
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
; device irq owners |
uglobal |
irq_owner: ; process id |
dd 0x0 |
dd 0x0 |
dd 0x0 |
dd 0x0 |
dd 0x0 |
dd 0x0 |
dd 0x0 |
dd 0x0 |
dd 0x0 |
dd 0x0 |
dd 0x0 |
dd 0x0 |
dd 0x0 |
dd 0x0 |
dd 0x0 |
dd 0x0 |
endg |
; on irq read ports |
uglobal |
irq00read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
irq01read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
irq02read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
irq03read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
irq04read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
irq05read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
irq06read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
irq07read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
irq08read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
irq09read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
irq10read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
irq11read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
irq12read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
irq13read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
irq14read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
irq15read dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
endg |
; status |
uglobal |
hd1_status dd 0x0 ; 0 - free : other - pid |
application_table_status dd 0x0 ; 0 - free : other - pid |
endg |
; device addresses |
uglobal |
mididp dd 0x0 |
midisp dd 0x0 |
cdbase dd 0x0 |
cdid dd 0x0 |
hdbase dd 0x0 ; for boot 0x1f0 |
hdid dd 0x0 |
hdpos dd 0x0 ; for boot 0x1 |
fat32part dd 0x0 ; for boot 0x1 |
;part2_ld dd 0x0 |
;* start code - Mario79 |
mouse_pause dd 0 |
MouseTickCounter dd 0 |
ps2_mouse_detected db 0 |
com1_mouse_detected db 0 |
com2_mouse_detected db 0 |
;* end code - Mario79 |
wraw_bacground_select db 0 |
lba_read_enabled dd 0x0 ; 0 = disabled , 1 = enabled |
pci_access_enabled dd 0x0 ; 0 = disabled , 1 = enabled |
sb16 dd 0x0 |
buttontype dd 0x0 |
windowtypechanged dd 0x0 |
align 4 |
cpu_caps dd 4 dup(0) |
pg_data PG_DATA |
heap_test dd ? |
hd_entries rd 1 ;unused ? 0xfe10 |
endg |
iglobal |
keyboard dd 0x1 |
sound_dma dd 0x1 |
syslang dd 0x1 |
endg |
if __DEBUG__ eq 1 |
include_debug_strings |
end if |
IncludeIGlobals |
endofcode: |
IncludeUGlobals |
uglobals_size = $ - endofcode |
diff16 "end of kernel code",0,$ |
__REV__ = __REV |
diff10 "revision",0,__REV__ |
/kernel/trunk/kernel32.inc |
---|
123,8 → 123,11 |
.bk_ev dd ? ;+52 |
.fd_obj dd ? ;+56 |
.bk_obj dd ? ;+60 |
.saved_esp dd ? ;+64 |
.io_map rd 2 ;+68 |
.dbg_state dd ? ;+76 |
db 64 dup(?) ;+64 |
db 48 dup(?) ;+80 |
.wnd_shape dd ? ;+128 |
.wnd_shape_scale dd ? ;+132 |
177,8 → 180,6 |
; shutdown |
include "boot/shutdown.inc" ; shutdown or restart |
; file system |
include "fs/fs.inc" ; syscall |
205,6 → 206,9 |
include "network/stack.inc" |
;include "drivers/uart.inc" |
; Mouse pointer |
include "gui/mouse.inc" |
/kernel/trunk/memmap.inc |
---|
1,4 → 1,3 |
$Revision$ |
; |
; MEMORY MAP |
; |
25,7 → 24,9 |
; |
; Runtime: |
; |
; 0000 -> 1FFF window_data - 256 entries |
; 0x00000000 -> 0x7FFFFFFF application 2Gb |
; 0x80000000 -> 1FFF window_data - 256 entries |
; |
; 0000 dword x start |
; 0004 dword y start |
120,21 → 121,37 |
; FFF5 byte 1 do not draw pointer |
; FFFF byte do not change task for 1/100 sec. |
; |
; 10000 -> 3DBFF kernel, 32-bit run-time code (up to 183 Kb) |
; 3DC00 -> 3EBFF stack at boot time (4Kb) |
; 3EC00 -> 3F5FF basic text font II |
; 3F600 -> 3FFFF basic text font I |
; 40000 -> 4FFFF data of retrieved disks and partitions (Mario79) |
; 0x80010000 -> 3DBFF kernel, 32-bit run-time code (up to 183 Kb) |
; 0x8003DC00 -> 3EBFF stack at boot time (4Kb) |
; 0x8003EC00 -> 3F5FF basic text font II |
; 0x8003F600 -> 3FFFF basic text font I |
; 0x80040000 -> 4FFFF data of retrieved disks and partitions (Mario79) |
; 50000 -> 50FFF main page directory |
; 50200 -> 5FFFF pages bitmap |
; 0x80050000 -> 50FFF main page directory |
; 0x80050200 -> 5FFFF pages bitmap |
; 60000 -> 7FFFF free (128 Kb) |
; 80000 -> 8FFFF additional app info, in 256 byte steps - 256 entries |
; 0x80060000 -> 7FFFF free (128 Kb) |
; 0x80080000 -> 8FFFF additional app info, in 256 byte steps - 256 entries |
; |
; 00 11db name of app running |
; 10 108db floating point unit save area |
; 7f byte 0= no fpu saved , 1= fpu saved to 0x10 -> restore |
; 0x10 dword pointer to fpu save area |
; 0x14 dword event count |
; 0x18 dword user fpu exceptoins handler |
; 0x1c dword user sse exceptions handler |
; 20 dword PL0 stack base |
; 24 dword user heap base |
; 28 dword user heap top |
; 2c dword window cursor handle |
; 30 dword first event in list |
; 34 dword last event in list |
; 38 dword first kernel object in list |
; 3c dword last kernel object in list |
; 40 dword thread esp |
; 44 dword io permission map page 0 |
; 48 dword io permission map page 1 |
4c dword debug state: 1= load debug registers |
; 50-7F unused |
; |
; 80 dword address of random shaped window area |
; 84 byte shape area scale |
; 88 dword free |
153,17 → 170,17 |
; BC dword address of debug event memory |
; C0 5 dd thread debug registers: DR0,DR1,DR2,DR3,DR7 |
; |
; 90000 -> 9FFFF tmp |
; A0000 -> AFFFF screen access area |
; B0000 -> FFFFF bios rest in peace -area |
; 100000 -> 27FFFF diskette image |
; 280000 -> 281FFF ramdisk fat |
; 282000 -> 283FFF floppy fat |
; 0x80090000 -> 9FFFF tmp |
; 0x800A0000 -> AFFFF screen access area |
; 0x800B0000 -> FFFFF bios rest in peace -area |
; 0x80100000 -> 27FFFF diskette image |
; 0x80280000 -> 281FFF ramdisk fat |
; 0x80282000 -> 283FFF floppy fat |
; |
; 284000 -> 29FFFF free (112 Kb) |
; 0x80284000 -> 29FFFF free (112 Kb) |
; |
; 2A0000 -> 2B00ff wav device data |
; 2C0000 -> 2C3fff button info |
; 0x802A0000 -> 2B00ff wav device data |
; 0x802C0000 -> 2C3fff button info |
; |
; 0000 word number of buttons |
; first button entry at 0x10 |
175,9 → 192,9 |
; +000A word y size |
; +000C word button id number : bits 16-31 |
; |
; 2C4000 -> 2CFFFF free (48Kb) |
; 0x802C4000 -> 2CFFFF free (48Kb) |
; |
; 2D0000 -> 2DFFFF reserved port area |
; 0x802D0000 -> 2DFFFF reserved port area |
; |
; 0000 dword no of port areas reserved |
; 0010 dword process id |
185,41 → 202,38 |
; dword end port |
; dword 0 |
; |
; 2E0000 -> 2EFFFF irq data area |
; 2F0000 -> 2FFFFF low memory save |
; 0x802E0000 -> 2EFFFF irq data area |
; 0x802F0000 -> 2FFFFF low memory save |
; |
; 300000 -> 45FFFF background image, max 1,375 M |
; 0x80300000 -> 45FFFF background image, max 1,375 M |
; |
; 460000 -> 5FFFFF display info |
; 0x80460000 -> 5FFFFF display info |
; |
; 600000 -> 6FFFFF hd cache |
; 0x80600000 -> 6FFFFF hd cache |
; |
; 700000 -> 71ffff tcp memory (128 kb) |
; 720000 -> 75ffff free (256 kb) |
; 0x80700000 -> 71ffff tcp memory 128 Kb |
; 0x80720000 -> 75ffff free (256 kb) |
; |
; 760000 -> 76ffff !vrr driver |
; 770000 -> 777fff tcp memory ( 32 kb) |
; 0x80760000 -> 76ffff !vrr driver |
; 0x80770000 -> 777fff tcp memory 32 Kb |
; |
; 780000 -> 987FFF TSS and IO map for (8192*8)=65536 ports |
; (128+8192)*256 = 2129920 = 0x208000 |
; |
; 988000 -> 98AFFF draw_data - 256 entries |
; |
; 0x80780000 -> 0x80782FFF draw data - 256 entries |
; 00 dword draw limit - x start |
; 04 dword draw limit - y start |
; 08 dword draw limit - x end |
; 0C dword draw limit - y end |
; |
; 0x80783F80 -> 0x80783FFF TSS 128 bytes |
; |
; 0x0098B000 -> kernel heap |
; 0x80784000 -> 0x80785FFF IO map for (8192*8)=65536 ports |
; |
; 0x01FFFFFF heap min limit |
; 0x7DBFFFFF heap max limit |
; 0x7DC00000 -> 0x7FBFFFFF LFB 32Mb |
; 0x7DC00000 -> 0x7E3FFFFF application available LFB 8Mb |
; 0x7E400000 -> 0x7FBFFFFF kernel LFB part 24 Mb |
; 0x7FC00000 -> 0x7FFFFFFF page tables 4Mb |
; 0x80000000 -> 0xFFFFFFFF application 2Gb |
; 0x80786000 -> kernel heap |
; 0x81FFFFFF heap min 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 |
/kernel/trunk/network/socket.inc |
---|
596,7 → 596,7 |
.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 |
/kernel/trunk/proc32.inc |
---|
1,4 → 1,4 |
$Revision$ |
; Macroinstructions for defining and calling procedures |
macro stdcall proc,[arg] ; directly call STDCALL procedure |
/kernel/trunk/video/cursors.inc |
---|
1,10 → 1,15 |
$Revision$ |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
LOAD_FROM_FILE equ 0 |
LOAD_FROM_MEM equ 1 |
LOAD_INDIRECT equ 2 |
LOAD_SYSTEM equ 3 |
VIDEO_FREE equ 2 |
struc BITMAPINFOHEADER { |
.biSize dd ? ; DWORD |
268,15 → 273,13 |
jne .fail |
; cmp [eax+CURSOR.size], CURSOR_SIZE |
; jne .fail |
mov ebx, [CURRENT_TASK] |
shl ebx, 8 |
xchg eax, [ebx+SLOT_BASE+APPDATA.cursor] |
mov ebx, [current_slot] |
xchg eax, [ebx+APPDATA.cursor] |
ret |
.fail: |
mov eax, [def_cursor] |
mov ebx, [CURRENT_TASK] |
shl ebx, 8 |
xchg eax, [ebx+SLOT_BASE+APPDATA.cursor] |
mov ebx, [current_slot] |
xchg eax, [ebx+APPDATA.cursor] |
ret |
endp |
399,12 → 402,11 |
cmp ebx, [esi+CURSOR.pid] |
jne .fail |
mov ebx, [CURRENT_TASK] |
shl ebx, 8 |
cmp esi, [ebx+SLOT_BASE+APPDATA.cursor] |
mov ebx, [current_slot] |
cmp esi, [ebx+APPDATA.cursor] |
jne @F |
mov eax, [def_cursor] |
mov [ebx+SLOT_BASE+APPDATA.cursor], eax |
mov [ebx+APPDATA.cursor], eax |
@@: |
mov eax, [hcursor] |
call [eax+APPOBJ.destroy] |
/kernel/trunk/vmodeint.inc |
---|
27,7 → 27,7 |
pushd [ScreenWidth] [ScreenHeight] |
popd [old_screen_height] [old_screen_width] |
or eax,-1 ; If driver is absent then eax does not change |
call 0x760100 ; Entry point of video driver |
call OS_BASE+0x760100 ; Entry point of video driver |
mov [esp+36],eax |
mov [esp+24],ebx |
mov [esp+32],ecx |
/kernel/trunk/vmodeld.inc |
---|
24,15 → 24,8 |
mov [OS_BASE+0x760000],eax ; |
mov [OS_BASE+0x760100],byte 0xC3 ; Instruction RETN - driver loop |
pushad |
push eax |
mov eax, vmode - std_application_base_address |
call file_system_lfn |
pop eax |
popad |
; mov esi, vmode |
; xor ebx, ebx |
; mov ecx, 0x8000 ; size of memory area for driver |
; mov edx, OS_BASE+0x760000 ; Memory position of driver |
; call fs_RamdiskRead |
mov esi, vmode |
xor ebx, ebx |
mov ecx, 0x8000 ; size of memory area for driver |
mov edx, OS_BASE+0x760000 ; Memory position of driver |
call fs_RamdiskRead |