Subversion Repositories Kolibri OS

Rev

Rev 8988 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;                                                              ;;
  3. ;; Copyright (C) KolibriOS team 2004-2021. All rights reserved. ;;
  4. ;; Distributed under terms of the GNU General Public License    ;;
  5. ;;                                                              ;;
  6. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  7.  
  8. $Revision: 9051 $
  9.  
  10.  
  11. keymap:
  12.  
  13.      db   '6',27
  14.      db   '1234567890-=',8,9
  15.      db   'qwertyuiop[]',13
  16.      db   '~asdfghjkl;',39,96,0,'\zxcvbnm,./',0,'45 '
  17.      db   '@234567890123',180,178,184,'6',176,'7'
  18.      db   179,'8',181,177,183,185,182
  19.      db   'AB<D',255,'FGHIJKLMNOPQRSTUVWXYZ'
  20.      db   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
  21.      db   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
  22.      db   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
  23.  
  24. keymap_shift:
  25.      db   '6',27
  26.      db   '!@#$%^&*()_+',8,9
  27.      db   'QWERTYUIOP{}',13
  28.      db   '~ASDFGHJKL:"~',0,'|ZXCVBNM<>?',0,'45 '
  29.      db   '@234567890123',180,178,184,'6',176,'7'
  30.      db   179,'8',181,177,183,185,182
  31.      db   'AB>D',255,'FGHIJKLMNOPQRSTUVWXYZ'
  32.      db   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
  33.      db   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
  34.      db   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
  35.  
  36.  
  37. keymap_alt:
  38.      db   ' ',27
  39.      db   ' @ $  {[]}\ ',8,9
  40.      db   '            ',13
  41.      db   '             ',0,'           ',0,'4',0,' '
  42.      db   '             ',180,178,184,'6',176,'7'
  43.      db   179,'8',181,177,183,185,182
  44.      db   'ABCD',255,'FGHIJKLMNOPQRSTUVWXYZ'
  45.      db   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
  46.      db   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
  47.      db   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
  48.  
  49.  
  50.  
  51. if lang eq ru
  52.   boot_initirq      cp866 'Инициализация IRQ',0
  53.   boot_picinit      cp866 'Инициализация PIC',0
  54.   boot_v86machine   cp866 'Инициализация системной V86 машины',0
  55.   boot_inittimer    cp866 'Инициализация системного таймера (IRQ0)',0
  56.   boot_initapic     cp866 'Попытка инициализации APIC',0
  57.   boot_enableirq    cp866 'Включить прерывания 2, 13',0
  58.   boot_disabling_ide cp866 'Запрещение прерываний в контроллере IDE',0
  59.   boot_enabling_ide cp866 'Разрешение прерываний в контроллере IDE',0
  60.   boot_set_int_IDE  cp866 'Установка обработчиков прерываний IDE',0
  61.   boot_detectfloppy cp866 'Поиск floppy дисководов',0
  62.   boot_detecthdcd   cp866 'Поиск жестких дисков и ATAPI приводов',0
  63.   boot_getcache     cp866 'Получение памяти для кэша',0
  64.   boot_detectpart   cp866 'Поиск разделов на дисковых устройствах',0
  65.   boot_init_sys     cp866 'Инициализация системного каталога /sys',0
  66.   boot_loadlibs     cp866 'Загрузка библиотек (.obj)',0
  67.   boot_memdetect    cp866 'Количество оперативной памяти','     ',' Мб',0
  68.   boot_tss          cp866 'Установка TSSs',0
  69.   boot_cpuid        cp866 'Чтение CPUIDs',0
  70. ;  boot_devices      cp866 'Поиск устройств',0
  71.   boot_timer        cp866 'Установка таймера',0
  72.   boot_initramdisk  cp866 'Инициализация рамдиска',0
  73.   boot_irqs         cp866 'Переопределение IRQ',0
  74.   boot_setmouse     cp866 'Установка мыши',0
  75.   boot_windefs      cp866 'Установка настроек окон по умолчанию',0
  76.   boot_bgr          cp866 'Установка фона',0
  77.   boot_resirqports  cp866 'Резервирование IRQ и портов',0
  78.   boot_setrports    cp866 'Установка адресов IRQ',0
  79.   boot_setostask    cp866 'Создание процесса ядра',0
  80.   boot_allirqs      cp866 'Открытие всех IRQ',0
  81.   boot_tsc          cp866 'Чтение TSC',0
  82.   boot_cpufreq      cp866 'Частота процессора ','    ',' МГц',0
  83.   boot_pal_ega      cp866 'Установка EGA/CGA 320x200 палитры',0
  84.   boot_pal_vga      cp866 'Установка VGA 640x480 палитры',0
  85.   boot_failed       cp866 'Загрузка первого приложения не удалась',0
  86.   boot_mtrr         cp866 'Установка MTRR',0
  87.  
  88.   boot_APIC_found   cp866 'APIC включен', 0
  89.   boot_APIC_nfound  cp866 'APIC не найден', 0
  90. if preboot_blogesc
  91.   boot_tasking      cp866 'Все готово для запуска, нажмитре ESC для старта',0
  92. end if
  93. else if lang eq sp
  94.   include 'data32sp.inc'
  95. else if lang eq et
  96.   include 'data32et.inc'
  97. else
  98.   boot_initirq      db   'Initialize IRQ',0
  99.   boot_picinit      db   'Initialize PIC',0
  100.   boot_v86machine   db   'Initialize system V86 machine',0
  101.   boot_inittimer    db   'Initialize system timer (IRQ0)',0
  102.   boot_initramdisk  db   'Initialize ramdisk',0
  103.   boot_initapic     db   'Try to initialize APIC',0
  104.   boot_enableirq    db   'Enable interrupts 2, 13',0
  105.   boot_disabling_ide db   'Disable interrupts in IDE controller',0
  106.   boot_enabling_ide db   'Enable interrupts in IDE controller',0
  107.   boot_set_int_IDE  db   'Set handler of interrupts for IDE',0
  108.   boot_detectfloppy db   'Search floppy drives',0
  109.   boot_detecthdcd   db   'Search hard drives and ATAPI drives',0
  110.   boot_getcache     db   'Get memory for cache',0
  111.   boot_detectpart   db   'Search partitions on disk devices',0
  112.   boot_init_sys     db   'Initialize system directory /sys',0
  113.   boot_loadlibs     db   'Loading librares (.obj)',0
  114.   boot_memdetect    db   'Determining amount of memory',0
  115.   boot_tss          db   'Setting TSSs',0
  116.   boot_cpuid        db   'Reading CPUIDs',0
  117. ;  boot_devices      db   'Detecting devices',0
  118.   boot_setmouse     db   'Setting mouse',0
  119.   boot_windefs      db   'Setting window defaults',0
  120.   boot_bgr          db   'Calculating background',0
  121.   boot_resirqports  db   'Reserving IRQs & ports',0
  122.   boot_setostask    db   'Setting OS task',0
  123.   boot_allirqs      db   'Unmasking IRQs',0
  124.   boot_tsc          db   'Reading TSC',0
  125.   boot_cpufreq      db   'CPU frequency is ','    ',' MHz',0
  126.   boot_pal_ega      db   'Setting EGA/CGA 320x200 palette',0
  127.   boot_pal_vga      db   'Setting VGA 640x480 palette',0
  128.   boot_failed       db   'Failed to start first app',0
  129.   boot_mtrr         db   'Setting MTRR',0
  130.  
  131.   boot_APIC_found   db   'APIC enabled', 0
  132.   boot_APIC_nfound  db   'APIC not found', 0
  133. if preboot_blogesc
  134.   boot_tasking      db   'All set - press ESC to start',0
  135. end if
  136. end if
  137.  
  138. ;new_process_loading db 'K : New Process - loading',13,10,0
  139. ;new_process_running db 'K : New Process - done',13,10,0
  140. start_not_enough_memory db 'K : New Process - not enough memory',13,10,0
  141.  
  142. msg_unresolved db 'unresolved ',0
  143. ;msg_module     db 'in module ',0
  144. ;if ~ lang eq sp
  145. ;msg_version    db 'incompatible driver version',13,10,0
  146. ;msg_www        db 'please visit www.kolibrios.org',13,10,0
  147. ;end if
  148. msg_CR         db  13,10,0
  149.  
  150. szPS2MDriver    db '/sys/drivers/PS2MOUSE.SYS',0
  151. ;szCOM_MDriver   db 'COM_MOUSE',0
  152. szVidintel      db '/sys/drivers/vidintel.sys',0
  153. szUSB           db 'USB',0
  154.  
  155. szEXPORTS      db 'EXPORTS',0
  156. sz_EXPORTS     db '_EXPORTS',0
  157.  
  158. szIMPORTS      db 'IMPORTS',0
  159.  
  160. read_firstapp  db '/sys/'
  161. firstapp       db '/sys/LAUNCHER',0
  162. notifyapp      db '/sys/@notify',0
  163. if lang eq ru
  164. ud_user_message  cp866 'Ошибка: неподдерживаемая инструкция процессора',0
  165. mtrr_user_message cp866 '"Обнаружена проблема с конфигурацией MTRR.\nПроизводительность может быть пониженной" -dW',0
  166. else if ~ lang eq sp
  167. ud_user_message db 'Error: unsupported processor instruction',0
  168. mtrr_user_message db '"There is a problem with MTRR configuration.\nPerformance can be low" -dW',0
  169. end if
  170.  
  171. except_notify_fstr  db "'%s (pid %d): %s!' -E", 0 ; String format to write to notify exception message
  172. except_notify_msg   rb 64                         ; The message displayed by notify when an application exception occurs
  173.  
  174. kernel_file_load:
  175. ; load kernel.mnt to _CLEAN_ZONE
  176.         dd      0       ; subfunction
  177.         dq      0       ; offset in file
  178.         dd      0x31000 ; number of bytes to read
  179.         dd      _CLEAN_ZONE ; buffer for data
  180.         db      '/sys/KERNEL.MNT',0
  181.  
  182. dev_data_path  db '/RD/1/DRIVERS/DEVICES.DAT',0
  183. ; { Patch by Coldy, For DLL autoload
  184. dll_lib_path  db '/RD/1/LIB/DLL.OBJ',0
  185. dll_error_msg db '"DLL.OBJ not found!\nTerminate application!" -dE',0  
  186. ; } End patch by Coldy, For DLL autoload
  187. align 4
  188.  
  189. shmem_list:
  190.  .bk           dd shmem_list
  191.  .fd           dd shmem_list
  192.  
  193. dll_list:
  194.  .bk           dd dll_list
  195.  .fd           dd dll_list
  196.  
  197. pcidev_list:
  198.  .bk           dd pcidev_list
  199.  .fd           dd pcidev_list
  200.  
  201. MAX_DEFAULT_DLL_ADDR = 0x80000000
  202. MIN_DEFAULT_DLL_ADDR = 0x70000000
  203. dll_cur_addr   dd MIN_DEFAULT_DLL_ADDR
  204.  
  205. ; supported videomodes
  206.  
  207.  
  208. ; mike.dld {
  209. ;db 0
  210. ;dd servetable-0x10000
  211. ;align 4
  212. ;draw_line       dd __sys_draw_line
  213. ;draw_pointer    dd __sys_draw_pointer
  214. ;//mike.dld, 2006-08-02 [
  215. ;;drawbar         dd __sys_drawbar
  216. ;;drawbar         dd __sys_drawbar.forced
  217. ;drawbar         dd vesa20_drawbar
  218. ;//mike.dld, 2006-08-02 ]
  219. ;putpixel        dd __sys_putpixel
  220. ; } mike.dld
  221.  
  222.  
  223. align 4
  224. keyboard   dd 1
  225.  
  226. if lang eq en
  227.   SYSLANG = 1
  228. else if lang eq fi
  229.   SYSLANG = 2
  230. else if lang eq de
  231.   SYSLANG = 3
  232. else if lang eq ru
  233.   SYSLANG = 4
  234. else if lang eq fr
  235.   SYSLANG = 5
  236. else if lang eq et
  237.   SYSLANG = 6
  238. else if lang eq sp
  239.   SYSLANG = 7
  240. else if lang eq it
  241.   SYSLANG = 8
  242. else if lang eq ca
  243.   SYSLANG = 9
  244. else
  245.   display 'unsupported language specified',13,10
  246. end if
  247. syslang    dd SYSLANG
  248.  
  249. boot_y     dd 10
  250.  
  251. pci_bios_entry  dd 0
  252.                 dw pci_code_sel
  253.  
  254. if __DEBUG__ eq 1
  255.   include_debug_strings
  256. end if
  257.  
  258. IncludeIGlobals
  259.  
  260. align 16
  261. gdts:
  262.  
  263.         dw     gdte-$-1
  264.         dd     gdts
  265.         dw     0
  266.  
  267. ; Attention! Do not change the order of the first four selectors. They are used in Fast System Call
  268. ; must be : os_code, os_data, app_code, app_data, ....
  269.  
  270. int_code_l:
  271. os_code_l:
  272.         dw     0xffff
  273.         dw     0x0000
  274.         db     0x00
  275.         dw     11011111b *256 +10011010b
  276.         db     0x00
  277.  
  278. int_data_l:
  279. os_data_l:
  280.         dw     0xffff
  281.         dw     0x0000
  282.         db     0x00
  283.         dw     11011111b *256 +10010010b
  284.         db     0x00
  285.  
  286. app_code_l:
  287.         dw 0xFFFF
  288.         dw 0
  289.         db 0
  290.         db cpl3
  291.         dw G32+D32+0xF;
  292.  
  293. app_data_l:
  294.         dw 0xFFFF
  295.         dw 0
  296.         db 0
  297.         db drw3
  298.         dw G32+D32+0xF;
  299.  
  300. ; ------------- PCI BIOS ------------------
  301.  
  302. pci_code_32:
  303.         dw 0         ;lim  0-15
  304.         dw 0         ;base 0-15
  305.         db 0         ;base 16-23
  306.         db cpl0      ;type
  307.         db D32       ;lim 16-19+props
  308.         db 0         ;base 24-31
  309.  
  310. pci_data_32:
  311.         dw 0         ;lim  0-15
  312.         dw 0         ;base 0-15
  313.         db 0         ;base 16-23
  314.         db dpl0      ;type
  315.         db D32       ;lim 16-19+props
  316.         db 0         ;base 24-31
  317.  
  318. ; --------------- APM ---------------------
  319. apm_code_32:
  320.         dw     0x0f        ; limit 64kb
  321.         db     0, 0, 0
  322.         dw     11010000b *256 +10011010b
  323.         db     0x00
  324. apm_code_16:
  325.         dw     0x0f
  326.         db     0, 0, 0
  327.         dw     10010000b *256 +10011010b
  328.         db     0x00
  329. apm_data_16:
  330.         dw     0x0f
  331.         db     0, 0, 0
  332.         dw     10010000b *256 +10010010b
  333.         db     0x00
  334. ; -----------------------------------------
  335.  
  336. graph_data_l:
  337.  
  338.         dw     0x7ff
  339.         dw     0x0000
  340.         db     0x00
  341.         dw     11010000b *256 +11110010b
  342.         db     0x00
  343. tss0_l:
  344.         dw     sizeof.TSS-1
  345.         dw     tss and 0xFFFF
  346.         db     (tss shr 16) and 0xFF
  347.         db     10001001b
  348.         dw     (tss shr 16) and 0xFF00
  349.  
  350. tls_data_l:
  351.         dw 0x0FFF
  352.         dw 0
  353.         db 0
  354.         db drw3
  355.         dw D32
  356.  
  357. gdte:
  358.  
  359. diff16 "end of .data segment",0,$
  360. endofcode:
  361.  
  362. align 16
  363. cur_saved_data:
  364.         rb  4096
  365. align 64
  366. fpu_data:
  367.         rb  0xa80       ; bochs avx512
  368. fpu_data_size = $ - fpu_data
  369. draw_data:
  370.         rb  32*256
  371. BPSLine_calc_area   rd  MAX_SCREEN_HEIGHT
  372. d_width_calc_area   rd  MAX_SCREEN_HEIGHT
  373. mouseunder          rd  16*24
  374.  
  375. mem_block_list      rd  64*2
  376. mem_used_list       rd  64*2
  377. mem_hash_cnt        rd  64
  378.  
  379. thr_slot_map        rd  8
  380.  
  381. _display            display_t
  382. bios_fb             FRB
  383.  
  384. mst                 MEM_STATE
  385.  
  386. cpu_freq            dq  ?
  387.  
  388. heap_mutex          MUTEX
  389. heap_size           dd  ?
  390. heap_free           dd  ?
  391. heap_blocks         dd  ?
  392. free_blocks         dd  ?
  393. mem_block_mask      rd  2
  394. next_memblock       dd  ?
  395.  
  396. pte_valid_mask      dd  ?
  397. page_start          dd  ?
  398. page_end            dd  ?
  399. sys_page_map        dd  ?
  400. os_stack_seg        dd  ?
  401.  
  402. srv.fd              dd  ?
  403. srv.bk              dd  ?
  404.  
  405. LFBAddress          dd  ?
  406.  
  407. PUTPIXEL            dd  ?
  408. GETPIXEL            dd  ?
  409.  
  410. if VESA_1_2_VIDEO
  411. BANK_SWITCH         dd  ?   ; reserved for vesa 1.2
  412. BANK_RW             dd  ?
  413. end if
  414.  
  415. MOUSE_PICTURE       dd  ?
  416.  
  417. def_cursor          dd  ?
  418. def_cursor_clock    dd  ?
  419. current_cursor      dd  ?
  420. hw_cursor           dd  ?
  421. cur_saved_base      dd  ?
  422.  
  423. cur.lock            dd  ?   ; 1 - lock update, 2- hide
  424. cur.left            dd  ?   ; cursor clip box
  425. cur.top             dd  ?
  426. cur.w               dd  ?
  427. cur.h               dd  ?
  428.  
  429. ipc_tmp             dd  ?
  430. ipc_pdir            dd  ?
  431. ipc_ptab            dd  ?
  432.  
  433. proc_mem_map        dd  ?
  434. proc_mem_pdir       dd  ?
  435. proc_mem_tab        dd  ?
  436.  
  437. tmp_task_ptab       dd  ?
  438.  
  439. default_io_map      dd  ?
  440.  
  441. LFBSize             dd  ?
  442.  
  443. current_process     dd  ?
  444. current_slot        dd  ?   ; pointer to APPDATA of current thread
  445. current_slot_idx    dd  ?   ; index of current thread slot
  446. thread_count        dd  ?
  447.  
  448. ; device addresses
  449. mididp  dd  ?
  450. midisp  dd  ?
  451.  
  452. cdbase  dd  ?
  453. cdid    dd  ?
  454.  
  455. hdbase  dd  ?   ; for boot 0x1f0
  456. hdid    dd  ?
  457. hdpos   dd  ?   ; for boot 0x1
  458. cdpos   dd  ?
  459.  
  460. ;CPUID information
  461. cpu_vendor  rd  3
  462. cpu_sign    dd  ?
  463. cpu_info    dd  ?
  464. cpu_caps    rd  4
  465.  
  466. xsave_area_size dd ?
  467. xsave_eax       dd ?
  468. xsave_edx       dd ?
  469.  
  470. pg_data     PG_DATA
  471. heap_test   dd  ?
  472.  
  473. skin_data   dd  ?
  474.  
  475. mouse_active    dd  ?
  476. mouse_pause     dd  ?
  477.  
  478. BgrDrawMode     dd  ?
  479. BgrDataWidth    dd  ?
  480. BgrDataHeight   dd  ?
  481.  
  482. buttontype          dd  ?
  483. windowtypechanged   dd  ?
  484.  
  485. debug_step_pointer  dd  ?
  486.  
  487. lba_read_enabled    dd  ?   ; 0 = disabled , 1 = enabled
  488. pci_access_enabled  dd  ?   ; 0 = disabled , 1 = enabled
  489.  
  490. NumBiosDisks        dd  ?
  491. BiosDisksData       rb  200h    ; struct BiosDiskData
  492. BiosDiskCaches      rb  80h*(cache_ide1-cache_ide0)
  493. BiosDiskPartitions  rd  80h
  494.  
  495. img_background          dd  ?
  496. mem_BACKGROUND          dd  ?
  497. static_background_data  dd  ?
  498.  
  499. hd1_status              dd  ?   ; 0 - free : other - pid
  500. application_table_owner dd  ?   ; 0 - free : other - pid
  501. application_table_mutex MUTEX
  502.  
  503. redrawmouse_unconditional   dd  ?
  504.  
  505. MOUSE_SCROLL_H  rw  1
  506. MOUSE_X:        rw  1
  507. MOUSE_Y:        rw  1
  508. MOUSE_SCROLL_V  rw  1
  509.  
  510. X_UNDER         rw  1
  511. Y_UNDER         rw  1
  512. COLOR_TEMP      dd  ?
  513. MOUSE_COLOR_MEM dd  ?
  514.  
  515. SCR_MODE    rw  2
  516.  
  517. BTN_DOWN:   rb  4
  518.  
  519. cpu_phys_addr_width db  ?   ; also known as MAXPHYADDR in Intel manuals
  520. hdd_appl_data       db  ?   ; 0 = system cache, 1 - application cache
  521. cd_appl_data        db  ?   ; 0 = system cache, 1 - application cache
  522.  
  523. timer_ticks_enable  db  ?  ; for cd driver
  524.  
  525. REDRAW_BACKGROUND   db  ?
  526.  
  527. align 16
  528. DRIVE_DATA: rb  DRIVE_DATA_SIZE
  529.  
  530. IncludeUGlobals
  531.  
  532. uglobals_size = $ - endofcode
  533.  
  534. if ~ lang eq sp
  535. diff16 "end of .bss",0,$
  536. end if
  537.  
  538. ; check if kernel fits memmap
  539. assert $-OS_BASE+0x1000 < TMP_STACK_TOP
  540.  
  541. org (OS_BASE+0x0100000)
  542.  
  543. ; Currently size of memory allocated for the ramdisk is fixed.
  544. ; This should be revisited when/if memory map would become more dynamic.
  545. RAMDISK_CAPACITY = 2880 ; in sectors
  546.  
  547. RAMDISK:
  548.         rb  RAMDISK_CAPACITY*512
  549.  
  550. _CLEAN_ZONE:
  551. CLEAN_ZONE = _CLEAN_ZONE - OS_BASE
  552.  
  553. BgrAuxTable     rb  32768
  554. align 65536
  555. SB16Buffer      rb  65536
  556.  
  557. align 4096
  558. BUTTON_INFO     rb  64*1024
  559. RESERVED_PORTS:
  560.         rb  64*1024
  561. sys_pgmap:
  562.         rb  1024*1024/8