Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2013 → Rev 2014

/kernel/branches/Kolibri-A/trunk/bld.bat
1,53 → 1,7
@echo off
 
set languages=en ru
 
call :Check_Lang en
call :Target_kernel
 
if ERRORLEVEL 0 goto Exit_OK
 
echo There was an error executing script.
echo For any help, please send a report.
pause
goto :eof
 
 
 
 
:Check_Lang
set res=%1
:Check_Lang_loop
for %%a in (%languages%) do if %%a==%res% set lang=%res%
if defined lang goto :eof
 
echo Language '%res%' is incorrect
echo Enter valid language [ %languages% ]:
 
set /P res=">
goto Check_Lang_loop
goto :eof
 
 
:Target_kernel
echo *** building kernel with language '%lang%' ...
 
if not exist bin mkdir bin
echo lang fix %lang% > lang.inc
c:\fasm\fasm -m 65536 kernel.asm bin\kernel.mnt
if not %errorlevel%==0 goto :Error_FasmFailed
erase lang.inc
goto :eof
fasm -m 65536 kernel.asm bin\kernel.mnt
 
 
 
:Error_FasmFailed
echo error: fasm execution failed
erase lang.inc
pause
exit 1
 
:Exit_OK
echo all operations has been done
pause
exit 0
exit 0
/kernel/branches/Kolibri-A/trunk/boot/shutdown.inc
File deleted
Property changes:
Deleted: svn:keywords
-Rev
\ No newline at end of property
/kernel/branches/Kolibri-A/trunk/boot/bootcode.inc
20,49 → 20,7
;
;==========================================================================
 
if 0
putchar:
; in: al=character
mov ah, 0Eh
mov bh, 0
int 10h
ret
 
print:
; in: si->string
mov al, 186
call putchar
mov al, ' '
call putchar
 
printplain:
; in: si->string
pusha
lodsb
@@:
call putchar
lodsb
test al,al
jnz @b
popa
ret
 
 
setcursor:
; in: dl=column, dh=row
mov ah, 2
mov bh, 0
int 10h
ret
 
macro _setcursor row,column
{
mov dx, row*256 + column
call setcursor
}
 
end if
 
boot_read_floppy:
push si
xor si, si
80,8 → 38,6
ret
 
sayerr_plain:
jmp $
 
sayerr:
jmp $
 
163,6 → 119,7
push cs
pop es
 
if 0
; set videomode
mov ax, 3
int 0x10
172,6 → 129,7
pop es
xor di, di
mov ah, 1*16+15
end if
 
cpugood:
 
302,6 → 260,7
 
; pop ax ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ??
jmp .continue
 
.loader_block dd -1
.continue:
sti
344,316 → 303,8
 
; READ DISKETTE TO MEMORY
 
if 0
----
cmp [boot_dev],0
jne no_sys_on_floppy
xor ax, ax ; reset drive
xor dx, dx
int 0x13
; do we boot from CD-ROM?
mov ah, 41h
mov bx, 55AAh
xor dx, dx
int 0x13
jc .nocd
cmp bx, 0AA55h
jnz .nocd
mov ah, 48h
push ds
push es
pop ds
mov si, 0xa000
mov word [si], 30
int 0x13
pop ds
jc .nocd
push ds
lds si, [es:si+26]
test byte [ds:si+10], 40h
pop ds
jz .nocd
; yes - read all floppy by 18 sectors
 
; TODO: !!!! read only first sector and set variables !!!!!
; ...
; TODO: !!! then read flippy image track by track
 
mov cx, 0x0001 ; startcyl,startsector
.a1:
push cx dx
mov al, 18
mov bx, 0xa000
call boot_read_floppy
mov si, movedesc
push es
push ds
pop es
mov cx, 256*18
mov ah, 0x87
int 0x15
pop es
pop dx cx
test ah, ah
jnz sayerr_floppy
add dword [si+8*3+2], 512*18
inc dh
cmp dh, 2
jnz .a1
mov dh, 0
inc ch
cmp ch, 80
jae ok_sys_on_floppy
mov al, ch
shr ch, 2
jmp .a1
.nocd:
; no - read only used sectors from floppy
; now load floppy image to memory
; at first load boot sector and first FAT table
 
