Rev 3500 | Rev 5201 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
431 | serge | 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
||
3908 | Serge | 3 | ;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;; |
431 | serge | 4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
||
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
7 | |||
593 | mikedld | 8 | $Revision: 3908 $ |
9 | |||
10 | |||
3908 | Serge | 11 | read_ramdisk: |
1 | ha | 12 | ; READ RAMDISK IMAGE FROM HD |
13 | |||
2434 | Serge | 14 | cmp [boot_dev+OS_BASE+0x10000], 1 |
15 | jne no_sys_on_hd |
||
1 | ha | 16 | |
3908 | Serge | 17 | xor ebp, ebp |
18 | .hd_loop: |
||
19 | lea eax, [ebp+'0'] |
||
20 | mov [read_image_fsinfo.name_digit], al |
||
21 | movzx eax, byte [DRIVE_DATA+2+ebp] |
||
22 | test eax, eax |
||
23 | jz .next_hd |
||
24 | push eax |
||
25 | mov esi, 1 |
||
26 | .partition_loop: |
||
27 | mov eax, esi |
||
28 | push -'0' |
||
29 | @@: |
||
30 | xor edx, edx |
||
31 | div [_10] |
||
32 | push edx |
||
33 | test eax, eax |
||
34 | jnz @b |
||
35 | mov edi, read_image_fsinfo.partition |
||
36 | @@: |
||
37 | pop eax |
||
38 | add al, '0' |
||
39 | stosb |
||
40 | jnz @b |
||
41 | mov byte [edi-1], '/' |
||
42 | push esi edi |
||
43 | mov esi, bootpath1 |
||
44 | mov ecx, bootpath1.len |
||
45 | rep movsb |
||
2434 | Serge | 46 | call read_image |
47 | test eax, eax |
||
3908 | Serge | 48 | jz .yes |
49 | cmp eax, 6 |
||
50 | jz .yes |
||
51 | pop edi |
||
52 | push edi |
||
53 | mov esi, bootpath2 |
||
54 | mov ecx, bootpath2.len |
||
55 | rep movsb |
||
2434 | Serge | 56 | call read_image |
57 | test eax, eax |
||
3908 | Serge | 58 | jz .yes |
59 | cmp eax, 6 |
||
60 | jz .yes |
||
61 | pop edi esi |
||
62 | inc esi |
||
63 | cmp esi, [esp] |
||
64 | jbe .partition_loop |
||
65 | pop eax |
||
66 | .next_hd: |
||
67 | inc ebp |
||
68 | cmp ebp, 4 |
||
69 | jb .hd_loop |
||
70 | jmp no_sys_on_hd |
||
71 | .yes: |
||
72 | pop edi esi eax |
||
73 | jmp yes_sys_on_hd |
||
1 | ha | 74 | |
2987 | Serge | 75 | iglobal |
76 | align 4 |
||
77 | read_image_fsinfo: |
||
78 | dd 0 ; function: read |
||
79 | dq 0 ; offset: zero |
||
3908 | Serge | 80 | dd 1474560 ; size |
2987 | Serge | 81 | dd RAMDISK ; buffer |
3908 | Serge | 82 | db '/hd' |
83 | .name_digit db '0' |
||
84 | db '/' |
||
85 | .partition: |
||
86 | rb 64 ; should be enough for '255/KOLIBRI/KOLIBRI.IMG' |
||
87 | |||
88 | bootpath1 db 'KOLIBRI.IMG',0 |
||
89 | .len = $ - bootpath1 |
||
90 | bootpath2 db 'KOLIBRI/KOLIBRI.IMG',0 |
||
91 | .len = $ - bootpath2 |
||
2987 | Serge | 92 | endg |
93 | |||
1 | ha | 94 | read_image: |
2987 | Serge | 95 | mov ebx, read_image_fsinfo |
96 | pushad |
||
3500 | Serge | 97 | call file_system_lfn_protected |
2987 | Serge | 98 | popad |
381 | serge | 99 | ret |
1 | ha | 100 | |
101 | no_sys_on_hd: |
||
545 | spraid | 102 | ; test_to_format_ram_disk (need if not using ram disk) |
2434 | Serge | 103 | cmp [boot_dev+OS_BASE+0x10000], 3 |
104 | jne not_format_ram_disk |
||
545 | spraid | 105 | ; format_ram_disk |
2434 | Serge | 106 | mov edi, RAMDISK |
107 | mov ecx, 0x1080 |
||
108 | xor eax, eax |
||
109 | @@: |
||
110 | stosd |
||
111 | loop @b |
||
545 | spraid | 112 | |
2434 | Serge | 113 | mov ecx, 0x58F7F |
114 | mov eax, 0xF6F6F6F6 |
||
115 | @@: |
||
116 | stosd |
||
117 | loop @b |
||
545 | spraid | 118 | |
2434 | Serge | 119 | mov [RAMDISK+0x200], dword 0xFFFFF0 ; fat table |
120 | mov [RAMDISK+0x4200], dword 0xFFFFF0 |
||
545 | spraid | 121 | |
122 | not_format_ram_disk: |
||
1 | ha | 123 | yes_sys_on_hd: |