Subversion Repositories Kolibri OS

Rev

Rev 7124 | Rev 7132 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7124 Rev 7129
Line 69... Line 69...
69
format binary as "mnt"
69
format binary as "mnt"
Line 70... Line 70...
70
 
70
 
71
include 'macros.inc'
71
include 'macros.inc'
Line 72... Line 72...
72
include 'struct.inc'
72
include 'struct.inc'
Line 73... Line 73...
73
 
73
 
74
$Revision: 7124 $
74
$Revision: 7129 $
Line 129... Line 129...
129
;;    - Scincode.inc  Window skinning
129
;;    - Scincode.inc  Window skinning
130
;;    - Pci32.inc     PCI functions
130
;;    - Pci32.inc     PCI functions
131
;;
131
;;
132
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
132
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 133... Line -...
133
 
-
 
134
 
133
 
135
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
134
; In bios boot mode the kernel code below is appended to bootbios.bin file.
136
;;                                                                      ;;
135
; That is a loading and initialization code that also draws the blue screen
137
;;                  16 BIT ENTRY FROM BOOTSECTOR                        ;;
136
; menu with svn revision number near top right corner of the screen. This fasm
138
;;                                                                      ;;
137
; preprocessor code searches for '****' signature inside bootbios.bin and
139
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
-
 
138
; places revision number there.
140
 
139
if ~ defined UEFI
141
use16
140
  bootbios:
-
 
141
  file 'bootbios.bin'
142
                  org   0x0
142
  if __REV__ > 0
143
        jmp     start_of_code
-
 
144
 
143
    cur_pos = 0
-
 
144
    cnt = 0
145
if lang eq sp
145
    repeat $ - bootbios
146
include "kernelsp.inc"  ; spanish kernel messages
146
      load a byte from %
147
else if lang eq et
147
      if a = '*'
148
version db    'Kolibri OS  versioon 0.7.7.0+    ',13,10,13,10,0
148
        cnt = cnt + 1
149
else
149
      else
150
version db    'Kolibri OS  version 0.7.7.0+     ',13,10,13,10,0
150
        cnt = 0
151
end if
-
 
152
 
151
      end if
153
include "boot/bootstr.inc"     ; language-independent boot messages
152
      if cnt = 4
154
include "boot/preboot.inc"
-
 
155
 
153
        cur_pos = % - 1
156
if lang eq ge
154
        break
157
include "boot/bootge.inc"     ; german system boot messages
155
      end if
158
else if lang eq sp
156
    end repeat
-
 
157
    store byte ' ' at cur_pos + 1
159
include "boot/bootsp.inc"     ; spanish system boot messages
158
    rev_var = __REV__
160
else if lang eq ru
159
    while rev_var > 0
161
include "boot/bootru.inc"      ; russian system boot messages
160
      store byte rev_var mod 10 + '0' at cur_pos
162
include "boot/ru.inc"          ; Russian font
161
      cur_pos = cur_pos - 1
163
else if lang eq et
162
      rev_var = rev_var / 10
164
include "boot/bootet.inc"      ; estonian system boot messages
163
    end while
165
include "boot/et.inc"          ; Estonian font
-
 
166
else
164
      store byte ' ' at cur_pos
167
include "boot/booten.inc"      ; english system boot messages
165
      store dword ' SVN' at cur_pos - 4
168
end if
-
 
169
 
-
 
170
include "boot/bootcode.inc"    ; 16 bit system boot code
-
 
171
include "bus/pci/pci16.inc"
-
 
172
include "detect/biosdisk.inc"
-
 
173
 
-
 
174
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
175
;;                                                                      ;;
-
 
176
;;                  SWITCH TO 32 BIT PROTECTED MODE                     ;;
-
 
177
;;                                                                      ;;
-
 
178
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
179
 
-
 
180
 
-
 
181
; CR0 Flags - Protected mode and Paging
-
 
182
 
-
 
183
        mov     ecx, CR0_PE+CR0_AM
-
 
184
 
-
 
185
; Enabling 32 bit protected mode
-
 
186
 
-
 
187
        sidt    [cs:old_ints_h]
-
 
188
 
-
 
189
        cli                             ; disable all irqs
-
 
190
        cld
-
 
191
        mov     al, 255                 ; mask all irqs
-
 
192
        out     0xa1, al