; read only first sector and fill variables
mov cx, 0x0001 ; first logical sector
xor dx, dx ; head = 0, drive = 0 (a:)
mov al, 1 ; read one sector
mov bx, 0xB000 ; es:bx -> data area
call boot_read_floppy
; fill the necessary parameters to work with a floppy
mov ax, word [es:bx+24]
mov word [BPB_SecPerTrk], ax
mov ax, word [es:bx+26]
mov word [BPB_NumHeads], ax
mov ax, word [es:bx+17]
mov word [BPB_RootEntCnt], ax
mov ax, word [es:bx+14]
mov word [BPB_RsvdSecCnt], ax
mov ax, word [es:bx+19]
mov word [BPB_TotSec16], ax
mov al, byte [es:bx+13]
mov byte [BPB_SecPerClus], al
mov al, byte [es:bx+16]
mov byte [BPB_NumFATs], al
;<Lrz> 18.11.2008
mov ax, word [es:bx+22]
mov word [BPB_FATSz16], ax
mov cx, word [es:bx+11]
mov word [BPB_BytsPerSec], cx
 
; count of clusters in FAT12 ((size_of_FAT*2)/3)
; mov ax, word [BPB_FATSz16]
; mov cx, word [BPB_BytsPerSec]
;end <Lrz> 18.11.2008
xor dx, dx
mul cx
shl ax, 1
mov cx, 3
div cx ; now ax - number of clusters in FAT12
mov word [end_of_FAT], ax
 
; load first FAT table
mov cx, 0x0002 ; startcyl,startsector ; TODO!!!!!
xor dx, dx ; starthead,drive
mov al, byte [BPB_FATSz16] ; no of sectors to read
add bx, word [BPB_BytsPerSec] ; es:bx -> data area
call boot_read_floppy
mov bx, 0xB000
 
; and copy them to extended memory
mov si, movedesc
mov [si+8*2+3], bh ; from
 
mov ax, word [BPB_BytsPerSec]
shr ax, 1 ; words per sector
mov cx, word [BPB_RsvdSecCnt]
add cx, word [BPB_FATSz16]
mul cx
push ax ; save to stack count of words in boot+FAT
xchg ax, cx
 
push es
push ds
pop es
mov ah, 0x87
int 0x15
pop es
test ah, ah
jz @f
sayerr_floppy:
mov dx, 0x3f2
mov al, 0
out dx, al
; mov si, memmovefailed
jmp $
@@:
pop ax ; restore from stack count of words in boot+FAT
shl ax, 1 ; make bytes count from count of words
and eax, 0ffffh
add dword [si+8*3+2], eax
 
; copy first FAT to second copy
; TODO: BPB_NumFATs !!!!!
add bx, word [BPB_BytsPerSec] ; !!! TODO: may be need multiply by BPB_RsvdSecCnt !!!
mov byte [si+8*2+3], bh ; bx - begin of FAT
 
mov ax, word [BPB_BytsPerSec]
shr ax, 1 ; words per sector
mov cx, word [BPB_FATSz16]
mul cx
mov cx, ax ; cx - count of words in FAT
 
push es
push ds
pop es
mov ah, 0x87
int 0x15
pop es
test ah, ah
jnz sayerr_floppy
 
mov ax, cx
shl ax, 1
and eax, 0ffffh ; ax - count of bytes in FAT
add dword [si+8*3+2], eax
 
; reading RootDir
; TODO: BPB_NumFATs
add bx, ax
add bx, 100h
and bx, 0ff00h ; bx - place in buffer to write RootDir
push bx
 
mov bx, word [BPB_BytsPerSec]
shr bx, 5 ; divide bx by 32
mov ax, word [BPB_RootEntCnt]
xor dx, dx
div bx
push ax ; ax - count of RootDir sectors
 
mov ax, word [BPB_FATSz16]
xor cx, cx
mov cl, byte [BPB_NumFATs]
mul cx
add ax, word [BPB_RsvdSecCnt] ; ax - first sector of RootDir
 
mov word [FirstDataSector], ax
pop bx
push bx
add word [FirstDataSector], bx ; Begin of data region of floppy
 
; read RootDir
call conv_abs_to_THS
pop ax
pop bx ; place in buffer to write
push ax
call boot_read_floppy ; read RootDir into buffer
; copy RootDir
mov byte [si+8*2+3], bh ; from buffer
pop ax ; ax = count of RootDir sectors
mov cx, word [BPB_BytsPerSec]
mul cx
shr ax, 1
mov cx, ax ; count of words to copy
push es
push ds
pop es
mov ah, 0x87
int 0x15
pop es
 
mov ax, cx
shl ax, 1
and eax, 0ffffh ; ax - count of bytes in RootDir
add dword [si+8*3+2], eax ; add count of bytes copied
 
; Reading data clusters from floppy
mov byte [si+8*2+3], bh
push bx
 
