Rev 4149 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4127 | decky | 1 | #ifdef CONFIG_FB |
4128 | decky | 2 | |
3 | #define MULTIBOOT_LOADER_MAGIC 0x2BADB002 |
||
4 | #define MBINFO_BIT_CMDLINE 2 |
||
5 | #define MBINFO_OFFSET_CMDLINE 16 |
||
6 | |||
7 | # copy real mode VESA initialization code |
||
8 | |||
4127 | decky | 9 | mov $vesa_init, %esi |
10 | mov $VESA_INIT_SEGMENT << 4, %edi |
||
11 | mov $e_vesa_init - vesa_init, %ecx |
||
12 | rep movsb |
||
13 | |||
4128 | decky | 14 | # check for GRUB command line |
15 | |||
16 | mov grub_eax, %eax |
||
17 | cmp $MULTIBOOT_LOADER_MAGIC, %eax |
||
18 | jne no_cmdline |
||
19 | |||
20 | mov grub_ebx, %ebx |
||
21 | mov (%ebx), %eax |
||
22 | bt $MBINFO_BIT_CMDLINE, %eax |
||
23 | jnc no_cmdline |
||
24 | |||
25 | # skip the kernel path in command line |
||
26 | |||
27 | mov MBINFO_OFFSET_CMDLINE(%ebx), %esi |
||
28 | |||
29 | skip_loop: |
||
30 | lodsb |
||
31 | |||
32 | cmp $0, %al |
||
33 | je no_cmdline |
||
34 | |||
35 | cmp $' ', %al |
||
36 | je skip_loop_done |
||
37 | |||
38 | jmp skip_loop |
||
39 | skip_loop_done: |
||
40 | |||
4149 | decky | 41 | space_loop: |
42 | mov (%esi), %al |
||
43 | |||
44 | cmp $0, %al |
||
45 | je no_cmdline |
||
46 | |||
47 | cmp $' ', %al |
||
48 | jne space_loop_done |
||
49 | |||
50 | inc %esi |
||
51 | jmp space_loop |
||
52 | space_loop_done: |
||
4128 | decky | 53 | |
54 | # copy at most 23 characters from command line |
||
55 | |||
4127 | decky | 56 | mov $VESA_INIT_SEGMENT << 4, %edi |
4128 | decky | 57 | add $default_mode - vesa_init, %edi |
58 | mov $23, %ecx |
||
59 | |||
60 | cmd_loop: |
||
61 | lodsb |
||
62 | stosb |
||
63 | |||
64 | cmp $0, %al |
||
65 | je cmd_loop_done |
||
66 | |||
67 | loop cmd_loop |
||
68 | cmd_loop_done: |
||
69 | |||
70 | # zero termination |
||
71 | |||
72 | xor %eax, %eax |
||
73 | stosb |
||
74 | |||
75 | no_cmdline: |
||
76 | |||
77 | # jump to the real mode |
||
78 | |||
79 | mov $VESA_INIT_SEGMENT << 4, %edi |
||
4127 | decky | 80 | jmpl *%edi |
81 | |||
82 | vesa_meeting_point: |
||
4128 | decky | 83 | # returned back to protected mode |
84 | |||
4151 | decky | 85 | mov %ax, KA2PA(vesa_scanline) |
86 | shr $16, %eax |
||
87 | mov %ax, KA2PA(vesa_bpp) |
||
88 | |||
89 | mov %bx, KA2PA(vesa_height) |
||
4127 | decky | 90 | shr $16, %ebx |
4151 | decky | 91 | mov %bx, KA2PA(vesa_width) |
92 | |||
93 | mov %dl, KA2PA(vesa_green_pos) |
||
94 | shr $8, %edx |
||
95 | mov %dl, KA2PA(vesa_green_mask) |
||
96 | shr $8, %edx |
||
97 | mov %dl, KA2PA(vesa_red_pos) |
||
98 | shr $8, %edx |
||
99 | mov %dl, KA2PA(vesa_red_mask) |
||
100 | |||
101 | mov %esi, %edx |
||
102 | mov %dl, KA2PA(vesa_blue_pos) |
||
103 | shr $8, %edx |
||
104 | mov %dl, KA2PA(vesa_blue_mask) |
||
105 | |||
106 | mov %edi, KA2PA(vesa_ph_addr) |
||
4127 | decky | 107 | #endif |