forked from KolibriOS/kolibrios
*Reduced size of boot code. (diamond)
*Debug API added. (diamond) git-svn-id: svn://kolibrios.org@40 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
4c548cc4f0
commit
f4fbaa166e
@ -139,6 +139,14 @@ macro _setcursor row,column
|
|||||||
call setcursor
|
call setcursor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pagetable_set:
|
||||||
|
or al, 7
|
||||||
|
@@:
|
||||||
|
stosd
|
||||||
|
add eax, 1000h
|
||||||
|
loop @b
|
||||||
|
ret
|
||||||
|
|
||||||
; 16-bit data
|
; 16-bit data
|
||||||
; videomodes table
|
; videomodes table
|
||||||
gr_table:
|
gr_table:
|
||||||
@ -275,6 +283,7 @@ dfl1:
|
|||||||
cmp ax,dx
|
cmp ax,dx
|
||||||
jnz cpugood
|
jnz cpugood
|
||||||
mov si,not386-0x10000
|
mov si,not386-0x10000
|
||||||
|
sayerr:
|
||||||
call print
|
call print
|
||||||
jmp $
|
jmp $
|
||||||
cpugood:
|
cpugood:
|
||||||
@ -347,9 +356,9 @@ wait_loop: ; variant 2
|
|||||||
jnz @f
|
jnz @f
|
||||||
mov ax,[es:di+4]
|
mov ax,[es:di+4]
|
||||||
add ax,'0'*256+'0'
|
add ax,'0'*256+'0'
|
||||||
mov [vervesa+vervesa_off-0x10000], ah
|
mov si,vervesa-0x10000
|
||||||
mov [vervesa+vervesa_off+2-0x10000], al
|
mov [si+vervesa_off], ah
|
||||||
mov si,vervesa-0x10000
|
mov [si+vervesa_off+2], al
|
||||||
@@: call print
|
@@: call print
|
||||||
|
|
||||||
; \begin{diamond}[30.11.2005]
|
; \begin{diamond}[30.11.2005]
|
||||||
@ -360,36 +369,33 @@ cfgmanager:
|
|||||||
; b) preboot_mtrr = use hardware acceleration?
|
; b) preboot_mtrr = use hardware acceleration?
|
||||||
; c) preboot_vrrm = use VRR?
|
; c) preboot_vrrm = use VRR?
|
||||||
; d) preboot_device = from what boot?
|
; d) preboot_device = from what boot?
|
||||||
mov si, preboot_graph-0x10000
|
mov di, preboot_graph-0x10000
|
||||||
; check bootloader block
|
; check bootloader block
|
||||||
cmp [.loader_block-0x10000], 0
|
cmp [.loader_block-0x10000], 0
|
||||||
jz .noloaderblock
|
jz .noloaderblock
|
||||||
les bx, [.loader_block-0x10000]
|
les bx, [.loader_block-0x10000]
|
||||||
cmp byte [es:bx], 1
|
cmp byte [es:bx], 1
|
||||||
jz @f
|
|
||||||
mov si, loader_block_error-0x10000
|
mov si, loader_block_error-0x10000
|
||||||
call print
|
jnz sayerr
|
||||||
jmp $
|
|
||||||
@@:
|
|
||||||
test byte [es:bx+1], 1
|
test byte [es:bx+1], 1
|
||||||
jz @f
|
jz @f
|
||||||
; image in memory present
|
; image in memory present
|
||||||
cmp [si+preboot_device-preboot_graph], 0
|
cmp [di+preboot_device-preboot_graph], 0
|
||||||
jnz @f
|
jnz @f
|
||||||
mov [si+preboot_device-preboot_graph], 3
|
mov [di+preboot_device-preboot_graph], 3
|
||||||
@@:
|
@@:
|
||||||
.noloaderblock:
|
.noloaderblock:
|
||||||
; determine default settings
|
; determine default settings
|
||||||
mov [.bSettingsChanged-0x10000], 0
|
mov [.bSettingsChanged-0x10000], 0
|
||||||
cmp byte [si], 0
|
cmp byte [di], 0
|
||||||
jnz .preboot_gr_end
|
jnz .preboot_gr_end
|
||||||
mov [si+preboot_gprobe-preboot_graph], 0
|
mov [di+preboot_gprobe-preboot_graph], 0
|
||||||
mov al, [vervesa+vervesa_off-0x10000]
|
mov al, [vervesa+vervesa_off-0x10000]
|
||||||
cmp al, 'x'
|
cmp al, 'x'
|
||||||
jz .novesa
|
jz .novesa
|
||||||
cmp al, '1'
|
cmp al, '1'
|
||||||
jz .vesa12
|
jz .vesa12
|
||||||
mov [si+preboot_gprobe-preboot_graph], 2
|
mov [di+preboot_gprobe-preboot_graph], 2
|
||||||
mov al, 3
|
mov al, 3
|
||||||
jmp @f
|
jmp @f
|
||||||
.vesa12:
|
.vesa12:
|
||||||
@ -398,14 +404,14 @@ cfgmanager:
|
|||||||
.novesa:
|
.novesa:
|
||||||
mov al, 10
|
mov al, 10
|
||||||
@@:
|
@@:
|
||||||
mov [si], al
|
mov [di], al
|
||||||
.preboot_gr_end:
|
.preboot_gr_end:
|
||||||
cmp [si+preboot_mtrr-preboot_graph], 1
|
cmp [di+preboot_mtrr-preboot_graph], 1
|
||||||
adc [si+preboot_mtrr-preboot_graph], 0
|
adc [di+preboot_mtrr-preboot_graph], 0
|
||||||
cmp [si+preboot_vrrm-preboot_graph], 1
|
cmp [di+preboot_vrrm-preboot_graph], 1
|
||||||
adc [si+preboot_vrrm-preboot_graph], 0
|
adc [di+preboot_vrrm-preboot_graph], 0
|
||||||
cmp [si+preboot_device-preboot_graph], 1
|
cmp [di+preboot_device-preboot_graph], 1
|
||||||
adc [si+preboot_device-preboot_graph], 0
|
adc [di+preboot_device-preboot_graph], 0
|
||||||
; notify user
|
; notify user
|
||||||
mov si, linef-0x10000
|
mov si, linef-0x10000
|
||||||
call print
|
call print
|
||||||
@ -457,21 +463,11 @@ cfgmanager:
|
|||||||
mov si, linef-0x10000
|
mov si, linef-0x10000
|
||||||
call printplain
|
call printplain
|
||||||
mov si, mtrr_msg-0x10000
|
mov si, mtrr_msg-0x10000
|
||||||
call print
|
|
||||||
mov si, on_msg-0x10000
|
|
||||||
cmp [preboot_mtrr-0x10000], 1
|
cmp [preboot_mtrr-0x10000], 1
|
||||||
jz @f
|
call .say_on_off
|
||||||
mov si, off_msg-0x10000
|
|
||||||
@@:
|
|
||||||
call printplain
|
|
||||||
mov si, vrrm_msg-0x10000
|
mov si, vrrm_msg-0x10000
|
||||||
call print
|
|
||||||
mov si, on_msg-0x10000
|
|
||||||
cmp [preboot_vrrm-0x10000], 1
|
cmp [preboot_vrrm-0x10000], 1
|
||||||
jz @f
|
call .say_on_off
|
||||||
mov si, off_msg-0x10000
|
|
||||||
@@:
|
|
||||||
call printplain
|
|
||||||
mov si, preboot_device_msg-0x10000
|
mov si, preboot_device_msg-0x10000
|
||||||
call print
|
call print
|
||||||
mov al, [preboot_device-0x10000]
|
mov al, [preboot_device-0x10000]
|
||||||
@ -479,7 +475,6 @@ cfgmanager:
|
|||||||
mov si, [preboot_device_msgs-0x10000+eax*2]
|
mov si, [preboot_device_msgs-0x10000+eax*2]
|
||||||
call printplain
|
call printplain
|
||||||
.wait:
|
.wait:
|
||||||
; empty BIOS keyboard buffer
|
|
||||||
_setcursor 25,0 ; out of screen
|
_setcursor 25,0 ; out of screen
|
||||||
; set timer interrupt handler
|
; set timer interrupt handler
|
||||||
cli
|
cli
|
||||||
@ -497,9 +492,9 @@ cfgmanager:
|
|||||||
; restore timer interrupt
|
; restore timer interrupt
|
||||||
push 0
|
push 0
|
||||||
pop es
|
pop es
|
||||||
mov ecx, [.oldtimer-0x10000]
|
mov eax, [.oldtimer-0x10000]
|
||||||
mov [es:8*4], ecx
|
mov [es:8*4], eax
|
||||||
mov [.timer-0x10000], ecx
|
mov [.timer-0x10000], eax
|
||||||
_setcursor 7,0
|
_setcursor 7,0
|
||||||
mov si, space_msg-0x10000
|
mov si, space_msg-0x10000
|
||||||
call printplain
|
call printplain
|
||||||
@ -518,13 +513,13 @@ cfgmanager:
|
|||||||
jnz .wait
|
jnz .wait
|
||||||
_setcursor 15,0
|
_setcursor 15,0
|
||||||
mov si,bdev-0x10000
|
mov si,bdev-0x10000
|
||||||
call printplain
|
call print
|
||||||
mov bx,'13'
|
mov bx,'13'
|
||||||
call getkey
|
call getkey
|
||||||
mov [preboot_device-0x10000], al
|
mov [preboot_device-0x10000], al
|
||||||
_setcursor 13,0
|
_setcursor 13,0
|
||||||
.d:
|
.d:
|
||||||
mov [.bSettingsChanged-0x10000], al
|
mov [.bSettingsChanged-0x10000], 1
|
||||||
mov si, space_msg-0x10000
|
mov si, space_msg-0x10000
|
||||||
call printplain
|
call printplain
|
||||||
_setcursor 15,0
|
_setcursor 15,0
|
||||||
@ -553,7 +548,7 @@ cfgmanager:
|
|||||||
.change_b:
|
.change_b:
|
||||||
_setcursor 15,0
|
_setcursor 15,0
|
||||||
mov si, gr_acc-0x10000
|
mov si, gr_acc-0x10000
|
||||||
call printplain
|
call print
|
||||||
mov bx, '12'
|
mov bx, '12'
|
||||||
call getkey
|
call getkey
|
||||||
mov [preboot_mtrr-0x10000], al
|
mov [preboot_mtrr-0x10000], al
|
||||||
@ -562,16 +557,28 @@ cfgmanager:
|
|||||||
.change_c:
|
.change_c:
|
||||||
_setcursor 15,0
|
_setcursor 15,0
|
||||||
mov si, vrrmprint-0x10000
|
mov si, vrrmprint-0x10000
|
||||||
call printplain
|
call print
|
||||||
mov bx, '12'
|
mov bx, '12'
|
||||||
call getkey
|
call getkey
|
||||||
mov [preboot_vrrm-0x10000], al
|
mov [preboot_vrrm-0x10000], al
|
||||||
_setcursor 12,0
|
_setcursor 12,0
|
||||||
jmp .d
|
jmp .d
|
||||||
|
.say_on_off:
|
||||||
|
pushf
|
||||||
|
call print
|
||||||
|
mov si, on_msg-0x10000
|
||||||
|
popf
|
||||||
|
jz @f
|
||||||
|
mov si, off_msg-0x10000
|
||||||
|
@@: call printplain
|
||||||
|
ret
|
||||||
|
; novesa and vervesa strings are not used at the moment of executing this code
|
||||||
|
virtual at novesa
|
||||||
.oldtimer dd ?
|
.oldtimer dd ?
|
||||||
.starttime dd ?
|
.starttime dd ?
|
||||||
.bSettingsChanged db ?
|
.bSettingsChanged db ?
|
||||||
.timer dd ?
|
.timer dd ?
|
||||||
|
end virtual
|
||||||
.loader_block dd 0
|
.loader_block dd 0
|
||||||
.gettime:
|
.gettime:
|
||||||
mov ah, 0
|
mov ah, 0
|
||||||
@ -672,9 +679,9 @@ end if
|
|||||||
.cont:
|
.cont:
|
||||||
push cs
|
push cs
|
||||||
pop ds
|
pop ds
|
||||||
mov byte [space_msg-0x10000+80], 0
|
|
||||||
_setcursor 15,0
|
|
||||||
mov si, space_msg-0x10000
|
mov si, space_msg-0x10000
|
||||||
|
mov byte [si+80], 0
|
||||||
|
_setcursor 15,0
|
||||||
call printplain
|
call printplain
|
||||||
_setcursor 15,0
|
_setcursor 15,0
|
||||||
.load:
|
.load:
|
||||||
@ -683,13 +690,6 @@ end if
|
|||||||
; ASK GRAPHICS MODE
|
; ASK GRAPHICS MODE
|
||||||
|
|
||||||
movzx ax, [preboot_graph-0x10000]
|
movzx ax, [preboot_graph-0x10000]
|
||||||
test ax, ax
|
|
||||||
jne pre_graph
|
|
||||||
mov si,gr_mode-0x10000
|
|
||||||
call printplain
|
|
||||||
mov bx,'09'
|
|
||||||
call getkey
|
|
||||||
pre_graph:
|
|
||||||
push 0
|
push 0
|
||||||
pop es
|
pop es
|
||||||
; address is gr_table+6*(ax-1)-0x10000
|
; address is gr_table+6*(ax-1)-0x10000
|
||||||
@ -699,77 +699,51 @@ end if
|
|||||||
mov cx,[si+2]
|
mov cx,[si+2]
|
||||||
mov dx,[si+4]
|
mov dx,[si+4]
|
||||||
cmp al, 9*2
|
cmp al, 9*2
|
||||||
|
mov al, 32 ; BPP
|
||||||
jb @f
|
jb @f
|
||||||
mov byte [es:0x9000], 32
|
mov [es:0x9000], al
|
||||||
mov dword [es:0x9018], 0x800000
|
mov dword [es:0x9018], 0x800000
|
||||||
@@:
|
@@:
|
||||||
mov [es:0x9008],bx
|
mov [es:0x9008],bx
|
||||||
mov [es:0x900A],cx
|
mov [es:0x900A],cx
|
||||||
mov [es:0x900C],dx
|
mov [es:0x900C],dx
|
||||||
mov ax,32
|
|
||||||
test bh, bh
|
test bh, bh
|
||||||
jz nov
|
jz nov
|
||||||
|
|
||||||
; USE DEFAULTS OR PROBE
|
; USE DEFAULTS OR PROBE
|
||||||
|
|
||||||
; bx - mode : cx - x size : dx - y size
|
; bx - mode : cx - x size : dx - y size
|
||||||
|
cmp [preboot_gprobe-0x10000], 1
|
||||||
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
jz noprobe
|
||||||
movzx ax,[preboot_gprobe-0x10000]
|
|
||||||
test ax,ax
|
|
||||||
jne pre_probe
|
|
||||||
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
||||||
|
|
||||||
test bx,0100000000000000b
|
|
||||||
jz noprobe
|
|
||||||
|
|
||||||
mov si,probetext-0x10000
|
|
||||||
call printplain
|
|
||||||
push bx
|
|
||||||
mov bx, '12'
|
|
||||||
call getkey
|
|
||||||
pop bx
|
|
||||||
|
|
||||||
pre_probe:
|
|
||||||
dec ax
|
|
||||||
je noprobe
|
|
||||||
|
|
||||||
push cx dx
|
|
||||||
|
|
||||||
mov bx,0x100
|
mov bx,0x100
|
||||||
|
|
||||||
newprobe:
|
newprobe:
|
||||||
|
|
||||||
inc bx
|
inc bx
|
||||||
cmp bx,0x17f
|
cmp bx,0x17f
|
||||||
jne probemore
|
mov si,prnotfnd-0x10000
|
||||||
|
jz sayerr
|
||||||
mov si,prnotfnd-0x10000
|
|
||||||
call printplain
|
|
||||||
|
|
||||||
jmp $
|
|
||||||
|
|
||||||
probemore:
|
probemore:
|
||||||
|
push cx
|
||||||
mov ax,0x4f01
|
mov ax,0x4f01
|
||||||
mov cx,bx
|
mov cx,bx
|
||||||
and cx,0xfff
|
and cx,0xfff
|
||||||
mov di,0xa000
|
mov di,0xa000
|
||||||
int 0x10
|
int 0x10
|
||||||
|
pop cx
|
||||||
|
|
||||||
test byte [es:di], 80h ; lfb?
|
test byte [es:di], 80h ; lfb?
|
||||||
jz newprobe
|
jz newprobe
|
||||||
mov ax, [es:di+0x12] ; x size?
|
cmp [es:di+0x12], cx ; x size?
|
||||||
cmp ax, [esp+2]
|
|
||||||
jnz newprobe
|
jnz newprobe
|
||||||
cmp [es:di+0x14], dx ; y size?
|
cmp [es:di+0x14], dx ; y size?
|
||||||
jnz newprobe
|
jnz newprobe
|
||||||
cmp byte [es:di+0x19], 32 ;24
|
cmp byte [es:di+0x19], 32 ;24
|
||||||
jb newprobe
|
jb newprobe
|
||||||
|
|
||||||
add bx,0100000000000000b
|
; add bx,0100000000000000b
|
||||||
|
or bh, 40h
|
||||||
mov [es:0x9008],bx
|
mov [es:0x9008],bx
|
||||||
pop dx cx
|
|
||||||
|
|
||||||
noprobe:
|
noprobe:
|
||||||
|
|
||||||
@ -782,27 +756,26 @@ end if
|
|||||||
mov di,0xa000
|
mov di,0xa000
|
||||||
int 0x10
|
int 0x10
|
||||||
; LFB
|
; LFB
|
||||||
mov ecx,[es:di+0x28]
|
mov eax,[es:di+0x28]
|
||||||
mov [es:0x9018],ecx
|
mov [es:0x9018],eax
|
||||||
; ---- vbe voodoo
|
; ---- vbe voodoo
|
||||||
BytesPerScanLine equ 0x10
|
BytesPerScanLine equ 0x10
|
||||||
mov ax, [es:di+BytesPerScanLine]
|
mov ax, [es:di+BytesPerScanLine]
|
||||||
mov [es:0x9001],ax
|
mov [es:0x9001],ax
|
||||||
; BPP
|
; BPP
|
||||||
movzx ax,byte [es:di+0x19]
|
mov al,byte [es:di+0x19]
|
||||||
mov [es:0x9000],al
|
mov [es:0x9000],al
|
||||||
nov:
|
nov:
|
||||||
cmp ax,24
|
cmp al,24
|
||||||
mov si,bt24-0x10000
|
mov si,bt24-0x10000
|
||||||
jz bppl
|
jz bppl
|
||||||
cmp ax,32
|
cmp al,32
|
||||||
mov si,bt32-0x10000
|
mov si,bt32-0x10000
|
||||||
jz bppl
|
jz bppl
|
||||||
mov si,btns-0x10000
|
mov si,btns-0x10000
|
||||||
call print
|
jmp sayerr
|
||||||
jmp $
|
|
||||||
bppl:
|
bppl:
|
||||||
call printplain
|
call print
|
||||||
|
|
||||||
|
|
||||||
; FIND VESA 1.2 PM BANK SWITCH ADDRESS
|
; FIND VESA 1.2 PM BANK SWITCH ADDRESS
|
||||||
@ -825,33 +798,12 @@ end if
|
|||||||
; GRAPHICS ACCELERATION
|
; GRAPHICS ACCELERATION
|
||||||
|
|
||||||
mov al, [preboot_mtrr-0x10000]
|
mov al, [preboot_mtrr-0x10000]
|
||||||
test al,al
|
|
||||||
jne pre_mtrr
|
|
||||||
mov si,gr_acc-0x10000
|
|
||||||
call printplain
|
|
||||||
mov bx,'12'
|
|
||||||
call getkey
|
|
||||||
pre_mtrr:
|
|
||||||
mov [es:0x901C],al
|
mov [es:0x901C],al
|
||||||
; commented by diamond - newlines are not used now
|
|
||||||
; mov si,linef-0x10000
|
|
||||||
; call printplain
|
|
||||||
|
|
||||||
|
|
||||||
; VRR_M USE
|
; VRR_M USE
|
||||||
|
|
||||||
mov al,[preboot_vrrm-0x10000]
|
mov al,[preboot_vrrm-0x10000]
|
||||||
test al,al
|
|
||||||
jne pre_vrrm
|
|
||||||
mov si,vrrmprint-0x10000
|
|
||||||
call print
|
|
||||||
mov bx,'13'
|
|
||||||
call getkey
|
|
||||||
pre_vrrm:
|
|
||||||
mov [es:0x9030],al
|
mov [es:0x9030],al
|
||||||
; commented by diamond - newlines are not used now
|
|
||||||
; mov si,linef2-0x10000
|
|
||||||
; call printplain
|
|
||||||
|
|
||||||
|
|
||||||
; MEMORY MODEL
|
; MEMORY MODEL
|
||||||
@ -939,24 +891,12 @@ end if
|
|||||||
; BOOT DEVICE
|
; BOOT DEVICE
|
||||||
|
|
||||||
mov al, [preboot_device-0x10000]
|
mov al, [preboot_device-0x10000]
|
||||||
test al, al
|
dec al
|
||||||
jnz pre_device
|
|
||||||
mov si,bdev-0x10000
|
|
||||||
call printplain
|
|
||||||
mov bx,'13'
|
|
||||||
call getkey
|
|
||||||
pre_device:
|
|
||||||
dec ax
|
|
||||||
mov [boot_dev-0x10000],al
|
mov [boot_dev-0x10000],al
|
||||||
; commented by diamond - newlines are not used now
|
|
||||||
; mov si,linef-0x10000
|
|
||||||
; call printplain
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; READ DISKETTE TO MEMORY
|
; READ DISKETTE TO MEMORY
|
||||||
|
|
||||||
cmp [boot_dev-0x10000],0
|
; cmp [boot_dev-0x10000],0
|
||||||
jne no_sys_on_floppy
|
jne no_sys_on_floppy
|
||||||
mov si,diskload-0x10000
|
mov si,diskload-0x10000
|
||||||
call print
|
call print
|
||||||
@ -979,6 +919,7 @@ end if
|
|||||||
cmp si,10
|
cmp si,10
|
||||||
jnz newread
|
jnz newread
|
||||||
mov si,badsect-0x10000
|
mov si,badsect-0x10000
|
||||||
|
sayerr_plain:
|
||||||
call printplain
|
call printplain
|
||||||
jmp $
|
jmp $
|
||||||
goodread:
|
goodread:
|
||||||
@ -998,8 +939,7 @@ end if
|
|||||||
mov al,0
|
mov al,0
|
||||||
out dx,al
|
out dx,al
|
||||||
mov si,memmovefailed-0x10000
|
mov si,memmovefailed-0x10000
|
||||||
call print
|
jmp sayerr_plain
|
||||||
jmp $
|
|
||||||
goodmove:
|
goodmove:
|
||||||
|
|
||||||
add dword [movedesc-0x10000+0x18+2], 512*18
|
add dword [movedesc-0x10000+0x18+2], 512*18
|
||||||
@ -1030,8 +970,7 @@ end if
|
|||||||
jnz reads
|
jnz reads
|
||||||
readdone:
|
readdone:
|
||||||
pop ax
|
pop ax
|
||||||
mov si,backspace-0x10000
|
mov si,backspace2-0x10000
|
||||||
call printplain
|
|
||||||
call printplain
|
call printplain
|
||||||
mov si,okt-0x10000
|
mov si,okt-0x10000
|
||||||
call printplain
|
call printplain
|
||||||
@ -1054,30 +993,36 @@ end if
|
|||||||
pop es ; es:di = 6000:0
|
pop es ; es:di = 6000:0
|
||||||
xor di,di
|
xor di,di
|
||||||
mov cx,256*map_mem ; Map (mapmem) M
|
mov cx,256*map_mem ; Map (mapmem) M
|
||||||
mov eax,7
|
; mov eax,7
|
||||||
pt2:
|
; pt2:
|
||||||
cmp cx,256*(map_mem-8) ; 8 M map to LFB
|
; cmp cx,256*(map_mem-8) ; 8 M map to LFB
|
||||||
jnz pt3
|
; jnz pt3
|
||||||
pop eax
|
; pop eax
|
||||||
add eax,7
|
; add eax,7
|
||||||
pt3:
|
; pt3:
|
||||||
cmp cx,256*(map_mem-12) ; 12 M back to linear = physical
|
; cmp cx,256*(map_mem-12) ; 12 M back to linear = physical
|
||||||
jnz pt4
|
; jnz pt4
|
||||||
mov eax,12*0x100000 + 7
|
; mov eax,12*0x100000 + 7
|
||||||
pt4:
|
; pt4:
|
||||||
stosd
|
; stosd
|
||||||
add eax,4096
|
; add eax,4096
|
||||||
loop pt2
|
; loop pt2
|
||||||
|
; initialize as identity mapping
|
||||||
|
xor eax, eax
|
||||||
|
call pagetable_set
|
||||||
|
; 8M..12M map to LFB
|
||||||
|
pop eax
|
||||||
|
; mov cx, 256*4
|
||||||
|
mov ch, 4
|
||||||
|
mov di, 2000h
|
||||||
|
call pagetable_set
|
||||||
|
|
||||||
push 0x7100
|
push 0x7100
|
||||||
pop es
|
pop es
|
||||||
xor di,di
|
xor di,di
|
||||||
mov eax,8*0x100000+7
|
mov eax,8*0x100000
|
||||||
mov cx,256*4
|
mov cx,256*4
|
||||||
pt5:
|
call pagetable_set
|
||||||
stosd
|
|
||||||
add eax,0x1000
|
|
||||||
loop pt5
|
|
||||||
|
|
||||||
; 4 KB PAGE DIRECTORY
|
; 4 KB PAGE DIRECTORY
|
||||||
|
|
||||||
@ -1086,15 +1031,12 @@ end if
|
|||||||
xor di, di
|
xor di, di
|
||||||
mov cx, 64 / 4
|
mov cx, 64 / 4
|
||||||
mov eax, 0x60007 ; for 0 M
|
mov eax, 0x60007 ; for 0 M
|
||||||
pd4k:
|
call pagetable_set
|
||||||
stosd
|
|
||||||
add eax, 0x1000
|
|
||||||
loop pd4k
|
|
||||||
mov dword [es:0x800],0x71007 ;map region 0x80000000-0x803FFFFF to 0x800000-0xCFFFFF
|
mov dword [es:0x800],0x71007 ;map region 0x80000000-0x803FFFFF to 0x800000-0xCFFFFF
|
||||||
xor si,si
|
xor si,si
|
||||||
mov di,second_base_address shr 20
|
mov di,second_base_address shr 20
|
||||||
mov cx,64/4
|
mov cx,64/2
|
||||||
rep movs dword [es:di], [es:si]
|
rep movs word [es:di], [es:si]
|
||||||
|
|
||||||
mov eax, 0x7F000 +8+16 ; Page directory and enable caches
|
mov eax, 0x7F000 +8+16 ; Page directory and enable caches
|
||||||
mov cr3, eax
|
mov cr3, eax
|
||||||
@ -1102,9 +1044,8 @@ end if
|
|||||||
; SET GRAPHICS
|
; SET GRAPHICS
|
||||||
|
|
||||||
pop es
|
pop es
|
||||||
mov bx,[es:0x9008] ; vga & 320x200
|
mov ax,[es:0x9008] ; vga & 320x200
|
||||||
mov ax, bx
|
mov bx, ax
|
||||||
push ax
|
|
||||||
cmp ax,0x13
|
cmp ax,0x13
|
||||||
je setgr
|
je setgr
|
||||||
cmp ax,0x12
|
cmp ax,0x12
|
||||||
@ -1113,18 +1054,15 @@ end if
|
|||||||
setgr:
|
setgr:
|
||||||
int 0x10
|
int 0x10
|
||||||
test ah,ah
|
test ah,ah
|
||||||
jz gmok
|
mov si, fatalsel-0x10000
|
||||||
mov si,fatalsel-0x10000
|
jnz sayerr
|
||||||
call print
|
|
||||||
jmp $
|
|
||||||
|
|
||||||
gmok:
|
|
||||||
; set mode 0x12 graphics registers:
|
; set mode 0x12 graphics registers:
|
||||||
cmp bx,0x12
|
cmp bx,0x12
|
||||||
jne gmok2
|
jne gmok2
|
||||||
|
|
||||||
mov al,0x05
|
mov al,0x05
|
||||||
mov dx,0x03ce
|
mov dx,0x03ce
|
||||||
|
push dx
|
||||||
out dx,al ; select GDC mode register
|
out dx,al ; select GDC mode register
|
||||||
mov al,0x02
|
mov al,0x02
|
||||||
inc dx
|
inc dx
|
||||||
@ -1138,7 +1076,7 @@ end if
|
|||||||
out dx,al ; set mask for all planes 0-3
|
out dx,al ; set mask for all planes 0-3
|
||||||
|
|
||||||
mov al,0x08
|
mov al,0x08
|
||||||
mov dx,0x03ce
|
pop dx
|
||||||
out dx,al ; select GDC bit mask register
|
out dx,al ; select GDC bit mask register
|
||||||
; for writes to 0x03cf
|
; for writes to 0x03cf
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ d80x25_bottom:
|
|||||||
d80x25_bottom_num = 3
|
d80x25_bottom_num = 3
|
||||||
|
|
||||||
novesa db "Display: EGA/CGA",13,10,0
|
novesa db "Display: EGA/CGA",13,10,0
|
||||||
vervesa db "Version of Vesa: Vesa x.x ",13,10,0
|
vervesa db "Version of Vesa: Vesa x.x",13,10,0
|
||||||
vervesa_off=22
|
vervesa_off=22
|
||||||
gr_mode db 186," Vesa 2.0+ 16 M LFB: [1] 640x480, [2] 800x600, "
|
gr_mode db 186," Vesa 2.0+ 16 M LFB: [1] 640x480, [2] 800x600, "
|
||||||
db "[3] 1024x768, [4] 1280x1024",13,10
|
db "[3] 1024x768, [4] 1280x1024",13,10
|
||||||
@ -62,25 +62,24 @@ gr_mode db 186," Vesa 2.0+ 16 M LFB: [1] 640x480, [2] 800x600, "
|
|||||||
db 186," EGA/CGA 256 Colors: [9] 320x200, "
|
db 186," EGA/CGA 256 Colors: [9] 320x200, "
|
||||||
db "VGA 16 Colors: [0] 640x480",13,10
|
db "VGA 16 Colors: [0] 640x480",13,10
|
||||||
db 186," Select mode: ",0
|
db 186," Select mode: ",0
|
||||||
bt24 db 13,10,186," Bits Per Pixel: 24",13,10,0
|
bt24 db "Bits Per Pixel: 24",13,10,0
|
||||||
bt32 db 13,10,186," Bits Per Pixel: 32",13,10,0
|
bt32 db "Bits Per Pixel: 32",13,10,0
|
||||||
vrrmprint db 13,10,186," Apply VRR? (picture frequency greater than 60Hz"
|
vrrmprint db "Apply VRR? (picture frequency greater than 60Hz"
|
||||||
db " only for transfers:",13,10
|
db " only for transfers:",13,10
|
||||||
db 186," 1024*768->800*600 and 800*600->640*480) [1-yes,2-no]:",0
|
db 186," 1024*768->800*600 and 800*600->640*480) [1-yes,2-no]:",0
|
||||||
askmouse db " Mouse at:"
|
;askmouse db " Mouse at:"
|
||||||
db " [1] PS/2 (USB), [2] Com1, [3] Com2."
|
; db " [1] PS/2 (USB), [2] Com1, [3] Com2."
|
||||||
db " Select port [1-3]: ",0
|
; db " Select port [1-3]: ",0
|
||||||
no_com1 db 13,10,186, " No COM1 mouse",0
|
;no_com1 db 13,10,186, " No COM1 mouse",0
|
||||||
no_com2 db 13,10,186, " No COM2 mouse",0
|
;no_com2 db 13,10,186, " No COM2 mouse",0
|
||||||
gr_acc db 13,10,186," Vesa 2.0+ : MTRR graphics acceleration "
|
gr_acc db "Vesa 2.0+ : MTRR graphics acceleration "
|
||||||
db "[1-yes/2-no] ? ",0
|
|
||||||
gr_direct db 186," Use direct LFB writing? "
|
|
||||||
db "[1-yes/2-no] ? ",0
|
db "[1-yes/2-no] ? ",0
|
||||||
|
;gr_direct db 186," Use direct LFB writing? "
|
||||||
|
; db "[1-yes/2-no] ? ",0
|
||||||
;mem_model db 13,10,186," Motherboard memory [1-16 Mb / 2-32 Mb / "
|
;mem_model db 13,10,186," Motherboard memory [1-16 Mb / 2-32 Mb / "
|
||||||
; db "3-64Mb / 4-128 Mb / 5-256 Mb] ? ",0
|
; db "3-64Mb / 4-128 Mb / 5-256 Mb] ? ",0
|
||||||
bootlog db 13,10,186," After bootlog display [1-continue/2-pause] ? ",0
|
;bootlog db 13,10,186," After bootlog display [1-continue/2-pause] ? ",0
|
||||||
bdev db 186
|
bdev db "Load ramdisk from [1-floppy; 2-C:\menuet.img (FAT32);"
|
||||||
db " Load ramdisk from [1-floppy; 2-C:\menuet.img (FAT32);"
|
|
||||||
db 13,10,186," "
|
db 13,10,186," "
|
||||||
db "3-use preloaded ram-image from kernel restart]: ",0
|
db "3-use preloaded ram-image from kernel restart]: ",0
|
||||||
probetext db 13,10,13,10,186," Use standart graphics mode? [1-yes, "
|
probetext db 13,10,13,10,186," Use standart graphics mode? [1-yes, "
|
||||||
@ -90,18 +89,18 @@ probetext db 13,10,13,10,186," Use standart graphics mode? [1-yes, "
|
|||||||
;memokz64 db 13,10,186," RAM 64 Mb",0
|
;memokz64 db 13,10,186," RAM 64 Mb",0
|
||||||
;memokz32 db 13,10,186," RAM 32 Mb",0
|
;memokz32 db 13,10,186," RAM 32 Mb",0
|
||||||
;memokz16 db 13,10,186," RAM 16 Mb",0
|
;memokz16 db 13,10,186," RAM 16 Mb",0
|
||||||
prnotfnd db " pr. - not found.",0
|
prnotfnd db "Fatal - Videomode not found.",0
|
||||||
modena db "Fatal - VBE 0x112+ required.",0
|
;modena db "Fatal - VBE 0x112+ required.",0
|
||||||
not386 db "Fatal - CPU 386+ required.",0
|
not386 db "Fatal - CPU 386+ required.",0
|
||||||
btns db 13,10,186,"Fatal - Can't determine color depth.",0
|
btns db "Fatal - Can't determine color depth.",0
|
||||||
fatalsel db 13,10,"Fatal - Graphics mode not supported by hardware.",0
|
fatalsel db "Fatal - Graphics mode not supported by hardware.",0
|
||||||
badsect db 13,10,186," Fatal - Bad sector. Replace floppy. ",0
|
badsect db 13,10,186," Fatal - Bad sector. Replace floppy.",0
|
||||||
memmovefailed db "Fatal - Int 0x15 move failed.",0
|
memmovefailed db 13,10,186," Fatal - Int 0x15 move failed.",0
|
||||||
okt db " ... OK"
|
okt db " ... OK"
|
||||||
linef db 13,10,0
|
linef db 13,10,0
|
||||||
diskload db 13,10,186," Loading diskette: 00 %",8,8,8,8,0
|
diskload db "Loading diskette: 00 %",8,8,8,8,0
|
||||||
backspace db 8,0
|
pros db "00"
|
||||||
pros db "00",8,8,0
|
backspace2 db 8,8,0
|
||||||
boot_dev db 0 ; 0=floppy, 1=hd
|
boot_dev db 0 ; 0=floppy, 1=hd
|
||||||
start_msg db "Press [abcd] to change settings, press [Enter] to continue booting",13,10,0
|
start_msg db "Press [abcd] to change settings, press [Enter] to continue booting",13,10,0
|
||||||
time_msg db " or wait "
|
time_msg db " or wait "
|
||||||
|
@ -53,7 +53,7 @@ d80x25_bottom:
|
|||||||
d80x25_bottom_num = 3
|
d80x25_bottom_num = 3
|
||||||
|
|
||||||
novesa db "‚¨¤¥®ª àâ : EGA/CGA",13,10,0
|
novesa db "‚¨¤¥®ª àâ : EGA/CGA",13,10,0
|
||||||
vervesa db "‚¥àá¨ï VESA: Vesa x.x ",13,10,0
|
vervesa db "‚¥àá¨ï VESA: Vesa x.x",13,10,0
|
||||||
vervesa_off=19
|
vervesa_off=19
|
||||||
gr_mode db 186," Vesa 2.0+ 16 M LFB: [1] 640x480, [2] 800x600, "
|
gr_mode db 186," Vesa 2.0+ 16 M LFB: [1] 640x480, [2] 800x600, "
|
||||||
db "[3] 1024x768, [4] 1280x1024",13,10
|
db "[3] 1024x768, [4] 1280x1024",13,10
|
||||||
@ -62,25 +62,24 @@ gr_mode db 186," Vesa 2.0+ 16 M LFB: [1] 640x480, [2] 800x600, "
|
|||||||
db 186," EGA/CGA 256 –¢¥â®¢: [9] 320x200, "
|
db 186," EGA/CGA 256 –¢¥â®¢: [9] 320x200, "
|
||||||
db "VGA 16 –¢¥â®¢: [0] 640x480",13,10
|
db "VGA 16 –¢¥â®¢: [0] 640x480",13,10
|
||||||
db 186," ‚ë¡¥à¨â¥ ¢¨¤¥®à¥¦¨¬: ",0
|
db 186," ‚ë¡¥à¨â¥ ¢¨¤¥®à¥¦¨¬: ",0
|
||||||
bt24 db 13,10,186," ƒ«ã¡¨ 梥â : 24",13,10,0
|
bt24 db "ƒ«ã¡¨ 梥â : 24",13,10,0
|
||||||
bt32 db 13,10,186," ƒ«ã¡¨ 梥â : 32",13,10,0
|
bt32 db "ƒ«ã¡¨ 梥â : 32",13,10,0
|
||||||
vrrmprint db 13,10,186," ˆá¯®«ì§®¢ âì VRR? (ç áâ®â ª ¤à®¢ ¢ëè¥ 60 ƒæ"
|
vrrmprint db "ˆá¯®«ì§®¢ âì VRR? (ç áâ®â ª ¤à®¢ ¢ëè¥ 60 ƒæ"
|
||||||
db " ⮫쪮 ¤«ï ¯¥à¥å®¤®¢:",13,10
|
db " ⮫쪮 ¤«ï ¯¥à¥å®¤®¢:",13,10
|
||||||
db 186," 1024*768>800*600 ¨ 800*600>640*480) [1-¤ , 2-¥â]: ",0
|
db 186," 1024*768>800*600 ¨ 800*600>640*480) [1-¤ , 2-¥â]: ",0
|
||||||
askmouse db "Œëèì:" ; 186, " "
|
;askmouse db "Œëèì:" ; 186, " "
|
||||||
db " [1] PS/2 (USB), [2] Com1, [3] Com2."
|
; db " [1] PS/2 (USB), [2] Com1, [3] Com2."
|
||||||
db " ‚ë¡¥à¨â¥ ¯®àâ [1-3]: ",0
|
; db " ‚ë¡¥à¨â¥ ¯®àâ [1-3]: ",0
|
||||||
no_com1 db 13,10,186," No COM1 mouse",0
|
;no_com1 db 13,10,186," No COM1 mouse",0
|
||||||
no_com2 db 13,10,186," No COM2 mouse",0
|
;no_com2 db 13,10,186," No COM2 mouse",0
|
||||||
gr_acc db 13,10,186," Vesa 2.0+: ‚ª«îç¨âì MTRR ¤«ï ãáª®à¥¨ï £à 䨪¨? "
|
gr_acc db "Vesa 2.0+: ‚ª«îç¨âì MTRR ¤«ï ãáª®à¥¨ï £à 䨪¨? "
|
||||||
db "[1-¤ /2-¥â]: ",0
|
|
||||||
gr_direct db 186," ˆá¯®«ì§®¢ âì «¨¥©ë© ¢¨¤¥®¡ãä¥à? "
|
|
||||||
db "[1-¤ /2-¥â]: ",0
|
db "[1-¤ /2-¥â]: ",0
|
||||||
|
;gr_direct db 186," ˆá¯®«ì§®¢ âì «¨¥©ë© ¢¨¤¥®¡ãä¥à? "
|
||||||
|
; db "[1-¤ /2-¥â]: ",0
|
||||||
;mem_model db 13,10,186," Ž¡ê+¬ ¯ ¬ï⨠[1-16 Mb / 2-32 Mb / "
|
;mem_model db 13,10,186," Ž¡ê+¬ ¯ ¬ï⨠[1-16 Mb / 2-32 Mb / "
|
||||||
; db "3-64Mb / 4-128 Mb / 5-256 Mb]: ",0
|
; db "3-64Mb / 4-128 Mb / 5-256 Mb]: ",0
|
||||||
bootlog db 13,10,186," <20>à®á¬®âà¥âì ¦ãà « § £à㧪¨? [1-¥â/2-¤ ]: ",0
|
;bootlog db 13,10,186," <20>à®á¬®âà¥âì ¦ãà « § £à㧪¨? [1-¥â/2-¤ ]: ",0
|
||||||
bdev db 186
|
bdev db "‡ £à㧨âì ®¡à § ¨§ [1-¤¨áª¥â ; 2-C:\menuet.img (FAT32);"
|
||||||
db " ‡ £à㧨âì ®¡à § ¨§ [1-¤¨áª¥â ; 2-C:\menuet.img (FAT32);"
|
|
||||||
db 13,10,186," "
|
db 13,10,186," "
|
||||||
db "3-¨á¯®«ì§®¢ âì 㦥 § £àã¦¥ë© ®¡à §]: ",0
|
db "3-¨á¯®«ì§®¢ âì 㦥 § £àã¦¥ë© ®¡à §]: ",0
|
||||||
probetext db 13,10,13,10,186," ‘â ¤ àâë© ¢¨¤¥®à¥¦¨¬? [1-¤ , "
|
probetext db 13,10,13,10,186," ‘â ¤ àâë© ¢¨¤¥®à¥¦¨¬? [1-¤ , "
|
||||||
@ -90,19 +89,18 @@ probetext db 13,10,13,10,186,"
|
|||||||
;memokz64 db 13,10,186," RAM 64 Mb",0
|
;memokz64 db 13,10,186," RAM 64 Mb",0
|
||||||
;memokz32 db 13,10,186," RAM 32 Mb",0
|
;memokz32 db 13,10,186," RAM 32 Mb",0
|
||||||
;memokz16 db 13,10,186," RAM 16 Mb",0
|
;memokz16 db 13,10,186," RAM 16 Mb",0
|
||||||
prnotfnd db " pr. - ®è¨¡ª .",0
|
prnotfnd db "Žè¨¡ª - ‚¨¤¥®à¥¦¨¬ ¥ ©¤¥.",0
|
||||||
modena db "Žè¨¡ª - ’ॡã¥âáï ¯®¤¤¥à¦ª VBE 0x112+.",0
|
;modena db "Žè¨¡ª - ’ॡã¥âáï ¯®¤¤¥à¦ª VBE 0x112+.",0
|
||||||
not386 db "Žè¨¡ª - ’ॡã¥âáï ¯à®æ¥áá®à 386+.",0
|
not386 db "Žè¨¡ª - ’ॡã¥âáï ¯à®æ¥áá®à 386+.",0
|
||||||
btns db 13,10,186," Žè¨¡ª - <20>¥ ¬®£ã ®¯à¥¤¥«¨âì £«ã¡¨ã 梥â .",0
|
btns db "Žè¨¡ª - <20>¥ ¬®£ã ®¯à¥¤¥«¨âì £«ã¡¨ã 梥â .",0
|
||||||
fatalsel db 13,10,"Žè¨¡ª - ‚ë¡à ë© ¢¨¤¥®à¥¦¨¬ ¥ ¯®¤¤¥à¦¨¢ ¥âáï.",0
|
fatalsel db "Žè¨¡ª - ‚ë¡à ë© ¢¨¤¥®à¥¦¨¬ ¥ ¯®¤¤¥à¦¨¢ ¥âáï.",0
|
||||||
badsect db 13,10,186," Žè¨¡ª - „¨áª¥â ¯®¢à¥¦¤¥ . <20>®¯à®¡ã©â¥ ¤àã£ãî. "
|
badsect db 13,10,186," Žè¨¡ª - „¨áª¥â ¯®¢à¥¦¤¥ . <20>®¯à®¡ã©â¥ ¤àã£ãî.",0
|
||||||
db 0
|
memmovefailed db 13,10,186," Žè¨¡ª - Int 0x15 move failed.",0
|
||||||
memmovefailed db "Fatal - Int 0x15 move failed.",0
|
|
||||||
okt db " ... OK"
|
okt db " ... OK"
|
||||||
linef db 13,10,0
|
linef db 13,10,0
|
||||||
diskload db 13,10,186," ‡ £à㧪 ¤¨áª¥âë: 00 %",8,8,8,8,0
|
diskload db "‡ £à㧪 ¤¨áª¥âë: 00 %",8,8,8,8,0
|
||||||
backspace db 8,0
|
pros db "00"
|
||||||
pros db "00",8,8,0
|
backspace2 db 8,8,0
|
||||||
boot_dev db 0
|
boot_dev db 0
|
||||||
start_msg db "<EFBFBD> ¦¬¨â¥ [abcd] ¤«ï ¨§¬¥¥¨ï áâ஥ª, [Enter] ¤«ï ¯à®¤®«¦¥¨ï § £à㧪¨",13,10,0
|
start_msg db "<EFBFBD> ¦¬¨â¥ [abcd] ¤«ï ¨§¬¥¥¨ï áâ஥ª, [Enter] ¤«ï ¯à®¤®«¦¥¨ï § £à㧪¨",13,10,0
|
||||||
time_msg db " ¨«¨ ¯®¤®¦¤¨â¥ "
|
time_msg db " ¨«¨ ¯®¤®¦¤¨â¥ "
|
||||||
|
344
kernel/trunk/core/debug.inc
Normal file
344
kernel/trunk/core/debug.inc
Normal file
@ -0,0 +1,344 @@
|
|||||||
|
; this code uses following additions to system structures:
|
||||||
|
; in additional app info at 80000..8FFFF:
|
||||||
|
; AC (dword) 0 or debugger slot
|
||||||
|
; BC (dword) address of debug event memory
|
||||||
|
; new process slot state:
|
||||||
|
; 1 = suspended
|
||||||
|
; 2 = suspended waiting for event
|
||||||
|
; new event: 8 (and new possible bitflag for A8 in additional app info)
|
||||||
|
; diamond, 2006
|
||||||
|
sys_debug_services:
|
||||||
|
cmp eax, 8
|
||||||
|
ja @f
|
||||||
|
jmp dword [sys_debug_services_table+eax*4]
|
||||||
|
@@: ret
|
||||||
|
sys_debug_services_table:
|
||||||
|
dd debug_set_event_data
|
||||||
|
dd debug_getcontext
|
||||||
|
dd debug_setcontext
|
||||||
|
dd debug_detach
|
||||||
|
dd debug_suspend
|
||||||
|
dd debug_resume
|
||||||
|
dd debug_read_process_memory
|
||||||
|
dd debug_write_process_memory
|
||||||
|
dd debug_terminate
|
||||||
|
|
||||||
|
debug_set_event_data:
|
||||||
|
; in: ebx = pointer
|
||||||
|
; destroys eax
|
||||||
|
mov eax, [0x3000]
|
||||||
|
shl eax, 8
|
||||||
|
mov [eax+0x80000+0xBC], ebx
|
||||||
|
ret
|
||||||
|
|
||||||
|
get_debuggee_slot:
|
||||||
|
; in: ebx=PID
|
||||||
|
; out: CF=1 if error
|
||||||
|
; CF=0 and eax=slot*0x20 if ok
|
||||||
|
; out: interrupts disabled
|
||||||
|
cli
|
||||||
|
mov eax, ebx
|
||||||
|
call pid_to_slot
|
||||||
|
test eax, eax
|
||||||
|
jz .ret_bad
|
||||||
|
shl eax, 5
|
||||||
|
push ebx
|
||||||
|
mov ebx, [0x3000]
|
||||||
|
cmp [0x80000+eax*8+0xAC], ebx
|
||||||
|
pop ebx
|
||||||
|
jnz .ret_bad
|
||||||
|
; clc ; automatically
|
||||||
|
ret
|
||||||
|
.ret_bad:
|
||||||
|
stc
|
||||||
|
ret
|
||||||
|
|
||||||
|
debug_detach:
|
||||||
|
; in: ebx=pid
|
||||||
|
; destroys eax,ebx
|
||||||
|
call get_debuggee_slot
|
||||||
|
jc .ret
|
||||||
|
and dword [eax*8+0x80000+0xAC], 0
|
||||||
|
call do_resume
|
||||||
|
.ret:
|
||||||
|
sti
|
||||||
|
ret
|
||||||
|
|
||||||
|
debug_terminate:
|
||||||
|
; in: ebx=pid
|
||||||
|
call get_debuggee_slot
|
||||||
|
jc debug_detach.ret
|
||||||
|
mov ebx, eax
|
||||||
|
shr ebx, 5
|
||||||
|
push 2
|
||||||
|
pop eax
|
||||||
|
jmp sys_system
|
||||||
|
|
||||||
|
debug_suspend:
|
||||||
|
; in: ebx=pid
|
||||||
|
; destroys eax,ebx
|
||||||
|
call get_debuggee_slot
|
||||||
|
jc .ret
|
||||||
|
mov bl, [0x3000+eax+0xA] ; process state
|
||||||
|
test bl, bl
|
||||||
|
jz .1
|
||||||
|
cmp bl, 5
|
||||||
|
jnz .ret
|
||||||
|
mov bl, 2
|
||||||
|
.2: mov [0x3000+eax+0xA], bl
|
||||||
|
.ret:
|
||||||
|
sti
|
||||||
|
ret
|
||||||
|
.1:
|
||||||
|
inc ebx
|
||||||
|
jmp .2
|
||||||
|
|
||||||
|
do_resume:
|
||||||
|
mov bl, [0x3000+eax+0xA]
|
||||||
|
cmp bl, 1
|
||||||
|
jz .1
|
||||||
|
cmp bl, 2
|
||||||
|
jnz .ret
|
||||||
|
mov bl, 5
|
||||||
|
.2: mov [0x3000+eax+0xA], bl
|
||||||
|
.ret: ret
|
||||||
|
.1: dec ebx
|
||||||
|
jmp .2
|
||||||
|
|
||||||
|
debug_resume:
|
||||||
|
; in: ebx=pid
|
||||||
|
; destroys eax,ebx
|
||||||
|
call get_debuggee_slot
|
||||||
|
jc .ret
|
||||||
|
call do_resume
|
||||||
|
.ret: sti
|
||||||
|
ret
|
||||||
|
|
||||||
|
debug_getcontext:
|
||||||
|
; in:
|
||||||
|
; ebx=pid
|
||||||
|
; ecx=sizeof(CONTEXT)
|
||||||
|
; edx->CONTEXT
|
||||||
|
; 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
|
||||||
|
pop ebx
|
||||||
|
dec eax
|
||||||
|
jnz .ret
|
||||||
|
call get_debuggee_slot
|
||||||
|
jc .ret
|
||||||
|
imul eax, tss_step/32
|
||||||
|
add eax, tss_data
|
||||||
|
mov edi, edx
|
||||||
|
cmp [l.cs - tss_sceleton + eax], app_code
|
||||||
|
jnz .ring0
|
||||||
|
lea esi, [l.eip - tss_sceleton + eax]
|
||||||
|
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, [l.esp0 - tss_sceleton + eax]
|
||||||
|
; top of ring0 stack: ring3 stack ptr (ss+esp), iret data (cs+eip+eflags), ds, es, pushad
|
||||||
|
sub esi, 8+12+8+20h
|
||||||
|
lodsd
|
||||||
|
mov [edi+24h], eax
|
||||||
|
lodsd
|
||||||
|
mov [edi+20h], eax
|
||||||
|
lodsd
|
||||||
|
mov [edi+1Ch], eax
|
||||||
|
lodsd
|
||||||
|
lodsd
|
||||||
|
mov [edi+14h], eax
|
||||||
|
lodsd
|
||||||
|
mov [edi+10h], eax
|
||||||
|
lodsd
|
||||||
|
mov [edi+0Ch], eax
|
||||||
|
lodsd
|
||||||
|
mov [edi+8], eax
|
||||||
|
add esi, 8
|
||||||
|
lodsd
|
||||||
|
mov [edi], eax
|
||||||
|
lodsd
|
||||||
|
lodsd
|
||||||
|
mov [edi+4], eax
|
||||||
|
lodsd
|
||||||
|
mov [edi+18h], eax
|
||||||
|
.ret:
|
||||||
|
sti
|
||||||
|
ret
|
||||||
|
|
||||||
|
debug_setcontext:
|
||||||
|
; in:
|
||||||
|
; ebx=pid
|
||||||
|
; ecx=sizeof(CONTEXT)
|
||||||
|
; edx->CONTEXT
|
||||||
|
; 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
|
||||||
|
pop ebx
|
||||||
|
dec eax
|
||||||
|
jnz .ret
|
||||||
|
call get_debuggee_slot
|
||||||
|
jc .stiret
|
||||||
|
imul eax, tss_step/32
|
||||||
|
add eax, tss_data
|
||||||
|
mov esi, edx
|
||||||
|
cmp [l.cs - tss_sceleton + eax], app_code
|
||||||
|
jnz .ring0
|
||||||
|
lea edi, [l.eip - tss_sceleton + eax]
|
||||||
|
shr ecx, 2
|
||||||
|
rep movsd
|
||||||
|
jmp .stiret
|
||||||
|
.ring0:
|
||||||
|
mov edi, [l.esp0 - tss_sceleton + eax]
|
||||||
|
sub edi, 8+12+8+20h
|
||||||
|
mov eax, [esi+24h]
|
||||||
|
stosd
|
||||||
|
mov eax, [esi+20h]
|
||||||
|
stosd
|
||||||
|
mov eax, [esi+1Ch]
|
||||||
|
stosd
|
||||||
|
scasd
|
||||||
|
mov eax, [esi+14h]
|
||||||
|
stosd
|
||||||
|
mov eax, [esi+10h]
|
||||||
|
stosd
|
||||||
|
mov eax, [esi+0Ch]
|
||||||
|
stosd
|
||||||
|
mov eax, [esi+8]
|
||||||
|
stosd
|
||||||
|
add edi, 8
|
||||||
|
mov eax, [esi]
|
||||||
|
stosd
|
||||||
|
scasd
|
||||||
|
mov eax, [esi+4]
|
||||||
|
stosd
|
||||||
|
mov eax, [esi+18h]
|
||||||
|
stosd
|
||||||
|
.stiret:
|
||||||
|
sti
|
||||||
|
.ret:
|
||||||
|
ret
|
||||||
|
|
||||||
|
debug_read_process_memory:
|
||||||
|
; in:
|
||||||
|
; ebx=pid
|
||||||
|
; ecx=length
|
||||||
|
; esi->buffer in debugger
|
||||||
|
; edx=address in debuggee
|
||||||
|
; out: [esp+36]=eax=sizeof(read)
|
||||||
|
; destroys all
|
||||||
|
add esi, std_application_base_address
|
||||||
|
push ebx
|
||||||
|
mov ebx, esi
|
||||||
|
call check_region
|
||||||
|
pop ebx
|
||||||
|
dec eax
|
||||||
|
jnz .ret
|
||||||
|
call get_debuggee_slot
|
||||||
|
jc .stiret
|
||||||
|
mov ebx, esi
|
||||||
|
call read_process_memory
|
||||||
|
.stiret:
|
||||||
|
sti
|
||||||
|
.ret:
|
||||||
|
ret
|
||||||
|
|
||||||
|
debug_write_process_memory:
|
||||||
|
; in:
|
||||||
|
; ebx=pid
|
||||||
|
; ecx=length
|
||||||
|
; esi->buffer in debugger
|
||||||
|
; edx=address in debuggee
|
||||||
|
; out: [esp+36]=eax=sizeof(write)
|
||||||
|
; destroys all
|
||||||
|
add esi, std_application_base_address
|
||||||
|
push ebx
|
||||||
|
mov ebx, esi
|
||||||
|
call check_region
|
||||||
|
pop ebx
|
||||||
|
dec eax
|
||||||
|
jnz .ret
|
||||||
|
call get_debuggee_slot
|
||||||
|
jc .stiret
|
||||||
|
mov ebx, esi
|
||||||
|
call write_process_memory
|
||||||
|
.stiret:
|
||||||
|
sti
|
||||||
|
.ret:
|
||||||
|
ret
|
||||||
|
|
||||||
|
debugger_notify:
|
||||||
|
; in: eax=debugger slot
|
||||||
|
; ecx=size of debug message
|
||||||
|
; [esp+4]..[esp+4+ecx]=message
|
||||||
|
; interrupts must be disabled!
|
||||||
|
; destroys all general registers
|
||||||
|
; interrupts remain disabled
|
||||||
|
mov ebp, eax
|
||||||
|
shl eax, 8
|
||||||
|
.1:
|
||||||
|
mov edx, [0x80000+eax+0xBC]
|
||||||
|
test edx, edx
|
||||||
|
jz .ret
|
||||||
|
; read buffer header
|
||||||
|
push ecx
|
||||||
|
push eax
|
||||||
|
push eax
|
||||||
|
mov eax, ebp
|
||||||
|
mov ebx, esp
|
||||||
|
mov ecx, 8
|
||||||
|
call read_process_memory
|
||||||
|
cmp eax, ecx
|
||||||
|
jz @f
|
||||||
|
add esp, 12
|
||||||
|
jmp .ret
|
||||||
|
@@:
|
||||||
|
cmp dword [ebx], 0
|
||||||
|
jg @f
|
||||||
|
.2:
|
||||||
|
pop ecx
|
||||||
|
pop ecx
|
||||||
|
pop ecx
|
||||||
|
sti
|
||||||
|
call change_task
|
||||||
|
cli
|
||||||
|
jmp .1
|
||||||
|
@@:
|
||||||
|
mov ecx, [ebx+8]
|
||||||
|
add ecx, [ebx+4]
|
||||||
|
cmp ecx, [ebx]
|
||||||
|
ja .2
|
||||||
|
; advance buffer position
|
||||||
|
push ecx
|
||||||
|
mov ecx, 4
|
||||||
|
sub ebx, ecx
|
||||||
|
mov eax, ebp
|
||||||
|
add edx, ecx
|
||||||
|
call write_process_memory
|
||||||
|
pop eax
|
||||||
|
; write message
|
||||||
|
mov eax, ebp
|
||||||
|
add edx, ecx
|
||||||
|
add edx, [ebx+8]
|
||||||
|
add ebx, 20
|
||||||
|
pop ecx
|
||||||
|
pop ecx
|
||||||
|
pop ecx
|
||||||
|
call write_process_memory
|
||||||
|
; new debug event
|
||||||
|
mov eax, ebp
|
||||||
|
shl eax, 8
|
||||||
|
or byte [0x80000+eax+0xA8+1], 1 ; set flag 100h
|
||||||
|
.ret:
|
||||||
|
ret
|
@ -60,6 +60,7 @@ new_start_application_floppy:
|
|||||||
;input:
|
;input:
|
||||||
; eax - pointer to filename
|
; eax - pointer to filename
|
||||||
; ebx - parameters to pass
|
; ebx - parameters to pass
|
||||||
|
; edx - flags
|
||||||
;result:
|
;result:
|
||||||
; eax - pid of new process
|
; eax - pid of new process
|
||||||
; or 0 if call fails.
|
; or 0 if call fails.
|
||||||
@ -231,6 +232,7 @@ new_start_application_fl:
|
|||||||
;input:
|
;input:
|
||||||
; eax - pointer to filename
|
; eax - pointer to filename
|
||||||
; ebx - parameters to pass
|
; ebx - parameters to pass
|
||||||
|
; edx - flags
|
||||||
;result:
|
;result:
|
||||||
; eax - pid of new process
|
; eax - pid of new process
|
||||||
; or 0 if call fails.
|
; or 0 if call fails.
|
||||||
@ -546,6 +548,13 @@ new_start_application_fl:
|
|||||||
mov ebx,[new_process_place]
|
mov ebx,[new_process_place]
|
||||||
shl ebx,5
|
shl ebx,5
|
||||||
mov [0x3000+ebx+0xa],byte 0 ;set process state - running
|
mov [0x3000+ebx+0xa],byte 0 ;set process state - running
|
||||||
|
; set if debuggee
|
||||||
|
test byte [esp+28], 1
|
||||||
|
jz .no_debug
|
||||||
|
mov [0x3000+ebx+0xa],byte 1 ;set process state - suspended
|
||||||
|
mov eax,[0x3000]
|
||||||
|
mov [0x80000+ebx*8+0xac],eax ;set debugger PID - current
|
||||||
|
.no_debug:
|
||||||
|
|
||||||
mov esi,new_process_running
|
mov esi,new_process_running
|
||||||
call sys_msg_board_str ;output information about succefull startup
|
call sys_msg_board_str ;output information about succefull startup
|
||||||
@ -563,6 +572,7 @@ new_sys_threads:
|
|||||||
; ecx=thread stack value
|
; ecx=thread stack value
|
||||||
;result:
|
;result:
|
||||||
; eax=pid
|
; eax=pid
|
||||||
|
xor edx,edx ; flags=0
|
||||||
pushad
|
pushad
|
||||||
|
|
||||||
cmp eax,1
|
cmp eax,1
|
||||||
@ -1165,6 +1175,7 @@ new_start_application_hd:
|
|||||||
;eax - file name (kernel address)
|
;eax - file name (kernel address)
|
||||||
;ebx - file name length
|
;ebx - file name length
|
||||||
;ecx - work area (kernel address)
|
;ecx - work area (kernel address)
|
||||||
|
;edx - flags
|
||||||
;ebp - parameters
|
;ebp - parameters
|
||||||
mov [appl_path],edi
|
mov [appl_path],edi
|
||||||
pushad
|
pushad
|
||||||
@ -1355,3 +1366,5 @@ new_start_application_hd:
|
|||||||
sti
|
sti
|
||||||
ret
|
ret
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
include 'debug.inc'
|
||||||
|
@ -4,8 +4,7 @@
|
|||||||
|
|
||||||
align 32
|
align 32
|
||||||
irq0:
|
irq0:
|
||||||
pushad
|
save_ring3_context
|
||||||
push ds es
|
|
||||||
mov ax, os_data
|
mov ax, os_data
|
||||||
mov ds, ax
|
mov ds, ax
|
||||||
mov es, ax
|
mov es, ax
|
||||||
@ -45,6 +44,7 @@ irq0:
|
|||||||
.waiting_for_termination:
|
.waiting_for_termination:
|
||||||
.waiting_for_reuse:
|
.waiting_for_reuse:
|
||||||
.waiting_for_event:
|
.waiting_for_event:
|
||||||
|
.suspended:
|
||||||
cmp ebx, [0x3004]
|
cmp ebx, [0x3004]
|
||||||
jb @f
|
jb @f
|
||||||
mov edi, 0x3000
|
mov edi, 0x3000
|
||||||
@ -55,6 +55,10 @@ irq0:
|
|||||||
inc ebx
|
inc ebx
|
||||||
|
|
||||||
mov al, byte [edi+0xA]
|
mov al, byte [edi+0xA]
|
||||||
|
cmp al, 1
|
||||||
|
jz .suspended
|
||||||
|
cmp al, 2
|
||||||
|
jz .suspended
|
||||||
cmp al, 3
|
cmp al, 3
|
||||||
je .waiting_for_termination
|
je .waiting_for_termination
|
||||||
cmp al, 4
|
cmp al, 4
|
||||||
@ -101,8 +105,7 @@ irq0:
|
|||||||
inc [context_counter] ;noname & halyavin
|
inc [context_counter] ;noname & halyavin
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
pop es ds
|
restore_ring3_context
|
||||||
popad
|
|
||||||
iret
|
iret
|
||||||
|
|
||||||
|
|
||||||
|
@ -164,6 +164,17 @@ iglobal
|
|||||||
dd i40
|
dd i40
|
||||||
endg
|
endg
|
||||||
|
|
||||||
|
macro save_ring3_context
|
||||||
|
{
|
||||||
|
push ds es
|
||||||
|
pushad
|
||||||
|
}
|
||||||
|
macro restore_ring3_context
|
||||||
|
{
|
||||||
|
popad
|
||||||
|
pop es ds
|
||||||
|
}
|
||||||
|
|
||||||
; simply return control to interrupted process
|
; simply return control to interrupted process
|
||||||
unknown_interrupt:
|
unknown_interrupt:
|
||||||
iret
|
iret
|
||||||
@ -172,6 +183,7 @@ macro exc_wo_code [num]
|
|||||||
{
|
{
|
||||||
forward
|
forward
|
||||||
e#num :
|
e#num :
|
||||||
|
save_ring3_context
|
||||||
mov bl, num
|
mov bl, num
|
||||||
jmp exc_c
|
jmp exc_c
|
||||||
}
|
}
|
||||||
@ -181,6 +193,7 @@ macro exc_w_code [num]
|
|||||||
forward
|
forward
|
||||||
e#num :
|
e#num :
|
||||||
add esp, 4
|
add esp, 4
|
||||||
|
save_ring3_context
|
||||||
mov bl, num
|
mov bl, num
|
||||||
jmp exc_c
|
jmp exc_c
|
||||||
}
|
}
|
||||||
@ -193,6 +206,16 @@ exc_c:
|
|||||||
mov ds, ax
|
mov ds, ax
|
||||||
mov es, ax
|
mov es, ax
|
||||||
|
|
||||||
|
; test if debugging
|
||||||
|
cli
|
||||||
|
mov eax, [0x3000]
|
||||||
|
shl eax, 8
|
||||||
|
mov eax, [0x80000+eax+0xAC]
|
||||||
|
test eax, eax
|
||||||
|
jnz .debug
|
||||||
|
sti
|
||||||
|
; not debuggee => say error and terminate
|
||||||
|
add esp, 28h
|
||||||
movzx eax, bl
|
movzx eax, bl
|
||||||
mov [error_interrupt], eax
|
mov [error_interrupt], eax
|
||||||
call show_error_parameters
|
call show_error_parameters
|
||||||
@ -202,6 +225,25 @@ exc_c:
|
|||||||
|
|
||||||
jmp change_task
|
jmp change_task
|
||||||
|
|
||||||
|
.debug:
|
||||||
|
; we are debugged process, notify debugger and suspend ourself
|
||||||
|
; eax=debugger PID
|
||||||
|
movzx ecx, bl
|
||||||
|
push ecx
|
||||||
|
mov ecx, [0x3010]
|
||||||
|
push dword [ecx+4] ; PID of current process
|
||||||
|
push 12
|
||||||
|
pop ecx
|
||||||
|
push 1 ; 1=exception
|
||||||
|
call debugger_notify
|
||||||
|
pop ecx
|
||||||
|
pop ecx
|
||||||
|
pop ecx
|
||||||
|
mov edx, [0x3010]
|
||||||
|
mov byte [edx+0xA], 1 ; suspended
|
||||||
|
call change_task
|
||||||
|
restore_ring3_context
|
||||||
|
iretd
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; FPU ERROR HANDLER ;;
|
;; FPU ERROR HANDLER ;;
|
||||||
@ -209,11 +251,8 @@ exc_c:
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
e7:
|
e7:
|
||||||
|
save_ring3_context
|
||||||
clts
|
clts
|
||||||
|
|
||||||
push eax
|
|
||||||
push ds es
|
|
||||||
|
|
||||||
mov ax, os_data
|
mov ax, os_data
|
||||||
mov ds, ax
|
mov ds, ax
|
||||||
mov es, ax
|
mov es, ax
|
||||||
@ -232,10 +271,7 @@ e7:
|
|||||||
frstor [eax+0x10]
|
frstor [eax+0x10]
|
||||||
@@:
|
@@:
|
||||||
mov [eax + 0x7f], byte 1
|
mov [eax + 0x7f], byte 1
|
||||||
|
restore_ring3_context
|
||||||
pop es ds
|
|
||||||
pop eax
|
|
||||||
|
|
||||||
iret
|
iret
|
||||||
|
|
||||||
iglobal
|
iglobal
|
||||||
@ -320,7 +356,7 @@ macro irqh [num]
|
|||||||
{
|
{
|
||||||
forward
|
forward
|
||||||
p_irq#num :
|
p_irq#num :
|
||||||
pushad
|
save_ring3_context
|
||||||
mov edi, num
|
mov edi, num
|
||||||
jmp irq_c
|
jmp irq_c
|
||||||
}
|
}
|
||||||
@ -328,58 +364,48 @@ macro irqh [num]
|
|||||||
irqh 2,5,7,8,9,10,11,14,15
|
irqh 2,5,7,8,9,10,11,14,15
|
||||||
|
|
||||||
irq_c:
|
irq_c:
|
||||||
push ds es
|
|
||||||
mov ax, os_data
|
mov ax, os_data
|
||||||
mov ds, ax
|
mov ds, ax
|
||||||
mov es, ax
|
mov es, ax
|
||||||
call irqhandler
|
call irqhandler
|
||||||
pop es ds
|
restore_ring3_context
|
||||||
popad
|
|
||||||
iret
|
iret
|
||||||
|
|
||||||
p_irq6:
|
p_irq6:
|
||||||
pushad
|
save_ring3_context
|
||||||
push ds es
|
|
||||||
mov ax, os_data
|
mov ax, os_data
|
||||||
mov ds, ax
|
mov ds, ax
|
||||||
mov es, ax
|
mov es, ax
|
||||||
call fdc_irq
|
call fdc_irq
|
||||||
call ready_for_next_irq
|
call ready_for_next_irq
|
||||||
pop es ds
|
restore_ring3_context
|
||||||
popad
|
|
||||||
iret
|
iret
|
||||||
|
|
||||||
p_irq3:
|
p_irq3:
|
||||||
pushad
|
save_ring3_context
|
||||||
push ds es
|
|
||||||
mov ax, os_data
|
mov ax, os_data
|
||||||
mov ds, ax
|
mov ds, ax
|
||||||
mov es, ax
|
mov es, ax
|
||||||
call check_mouse_data_com2
|
call check_mouse_data_com2
|
||||||
pop es ds
|
restore_ring3_context
|
||||||
popad
|
|
||||||
iret
|
iret
|
||||||
|
|
||||||
p_irq4:
|
p_irq4:
|
||||||
pushad
|
save_ring3_context
|
||||||
push ds es
|
|
||||||
mov ax, os_data
|
mov ax, os_data
|
||||||
mov ds, ax
|
mov ds, ax
|
||||||
mov es, ax
|
mov es, ax
|
||||||
call check_mouse_data_com1
|
call check_mouse_data_com1
|
||||||
pop es ds
|
restore_ring3_context
|
||||||
popad
|
|
||||||
iret
|
iret
|
||||||
|
|
||||||
p_irq12:
|
p_irq12:
|
||||||
pushad
|
save_ring3_context
|
||||||
push ds es
|
|
||||||
mov ax, os_data
|
mov ax, os_data
|
||||||
mov ds, ax
|
mov ds, ax
|
||||||
mov es, ax
|
mov es, ax
|
||||||
call check_mouse_data_ps2
|
call check_mouse_data_ps2
|
||||||
pop es ds
|
restore_ring3_context
|
||||||
popad
|
|
||||||
iret
|
iret
|
||||||
|
|
||||||
ready_for_next_irq:
|
ready_for_next_irq:
|
||||||
@ -396,8 +422,7 @@ ready_for_next_irq_1:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
irqD:
|
irqD:
|
||||||
pushad
|
save_ring3_context
|
||||||
push ds es
|
|
||||||
mov ax, os_data
|
mov ax, os_data
|
||||||
mov ds, ax
|
mov ds, ax
|
||||||
mov es, ax
|
mov es, ax
|
||||||
@ -410,10 +435,10 @@ irqD:
|
|||||||
mov al,0x20
|
mov al,0x20
|
||||||
out dx,al
|
out dx,al
|
||||||
mov dx,0x20
|
mov dx,0x20
|
||||||
out dx,al
|
out dx,al
|
||||||
|
|
||||||
|
restore_ring3_context
|
||||||
|
|
||||||
pop es ds
|
|
||||||
popad
|
|
||||||
iret
|
iret
|
||||||
|
|
||||||
|
|
||||||
@ -650,12 +675,13 @@ terminate: ; terminate application
|
|||||||
call sys_msg_board_str
|
call sys_msg_board_str
|
||||||
pop esi
|
pop esi
|
||||||
|
|
||||||
|
@@:
|
||||||
cli
|
cli
|
||||||
cmp [application_table_status],0
|
cmp [application_table_status],0
|
||||||
je term9
|
je term9
|
||||||
sti
|
sti
|
||||||
call change_task
|
call change_task
|
||||||
jmp terminate
|
jmp @b
|
||||||
term9:
|
term9:
|
||||||
|
|
||||||
call set_application_table_status
|
call set_application_table_status
|
||||||
@ -752,6 +778,23 @@ terminate: ; terminate application
|
|||||||
rep stosd
|
rep stosd
|
||||||
popa
|
popa
|
||||||
|
|
||||||
|
; debuggee test
|
||||||
|
pushad
|
||||||
|
mov edi, esi
|
||||||
|
shl edi, 5
|
||||||
|
mov eax, [0x80000+edi*8+0xAC]
|
||||||
|
test eax, eax
|
||||||
|
jz .nodebug
|
||||||
|
push 8
|
||||||
|
pop ecx
|
||||||
|
push dword [0x3000+edi+0x4] ; PID
|
||||||
|
push 2
|
||||||
|
call debugger_notify
|
||||||
|
pop ecx
|
||||||
|
pop ecx
|
||||||
|
.nodebug:
|
||||||
|
popad
|
||||||
|
|
||||||
pusha ; at 0x80000+
|
pusha ; at 0x80000+
|
||||||
mov edi,esi
|
mov edi,esi
|
||||||
shl edi,8
|
shl edi,8
|
||||||
@ -863,6 +906,25 @@ terminate: ; terminate application
|
|||||||
mov edi,esi ; do not run this process slot
|
mov edi,esi ; do not run this process slot
|
||||||
shl edi, 5
|
shl edi, 5
|
||||||
mov [edi+0x300A],byte 9
|
mov [edi+0x300A],byte 9
|
||||||
|
; debugger test - terminate all debuggees
|
||||||
|
mov eax, 2
|
||||||
|
mov ecx, 0x80000+2*0x100+0xAC
|
||||||
|
.xd0:
|
||||||
|
cmp eax, [0x3004]
|
||||||
|
ja .xd1
|
||||||
|
cmp dword [ecx], esi
|
||||||
|
jnz @f
|
||||||
|
and dword [ecx], 0
|
||||||
|
pushad
|
||||||
|
xchg eax, ebx
|
||||||
|
mov eax, 2
|
||||||
|
call sys_system
|
||||||
|
popad
|
||||||
|
@@:
|
||||||
|
inc eax
|
||||||
|
add ecx, 0x100
|
||||||
|
jmp .xd0
|
||||||
|
.xd1:
|
||||||
; call systest
|
; call systest
|
||||||
sti ; .. and life goes on
|
sti ; .. and life goes on
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ align 32
|
|||||||
i40:
|
i40:
|
||||||
push ds es
|
push ds es
|
||||||
pushad
|
pushad
|
||||||
|
cld
|
||||||
|
|
||||||
mov ax,word os_data
|
mov ax,word os_data
|
||||||
mov ds,ax
|
mov ds,ax
|
||||||
@ -136,9 +137,9 @@ iglobal
|
|||||||
dd sys_process_def ; 66-Process definitions - keyboard
|
dd sys_process_def ; 66-Process definitions - keyboard
|
||||||
dd sys_window_move ; 67-Window move or resize
|
dd sys_window_move ; 67-Window move or resize
|
||||||
dd sys_internal_services ; 68-Some internal services
|
dd sys_internal_services ; 68-Some internal services
|
||||||
|
dd sys_debug_services ; 69-Debug
|
||||||
|
|
||||||
times 255 - ( ($-servetable) /4 ) dd undefined_syscall
|
times 255 - ( ($-servetable) /4 ) dd undefined_syscall
|
||||||
|
|
||||||
dd sys_end ; -1-end application
|
dd sys_end ; -1-end application
|
||||||
endg
|
endg
|
||||||
|
|
||||||
|
@ -318,6 +318,7 @@ endg
|
|||||||
mov ebx,[ebx+0x10]
|
mov ebx,[ebx+0x10]
|
||||||
add ebx,[esp+12]
|
add ebx,[esp+12]
|
||||||
no_fl_start_param:
|
no_fl_start_param:
|
||||||
|
mov edx,[esp+16] ; flags
|
||||||
|
|
||||||
call start_application_fl
|
call start_application_fl
|
||||||
|
|
||||||
@ -440,6 +441,7 @@ endg
|
|||||||
add ebx,[esp+12]
|
add ebx,[esp+12]
|
||||||
|
|
||||||
no_flp_start_param:
|
no_flp_start_param:
|
||||||
|
mov edx,[esp+16] ; flags
|
||||||
|
|
||||||
call start_application_floppy
|
call start_application_floppy
|
||||||
|
|
||||||
@ -778,6 +780,7 @@ choice_necessity_partition_1:
|
|||||||
mov ebp,[ebp+0x10]
|
mov ebp,[ebp+0x10]
|
||||||
add ebp,[esp+12]
|
add ebp,[esp+12]
|
||||||
no_hd_start_param:
|
no_hd_start_param:
|
||||||
|
mov edx,[esp+16] ; flags
|
||||||
|
|
||||||
call start_application_hd
|
call start_application_hd
|
||||||
|
|
||||||
|
@ -154,6 +154,18 @@ get_event_for_app:
|
|||||||
ret
|
ret
|
||||||
no_stack_event:
|
no_stack_event:
|
||||||
|
|
||||||
|
test byte [edi+1], 1 ; DEBUG
|
||||||
|
jz no_debug_event
|
||||||
|
mov eax, [0x3000]
|
||||||
|
shl eax, 8
|
||||||
|
test [eax+0x80000+0xA8+1], byte 1
|
||||||
|
jz no_debug_event
|
||||||
|
and byte [eax+0x80000+0xA8+1], not 1
|
||||||
|
popad
|
||||||
|
mov eax, 9
|
||||||
|
ret
|
||||||
|
no_debug_event:
|
||||||
|
|
||||||
cmp dword [edi], 0xFFFF
|
cmp dword [edi], 0xFFFF
|
||||||
jbe no_events
|
jbe no_events
|
||||||
|
|
||||||
|
@ -30,8 +30,7 @@ endg
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
irq1:
|
irq1:
|
||||||
pushad
|
save_ring3_context
|
||||||
push ds es
|
|
||||||
mov ax, os_data
|
mov ax, os_data
|
||||||
mov ds, ax
|
mov ds, ax
|
||||||
mov es, ax
|
mov es, ax
|
||||||
@ -212,8 +211,7 @@ irq1:
|
|||||||
mov al,0x20 ; ready for next irq
|
mov al,0x20 ; ready for next irq
|
||||||
out 0x20,al
|
out 0x20,al
|
||||||
|
|
||||||
pop es ds
|
restore_ring3_context
|
||||||
popad
|
|
||||||
iret
|
iret
|
||||||
|
|
||||||
set_lights:
|
set_lights:
|
||||||
|
@ -728,12 +728,16 @@ finit ;reset the registers, contents which are still equal RM
|
|||||||
cmp al,1
|
cmp al,1
|
||||||
jne no_load_vrr_m
|
jne no_load_vrr_m
|
||||||
mov eax,vrr_m
|
mov eax,vrr_m
|
||||||
|
xor ebx,ebx ; no parameters
|
||||||
|
xor edx,edx ; no flags
|
||||||
call start_application_fl
|
call start_application_fl
|
||||||
cmp eax,2 ; if vrr_m app found (PID=2)
|
cmp eax,2 ; if vrr_m app found (PID=2)
|
||||||
je first_app_found
|
je first_app_found
|
||||||
|
|
||||||
no_load_vrr_m:
|
no_load_vrr_m:
|
||||||
mov eax,firstapp
|
mov eax,firstapp
|
||||||
|
xor ebx,ebx ; no parameters
|
||||||
|
xor edx,edx ; no flags
|
||||||
call start_application_fl
|
call start_application_fl
|
||||||
|
|
||||||
cmp eax,2 ; continue if a process has been loaded
|
cmp eax,2 ; continue if a process has been loaded
|
||||||
@ -3108,6 +3112,8 @@ checkmisc:
|
|||||||
cmp [ctrl_alt_del], 1
|
cmp [ctrl_alt_del], 1
|
||||||
jne nocpustart
|
jne nocpustart
|
||||||
mov eax, cpustring
|
mov eax, cpustring
|
||||||
|
xor ebx,ebx ; no parameters
|
||||||
|
xor edx,edx ; no flags
|
||||||
call start_application_fl
|
call start_application_fl
|
||||||
mov [ctrl_alt_del], 0
|
mov [ctrl_alt_del], 0
|
||||||
nocpustart:
|
nocpustart:
|
||||||
@ -4570,6 +4576,7 @@ syscall_startapp: ; StartApp
|
|||||||
add ebx,[edi]
|
add ebx,[edi]
|
||||||
noapppar:
|
noapppar:
|
||||||
; call start_application_fl
|
; call start_application_fl
|
||||||
|
xor edx,edx ; compatibility - flags=0
|
||||||
call new_start_application_fl
|
call new_start_application_fl
|
||||||
mov [esp+36],eax
|
mov [esp+36],eax
|
||||||
ret
|
ret
|
||||||
@ -4604,7 +4611,8 @@ syscall_starthdapp: ; StartHdApp
|
|||||||
add edi,0x10
|
add edi,0x10
|
||||||
add eax,[edi]
|
add eax,[edi]
|
||||||
add ecx,[edi]
|
add ecx,[edi]
|
||||||
mov ebp,0
|
xor ebp,ebp
|
||||||
|
xor edx,edx ; compatibility - flags=0
|
||||||
call start_application_hd
|
call start_application_hd
|
||||||
mov [esp+36],eax
|
mov [esp+36],eax
|
||||||
ret
|
ret
|
||||||
|
Loading…
Reference in New Issue
Block a user