mov di, 2 ; First data cluster
.read_loop:
mov bx, di
shr bx, 1 ; bx+di = di*1.5
jnc .even
test word [es:bx+di+0xB200], 0xFFF0 ; TODO: may not be 0xB200 !!!
jmp @f
.even:
test word [es:bx+di+0xB200], 0xFFF ; TODO: may not be 0xB200 !!!
 
@@:
jz .skip
; read cluster di
;.read:
;conv cluster di to abs. sector ax
; ax = (N-2) * BPB_SecPerClus + FirstDataSector
mov ax, di
sub ax, 2
xor bx, bx
mov bl, byte [BPB_SecPerClus]
mul bx
add ax, word [FirstDataSector]
call conv_abs_to_THS
pop bx
push bx
mov al, byte [BPB_SecPerClus] ; number of sectors in cluster
call boot_read_floppy
push es
push ds
pop es
pusha
;
mov ax, word [BPB_BytsPerSec]
xor cx, cx
mov cl, byte [BPB_SecPerClus]
mul cx
shr ax, 1 ; ax = (BPB_BytsPerSec * BPB_SecPerClus)/2
mov cx, ax ; number of words to copy (count words in cluster)
;
mov ah, 0x87
int 0x15 ; copy data
test ah, ah
popa
pop es
jnz sayerr_floppy
; skip cluster di
.skip:
mov ax, word [BPB_BytsPerSec]
xor cx, cx
mov cl, byte [BPB_SecPerClus]
mul cx
and eax, 0ffffh ; ax - count of bytes in cluster
add dword [si+8*3+2], eax
 
mov ax, word [end_of_FAT] ; max cluster number
pusha
; draw percentage
; total clusters: ax
; read clusters: di
xchg ax, di
mov cx, 100
mul cx
div di
aam
xchg al, ah
add ax, '00'
@@:
popa
inc di
cmp di, word [end_of_FAT] ; max number of cluster
jnz .read_loop
pop bx ; clear stack
 
ok_sys_on_floppy:
no_sys_on_floppy:
xor ax, ax ; reset drive
xor dx, dx
int 0x13
mov dx, 0x3f2 ; floppy motor off
mov al, 0
out dx, al
---
end if
 
 
; SET GRAPHICS
 
xor ax, ax
/kernel/branches/Kolibri-A/trunk/boot/booteng.inc
1,6 → 1,6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14,53 → 14,4
$Revision$
 
 
;d80x25_bottom:
; db 186,' KolibriOS is based on MenuetOS and comes with ABSOLUTELY '
; db 'NO WARRANTY ',186
; db 186,' See file COPYING for details '
; db ' ',186
; line_full_bottom
;d80x25_bottom_num = 3
 
;msg_apm db " APM x.x ", 0
;vervesa db "Version of Vesa: Vesa x.x",13,10,0
;novesa db "Display: EGA/CGA",13,10,0
;s_vesa db "Version of VESA: "
; .ver db "?.?",13,10,0
 
;gr_mode db "Select a videomode: ",13,10,0
 
;vrrmprint db "Apply VRR? (picture frequency greater than 60Hz"
; db " only for transfers:",13,10
; db 186," 1024*768->800*600 and 800*600->640*480) [1-yes,2-no]:",0
 
 
;ask_bd db "Add disks visible by BIOS emulated in V86-mode? [1-yes, 2-no]: ",0
 
;bdev db "Load ramdisk from [1-floppy; 2-C:\kolibri.img (FAT32);"
; db 13,10,186," "
; db "3-use preloaded ram-image from kernel restart;"
; db 13,10,186," "
; db "4-create blank image]: ",0
;probetext db 13,10,13,10,186," Use standart graphics mode? [1-yes, "
; db "2-probe bios (Vesa 3.0)]: ",0
;prnotfnd db "Fatal - Videomode not found.",0
;btns db "Fatal - Can't determine color depth.",0
;badsect db 13,10,186," Fatal - Bad sector. Replace floppy.",0
;memmovefailed db 13,10,186," Fatal - Int 0x15 move failed.",0
;okt db " ... OK"
;linef db 13,10,0
;diskload db "Loading diskette: 00 %",8,8,8,8,0
;pros db "00"
;backspace2 db 8,8,0
boot_dev db 0 ; 0=floppy, 1=hd
;start_msg db "Press [abcd] to change settings, press [Enter] to continue booting",13,10,0
;time_msg db " or wait "
;time_str db " 5 seconds"
; db " before automatical continuation",13,10,0
;current_cfg_msg db "cfgmanager.printcfg reached",13,10,0
;curvideo_msg db " [a] Videomode: ",0
 
