Subversion Repositories Kolibri OS

Rev

Rev 10010 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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