-
 
193
        out     0x21, al
-
 
194
   l.5:
-
 
195
        in      al, 0x64                ; Enable A20
-
 
196
        test    al, 2
-
 
197
        jnz     l.5
-
 
198
        mov     al, 0xD1
-
 
199
        out     0x64, al
-
 
200
   l.6:
-
 
201
        in      al, 0x64
-
 
202
        test    al, 2
-
 
203
        jnz     l.6
-
 
204
        mov     al, 0xDF
-
 
205
        out     0x60, al
-
 
206
   l.7:
-
 
207
        in      al, 0x64
-
 
208
        test    al, 2
-
 
209
        jnz     l.7
-
 
210
        mov     al, 0xFF
-
 
211
        out     0x64, al
-
 
212
 
-
 
213
        lgdt    [cs:tmp_gdt]            ; Load GDT
-
 
214
        mov     eax, cr0                ; protected mode
-
 
215
        or      eax, ecx
-
 
216
        and     eax, 10011111b *65536*256 + 0xffffff ; caching enabled
-
 
217
        mov     cr0, eax
-
 
218
        jmp     pword os_code:B32       ; jmp to enable 32 bit mode
-
 
219
 
-
 
220
align 8
-
 
221
tmp_gdt:
-
 
222
 
-
 
223
        dw     23
-
 
224
        dd     tmp_gdt+0x10000
-
 
225
        dw     0
-
 
226
 
-
 
227
        dw     0xffff
-
 
228
        dw     0x0000
-
 
229
        db     0x00
-
 
230
        dw     11011111b *256 +10011010b
-
 
231
        db     0x00
-
 
232
 
-
 
233
        dw     0xffff
-
 
234
        dw     0x0000
-
 
235
        db     0x00
-
 
236
        dw     11011111b *256 +10010010b
-
 
237
        db     0x00
-
 
238
 
-
 
239
include "data16.inc"
-
 
240
 
-
 
241
if ~ lang eq sp
-
 
242
diff16 "end of bootcode",0,$+0x10000
166
  end if
Line 243... Line 167...
243
end if
167
end if
244
 
168
 
Line 768... Line 692...
768
        call    boot_log
692
        call    boot_log
769
; Initialize system timer (IRQ0)
693
; Initialize system timer (IRQ0)
770
        call    PIT_init
694
        call    PIT_init
Line 771... Line 695...
771
 
695
 
772
; Register ramdisk file system
696
; Register ramdisk file system
773
        cmp     [boot_dev+OS_BASE+0x10000], 1
697
        cmp     byte [BOOT_DEV+OS_BASE+0x10000], 1
Line 774... Line 698...
774
        je      @f
698
        je      @f
775
 
699
 
776
        call    register_ramdisk
700
        call    register_ramdisk
Line 859... Line 783...
859
; initialisation IDE ATA code
783
; initialisation IDE ATA code
860
;-----------------------------------------------------------------------------
784
;-----------------------------------------------------------------------------
861
include 'detect/init_ata.inc'
785
include 'detect/init_ata.inc'
862
;-----------------------------------------------------------------------------
786
;-----------------------------------------------------------------------------
863
if 0
787
if 0
864
        mov     ax, [OS_BASE+0x10000+bx_from_load]
788
        mov     ax, [OS_BASE+BOOT_BX_FROM_LOAD]
865
        cmp     ax, 'r1'; if using not ram disk, then load librares and parameters {SPraid.simba}
789
        cmp     ax, 'r1'; if using not ram disk, then load librares and parameters {SPraid.simba}
866
        je      no_lib_load
790
        je      no_lib_load
Line 867... Line 791...
867
 
791
 
868
        mov     esi, boot_loadlibs
792
        mov     esi, boot_loadlibs
Line 1099... Line 1023...
1099
        hlt
1023
        hlt
Line 1100... Line 1024...
1100
 
1024
 
Line 1101... Line 1025...
1101
first_app_found:
1025
first_app_found:
-
 
1026
 
Line 1102... Line 1027...
1102
 
1027
; START MULTITASKING
1103
; START MULTITASKING
1028
preboot_blogesc = 0       ; start immediately after bootlog
1104
 
1029
 
1105
; A 'All set - press ESC to start' messages if need
1030
; A 'All set - press ESC to start' messages if need