;loading_msg db "Loading KolibriOS...",0
;save_quest db "Remember current settings? [y/n]: ",0
;loader_block_error db "Invalid boot data",0
/kernel/branches/Kolibri-A/trunk/boot/bootvesa.inc
78,7 → 78,7
mi VBE_ModeInfo
modes_table:
end virtual
cursor_pos dw 0 ;âðåìåííîå õðàíåíèå êóðñîðà.
cursor_pos dw 0 ;temporary cursor storage.
home_cursor dw 0 ;current shows rows a table
end_cursor dw 0 ;end of position current shows rows a table
scroll_start dw 0 ;start position of scroll bar
/kernel/branches/Kolibri-A/trunk/boot/rdload.inc
10,9 → 10,9
 
; READ RAMDISK IMAGE FROM HD
 
cmp [boot_dev+OS_BASE+0x10000],1
; jne no_sys_on_hd
 
; cmp [boot_dev+OS_BASE+0x10000],1
jmp no_sys_on_hd
if 0
test [DRIVE_DATA+1],byte 0x40
jz position_2
mov [hdbase],0x1f0
97,6 → 97,7
mov edi, 12
call file_read
ret
end if
 
image_retrieved db 0
counter_of_partitions db 0
/kernel/branches/Kolibri-A/trunk/bus/HT.inc
323,4 → 323,3
ret
 
 
 
/kernel/branches/Kolibri-A/trunk/bus/SB/SB710.ASM
File deleted
/kernel/branches/Kolibri-A/trunk/bus/SB/HUDSON.INC
0,0 → 1,3
 
SB_PM_CTRL_BLK equ 0x62
 
/kernel/branches/Kolibri-A/trunk/bus/SB/SB.INC
0,0 → 1,168
$Revision: 1598 $
 
SMBUS_PCIE_ADDR equ 0xF00A0000 ; bdf0:20.0 = SB7xx SMBus PCI Config Registers
LPC_PCIE_ADDR equ 0xF00A3000 ; bdf0:20.3 = SB7xx LPC ISA bridge Config Registers
 
SB_SIO_INDEX equ 0x2E
SB_PM_INDEX equ 0xCD6
 
if PLATFORM>PLATFORM_RS780
include "bus/sb/hudson.inc"
else
include "bus/sb/sb710.inc"
end if
 
;---------------------------------------------------------------------
align 4
smbus_read_pciconfig:
; in: dl = reg# | out: eax = data
mov ebx, SMBUS_PCIE_ADDR
and edx, 0x0FC
mov eax, dword [ebx+edx]
ret
;------------------------------------------------
align 4
smbus_write_pciconfig:
; in: dl = reg#; eax = data
mov ebx, SMBUS_PCIE_ADDR
and edx, 0x0FC
mov dword [ebx+edx], eax
ret
 
;--------------------------------------------------------------------
align 4
lpc_read_pciconfig:
; in: dl = reg# | out: eax = data
mov ebx, LPC_PCIE_ADDR
and edx, 0x0FC
mov eax, dword [ebx+edx]
ret
;------------------------------------------------
align 4
lpc_write_pciconfig:
; in: dl = reg#; eax = data
mov ebx, LPC_PCIE_ADDR
and edx, 0x0FC
mov dword [ebx+edx], eax
ret
 
;--------------------------------------------------------------------
align 4
read_sio_cfg:
; in: al = reg# | out: al = data
push edx
mov dx, SB_SIO_INDEX
out dx, al
inc dl
in al, dx
pop edx
ret
 
;------------------------------------------------
align 4
write_pm_cfg:
; in: al = reg#; ah = data
;------------------------------------------------
push edx
mov dx, SB_PM_INDEX
out dx, al
inc dl
xchg al, ah
out dx, al
xchg al, ah
pop edx
ret
;--------------------------------------------------------------------
align 4
read_pm_cfg:
; in: al = reg# | out: al = data
push edx
mov dx, SB_PM_INDEX
out dx, al
inc dl
in al, dx
pop edx
ret
 
;------------------------------------------------
align 4
write_sio_cfg:
; in: al = reg#; ah = data
;------------------------------------------------
push edx
mov dx, SB_SIO_INDEX
out dx, al
inc dl
xchg al, ah
out dx, al
xchg al, ah
pop edx
ret
;------------------------------------------------
align 4
enter_sio_cfg_mode:
; the magic sequence to unlock the port
;------------------------------------------------
mov dx, SB_SIO_INDEX
mov eax, 0x55550187 ; low byte first
out dx, al
shr eax, 8
out dx, al
shr eax, 8
out dx, al
shr eax, 8
out dx, al
ret
 
