diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
tree | 644b88f8a71896307d71438e9b3af49126ffb22b /arch/x86/boot | |
parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff) |
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'arch/x86/boot')
-rw-r--r-- | arch/x86/boot/compressed/Makefile | 6 | ||||
-rw-r--r-- | arch/x86/boot/compressed/head_64.S | 3 | ||||
-rw-r--r-- | arch/x86/boot/compressed/misc.c | 19 | ||||
-rw-r--r-- | arch/x86/boot/compressed/relocs.c | 87 | ||||
-rw-r--r-- | arch/x86/boot/compressed/vmlinux.lds.S | 3 | ||||
-rw-r--r-- | arch/x86/boot/header.S | 2 | ||||
-rw-r--r-- | arch/x86/boot/mkcpustr.c | 2 | ||||
-rw-r--r-- | arch/x86/boot/version.c | 4 | ||||
-rw-r--r-- | arch/x86/boot/video-vga.c | 9 | ||||
-rw-r--r-- | arch/x86/boot/video.c | 13 |
10 files changed, 93 insertions, 55 deletions
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index f8ed0658404c..fbb47daf2459 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile | |||
@@ -4,11 +4,12 @@ | |||
4 | # create a compressed vmlinux image from the original vmlinux | 4 | # create a compressed vmlinux image from the original vmlinux |
5 | # | 5 | # |
6 | 6 | ||
7 | targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma head_$(BITS).o misc.o piggy.o | 7 | targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.lzo head_$(BITS).o misc.o piggy.o |
8 | 8 | ||
9 | KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 | 9 | KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 |
10 | KBUILD_CFLAGS += -fno-strict-aliasing -fPIC | 10 | KBUILD_CFLAGS += -fno-strict-aliasing -fPIC |
11 | KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING | 11 | KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING |
12 | cflags-$(CONFIG_X86_32) := -march=i386 | ||
12 | cflags-$(CONFIG_X86_64) := -mcmodel=small | 13 | cflags-$(CONFIG_X86_64) := -mcmodel=small |
13 | KBUILD_CFLAGS += $(cflags-y) | 14 | KBUILD_CFLAGS += $(cflags-y) |
14 | KBUILD_CFLAGS += $(call cc-option,-ffreestanding) | 15 | KBUILD_CFLAGS += $(call cc-option,-ffreestanding) |
@@ -48,10 +49,13 @@ $(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE | |||
48 | $(call if_changed,bzip2) | 49 | $(call if_changed,bzip2) |
49 | $(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE | 50 | $(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE |
50 | $(call if_changed,lzma) | 51 | $(call if_changed,lzma) |
52 | $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE | ||
53 | $(call if_changed,lzo) | ||
51 | 54 | ||
52 | suffix-$(CONFIG_KERNEL_GZIP) := gz | 55 | suffix-$(CONFIG_KERNEL_GZIP) := gz |
53 | suffix-$(CONFIG_KERNEL_BZIP2) := bz2 | 56 | suffix-$(CONFIG_KERNEL_BZIP2) := bz2 |
54 | suffix-$(CONFIG_KERNEL_LZMA) := lzma | 57 | suffix-$(CONFIG_KERNEL_LZMA) := lzma |
58 | suffix-$(CONFIG_KERNEL_LZO) := lzo | ||
55 | 59 | ||
56 | quiet_cmd_mkpiggy = MKPIGGY $@ | 60 | quiet_cmd_mkpiggy = MKPIGGY $@ |
57 | cmd_mkpiggy = $(obj)/mkpiggy $< > $@ || ( rm -f $@ ; false ) | 61 | cmd_mkpiggy = $(obj)/mkpiggy $< > $@ || ( rm -f $@ ; false ) |
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S index 077e1b69198e..faff0dc9c06a 100644 --- a/arch/x86/boot/compressed/head_64.S +++ b/arch/x86/boot/compressed/head_64.S | |||
@@ -107,8 +107,7 @@ ENTRY(startup_32) | |||
107 | lgdt gdt(%ebp) | 107 | lgdt gdt(%ebp) |
108 | 108 | ||
109 | /* Enable PAE mode */ | 109 | /* Enable PAE mode */ |
110 | xorl %eax, %eax | 110 | movl $(X86_CR4_PAE), %eax |
111 | orl $(X86_CR4_PAE), %eax | ||
112 | movl %eax, %cr4 | 111 | movl %eax, %cr4 |
113 | 112 | ||
114 | /* | 113 | /* |
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c index 842b2a36174a..51e240779a44 100644 --- a/arch/x86/boot/compressed/misc.c +++ b/arch/x86/boot/compressed/misc.c | |||
@@ -19,11 +19,6 @@ | |||
19 | #define _ASM_X86_DESC_H 1 | 19 | #define _ASM_X86_DESC_H 1 |
20 | #endif | 20 | #endif |
21 | 21 | ||
22 | #ifdef CONFIG_X86_64 | ||
23 | #define _LINUX_STRING_H_ 1 | ||
24 | #define __LINUX_BITMAP_H 1 | ||
25 | #endif | ||
26 | |||
27 | #include <linux/linkage.h> | 22 | #include <linux/linkage.h> |
28 | #include <linux/screen_info.h> | 23 | #include <linux/screen_info.h> |
29 | #include <linux/elf.h> | 24 | #include <linux/elf.h> |
@@ -131,8 +126,8 @@ static void error(char *m); | |||
131 | static struct boot_params *real_mode; /* Pointer to real-mode data */ | 126 | static struct boot_params *real_mode; /* Pointer to real-mode data */ |
132 | static int quiet; | 127 | static int quiet; |
133 | 128 | ||
134 | static void *memset(void *s, int c, unsigned n); | 129 | void *memset(void *s, int c, size_t n); |
135 | void *memcpy(void *dest, const void *src, unsigned n); | 130 | void *memcpy(void *dest, const void *src, size_t n); |
136 | 131 | ||
137 | static void __putstr(int, const char *); | 132 | static void __putstr(int, const char *); |
138 | #define putstr(__x) __putstr(0, __x) | 133 | #define putstr(__x) __putstr(0, __x) |
@@ -162,6 +157,10 @@ static int lines, cols; | |||
162 | #include "../../../../lib/decompress_unlzma.c" | 157 | #include "../../../../lib/decompress_unlzma.c" |
163 | #endif | 158 | #endif |
164 | 159 | ||
160 | #ifdef CONFIG_KERNEL_LZO | ||
161 | #include "../../../../lib/decompress_unlzo.c" | ||
162 | #endif | ||
163 | |||
165 | static void scroll(void) | 164 | static void scroll(void) |
166 | { | 165 | { |
167 | int i; | 166 | int i; |
@@ -181,11 +180,9 @@ static void __putstr(int error, const char *s) | |||
181 | return; | 180 | return; |
182 | #endif | 181 | #endif |
183 | 182 | ||
184 | #ifdef CONFIG_X86_32 | ||
185 | if (real_mode->screen_info.orig_video_mode == 0 && | 183 | if (real_mode->screen_info.orig_video_mode == 0 && |
186 | lines == 0 && cols == 0) | 184 | lines == 0 && cols == 0) |
187 | return; | 185 | return; |
188 | #endif | ||
189 | 186 | ||
190 | x = real_mode->screen_info.orig_x; | 187 | x = real_mode->screen_info.orig_x; |
191 | y = real_mode->screen_info.orig_y; | 188 | y = real_mode->screen_info.orig_y; |
@@ -219,7 +216,7 @@ static void __putstr(int error, const char *s) | |||
219 | outb(0xff & (pos >> 1), vidport+1); | 216 | outb(0xff & (pos >> 1), vidport+1); |
220 | } | 217 | } |
221 | 218 | ||
222 | static void *memset(void *s, int c, unsigned n) | 219 | void *memset(void *s, int c, size_t n) |
223 | { | 220 | { |
224 | int i; | 221 | int i; |
225 | char *ss = s; | 222 | char *ss = s; |
@@ -229,7 +226,7 @@ static void *memset(void *s, int c, unsigned n) | |||
229 | return s; | 226 | return s; |
230 | } | 227 | } |
231 | 228 | ||
232 | void *memcpy(void *dest, const void *src, unsigned n) | 229 | void *memcpy(void *dest, const void *src, size_t n) |
233 | { | 230 | { |
234 | int i; | 231 | int i; |
235 | const char *s = src; | 232 | const char *s = src; |
diff --git a/arch/x86/boot/compressed/relocs.c b/arch/x86/boot/compressed/relocs.c index bbeb0c3fbd90..89bbf4e4d05d 100644 --- a/arch/x86/boot/compressed/relocs.c +++ b/arch/x86/boot/compressed/relocs.c | |||
@@ -9,6 +9,9 @@ | |||
9 | #include <byteswap.h> | 9 | #include <byteswap.h> |
10 | #define USE_BSD | 10 | #define USE_BSD |
11 | #include <endian.h> | 11 | #include <endian.h> |
12 | #include <regex.h> | ||
13 | |||
14 | static void die(char *fmt, ...); | ||
12 | 15 | ||
13 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | 16 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) |
14 | static Elf32_Ehdr ehdr; | 17 | static Elf32_Ehdr ehdr; |
@@ -30,25 +33,47 @@ static struct section *secs; | |||
30 | * the address for which it has been compiled. Don't warn user about | 33 | * the address for which it has been compiled. Don't warn user about |
31 | * absolute relocations present w.r.t these symbols. | 34 | * absolute relocations present w.r.t these symbols. |
32 | */ | 35 | */ |
33 | static const char* safe_abs_relocs[] = { | 36 | static const char abs_sym_regex[] = |
34 | "xen_irq_disable_direct_reloc", | 37 | "^(xen_irq_disable_direct_reloc$|" |
35 | "xen_save_fl_direct_reloc", | 38 | "xen_save_fl_direct_reloc$|" |
36 | }; | 39 | "VDSO|" |
40 | "__crc_)"; | ||
41 | static regex_t abs_sym_regex_c; | ||
42 | static int is_abs_reloc(const char *sym_name) | ||
43 | { | ||
44 | return !regexec(&abs_sym_regex_c, sym_name, 0, NULL, 0); | ||
45 | } | ||
37 | 46 | ||
38 | static int is_safe_abs_reloc(const char* sym_name) | 47 | /* |
48 | * These symbols are known to be relative, even if the linker marks them | ||
49 | * as absolute (typically defined outside any section in the linker script.) | ||
50 | */ | ||
51 | static const char rel_sym_regex[] = | ||
52 | "^_end$"; | ||
53 | static regex_t rel_sym_regex_c; | ||
54 | static int is_rel_reloc(const char *sym_name) | ||
39 | { | 55 | { |
40 | int i; | 56 | return !regexec(&rel_sym_regex_c, sym_name, 0, NULL, 0); |
57 | } | ||
41 | 58 | ||
42 | for (i = 0; i < ARRAY_SIZE(safe_abs_relocs); i++) { | 59 | static void regex_init(void) |
43 | if (!strcmp(sym_name, safe_abs_relocs[i])) | 60 | { |
44 | /* Match found */ | 61 | char errbuf[128]; |
45 | return 1; | 62 | int err; |
46 | } | 63 | |
47 | if (strncmp(sym_name, "VDSO", 4) == 0) | 64 | err = regcomp(&abs_sym_regex_c, abs_sym_regex, |
48 | return 1; | 65 | REG_EXTENDED|REG_NOSUB); |
49 | if (strncmp(sym_name, "__crc_", 6) == 0) | 66 | if (err) { |
50 | return 1; | 67 | regerror(err, &abs_sym_regex_c, errbuf, sizeof errbuf); |
51 | return 0; | 68 | die("%s", errbuf); |
69 | } | ||
70 | |||
71 | err = regcomp(&rel_sym_regex_c, rel_sym_regex, | ||
72 | REG_EXTENDED|REG_NOSUB); | ||
73 | if (err) { | ||
74 | regerror(err, &rel_sym_regex_c, errbuf, sizeof errbuf); | ||
75 | die("%s", errbuf); | ||
76 | } | ||
52 | } | 77 | } |
53 | 78 | ||
54 | static void die(char *fmt, ...) | 79 | static void die(char *fmt, ...) |
@@ -131,7 +156,7 @@ static const char *rel_type(unsigned type) | |||
131 | #undef REL_TYPE | 156 | #undef REL_TYPE |
132 | }; | 157 | }; |
133 | const char *name = "unknown type rel type name"; | 158 | const char *name = "unknown type rel type name"; |
134 | if (type < ARRAY_SIZE(type_name)) { | 159 | if (type < ARRAY_SIZE(type_name) && type_name[type]) { |
135 | name = type_name[type]; | 160 | name = type_name[type]; |
136 | } | 161 | } |
137 | return name; | 162 | return name; |
@@ -448,7 +473,7 @@ static void print_absolute_relocs(void) | |||
448 | * Before warning check if this absolute symbol | 473 | * Before warning check if this absolute symbol |
449 | * relocation is harmless. | 474 | * relocation is harmless. |
450 | */ | 475 | */ |
451 | if (is_safe_abs_reloc(name)) | 476 | if (is_abs_reloc(name) || is_rel_reloc(name)) |
452 | continue; | 477 | continue; |
453 | 478 | ||
454 | if (!printed) { | 479 | if (!printed) { |
@@ -501,21 +526,26 @@ static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym)) | |||
501 | sym = &sh_symtab[ELF32_R_SYM(rel->r_info)]; | 526 | sym = &sh_symtab[ELF32_R_SYM(rel->r_info)]; |
502 | r_type = ELF32_R_TYPE(rel->r_info); | 527 | r_type = ELF32_R_TYPE(rel->r_info); |
503 | /* Don't visit relocations to absolute symbols */ | 528 | /* Don't visit relocations to absolute symbols */ |
504 | if (sym->st_shndx == SHN_ABS) { | 529 | if (sym->st_shndx == SHN_ABS && |
530 | !is_rel_reloc(sym_name(sym_strtab, sym))) { | ||
505 | continue; | 531 | continue; |
506 | } | 532 | } |
507 | if (r_type == R_386_NONE || r_type == R_386_PC32) { | 533 | switch (r_type) { |
534 | case R_386_NONE: | ||
535 | case R_386_PC32: | ||
508 | /* | 536 | /* |
509 | * NONE can be ignored and and PC relative | 537 | * NONE can be ignored and and PC relative |
510 | * relocations don't need to be adjusted. | 538 | * relocations don't need to be adjusted. |
511 | */ | 539 | */ |
512 | } | 540 | break; |
513 | else if (r_type == R_386_32) { | 541 | case R_386_32: |
514 | /* Visit relocations that need to be adjusted */ | 542 | /* Visit relocations that need to be adjusted */ |
515 | visit(rel, sym); | 543 | visit(rel, sym); |
516 | } | 544 | break; |
517 | else { | 545 | default: |
518 | die("Unsupported relocation type: %d\n", r_type); | 546 | die("Unsupported relocation type: %s (%d)\n", |
547 | rel_type(r_type), r_type); | ||
548 | break; | ||
519 | } | 549 | } |
520 | } | 550 | } |
521 | } | 551 | } |
@@ -571,16 +601,15 @@ static void emit_relocs(int as_text) | |||
571 | } | 601 | } |
572 | else { | 602 | else { |
573 | unsigned char buf[4]; | 603 | unsigned char buf[4]; |
574 | buf[0] = buf[1] = buf[2] = buf[3] = 0; | ||
575 | /* Print a stop */ | 604 | /* Print a stop */ |
576 | printf("%c%c%c%c", buf[0], buf[1], buf[2], buf[3]); | 605 | fwrite("\0\0\0\0", 4, 1, stdout); |
577 | /* Now print each relocation */ | 606 | /* Now print each relocation */ |
578 | for (i = 0; i < reloc_count; i++) { | 607 | for (i = 0; i < reloc_count; i++) { |
579 | buf[0] = (relocs[i] >> 0) & 0xff; | 608 | buf[0] = (relocs[i] >> 0) & 0xff; |
580 | buf[1] = (relocs[i] >> 8) & 0xff; | 609 | buf[1] = (relocs[i] >> 8) & 0xff; |
581 | buf[2] = (relocs[i] >> 16) & 0xff; | 610 | buf[2] = (relocs[i] >> 16) & 0xff; |
582 | buf[3] = (relocs[i] >> 24) & 0xff; | 611 | buf[3] = (relocs[i] >> 24) & 0xff; |
583 | printf("%c%c%c%c", buf[0], buf[1], buf[2], buf[3]); | 612 | fwrite(buf, 4, 1, stdout); |
584 | } | 613 | } |
585 | } | 614 | } |
586 | } | 615 | } |
@@ -598,6 +627,8 @@ int main(int argc, char **argv) | |||
598 | FILE *fp; | 627 | FILE *fp; |
599 | int i; | 628 | int i; |
600 | 629 | ||
630 | regex_init(); | ||
631 | |||
601 | show_absolute_syms = 0; | 632 | show_absolute_syms = 0; |
602 | show_absolute_relocs = 0; | 633 | show_absolute_relocs = 0; |
603 | as_text = 0; | 634 | as_text = 0; |
diff --git a/arch/x86/boot/compressed/vmlinux.lds.S b/arch/x86/boot/compressed/vmlinux.lds.S index f4193bb48782..a6f1a59a5b0c 100644 --- a/arch/x86/boot/compressed/vmlinux.lds.S +++ b/arch/x86/boot/compressed/vmlinux.lds.S | |||
@@ -4,6 +4,7 @@ OUTPUT_FORMAT(CONFIG_OUTPUT_FORMAT, CONFIG_OUTPUT_FORMAT, CONFIG_OUTPUT_FORMAT) | |||
4 | 4 | ||
5 | #undef i386 | 5 | #undef i386 |
6 | 6 | ||
7 | #include <asm/cache.h> | ||
7 | #include <asm/page_types.h> | 8 | #include <asm/page_types.h> |
8 | 9 | ||
9 | #ifdef CONFIG_X86_64 | 10 | #ifdef CONFIG_X86_64 |
@@ -46,7 +47,7 @@ SECTIONS | |||
46 | *(.data.*) | 47 | *(.data.*) |
47 | _edata = . ; | 48 | _edata = . ; |
48 | } | 49 | } |
49 | . = ALIGN(CONFIG_X86_L1_CACHE_BYTES); | 50 | . = ALIGN(L1_CACHE_BYTES); |
50 | .bss : { | 51 | .bss : { |
51 | _bss = . ; | 52 | _bss = . ; |
52 | *(.bss) | 53 | *(.bss) |
diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S index b31cc54b4641..93e689f4bd86 100644 --- a/arch/x86/boot/header.S +++ b/arch/x86/boot/header.S | |||
@@ -16,7 +16,7 @@ | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <asm/segment.h> | 18 | #include <asm/segment.h> |
19 | #include <linux/utsrelease.h> | 19 | #include <generated/utsrelease.h> |
20 | #include <asm/boot.h> | 20 | #include <asm/boot.h> |
21 | #include <asm/e820.h> | 21 | #include <asm/e820.h> |
22 | #include <asm/page_types.h> | 22 | #include <asm/page_types.h> |
diff --git a/arch/x86/boot/mkcpustr.c b/arch/x86/boot/mkcpustr.c index 8ef60f20b371..919257f526f2 100644 --- a/arch/x86/boot/mkcpustr.c +++ b/arch/x86/boot/mkcpustr.c | |||
@@ -22,7 +22,7 @@ int main(void) | |||
22 | int i, j; | 22 | int i, j; |
23 | const char *str; | 23 | const char *str; |
24 | 24 | ||
25 | printf("static const char x86_cap_strs[] = \n"); | 25 | printf("static const char x86_cap_strs[] =\n"); |
26 | 26 | ||
27 | for (i = 0; i < NCAPINTS; i++) { | 27 | for (i = 0; i < NCAPINTS; i++) { |
28 | for (j = 0; j < 32; j++) { | 28 | for (j = 0; j < 32; j++) { |
diff --git a/arch/x86/boot/version.c b/arch/x86/boot/version.c index 2723d9b5ce43..2b15aa488ffb 100644 --- a/arch/x86/boot/version.c +++ b/arch/x86/boot/version.c | |||
@@ -13,8 +13,8 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include "boot.h" | 15 | #include "boot.h" |
16 | #include <linux/utsrelease.h> | 16 | #include <generated/utsrelease.h> |
17 | #include <linux/compile.h> | 17 | #include <generated/compile.h> |
18 | 18 | ||
19 | const char kernel_version[] = | 19 | const char kernel_version[] = |
20 | UTS_RELEASE " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ") " | 20 | UTS_RELEASE " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ") " |
diff --git a/arch/x86/boot/video-vga.c b/arch/x86/boot/video-vga.c index 819caa1f2008..ed7aeff786b2 100644 --- a/arch/x86/boot/video-vga.c +++ b/arch/x86/boot/video-vga.c | |||
@@ -42,22 +42,15 @@ static u8 vga_set_basic_mode(void) | |||
42 | { | 42 | { |
43 | struct biosregs ireg, oreg; | 43 | struct biosregs ireg, oreg; |
44 | u16 ax; | 44 | u16 ax; |
45 | u8 rows; | ||
46 | u8 mode; | 45 | u8 mode; |
47 | 46 | ||
48 | initregs(&ireg); | 47 | initregs(&ireg); |
49 | 48 | ||
49 | /* Query current mode */ | ||
50 | ax = 0x0f00; | 50 | ax = 0x0f00; |
51 | intcall(0x10, &ireg, &oreg); | 51 | intcall(0x10, &ireg, &oreg); |
52 | mode = oreg.al; | 52 | mode = oreg.al; |
53 | 53 | ||
54 | set_fs(0); | ||
55 | rows = rdfs8(0x484); /* rows minus one */ | ||
56 | |||
57 | if ((oreg.ax == 0x5003 || oreg.ax == 0x5007) && | ||
58 | (rows == 0 || rows == 24)) | ||
59 | return mode; | ||
60 | |||
61 | if (mode != 3 && mode != 7) | 54 | if (mode != 3 && mode != 7) |
62 | mode = 3; | 55 | mode = 3; |
63 | 56 | ||
diff --git a/arch/x86/boot/video.c b/arch/x86/boot/video.c index d42da3802499..43eda284d27f 100644 --- a/arch/x86/boot/video.c +++ b/arch/x86/boot/video.c | |||
@@ -27,6 +27,12 @@ static void store_cursor_position(void) | |||
27 | 27 | ||
28 | boot_params.screen_info.orig_x = oreg.dl; | 28 | boot_params.screen_info.orig_x = oreg.dl; |
29 | boot_params.screen_info.orig_y = oreg.dh; | 29 | boot_params.screen_info.orig_y = oreg.dh; |
30 | |||
31 | if (oreg.ch & 0x20) | ||
32 | boot_params.screen_info.flags |= VIDEO_FLAGS_NOCURSOR; | ||
33 | |||
34 | if ((oreg.ch & 0x1f) > (oreg.cl & 0x1f)) | ||
35 | boot_params.screen_info.flags |= VIDEO_FLAGS_NOCURSOR; | ||
30 | } | 36 | } |
31 | 37 | ||
32 | static void store_video_mode(void) | 38 | static void store_video_mode(void) |
@@ -292,11 +298,18 @@ static void restore_screen(void) | |||
292 | } | 298 | } |
293 | 299 | ||
294 | /* Restore cursor position */ | 300 | /* Restore cursor position */ |
301 | if (saved.curx >= xs) | ||
302 | saved.curx = xs-1; | ||
303 | if (saved.cury >= ys) | ||
304 | saved.cury = ys-1; | ||
305 | |||
295 | initregs(&ireg); | 306 | initregs(&ireg); |
296 | ireg.ah = 0x02; /* Set cursor position */ | 307 | ireg.ah = 0x02; /* Set cursor position */ |
297 | ireg.dh = saved.cury; | 308 | ireg.dh = saved.cury; |
298 | ireg.dl = saved.curx; | 309 | ireg.dl = saved.curx; |
299 | intcall(0x10, &ireg, NULL); | 310 | intcall(0x10, &ireg, NULL); |
311 | |||
312 | store_cursor_position(); | ||
300 | } | 313 | } |
301 | 314 | ||
302 | void set_video(void) | 315 | void set_video(void) |