Merge lp:~hamo/ubuntu/precise/grub2/grub2.lp1297128 into lp:~ubuntu-core-dev/ubuntu/precise/grub2/precise

Proposed by Yang Bai
Status: Merged
Approved by: Colin Watson
Approved revision: 2296
Merged at revision: 2296
Proposed branch: lp:~hamo/ubuntu/precise/grub2/grub2.lp1297128
Merge into: lp:~ubuntu-core-dev/ubuntu/precise/grub2/precise
Diff against target: 1230 lines (+1205/-0)
3 files modified
debian/changelog (+5/-0)
debian/patches/larger_terminal_size_restriction.patch (+1199/-0)
debian/patches/series (+1/-0)
To merge this branch: bzr merge lp:~hamo/ubuntu/precise/grub2/grub2.lp1297128
Reviewer Review Type Date Requested Status
Colin Watson Approve
Review via email: mp+213097@code.launchpad.net

Description of the change

backport upstream commits to precise-updates 2b23074a0c082219fe4490fa05b13a481b34b41e(partial), e89c2d48a991590c18c28ac867ccda67d4425187 and 44d47bbe6fe6ed0c8fc5855c07b2917a38371ae4 to support high resolution for grub terminal.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) wrote :

I'll fix the patch name to be in our namespace, but otherwise this looks fine, thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2013-12-12 01:31:53 +0000
+++ debian/changelog 2014-03-27 15:56:07 +0000
@@ -1,8 +1,13 @@
1grub2 (1.99-21ubuntu3.15) UNRELEASED; urgency=low1grub2 (1.99-21ubuntu3.15) UNRELEASED; urgency=low
22
3 [ Colin Watson ]
3 * Backport from upstream:4 * Backport from upstream:
4 - Fix sector number when writing to non-512B disks (LP: #1253443).5 - Fix sector number when writing to non-512B disks (LP: #1253443).
56
7 [ Yang Bai ]
8 * Backport from upstream:
9 - Support high resolution for grub terminal (LP: #1297128).
10
6 -- Colin Watson <cjwatson@ubuntu.com> Thu, 12 Dec 2013 01:27:08 +000011 -- Colin Watson <cjwatson@ubuntu.com> Thu, 12 Dec 2013 01:27:08 +0000
712
8grub2 (1.99-21ubuntu3.14) precise; urgency=low13grub2 (1.99-21ubuntu3.14) precise; urgency=low
914
=== added file 'debian/patches/larger_terminal_size_restriction.patch'
--- debian/patches/larger_terminal_size_restriction.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/larger_terminal_size_restriction.patch 2014-03-27 15:56:07 +0000
@@ -0,0 +1,1199 @@
1Index: grub2-backport/grub-core/commands/sleep.c
2===================================================================
3--- grub2-backport.orig/grub-core/commands/sleep.c
4+++ grub2-backport/grub-core/commands/sleep.c
5@@ -34,7 +34,7 @@ static const struct grub_arg_option opti
6 {0, 0, 0, 0, 0, 0}
7 };
8
9-static grub_uint16_t *pos;
10+static struct grub_term_coordinate *pos;
11
12 static void
13 do_print (int n)
14Index: grub2-backport/grub-core/kern/term.c
15===================================================================
16--- grub2-backport.orig/grub-core/kern/term.c
17+++ grub2-backport/grub-core/kern/term.c
18@@ -49,7 +49,7 @@ grub_putcode_dumb (grub_uint32_t code,
19 {
20 int n;
21
22- n = 8 - ((term->getxy (term) >> 8) & 7);
23+ n = 8 - ((term->getxy (term).x) & 7);
24 while (n--)
25 grub_putcode_dumb (' ', term);
26
27Index: grub2-backport/grub-core/loader/i386/linux.c
28===================================================================
29--- grub2-backport.orig/grub-core/loader/i386/linux.c
30+++ grub2-backport/grub-core/loader/i386/linux.c
31@@ -493,9 +493,9 @@ grub_linux_boot (void)
32 || grub_strcmp (term->name, "console") == 0
33 || grub_strcmp (term->name, "ofconsole") == 0)
34 {
35- grub_uint16_t pos = grub_term_getxy (term);
36- params->video_cursor_x = pos >> 8;
37- params->video_cursor_y = pos & 0xff;
38+ struct grub_term_coordinate pos = grub_term_getxy (term);
39+ params->video_cursor_x = pos.x;
40+ params->video_cursor_y = pos.y;
41 params->video_width = grub_term_width (term);
42 params->video_height = grub_term_height (term);
43 found = 1;
44Index: grub2-backport/grub-core/normal/cmdline.c
45===================================================================
46--- grub2-backport.orig/grub-core/normal/cmdline.c
47+++ grub2-backport/grub-core/normal/cmdline.c
48@@ -203,7 +203,8 @@ print_completion (const char *item, grub
49
50 struct cmdline_term
51 {
52- unsigned xpos, ypos, ystart, width, height;
53+ struct grub_term_coordinate pos;
54+ unsigned ystart, width, height;
55 struct grub_term_output *term;
56 };
57
58@@ -235,9 +236,9 @@ grub_cmdline_get (const char *prompt)
59
60 void cl_set_pos (struct cmdline_term *cl_term)
61 {
62- cl_term->xpos = (plen + lpos) % (cl_term->width - 1);
63- cl_term->ypos = cl_term->ystart + (plen + lpos) / (cl_term->width - 1);
64- grub_term_gotoxy (cl_term->term, cl_term->xpos, cl_term->ypos);
65+ cl_term->pos.x = (plen + lpos) % (cl_term->width - 1);
66+ cl_term->pos.y = cl_term->ystart + (plen + lpos) / (cl_term->width - 1);
67+ grub_term_gotoxy (cl_term->term, cl_term->pos);
68 }
69
70 void cl_set_pos_all (void)
71@@ -257,14 +258,14 @@ grub_cmdline_get (const char *prompt)
72 grub_putcode (c, cl_term->term);
73 else
74 grub_putcode (*p, cl_term->term);
75- cl_term->xpos++;
76- if (cl_term->xpos >= cl_term->width - 1)
77+ cl_term->pos.x++;
78+ if (cl_term->pos.x >= cl_term->width - 1)
79 {
80- cl_term->xpos = 0;
81- if (cl_term->ypos >= (unsigned) (cl_term->height - 1))
82+ cl_term->pos.x = 0;
83+ if (cl_term->pos.y >= (unsigned) (cl_term->height - 1))
84 cl_term->ystart--;
85 else
86- cl_term->ypos++;
87+ cl_term->pos.y++;
88 grub_putcode ('\n', cl_term->term);
89 }
90 }
91@@ -332,9 +333,9 @@ grub_cmdline_get (const char *prompt)
92
93 void init_clterm (struct cmdline_term *cl_term_cur)
94 {
95- cl_term_cur->xpos = plen;
96- cl_term_cur->ypos = (grub_term_getxy (cl_term_cur->term) & 0xFF);
97- cl_term_cur->ystart = cl_term_cur->ypos;
98+ cl_term_cur->pos.x = plen;
99+ cl_term_cur->pos.y = grub_term_getxy (cl_term_cur->term).y;
100+ cl_term_cur->ystart = cl_term_cur->pos.y;
101 cl_term_cur->width = grub_term_width (cl_term_cur->term);
102 cl_term_cur->height = grub_term_height (cl_term_cur->term);
103 }
104@@ -358,7 +359,7 @@ grub_cmdline_get (const char *prompt)
105 grub_term_output_t term;
106
107 FOR_ACTIVE_TERM_OUTPUTS(term)
108- if ((grub_term_getxy (term) >> 8) != 0)
109+ if ((grub_term_getxy (term).x) != 0)
110 grub_putcode ('\n', term);
111 }
112 grub_printf ("%s ", prompt_translated);
113Index: grub2-backport/grub-core/normal/main.c
114===================================================================
115--- grub2-backport.orig/grub-core/normal/main.c
116+++ grub2-backport/grub-core/normal/main.c
117@@ -233,7 +233,7 @@ grub_normal_init_page (struct grub_term_
118
119 posx = grub_getstringwidth (unicode_msg, last_position, term);
120 posx = (grub_term_width (term) - posx) / 2;
121- grub_term_gotoxy (term, posx, 1);
122+ grub_term_gotoxy (term, (struct grub_term_coordinate) { posx, 1 });
123
124 grub_print_ucs4 (unicode_msg, last_position, 0, 0, term);
125 grub_putcode ('\n', term);
126Index: grub2-backport/grub-core/normal/menu_entry.c
127===================================================================
128--- grub2-backport.orig/grub-core/normal/menu_entry.c
129+++ grub2-backport/grub-core/normal/menu_entry.c
130@@ -124,8 +124,8 @@ print_line (struct line *linep, int offs
131 struct per_term_screen *term_screen)
132 {
133 grub_term_gotoxy (term_screen->term,
134- GRUB_TERM_LEFT_BORDER_X + GRUB_TERM_MARGIN + start + 1,
135- y + GRUB_TERM_FIRST_ENTRY_Y);
136+ (struct grub_term_coordinate) {GRUB_TERM_LEFT_BORDER_X + GRUB_TERM_MARGIN + start + 1,
137+ y + GRUB_TERM_FIRST_ENTRY_Y });
138
139 if (linep->len >= offset + grub_term_entry_width (term_screen->term))
140 {
141@@ -162,8 +162,8 @@ print_empty_line (int y, struct per_term
142 int i;
143
144 grub_term_gotoxy (term_screen->term,
145- GRUB_TERM_LEFT_BORDER_X + GRUB_TERM_MARGIN + 1,
146- y + GRUB_TERM_FIRST_ENTRY_Y);
147+ (struct grub_term_coordinate) {GRUB_TERM_LEFT_BORDER_X + GRUB_TERM_MARGIN + 1,
148+ y + GRUB_TERM_FIRST_ENTRY_Y });
149
150 for (i = 0; i < grub_term_entry_width (term_screen->term) + 1; i++)
151 grub_putcode (' ', term_screen->term);
152@@ -173,9 +173,9 @@ print_empty_line (int y, struct per_term
153 static void
154 print_up (int flag, struct per_term_screen *term_screen)
155 {
156- grub_term_gotoxy (term_screen->term, GRUB_TERM_LEFT_BORDER_X
157+ grub_term_gotoxy (term_screen->term, (struct grub_term_coordinate) { GRUB_TERM_LEFT_BORDER_X
158 + grub_term_border_width (term_screen->term),
159- GRUB_TERM_FIRST_ENTRY_Y);
160+ GRUB_TERM_FIRST_ENTRY_Y });
161
162 if (flag)
163 grub_putcode (GRUB_UNICODE_UPARROW, term_screen->term);
164@@ -187,10 +187,10 @@ print_up (int flag, struct per_term_scre
165 static void
166 print_down (int flag, struct per_term_screen *term_screen)
167 {
168- grub_term_gotoxy (term_screen->term, GRUB_TERM_LEFT_BORDER_X
169+ grub_term_gotoxy (term_screen->term, (struct grub_term_coordinate) { GRUB_TERM_LEFT_BORDER_X
170 + grub_term_border_width (term_screen->term),
171 GRUB_TERM_TOP_BORDER_Y
172- + term_screen->num_entries);
173+ + term_screen->num_entries });
174
175 if (flag)
176 grub_putcode (GRUB_UNICODE_DOWNARROW, term_screen->term);
177@@ -298,9 +298,9 @@ update_screen (struct screen *screen, st
178
179 /* Place the cursor. */
180 grub_term_gotoxy (term_screen->term,
181- GRUB_TERM_LEFT_BORDER_X + GRUB_TERM_MARGIN + 1
182+ (struct grub_term_coordinate) { GRUB_TERM_LEFT_BORDER_X + GRUB_TERM_MARGIN + 1
183 + term_screen->x,
184- GRUB_TERM_FIRST_ENTRY_Y + term_screen->y);
185+ GRUB_TERM_FIRST_ENTRY_Y + term_screen->y });
186
187 grub_term_refresh (term_screen->term);
188 }
189@@ -1056,17 +1056,17 @@ complete (struct screen *screen, int con
190 / (grub_term_width (screen->terms[i].term)
191 - 8));
192 grub_uint32_t *endp;
193- grub_uint16_t pos;
194+ struct grub_term_coordinate pos;
195 grub_uint32_t *p = ucs4;
196
197 pos = grub_term_getxy (screen->terms[i].term);
198- grub_term_gotoxy (screen->terms[i].term, 0,
199- grub_term_height (screen->terms[i].term) - 3);
200+ grub_term_gotoxy (screen->terms[i].term, (struct grub_term_coordinate) { 0,
201+ grub_term_height (screen->terms[i].term) - 3 });
202
203 screen->completion_shown = 1;
204
205- grub_term_gotoxy (screen->terms[i].term, 0,
206- grub_term_height (screen->terms[i].term) - 3);
207+ grub_term_gotoxy (screen->terms[i].term, (struct grub_term_coordinate) { 0,
208+ grub_term_height (screen->terms[i].term) - 3 });
209 grub_puts_terminal (" ", screen->terms[i].term);
210 switch (completion_type)
211 {
212@@ -1112,7 +1112,7 @@ complete (struct screen *screen, int con
213
214 if (ucs4 + ucs4len > endp)
215 grub_putcode (GRUB_UNICODE_RIGHTARROW, screen->terms[i].term);
216- grub_term_gotoxy (screen->terms[i].term, pos >> 8, pos & 0xFF);
217+ grub_term_gotoxy (screen->terms[i].term, pos);
218 }
219 }
220
221@@ -1133,12 +1133,12 @@ complete (struct screen *screen, int con
222 static void
223 clear_completions (struct per_term_screen *term_screen)
224 {
225- grub_uint16_t pos;
226+ struct grub_term_coordinate pos;
227 unsigned i, j;
228
229 pos = grub_term_getxy (term_screen->term);
230- grub_term_gotoxy (term_screen->term, 0,
231- grub_term_height (term_screen->term) - 3);
232+ grub_term_gotoxy (term_screen->term, (struct grub_term_coordinate) { 0,
233+ grub_term_height (term_screen->term) - 3 });
234
235 for (i = 0; i < 2; i++)
236 {
237@@ -1147,7 +1147,7 @@ clear_completions (struct per_term_scree
238 grub_putcode ('\n', term_screen->term);
239 }
240
241- grub_term_gotoxy (term_screen->term, pos >> 8, pos & 0xFF);
242+ grub_term_gotoxy (term_screen->term, pos);
243 grub_term_refresh (term_screen->term);
244 }
245
246Index: grub2-backport/grub-core/normal/menu_text.c
247===================================================================
248--- grub2-backport.orig/grub-core/normal/menu_text.c
249+++ grub2-backport/grub-core/normal/menu_text.c
250@@ -106,7 +106,7 @@ draw_border (struct grub_term_output *te
251
252 grub_term_setcolorstate (term, GRUB_TERM_COLOR_NORMAL);
253
254- grub_term_gotoxy (term, GRUB_TERM_MARGIN, GRUB_TERM_TOP_BORDER_Y);
255+ grub_term_gotoxy (term, (struct grub_term_coordinate) { GRUB_TERM_MARGIN, GRUB_TERM_TOP_BORDER_Y });
256 grub_putcode (GRUB_UNICODE_CORNER_UL, term);
257 for (i = 0; i < (unsigned) grub_term_border_width (term) - 2; i++)
258 grub_putcode (GRUB_UNICODE_HLINE, term);
259@@ -114,16 +114,16 @@ draw_border (struct grub_term_output *te
260
261 for (i = 0; i < (unsigned) num_entries; i++)
262 {
263- grub_term_gotoxy (term, GRUB_TERM_MARGIN, GRUB_TERM_TOP_BORDER_Y + i + 1);
264+ grub_term_gotoxy (term, (struct grub_term_coordinate) { GRUB_TERM_MARGIN, GRUB_TERM_TOP_BORDER_Y + i + 1 });
265 grub_putcode (GRUB_UNICODE_VLINE, term);
266- grub_term_gotoxy (term, GRUB_TERM_MARGIN + grub_term_border_width (term)
267+ grub_term_gotoxy (term, (struct grub_term_coordinate) { GRUB_TERM_MARGIN + grub_term_border_width (term)
268 - 1,
269- GRUB_TERM_TOP_BORDER_Y + i + 1);
270+ GRUB_TERM_TOP_BORDER_Y + i + 1 });
271 grub_putcode (GRUB_UNICODE_VLINE, term);
272 }
273
274- grub_term_gotoxy (term, GRUB_TERM_MARGIN,
275- GRUB_TERM_TOP_BORDER_Y + num_entries + 1);
276+ grub_term_gotoxy (term, (struct grub_term_coordinate) { GRUB_TERM_MARGIN,
277+ GRUB_TERM_TOP_BORDER_Y + num_entries + 1 });
278 grub_putcode (GRUB_UNICODE_CORNER_LL, term);
279 for (i = 0; i < (unsigned) grub_term_border_width (term) - 2; i++)
280 grub_putcode (GRUB_UNICODE_HLINE, term);
281@@ -131,9 +131,9 @@ draw_border (struct grub_term_output *te
282
283 grub_term_setcolorstate (term, GRUB_TERM_COLOR_NORMAL);
284
285- grub_term_gotoxy (term, GRUB_TERM_MARGIN,
286- (GRUB_TERM_TOP_BORDER_Y + num_entries
287- + GRUB_TERM_MARGIN + 1));
288+ grub_term_gotoxy (term, (struct grub_term_coordinate) { GRUB_TERM_MARGIN,
289+ (GRUB_TERM_TOP_BORDER_Y + num_entries
290+ + GRUB_TERM_MARGIN + 1) });
291 }
292
293 static int
294@@ -227,7 +227,7 @@ print_entry (int y, int highlight, grub_
295 ? GRUB_TERM_COLOR_HIGHLIGHT
296 : GRUB_TERM_COLOR_NORMAL);
297
298- grub_term_gotoxy (term, GRUB_TERM_LEFT_BORDER_X + GRUB_TERM_MARGIN, y);
299+ grub_term_gotoxy (term, (struct grub_term_coordinate) { GRUB_TERM_LEFT_BORDER_X + GRUB_TERM_MARGIN, y });
300
301 int last_printed = 0;
302 for (x = GRUB_TERM_LEFT_BORDER_X + GRUB_TERM_MARGIN + 1, i = 0;
303@@ -281,7 +281,7 @@ print_entry (int y, int highlight, grub_
304 grub_term_setcolorstate (term, GRUB_TERM_COLOR_NORMAL);
305 grub_putcode (' ', term);
306
307- grub_term_gotoxy (term, grub_term_cursor_x (term), y);
308+ grub_term_gotoxy (term, (struct grub_term_coordinate) { grub_term_cursor_x (term), y });
309
310 grub_term_setcolor (term, old_color_normal, old_color_highlight);
311 grub_term_setcolorstate (term, GRUB_TERM_COLOR_NORMAL);
312@@ -295,8 +295,8 @@ print_entries (grub_menu_t menu, const s
313 int i;
314
315 grub_term_gotoxy (data->term,
316- GRUB_TERM_LEFT_BORDER_X + grub_term_border_width (data->term),
317- GRUB_TERM_FIRST_ENTRY_Y);
318+ (struct grub_term_coordinate) { GRUB_TERM_LEFT_BORDER_X + grub_term_border_width (data->term),
319+ GRUB_TERM_FIRST_ENTRY_Y });
320
321 if (data->first)
322 grub_putcode (GRUB_UNICODE_UPARROW, data->term);
323@@ -313,17 +313,17 @@ print_entries (grub_menu_t menu, const s
324 e = e->next;
325 }
326
327- grub_term_gotoxy (data->term, GRUB_TERM_LEFT_BORDER_X
328- + grub_term_border_width (data->term),
329- GRUB_TERM_TOP_BORDER_Y + data->num_entries);
330+ grub_term_gotoxy (data->term, (struct grub_term_coordinate) { GRUB_TERM_LEFT_BORDER_X
331+ + grub_term_border_width (data->term),
332+ GRUB_TERM_TOP_BORDER_Y + data->num_entries });
333
334 if (e)
335 grub_putcode (GRUB_UNICODE_DOWNARROW, data->term);
336 else
337 grub_putcode (' ', data->term);
338
339- grub_term_gotoxy (data->term, grub_term_cursor_x (data->term),
340- GRUB_TERM_FIRST_ENTRY_Y + data->offset);
341+ grub_term_gotoxy (data->term, (struct grub_term_coordinate) { grub_term_cursor_x (data->term),
342+ GRUB_TERM_FIRST_ENTRY_Y + data->offset });
343 }
344
345 /* Initialize the screen. If NESTED is non-zero, assume that this menu
346@@ -367,7 +367,7 @@ menu_text_print_timeout (int timeout, vo
347 char *msg_translated;
348 int posx;
349
350- grub_term_gotoxy (data->term, 0, grub_term_height (data->term) - 3);
351+ grub_term_gotoxy (data->term, (struct grub_term_coordinate) { 0, grub_term_height (data->term) - 3 });
352
353 msg_translated = grub_xasprintf (msg, timeout);
354 if (!msg_translated)
355@@ -379,12 +379,12 @@ menu_text_print_timeout (int timeout, vo
356
357 grub_print_message_indented (msg_translated, 3, 0, data->term);
358
359- posx = grub_term_getxy (data->term) >> 8;
360+ posx = grub_term_getxy (data->term).x;
361 grub_print_spaces (data->term, grub_term_width (data->term) - posx - 1);
362
363 grub_term_gotoxy (data->term,
364- grub_term_cursor_x (data->term),
365- GRUB_TERM_FIRST_ENTRY_Y + data->offset);
366+ (struct grub_term_coordinate) { grub_term_cursor_x (data->term),
367+ GRUB_TERM_FIRST_ENTRY_Y + data->offset });
368 grub_term_refresh (data->term);
369 }
370
371@@ -437,10 +437,10 @@ menu_text_clear_timeout (void *dataptr)
372 {
373 struct menu_viewer_data *data = dataptr;
374
375- grub_term_gotoxy (data->term, 0, grub_term_height (data->term) - 3);
376+ grub_term_gotoxy (data->term, (struct grub_term_coordinate) { 0, grub_term_height (data->term) - 3 });
377 grub_print_spaces (data->term, grub_term_width (data->term) - 1);
378- grub_term_gotoxy (data->term, grub_term_cursor_x (data->term),
379- GRUB_TERM_FIRST_ENTRY_Y + data->offset);
380+ grub_term_gotoxy (data->term, (struct grub_term_coordinate) { grub_term_cursor_x (data->term),
381+ GRUB_TERM_FIRST_ENTRY_Y + data->offset });
382 grub_term_refresh (data->term);
383 }
384
385Index: grub2-backport/grub-core/normal/term.c
386===================================================================
387--- grub2-backport.orig/grub-core/normal/term.c
388+++ grub2-backport/grub-core/normal/term.c
389@@ -57,7 +57,7 @@ static void
390 print_more (void)
391 {
392 char key;
393- grub_uint16_t *pos;
394+ struct grub_term_coordinate *pos;
395 grub_term_output_t term;
396 grub_uint32_t *unicode_str, *unicode_last_position;
397
398@@ -236,12 +236,12 @@ grub_puts_terminal (const char *str, str
399 grub_free (unicode_str);
400 }
401
402-grub_uint16_t *
403+struct grub_term_coordinate *
404 grub_term_save_pos (void)
405 {
406 struct grub_term_output *cur;
407 unsigned cnt = 0;
408- grub_uint16_t *ret, *ptr;
409+ struct grub_term_coordinate *ret, *ptr;
410
411 FOR_ACTIVE_TERM_OUTPUTS(cur)
412 cnt++;
413@@ -258,17 +258,17 @@ grub_term_save_pos (void)
414 }
415
416 void
417-grub_term_restore_pos (grub_uint16_t *pos)
418+grub_term_restore_pos (struct grub_term_coordinate *pos)
419 {
420 struct grub_term_output *cur;
421- grub_uint16_t *ptr = pos;
422+ struct grub_term_coordinate *ptr = pos;
423
424 if (!pos)
425 return;
426
427 FOR_ACTIVE_TERM_OUTPUTS(cur)
428 {
429- grub_term_gotoxy (cur, (*ptr & 0xff00) >> 8, *ptr & 0xff);
430+ grub_term_gotoxy (cur, *ptr);
431 ptr++;
432 }
433 }
434@@ -405,7 +405,7 @@ putglyph (const struct grub_unicode_glyp
435 {
436 int n;
437
438- n = 8 - ((term->getxy (term) >> 8) & 7);
439+ n = 8 - ((term->getxy (term).x) & 7);
440 c2.base = ' ';
441 while (n--)
442 (term->putchar) (term, &c2);
443@@ -507,7 +507,7 @@ static grub_ssize_t
444 get_startwidth (struct grub_term_output *term,
445 int margin_left)
446 {
447- return ((term->getxy (term) >> 8) & 0xff) - margin_left;
448+ return (term->getxy (term).x) - margin_left;
449 }
450
451 static int
452@@ -727,8 +727,8 @@ print_ucs4_real (const grub_uint32_t * s
453 if (backlog)
454 state = find_term_state (term);
455
456- if (((term->getxy (term) >> 8) & 0xff) < margin_left)
457- grub_print_spaces (term, margin_left - ((term->getxy (term) >> 8) & 0xff));
458+ if ((term->getxy (term).x) < margin_left)
459+ grub_print_spaces (term, margin_left - (term->getxy (term).x));
460 }
461
462 if ((term->flags & GRUB_TERM_CODE_TYPE_MASK)
463Index: grub2-backport/grub-core/term/efi/console.c
464===================================================================
465--- grub2-backport.orig/grub-core/term/efi/console.c
466+++ grub2-backport/grub-core/term/efi/console.c
467@@ -132,7 +132,7 @@ grub_console_getkey (struct grub_term_in
468 return GRUB_TERM_NO_KEY;
469 }
470
471-static grub_uint16_t
472+static struct grub_term_coordinate
473 grub_console_getwh (struct grub_term_output *term __attribute__ ((unused)))
474 {
475 grub_efi_simple_text_output_interface_t *o;
476@@ -147,24 +147,24 @@ grub_console_getwh (struct grub_term_out
477 rows = 25;
478 }
479
480- return ((columns << 8) | rows);
481+ return (struct grub_term_coordinate) { columns, rows };
482 }
483
484-static grub_uint16_t
485+static struct grub_term_coordinate
486 grub_console_getxy (struct grub_term_output *term __attribute__ ((unused)))
487 {
488 grub_efi_simple_text_output_interface_t *o;
489
490 if (grub_efi_is_finished)
491- return 0;
492+ return (struct grub_term_coordinate) { 0, 0 };
493
494 o = grub_efi_system_table->con_out;
495- return ((o->mode->cursor_column << 8) | o->mode->cursor_row);
496+ return (struct grub_term_coordinate) { o->mode->cursor_column, o->mode->cursor_row };
497 }
498
499 static void
500 grub_console_gotoxy (struct grub_term_output *term __attribute__ ((unused)),
501- grub_uint8_t x, grub_uint8_t y)
502+ struct grub_term_coordinate pos)
503 {
504 grub_efi_simple_text_output_interface_t *o;
505
506@@ -172,7 +172,7 @@ grub_console_gotoxy (struct grub_term_ou
507 return;
508
509 o = grub_efi_system_table->con_out;
510- efi_call_3 (o->set_cursor_position, o, x, y);
511+ efi_call_3 (o->set_cursor_position, o, pos.x, pos.y);
512 }
513
514 static void
515Index: grub2-backport/grub-core/term/gfxterm.c
516===================================================================
517--- grub2-backport.orig/grub-core/term/gfxterm.c
518+++ grub2-backport/grub-core/term/gfxterm.c
519@@ -978,34 +978,34 @@ grub_gfxterm_getcharwidth (struct grub_t
520 / virtual_screen.normal_char_width;
521 }
522
523-static grub_uint16_t
524+static struct grub_term_coordinate
525 grub_virtual_screen_getwh (struct grub_term_output *term __attribute__ ((unused)))
526 {
527- return (virtual_screen.columns << 8) | virtual_screen.rows;
528+ return (struct grub_term_coordinate) { virtual_screen.columns, virtual_screen.rows };
529 }
530
531-static grub_uint16_t
532+static struct grub_term_coordinate
533 grub_virtual_screen_getxy (struct grub_term_output *term __attribute__ ((unused)))
534 {
535- return ((virtual_screen.cursor_x << 8) | virtual_screen.cursor_y);
536+ return (struct grub_term_coordinate) { virtual_screen.cursor_x, virtual_screen.cursor_y };
537 }
538
539 static void
540 grub_gfxterm_gotoxy (struct grub_term_output *term __attribute__ ((unused)),
541- grub_uint8_t x, grub_uint8_t y)
542+ struct grub_term_coordinate pos)
543 {
544- if (x >= virtual_screen.columns)
545- x = virtual_screen.columns - 1;
546+ if (pos.x >= virtual_screen.columns)
547+ pos.x = virtual_screen.columns - 1;
548
549- if (y >= virtual_screen.rows)
550- y = virtual_screen.rows - 1;
551+ if (pos.y >= virtual_screen.rows)
552+ pos.y = virtual_screen.rows - 1;
553
554 /* Erase current cursor, if any. */
555 if (virtual_screen.cursor_state)
556 draw_cursor (0);
557
558- virtual_screen.cursor_x = x;
559- virtual_screen.cursor_y = y;
560+ virtual_screen.cursor_x = pos.x;
561+ virtual_screen.cursor_y = pos.y;
562
563 /* Draw cursor if visible. */
564 if (virtual_screen.cursor_state)
565Index: grub2-backport/grub-core/term/i386/pc/vga_text.c
566===================================================================
567--- grub2-backport.orig/grub-core/term/i386/pc/vga_text.c
568+++ grub2-backport/grub-core/term/i386/pc/vga_text.c
569@@ -27,7 +27,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
570 #define COLS 80
571 #define ROWS 25
572
573-static int grub_curr_x, grub_curr_y;
574+static struct grub_term_coordinate grub_curr_pos;
575
576 #define VGA_TEXT_SCREEN ((grub_uint16_t *) 0xb8000)
577
578@@ -46,7 +46,7 @@ screen_read_char (int x, int y)
579 static void
580 update_cursor (void)
581 {
582- unsigned int pos = grub_curr_y * COLS + grub_curr_x;
583+ unsigned int pos = grub_curr_pos.y * COLS + grub_curr_pos.x;
584 grub_vga_cr_write (pos >> 8, GRUB_VGA_CR_CURSOR_ADDR_HIGH);
585 grub_vga_cr_write (pos & 0xFF, GRUB_VGA_CR_CURSOR_ADDR_LOW);
586 }
587@@ -54,9 +54,9 @@ update_cursor (void)
588 static void
589 inc_y (void)
590 {
591- grub_curr_x = 0;
592- if (grub_curr_y < ROWS - 1)
593- grub_curr_y++;
594+ grub_curr_pos.x = 0;
595+ if (grub_curr_pos.y < ROWS - 1)
596+ grub_curr_pos.y++;
597 else
598 {
599 int x, y;
600@@ -71,10 +71,10 @@ inc_y (void)
601 static void
602 inc_x (void)
603 {
604- if (grub_curr_x >= COLS - 1)
605+ if (grub_curr_pos.x >= COLS - 1)
606 inc_y ();
607 else
608- grub_curr_x++;
609+ grub_curr_pos.x++;
610 }
611
612 static void
613@@ -84,17 +84,17 @@ grub_vga_text_putchar (struct grub_term_
614 switch (c->base)
615 {
616 case '\b':
617- if (grub_curr_x != 0)
618- screen_write_char (grub_curr_x--, grub_curr_y, ' ');
619+ if (grub_curr_pos.x != 0)
620+ screen_write_char (grub_curr_pos.x--, grub_curr_pos.y, ' ');
621 break;
622 case '\n':
623 inc_y ();
624 break;
625 case '\r':
626- grub_curr_x = 0;
627+ grub_curr_pos.x = 0;
628 break;
629 default:
630- screen_write_char (grub_curr_x, grub_curr_y,
631+ screen_write_char (grub_curr_pos.x, grub_curr_pos.y,
632 c->base | (grub_console_cur_color << 8));
633 inc_x ();
634 }
635@@ -102,18 +102,17 @@ grub_vga_text_putchar (struct grub_term_
636 update_cursor ();
637 }
638
639-static grub_uint16_t
640+static struct grub_term_coordinate
641 grub_vga_text_getxy (struct grub_term_output *term __attribute__ ((unused)))
642 {
643- return (grub_curr_x << 8) | grub_curr_y;
644+ return grub_curr_pos;
645 }
646
647 static void
648 grub_vga_text_gotoxy (struct grub_term_output *term __attribute__ ((unused)),
649- grub_uint8_t x, grub_uint8_t y)
650+ struct grub_term_coordinate pos)
651 {
652- grub_curr_x = x;
653- grub_curr_y = y;
654+ grub_curr_pos = pos;
655 update_cursor ();
656 }
657
658@@ -123,7 +122,7 @@ grub_vga_text_cls (struct grub_term_outp
659 int i;
660 for (i = 0; i < ROWS * COLS; i++)
661 VGA_TEXT_SCREEN[i] = ' ' | (grub_console_cur_color << 8);
662- grub_vga_text_gotoxy (term, 0, 0);
663+ grub_vga_text_gotoxy (term, (struct grub_term_coordinate) { 0, 0 });
664 }
665
666 static void
667Index: grub2-backport/grub-core/term/ieee1275/ofconsole.c
668===================================================================
669--- grub2-backport.orig/grub-core/term/ieee1275/ofconsole.c
670+++ grub2-backport/grub-core/term/ieee1275/ofconsole.c
671@@ -90,7 +90,7 @@ grub_ofconsole_dimensions (void)
672
673 if (! grub_ieee1275_get_property (options, "screen-#columns",
674 val, lval, 0))
675- grub_ofconsole_terminfo_output.width
676+ grub_ofconsole_terminfo_output.size.x
677 = (grub_uint8_t) grub_strtoul (val, 0, 10);
678 }
679 if (! grub_ieee1275_get_property_length (options, "screen-#rows", &lval)
680@@ -99,16 +99,16 @@ grub_ofconsole_dimensions (void)
681 char val[lval];
682 if (! grub_ieee1275_get_property (options, "screen-#rows",
683 val, lval, 0))
684- grub_ofconsole_terminfo_output.height
685+ grub_ofconsole_terminfo_output.size.y
686 = (grub_uint8_t) grub_strtoul (val, 0, 10);
687 }
688 }
689
690 /* Use a small console by default. */
691- if (! grub_ofconsole_terminfo_output.width)
692- grub_ofconsole_terminfo_output.width = 80;
693- if (! grub_ofconsole_terminfo_output.height)
694- grub_ofconsole_terminfo_output.height = 24;
695+ if (! grub_ofconsole_terminfo_output.size.x)
696+ grub_ofconsole_terminfo_output.size.x = 80;
697+ if (! grub_ofconsole_terminfo_output.size.y)
698+ grub_ofconsole_terminfo_output.size.y = 24;
699 }
700
701 static void
702@@ -185,8 +185,7 @@ struct grub_terminfo_input_state grub_of
703 struct grub_terminfo_output_state grub_ofconsole_terminfo_output =
704 {
705 .put = put,
706- .width = 80,
707- .height = 24
708+ .size = { 80, 24 }
709 };
710
711 static struct grub_term_input grub_ofconsole_term_input =
712Index: grub2-backport/grub-core/term/serial.c
713===================================================================
714--- grub2-backport.orig/grub-core/term/serial.c
715+++ grub2-backport/grub-core/term/serial.c
716@@ -84,8 +84,7 @@ static const struct grub_serial_output_s
717 .tinfo =
718 {
719 .put = serial_put,
720- .width = 80,
721- .height = 24
722+ .size = { 80, 24 }
723 }
724 };
725
726Index: grub2-backport/grub-core/term/terminfo.c
727===================================================================
728--- grub2-backport.orig/grub-core/term/terminfo.c
729+++ grub2-backport/grub-core/term/terminfo.c
730@@ -200,38 +200,37 @@ putstr (struct grub_term_output *term, c
731 data->put (term, *str++);
732 }
733
734-grub_uint16_t
735+struct grub_term_coordinate
736 grub_terminfo_getxy (struct grub_term_output *term)
737 {
738 struct grub_terminfo_output_state *data
739 = (struct grub_terminfo_output_state *) term->data;
740
741- return ((data->xpos << 8) | data->ypos);
742+ return data->pos;
743 }
744
745 void
746 grub_terminfo_gotoxy (struct grub_term_output *term,
747- grub_uint8_t x, grub_uint8_t y)
748+ struct grub_term_coordinate pos)
749 {
750 struct grub_terminfo_output_state *data
751 = (struct grub_terminfo_output_state *) term->data;
752
753- if (x > grub_term_width (term) || y > grub_term_height (term))
754+ if (pos.x > grub_term_width (term) || pos.y > grub_term_height (term))
755 {
756- grub_error (GRUB_ERR_OUT_OF_RANGE, "invalid point (%u,%u)", x, y);
757+ grub_error (GRUB_ERR_OUT_OF_RANGE, "invalid point (%u,%u)", pos.x, pos.y);
758 return;
759 }
760
761 if (data->gotoxy)
762- putstr (term, grub_terminfo_tparm (data->gotoxy, y, x));
763+ putstr (term, grub_terminfo_tparm (data->gotoxy, pos.y, pos.x));
764 else
765 {
766- if ((y == data->ypos) && (x == data->xpos - 1))
767+ if ((pos.y == data->pos.y) && (pos.x == data->pos.x - 1))
768 data->put (term, '\b');
769 }
770
771- data->xpos = x;
772- data->ypos = y;
773+ data->pos = pos;
774 }
775
776 /* Clear the screen. */
777@@ -243,7 +242,7 @@ grub_terminfo_cls (struct grub_term_outp
778
779 putstr (term, grub_terminfo_tparm (data->cls));
780
781- data->xpos = data->ypos = 0;
782+ data->pos = (struct grub_term_coordinate) { 0, 0 };
783 }
784
785 void
786@@ -331,42 +330,42 @@ grub_terminfo_putchar (struct grub_term_
787
788 case '\b':
789 case 127:
790- if (data->xpos > 0)
791- data->xpos--;
792+ if (data->pos.x > 0)
793+ data->pos.x--;
794 break;
795
796 case '\n':
797- if (data->ypos < grub_term_height (term) - 1)
798- data->ypos++;
799+ if (data->pos.y < grub_term_height (term) - 1)
800+ data->pos.y++;
801 break;
802
803 case '\r':
804- data->xpos = 0;
805+ data->pos.x = 0;
806 break;
807
808 default:
809- if (data->xpos + c->estimated_width >= grub_term_width (term) + 1)
810+ if ((int) data->pos.x + c->estimated_width >= (int) grub_term_width (term) + 1)
811 {
812- data->xpos = 0;
813- if (data->ypos < grub_term_height (term) - 1)
814- data->ypos++;
815+ data->pos.x = 0;
816+ if (data->pos.y < grub_term_height (term) - 1)
817+ data->pos.y++;
818 data->put (term, '\r');
819 data->put (term, '\n');
820 }
821- data->xpos += c->estimated_width;
822+ data->pos.x += c->estimated_width;
823 break;
824 }
825
826 data->put (term, c->base);
827 }
828
829-grub_uint16_t
830+struct grub_term_coordinate
831 grub_terminfo_getwh (struct grub_term_output *term)
832 {
833 struct grub_terminfo_output_state *data
834 = (struct grub_terminfo_output_state *) term->data;
835
836- return (data->width << 8) | data->height;
837+ return data->size;
838 }
839
840 #define ANSI_C0 0x9b
841@@ -621,8 +620,8 @@ grub_cmd_terminfo (grub_extcmd_context_t
842 {
843 struct grub_terminfo_output_state *data
844 = (struct grub_terminfo_output_state *) cur->data;
845- data->width = w;
846- data->height = h;
847+ data->pos.x = w;
848+ data->pos.y = h;
849 }
850
851 if (argc == 1)
852Index: grub2-backport/include/grub/term.h
853===================================================================
854--- grub2-backport.orig/include/grub/term.h
855+++ grub2-backport/include/grub/term.h
856@@ -167,6 +167,13 @@ struct grub_term_input
857 };
858 typedef struct grub_term_input *grub_term_input_t;
859
860+/* Made in a way to fit into uint32_t and so be passed in a register. */
861+struct grub_term_coordinate
862+{
863+ grub_uint16_t x;
864+ grub_uint16_t y;
865+};
866+
867 struct grub_term_output
868 {
869 /* The next terminal. */
870@@ -190,15 +197,15 @@ struct grub_term_output
871 grub_ssize_t (*getcharwidth) (struct grub_term_output *term,
872 const struct grub_unicode_glyph *c);
873
874- /* Get the screen size. The return value is ((Width << 8) | Height). */
875- grub_uint16_t (*getwh) (struct grub_term_output *term);
876+ /* Get the screen size. */
877+ struct grub_term_coordinate (*getwh) (struct grub_term_output *term);
878
879- /* Get the cursor position. The return value is ((X << 8) | Y). */
880- grub_uint16_t (*getxy) (struct grub_term_output *term);
881+ /* Get the cursor position. */
882+ struct grub_term_coordinate (*getxy) (struct grub_term_output *term);
883
884 /* Go to the position (X, Y). */
885 void (*gotoxy) (struct grub_term_output *term,
886- grub_uint8_t x, grub_uint8_t y);
887+ struct grub_term_coordinate pos);
888
889 /* Clear the screen. */
890 void (*cls) (struct grub_term_output *term);
891@@ -308,17 +315,17 @@ int EXPORT_FUNC(grub_checkkey) (void);
892 void grub_cls (void);
893 void EXPORT_FUNC(grub_refresh) (void);
894 void grub_puts_terminal (const char *str, struct grub_term_output *term);
895-grub_uint16_t *grub_term_save_pos (void);
896-void grub_term_restore_pos (grub_uint16_t *pos);
897+struct grub_term_coordinate *grub_term_save_pos (void);
898+void grub_term_restore_pos (struct grub_term_coordinate *pos);
899
900 static inline unsigned grub_term_width (struct grub_term_output *term)
901 {
902- return ((term->getwh(term)&0xFF00)>>8);
903+ return term->getwh(term).x;
904 }
905
906 static inline unsigned grub_term_height (struct grub_term_output *term)
907 {
908- return (term->getwh(term)&0xFF);
909+ return term->getwh(term).y;
910 }
911
912 /* The width of the border. */
913@@ -336,7 +343,7 @@ grub_term_entry_width (struct grub_term_
914 return grub_term_border_width (term) - 2 - GRUB_TERM_MARGIN * 2 - 1;
915 }
916
917-static inline grub_uint16_t
918+static inline struct grub_term_coordinate
919 grub_term_getxy (struct grub_term_output *term)
920 {
921 return term->getxy (term);
922@@ -350,9 +357,9 @@ grub_term_refresh (struct grub_term_outp
923 }
924
925 static inline void
926-grub_term_gotoxy (struct grub_term_output *term, grub_uint8_t x, grub_uint8_t y)
927+grub_term_gotoxy (struct grub_term_output *term, struct grub_term_coordinate pos)
928 {
929- term->gotoxy (term, x, y);
930+ term->gotoxy (term, pos);
931 }
932
933 static inline void
934Index: grub2-backport/include/grub/terminfo.h
935===================================================================
936--- grub2-backport.orig/include/grub/terminfo.h
937+++ grub2-backport/include/grub/terminfo.h
938@@ -49,18 +49,17 @@ struct grub_terminfo_output_state
939 char *cursor_off;
940 char *setcolor;
941
942- unsigned int width, height;
943-
944- unsigned int xpos, ypos;
945+ struct grub_term_coordinate size;
946+ struct grub_term_coordinate pos;
947
948 void (*put) (struct grub_term_output *term, const int c);
949 };
950
951 grub_err_t EXPORT_FUNC(grub_terminfo_output_init) (struct grub_term_output *term);
952 void EXPORT_FUNC(grub_terminfo_gotoxy) (grub_term_output_t term,
953- grub_uint8_t x, grub_uint8_t y);
954+ struct grub_term_coordinate pos);
955 void EXPORT_FUNC(grub_terminfo_cls) (grub_term_output_t term);
956-grub_uint16_t EXPORT_FUNC (grub_terminfo_getxy) (struct grub_term_output *term);
957+struct grub_term_coordinate EXPORT_FUNC (grub_terminfo_getxy) (struct grub_term_output *term);
958 void EXPORT_FUNC (grub_terminfo_setcursor) (struct grub_term_output *term,
959 const int on);
960 void EXPORT_FUNC (grub_terminfo_setcolorstate) (struct grub_term_output *term,
961@@ -71,7 +70,7 @@ grub_err_t EXPORT_FUNC (grub_terminfo_in
962 int EXPORT_FUNC (grub_terminfo_getkey) (struct grub_term_input *term);
963 void EXPORT_FUNC (grub_terminfo_putchar) (struct grub_term_output *term,
964 const struct grub_unicode_glyph *c);
965-grub_uint16_t EXPORT_FUNC (grub_terminfo_getwh) (struct grub_term_output *term);
966+struct grub_term_coordinate EXPORT_FUNC (grub_terminfo_getwh) (struct grub_term_output *term);
967
968
969 grub_err_t EXPORT_FUNC (grub_terminfo_output_register) (struct grub_term_output *term,
970Index: grub2-backport/grub-core/kern/emu/console.c
971===================================================================
972--- grub2-backport.orig/grub-core/kern/emu/console.c
973+++ grub2-backport/grub-core/kern/emu/console.c
974@@ -168,7 +168,7 @@ grub_ncurses_getkey (struct grub_term_in
975 return c;
976 }
977
978-static grub_uint16_t
979+static struct grub_term_coordinate
980 grub_ncurses_getxy (struct grub_term_output *term __attribute__ ((unused)))
981 {
982 int x;
983@@ -176,10 +176,10 @@ grub_ncurses_getxy (struct grub_term_out
984
985 getyx (stdscr, y, x);
986
987- return (x << 8) | y;
988+ return (struct grub_term_coordinate) { x, y };
989 }
990
991-static grub_uint16_t
992+static struct grub_term_coordinate
993 grub_ncurses_getwh (struct grub_term_output *term __attribute__ ((unused)))
994 {
995 int x;
996@@ -187,14 +187,14 @@ grub_ncurses_getwh (struct grub_term_out
997
998 getmaxyx (stdscr, y, x);
999
1000- return (x << 8) | y;
1001+ return (struct grub_term_coordinate) { x, y };
1002 }
1003
1004 static void
1005 grub_ncurses_gotoxy (struct grub_term_output *term __attribute__ ((unused)),
1006- grub_uint8_t x, grub_uint8_t y)
1007+ struct grub_term_coordinate pos)
1008 {
1009- move (y, x);
1010+ move (pos.y, pos.x);
1011 }
1012
1013 static void
1014Index: grub2-backport/grub-core/term/i386/vga_common.c
1015===================================================================
1016--- grub2-backport.orig/grub-core/term/i386/vga_common.c
1017+++ grub2-backport/grub-core/term/i386/vga_common.c
1018@@ -22,10 +22,10 @@
1019
1020 grub_uint8_t grub_console_cur_color = 0x7;
1021
1022-grub_uint16_t
1023+struct grub_term_coordinate
1024 grub_console_getwh (struct grub_term_output *term __attribute__ ((unused)))
1025 {
1026- return (80 << 8) | 25;
1027+ return (struct grub_term_coordinate) { 80, 25 };
1028 }
1029
1030 void
1031Index: grub2-backport/include/grub/i386/vga_common.h
1032===================================================================
1033--- grub2-backport.orig/include/grub/i386/vga_common.h
1034+++ grub2-backport/include/grub/i386/vga_common.h
1035@@ -25,7 +25,7 @@
1036
1037 extern grub_uint8_t grub_console_cur_color;
1038
1039-grub_uint16_t grub_console_getwh (struct grub_term_output *term);
1040+struct grub_term_coordinate grub_console_getwh (struct grub_term_output *term);
1041 void grub_console_setcolorstate (struct grub_term_output *term,
1042 grub_term_color_state state);
1043
1044Index: grub2-backport/include/grub/i386/pc/console.h
1045===================================================================
1046--- grub2-backport.orig/include/grub/i386/pc/console.h
1047+++ grub2-backport/include/grub/i386/pc/console.h
1048@@ -28,9 +28,6 @@
1049
1050 /* These are global to share code between C and asm. */
1051 int grub_console_getkey (struct grub_term_input *term);
1052-grub_uint16_t grub_console_getxy (struct grub_term_output *term);
1053-void grub_console_gotoxy (struct grub_term_output *term,
1054- grub_uint8_t x, grub_uint8_t y);
1055 void grub_console_cls (struct grub_term_output *term);
1056 void grub_console_setcursor (struct grub_term_output *term, int on);
1057 void grub_console_putchar (struct grub_term_output *term,
1058Index: grub2-backport/grub-core/kern/i386/pc/startup.S
1059===================================================================
1060--- grub2-backport.orig/grub-core/kern/i386/pc/startup.S
1061+++ grub2-backport/grub-core/kern/i386/pc/startup.S
1062@@ -678,72 +678,6 @@ notpending:
1063
1064
1065 /*
1066- * grub_uint16_t grub_console_getxy (void)
1067- * BIOS call "INT 10H Function 03h" to get cursor position
1068- * Call with %ah = 0x03
1069- * %bh = page
1070- * Returns %ch = starting scan line
1071- * %cl = ending scan line
1072- * %dh = row (0 is top)
1073- * %dl = column (0 is left)
1074- */
1075-
1076-
1077-FUNCTION(grub_console_getxy)
1078- pushl %ebp
1079- pushl %ebx /* save EBX */
1080-
1081- call prot_to_real
1082- .code16
1083-
1084- xorb %bh, %bh /* set page to 0 */
1085- movb $0x3, %ah
1086- int $0x10 /* get cursor position */
1087-
1088- DATA32 call real_to_prot
1089- .code32
1090-
1091- movb %dl, %ah
1092- movb %dh, %al
1093-
1094- popl %ebx
1095- popl %ebp
1096- ret
1097-
1098-
1099-/*
1100- * void grub_console_gotoxy(grub_uint8_t x, grub_uint8_t y)
1101- * BIOS call "INT 10H Function 02h" to set cursor position
1102- * Call with %ah = 0x02
1103- * %bh = page
1104- * %dh = row (0 is top)
1105- * %dl = column (0 is left)
1106- */
1107-
1108-
1109-FUNCTION(grub_console_gotoxy)
1110- pushl %ebp
1111- pushl %ebx /* save EBX */
1112-
1113- movb %cl, %dh /* %dh = y */
1114- /* %dl = x */
1115-
1116- call prot_to_real
1117- .code16
1118-
1119- xorb %bh, %bh /* set page to 0 */
1120- movb $0x2, %ah
1121- int $0x10 /* set cursor position */
1122-
1123- DATA32 call real_to_prot
1124- .code32
1125-
1126- popl %ebx
1127- popl %ebp
1128- ret
1129-
1130-
1131-/*
1132 * void grub_console_cls (void)
1133 * BIOS call "INT 10H Function 09h" to write character and attribute
1134 * Call with %ah = 0x09
1135Index: grub2-backport/grub-core/term/i386/pc/console.c
1136===================================================================
1137--- grub2-backport.orig/grub-core/term/i386/pc/console.c
1138+++ grub2-backport/grub-core/term/i386/pc/console.c
1139@@ -20,10 +20,60 @@
1140 #include <grub/machine/console.h>
1141 #include <grub/term.h>
1142 #include <grub/types.h>
1143+#include <grub/machine/int.h>
1144
1145 static const struct grub_machine_bios_data_area *bios_data_area =
1146 (struct grub_machine_bios_data_area *) GRUB_MEMORY_MACHINE_BIOS_DATA_AREA_ADDR;
1147
1148+/*
1149+ * BIOS call "INT 10H Function 03h" to get cursor position
1150+ * Call with %ah = 0x03
1151+ * %bh = page
1152+ * Returns %ch = starting scan line
1153+ * %cl = ending scan line
1154+ * %dh = row (0 is top)
1155+ * %dl = column (0 is left)
1156+ */
1157+
1158+
1159+static struct grub_term_coordinate
1160+grub_console_getxy (struct grub_term_output *term __attribute__ ((unused))
1161+)
1162+{
1163+ struct grub_bios_int_registers regs;
1164+
1165+ regs.eax = 0x0300;
1166+ regs.ebx = 0;
1167+ regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
1168+ grub_bios_interrupt (0x10, &regs);
1169+
1170+ return (struct grub_term_coordinate) {
1171+ (regs.edx & 0xff), ((regs.edx & 0xff00) >> 8) };
1172+}
1173+
1174+/*
1175+ * BIOS call "INT 10H Function 02h" to set cursor position
1176+ * Call with %ah = 0x02
1177+ * %bh = page
1178+ * %dh = row (0 is top)
1179+ * %dl = column (0 is left)
1180+ */
1181+static void
1182+grub_console_gotoxy (struct grub_term_output *term __attribute__ ((unused)
1183+),
1184+ struct grub_term_coordinate pos)
1185+{
1186+ struct grub_bios_int_registers regs;
1187+
1188+ /* set page to 0 */
1189+ regs.ebx = 0;
1190+ regs.eax = 0x0200;
1191+ regs.edx = (pos.y << 8) | pos.x;
1192+ regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
1193+ grub_bios_interrupt (0x10, &regs);
1194+}
1195+
1196+
1197 static int
1198 grub_console_getkeystatus (struct grub_term_input *term __attribute__ ((unused)))
1199 {
01200
=== modified file 'debian/patches/series'
--- debian/patches/series 2013-12-12 01:31:53 +0000
+++ debian/patches/series 2014-03-27 15:56:07 +0000
@@ -85,3 +85,4 @@
85ubuntu_probe_fusionio.patch85ubuntu_probe_fusionio.patch
86ubuntu_sysfs_partition_start.patch86ubuntu_sysfs_partition_start.patch
87ubuntu_disk_write_non_512_sectors.patch87ubuntu_disk_write_non_512_sectors.patch
88larger_terminal_size_restriction.patch

Subscribers

People subscribed via source and target branches