;-----------------------------------------------------------------------
; ATTENTION: the functions assume that RESET# signals use pins 84 and 34
; of IT8712F SuperIO chip. These signals may be (and will be!) different
; for every particular motherboard and SIO. Please refer to your m/board
; documentation to define the correct pins and GPIO lines!
;
; Note this example DOES NOT PRETEND to be 100% correct implementation
; of PCIe hotplug techniques !!
;-----------------------------------------------------------------------
align 4
init_pcie_slot_control:
;------------------------------------------------
call enter_sio_cfg_mode
mov ax, 0x0707 ; LDN = 07
call write_sio_cfg
mov al, 0x25
call read_sio_cfg ; ah = reg25h (Multy-function pin selector)
or ah, 3 ; set bits 0, 1 (GPIO)
call write_sio_cfg
mov al, 0x2A
call read_sio_cfg ; ah = reg2Ah (Extended fn pin selector)
or ah, 3 ; set bits 0, 1 (GPIO)
call write_sio_cfg
mov al, 0xB8
call read_sio_cfg ; ah = regB8h (internal pull-up enable)
or ah, 3 ; set bits 0, 1
call write_sio_cfg
mov al, 0xC0
call read_sio_cfg ; ah = regC0h (simple IO enable)
or ah, 3 ; set bits 0, 1
call write_sio_cfg
mov ax, 0x0202 ; Lock SIO config ports
call write_sio_cfg
ret
 
align 4
reset_pcie_slot:
;------------------------------------------------
call enter_sio_cfg_mode
mov ax, 0x0707 ; LDN = 07
call write_sio_cfg
mov al, 0xB0
call read_sio_cfg ; ah = regB0h (Pin polarity)
and ah, 0xFC ; invert bits 0, 1
call write_sio_cfg
or ah, 3 ; restore bits 0, 1
call write_sio_cfg
mov ax, 0x0202 ; Lock SIO config ports
call write_sio_cfg
ret
 
 
/kernel/branches/Kolibri-A/trunk/bus/SB/SB710.INC
0,0 → 1,3
 
SB_PM_CTRL_BLK equ 0x22
 
/kernel/branches/Kolibri-A/trunk/const.inc
26,6 → 26,11
CPU_P6 equ 6
CPU_PENTIUM4 equ 0x0F
 
PLATFORM equ 0x14
PLATFORM_RS780 equ 0x0F
PLATFORM_RS880 equ 0x10
PLATFORM_FUSION equ 0x14
 
CAPS_FPU equ 00 ;on-chip x87 floating point unit
CAPS_VME equ 01 ;virtual-mode enhancements
CAPS_DE equ 02 ;debugging extensions
/kernel/branches/Kolibri-A/trunk/core/heap.inc
1539,5 → 1539,5
.fail:
ret
endp
diff16 "heap code end ",0,$
diff16 "heap code size",init_kernel_heap,$
;diff16 "heap code end ",0,$
diff10 "heap code size",init_kernel_heap,$
/kernel/branches/Kolibri-A/trunk/core/memory.inc
1441,5 → 1441,5
.fail:
ret
endp
diff16 "memman code end",0,$
diff16 "memman code sze",alloc_page,$
;diff16 "memman code end",0,$
diff10 "memman code sze",alloc_page,$
/kernel/branches/Kolibri-A/trunk/data32.inc
47,28 → 47,26
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_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_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_bgr db 'Calculating background',0
; boot_setostask db 'Setting OS task',0
boot_allirqs db 'Unmasking all IRQs',0
boot_tsc db 'Reading TSC',0
; boot_tsc db 'Reading TSC',0
boot_cpufreq db 'CPU frequency is ',' ',' MHz',0
boot_failed db 'Failed to start first app',0
boot_mtrr db 'Setting MTRR',0
boot_uDMA_ok db 'Set user DMA OK',0
if preboot_blogesc
boot_tasking db 'All set - press ESC to start',0
end if
; boot_failed db 'Failed to start first app',0
; boot_mtrr db 'Setting MTRR',0
; boot_uDMA_ok db 'Set user DMA OK',0
;if preboot_blogesc
; boot_tasking db 'All set - press ESC to start',0
;end if
 
;new_process_loading db 'K : New Process - loading',13,10,0
;new_process_running db 'K : New Process - done',13,10,0
90,7 → 88,7
szPS2MDriver db 'PS2MOUSE',0
;szCOM_MDriver db 'COM_MOUSE',0
szUSB db 'USB',0
szAtiHW db '/rd/1/drivers/ati2d.drv',0
;szAtiHW db '/rd/1/drivers/ati2d.drv',0
 
szSTART db 'START',0
szEXPORTS db 'EXPORTS',0
/kernel/branches/Kolibri-A/trunk/gui/font.inc
130,5 → 130,5
popad
pop eax ; << // Alver 22.06.2008 // <<
ret
diff16 "font code end ",0,$
diff16 "font code size",dtext,$
;diff16 "font code end ",0,$
diff10 "font code size",dtext,$
/kernel/branches/Kolibri-A/trunk/gui/mouse.inc
700,5 → 700,5
.exit:
ret
 
diff16 "mouse code end ",0,$
;diff16 "mouse code end ",0,$
diff10 "mouse code size",mouse_check_events,$
/kernel/branches/Kolibri-A/trunk/gui/skincode.inc
458,5 → 458,5
 
ret 4
 
diff16 "skin code end ",0,$
diff16 "skin code size",read_skin_file,$
;diff16 "skin code end ",0,$
diff10 "skin code size",read_skin_file,$
/kernel/branches/Kolibri-A/trunk/gui/window.inc
1947,5 → 1947,5
pop esi ebx eax
ret
 
diff16 "window code end",0,$
;diff16 "window code end",0,$
diff10 "window.inc size",syscall_draw_window,$
/kernel/branches/Kolibri-A/trunk/hid/mousedrv.inc
439,5 → 439,5
@@:
ret
 
diff16 "window code end",0,$
;diff16 "window code end",0,$
diff10 "mousedrv size ",draw_mouse_under,$
/kernel/branches/Kolibri-A/trunk/kernel.asm
219,9 → 219,18
call init_BIOS32 ; (init.inc - to be removed later)
 
; PCIe extended config space access
; call rs7xx_pcie_init ; (bus/HT.inc)
 
display '** Platform chosen (const.inc): '
if PLATFORM>PLATFORM_RS780
call fusion_pcie_init ; (bus/HT.inc)
display 'RS880/Fusion '
else
call rs7xx_pcie_init ; (bus/HT.inc)
display 'RS780 '
end if
display 10,13
 
 
; MEMORY MODEL
call init_mem ; (init.inc)
call init_page_map ; (init.inc)
242,10 → 251,11
bios32_entry dd ?
tmp_page_tabs dd ?
 
use16
org $-0x10000
include "boot/shutdown.inc" ; shutdown or restart
org $+0x10000
;use16
;org $-0x10000
;include "boot/shutdown.inc" ; shutdown or restart
;org $+0x10000
 
use32
 
__DEBUG__ fix 1
572,16 → 582,6
include 'vmodeld.inc'
;!!!!!!!!!!!!!!!!!!!!!!!
 
if 0
mov ax,[OS_BASE+0x10000+bx_from_load]
cmp ax,'r1' ; if using not ram disk, then load librares and parameters {SPraid.simba}
je no_lib_load
; LOADING LIBRARES
stdcall dll.Load,@IMPORT ; loading librares for kernel (.obj files)
call load_file_parse_table ; prepare file parse table
call set_kernel_conf ; configure devices and gui
no_lib_load:
end if
 
; LOAD FONTS I and II
 
588,12 → 588,12
stdcall read_file, char, FONT_I, 0, 2304
stdcall read_file, char2, FONT_II, 0, 2560
 
mov esi,boot_fonts
call boot_log
; mov esi,boot_fonts
; call boot_log
 
; PRINT AMOUNT OF MEMORY
mov esi, boot_memdetect
call boot_log
; mov esi, boot_memdetect
; call boot_log
 
movzx ecx, word [boot_y]
or ecx, (10+29*6) shl 16 ; "Determining amount of memory"
610,8 → 610,8
 
call build_scheduler ; sys32.inc
 
mov esi,boot_devices
call boot_log
; mov esi,boot_devices
; call boot_log
 
mov [pci_access_enabled],1
 
624,15 → 624,15
 
; SET BACKGROUND DEFAULTS
 
mov esi,boot_bgr
call boot_log
; mov esi,boot_bgr
; call boot_log
call init_background ;
call calculatebackground
 
; SET UP OS TASK
 
mov esi,boot_setostask
call boot_log
; mov esi,boot_setostask
; call boot_log
 
xor eax, eax
mov dword [SLOT_BASE+APPDATA.fpu_state], fpu_data
683,8 → 683,8
 
; READ TSC / SECOND
 
mov esi,boot_tsc
call boot_log
; mov esi,boot_tsc
; call boot_log
cli
rdtsc ;call _rdtsc
mov ecx,eax
724,8 → 724,8
;call detect_devices
stdcall load_driver, szPS2MDriver
 
mov esi,boot_setmouse
call boot_log
; mov esi,boot_setmouse
; call boot_log
; call setmouse
; mov [MOUSE_PICTURE],dword mousepointer
cli
754,8 → 754,8
 
 
call init_userDMA ; <<<<<<<<< ============== core/memory.inc =================
mov esi, boot_uDMA_ok
call boot_log
; mov esi, boot_uDMA_ok
; call boot_log
 
; LOAD FIRST APPLICATION
cli
779,8 → 779,8
sub eax,2
jz first_app_found
 
mov esi, boot_failed
call boot_log
; mov esi, boot_failed
; call boot_log
 
mov eax, 0xDEADBEEF ; otherwise halt
hlt
825,13 → 825,13
 
; START MULTITASKING
 
if preboot_blogesc
mov esi, boot_tasking
call boot_log
.bll1: in al, 0x60 ; wait for ESC key press
cmp al, 129
jne .bll1
end if
;if preboot_blogesc
; mov esi, boot_tasking
; call boot_log
;.bll1: in al, 0x60 ; wait for ESC key press
; cmp al, 129
; jne .bll1
;end if
 
 
stdcall attach_int_handler, 1, irq1, 0
4468,230 → 4468,50
yes_shutdown_param:
cli
 
mov eax, kernel_file ; load kernel.mnt to 0x7000:0
push 12
pop esi
xor ebx,ebx
or ecx,-1
mov edx, OS_BASE+0x70000
call fileread
 
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
 
mov esi,OS_BASE+0x2F0000 ; restore 0x0 - 0xffff
mov edi, OS_BASE
mov ecx,0x10000/4
cld
rep movsd
 
call restorefatchain
 
mov al, 0xFF
out 0x21, al
out 0xA1, al
out 0x21, al ;IntrCntrl1Reg2
out 0xA1, al ;IntrCntrl2Reg2
 
cmp byte [BOOT_VAR + 0x9030], 2
jnz pm_restart
if 0
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
 
mov al,0xFE
out 0x64,al
 
hlt
jmp $-1
 
else
cmp byte [OS_BASE + 0x9030], 2
jnz no_acpi_power_off
 
; scan for RSDP
; 1) The first 1 Kb of the Extended BIOS Data Area (EBDA).
movzx eax, word [OS_BASE + 0x40E]
shl eax, 4
jz @f
mov ecx, 1024/16
call scan_rsdp
jnc .rsdp_found
@@:
; 2) The BIOS read-only memory space between 0E0000h and 0FFFFFh.
mov eax, 0xE0000
mov ecx, 0x2000
call scan_rsdp
jc no_acpi_power_off
.rsdp_found:
mov esi, [eax+16] ; esi contains physical address of the RSDT
mov ebp, [ipc_tmp]
stdcall map_page, ebp, esi, PG_MAP
lea eax, [esi+1000h]
lea edx, [ebp+1000h]
stdcall map_page, edx, eax, PG_MAP
and esi, 0xFFF
add esi, ebp
cmp dword [esi], 'RSDT'
jnz no_acpi_power_off
mov ecx, [esi+4]
sub ecx, 24h
jbe no_acpi_power_off
shr ecx, 2
add esi, 24h
.scan_fadt:
lodsd
mov ebx, eax
lea eax, [ebp+2000h]
stdcall map_page, eax, ebx, PG_MAP
lea eax, [ebp+3000h]
add ebx, 0x1000
stdcall map_page, eax, ebx, PG_MAP
and ebx, 0xFFF
lea ebx, [ebx+ebp+2000h]
cmp dword [ebx], 'FACP'
jz .fadt_found
loop .scan_fadt
jmp no_acpi_power_off
.fadt_found:
; ebx is linear address of FADT
mov edi, [ebx+40] ; physical address of the DSDT
lea eax, [ebp+4000h]
stdcall map_page, eax, edi, PG_MAP
lea eax, [ebp+5000h]
lea esi, [edi+0x1000]
stdcall map_page, eax, esi, PG_MAP
and esi, 0xFFF
sub edi, esi
cmp dword [esi+ebp+4000h], 'DSDT'
jnz no_acpi_power_off
mov eax, [esi+ebp+4004h] ; DSDT length
sub eax, 36+4
jbe no_acpi_power_off
add esi, 36
.scan_dsdt:
cmp dword [esi+ebp+4000h], '_S5_'
jnz .scan_dsdt_cont
cmp byte [esi+ebp+4000h+4], 12h ; DefPackage opcode
jnz .scan_dsdt_cont
mov dl, [esi+ebp+4000h+6]
cmp dl, 4 ; _S5_ package must contain 4 bytes
; ...in theory; in practice, VirtualBox has 2 bytes
ja .scan_dsdt_cont
cmp dl, 1
jb .scan_dsdt_cont
lea esi, [esi+ebp+4000h+7]
xor ecx, ecx
cmp byte [esi], 0 ; 0 means zero byte, 0Ah xx means byte xx
jz @f
cmp byte [esi], 0xA
jnz no_acpi_power_off
inc esi
mov cl, [esi]
@@:
inc esi
cmp dl, 2
jb @f
cmp byte [esi], 0
jz @f
cmp byte [esi], 0xA
jnz no_acpi_power_off
inc esi
mov ch, [esi]
@@:
jmp do_acpi_power_off
.scan_dsdt_cont:
inc esi
cmp esi, 0x1000
jb @f
sub esi, 0x1000
add edi, 0x1000
push eax
lea eax, [ebp+4000h]
stdcall map_page, eax, edi, PG_MAP
push PG_MAP
lea eax, [edi+1000h]
push eax
lea eax, [ebp+5000h]
push eax
stdcall map_page
pop eax
@@:
dec eax
jnz .scan_dsdt
jmp no_acpi_power_off
do_acpi_power_off:
mov edx, [ebx+48]
test edx, edx
jz .nosmi
mov al, [ebx+52]
mov al, SB_PM_CTRL_BLK
mov ah, al
inc ah
mov dx, 0x0CD6
out dx, al
mov edx, [ebx+64]
@@:
in ax, dx
test al, 1
jz @b
.nosmi:
and cx, 0x0707
shl cx, 2
or cx, 0x2020
mov edx, [ebx+64]
in ax, dx
and ax, 203h
or ah, cl
inc dl
in al, dx
mov cl, al
dec dl
mov al, ah
out dx, al
inc dl
in al, dx
mov ch, al
end if
mov dx, 0x0804 ;cx
mov ax, 0x03400
out dx, ax
mov edx, [ebx+68]
test edx, edx
jz @f
in ax, dx
and ax, 203h
or ah, ch
out dx, ax
@@:
jmp $
; THE END...
jmp $ ; just to be absolutely sure
 
 
no_acpi_power_off:
mov word [OS_BASE+0x467+0],pr_mode_exit
mov word [OS_BASE+0x467+2],0x1000
pm_restart:
 
mov al,0x0F
out 0x70,al
out 0x70,al ; NmiEnable
mov al,0x05
out 0x71,al
out 0x71,al ; RtcData
 
mov al,0xFE
out 0x64,al
mov ax, 6
mov dx, 0xCF9 ; reset reg
out dx, ax
 
hlt
jmp $-1
 
scan_rsdp:
add eax, OS_BASE
.s:
cmp dword [eax], 'RSD '
jnz .n
cmp dword [eax+4], 'PTR '
jnz .n
xor edx, edx
xor esi, esi
@@:
add dl, [eax+esi]
inc esi
cmp esi, 20
jnz @b
test dl, dl
jz .ok
.n:
add eax, 10h
loop .s
stc
.ok:
ret
end if
 
diff16 "End of 32-code ",0,$
 
/kernel/branches/Kolibri-A/trunk/kernel32.inc
247,6 → 247,7
include "bus/pci/pci32.inc"
;include "bus/pci/PCIe.inc"
include "bus/HT.inc" ; AMD HyperTransport bus control
include "bus/SB/SB.inc"
 
; Floppy drive controller
 
/kernel/branches/Kolibri-A/trunk/memmap.inc
149,11 → 149,11
; in the current version:
; -> 00B3C 16-bit code end
; -> 00C40 16-bit data end
; -> 10C40 32-bit code start
; -> 2D07E 32-bit code end
; -> 30418..end_of_kernel zero-filled zone after preinit_mem
; -> 33D63 uninitialized globals start
; -> 3BF52 end_of_kernel
; -> 105F0 32-bit code start
; -> 2C889 32-bit code end
; -> 2FC28..end_of_kernel zero-filled zone after preinit_mem
; -> 33563 uninitialized globals start
; -> 3B752 end_of_kernel
; -> 3C000 not used (>200k)
; 0x80050000 -> 090000 zero-filled zone after preinit_mem
; 0x8006CC00 -> 6DBFF stack at boot time (4Kb)
/kernel/branches/Kolibri-A/trunk/video/vesa20.inc
1059,6 → 1059,6
paddb mm4, mm1
movd eax, mm4
ret
diff16 "VESA2 code end ",0,$
diff16 "VESA2 code size",get_pixel,$
;diff16 "VESA2 code end ",0,$
diff10 "VESA2 code size",get_pixel,$