diff options
Diffstat (limited to 'arch/x86/boot')
-rw-r--r-- | arch/x86/boot/Makefile | 56 | ||||
-rw-r--r-- | arch/x86/boot/compressed/Makefile | 22 | ||||
-rw-r--r-- | arch/x86/boot/compressed/misc.c | 118 | ||||
-rw-r--r-- | arch/x86/boot/header.S | 29 | ||||
-rw-r--r-- | arch/x86/boot/memory.c | 39 | ||||
-rw-r--r-- | arch/x86/boot/pm.c | 44 | ||||
-rw-r--r-- | arch/x86/boot/pmjump.S | 1 | ||||
-rw-r--r-- | arch/x86/boot/setup.ld | 3 | ||||
-rw-r--r-- | arch/x86/boot/tools/build.c | 9 | ||||
-rw-r--r-- | arch/x86/boot/video-vga.c | 22 |
10 files changed, 117 insertions, 226 deletions
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile index c70eff69a1fb..6633b6e7505a 100644 --- a/arch/x86/boot/Makefile +++ b/arch/x86/boot/Makefile | |||
@@ -6,26 +6,24 @@ | |||
6 | # for more details. | 6 | # for more details. |
7 | # | 7 | # |
8 | # Copyright (C) 1994 by Linus Torvalds | 8 | # Copyright (C) 1994 by Linus Torvalds |
9 | # Changed by many, many contributors over the years. | ||
9 | # | 10 | # |
10 | 11 | ||
11 | # ROOT_DEV specifies the default root-device when making the image. | 12 | # ROOT_DEV specifies the default root-device when making the image. |
12 | # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case | 13 | # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case |
13 | # the default of FLOPPY is used by 'build'. | 14 | # the default of FLOPPY is used by 'build'. |
14 | 15 | ||
15 | ROOT_DEV := CURRENT | 16 | ROOT_DEV := CURRENT |
16 | 17 | ||
17 | # If you want to preset the SVGA mode, uncomment the next line and | 18 | # If you want to preset the SVGA mode, uncomment the next line and |
18 | # set SVGA_MODE to whatever number you want. | 19 | # set SVGA_MODE to whatever number you want. |
19 | # Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode. | 20 | # Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode. |
20 | # The number is the same as you would ordinarily press at bootup. | 21 | # The number is the same as you would ordinarily press at bootup. |
21 | 22 | ||
22 | SVGA_MODE := -DSVGA_MODE=NORMAL_VGA | 23 | SVGA_MODE := -DSVGA_MODE=NORMAL_VGA |
23 | 24 | ||
24 | # If you want the RAM disk device, define this to be the size in blocks. | 25 | targets := vmlinux.bin setup.bin setup.elf bzImage |
25 | 26 | targets += fdimage fdimage144 fdimage288 image.iso mtools.conf | |
26 | #RAMDISK := -DRAMDISK=512 | ||
27 | |||
28 | targets := vmlinux.bin setup.bin setup.elf zImage bzImage | ||
29 | subdir- := compressed | 27 | subdir- := compressed |
30 | 28 | ||
31 | setup-y += a20.o cmdline.o copy.o cpu.o cpucheck.o edd.o | 29 | setup-y += a20.o cmdline.o copy.o cpu.o cpucheck.o edd.o |
@@ -59,6 +57,7 @@ $(obj)/cpustr.h: $(obj)/mkcpustr FORCE | |||
59 | # How to compile the 16-bit code. Note we always compile for -march=i386, | 57 | # How to compile the 16-bit code. Note we always compile for -march=i386, |
60 | # that way we can complain to the user if the CPU is insufficient. | 58 | # that way we can complain to the user if the CPU is insufficient. |
61 | KBUILD_CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \ | 59 | KBUILD_CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \ |
60 | -DDISABLE_BRANCH_PROFILING \ | ||
62 | -Wall -Wstrict-prototypes \ | 61 | -Wall -Wstrict-prototypes \ |
63 | -march=i386 -mregparm=3 \ | 62 | -march=i386 -mregparm=3 \ |
64 | -include $(srctree)/$(src)/code16gcc.h \ | 63 | -include $(srctree)/$(src)/code16gcc.h \ |
@@ -68,20 +67,16 @@ KBUILD_CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \ | |||
68 | $(call cc-option, -fno-unit-at-a-time)) \ | 67 | $(call cc-option, -fno-unit-at-a-time)) \ |
69 | $(call cc-option, -fno-stack-protector) \ | 68 | $(call cc-option, -fno-stack-protector) \ |
70 | $(call cc-option, -mpreferred-stack-boundary=2) | 69 | $(call cc-option, -mpreferred-stack-boundary=2) |
71 | KBUILD_CFLAGS += $(call cc-option,-m32) | 70 | KBUILD_CFLAGS += $(call cc-option, -m32) |
72 | KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ | 71 | KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ |
73 | 72 | ||
74 | $(obj)/zImage: asflags-y := $(SVGA_MODE) $(RAMDISK) | 73 | $(obj)/bzImage: asflags-y := $(SVGA_MODE) |
75 | $(obj)/bzImage: ccflags-y := -D__BIG_KERNEL__ | ||
76 | $(obj)/bzImage: asflags-y := $(SVGA_MODE) $(RAMDISK) -D__BIG_KERNEL__ | ||
77 | $(obj)/bzImage: BUILDFLAGS := -b | ||
78 | 74 | ||
79 | quiet_cmd_image = BUILD $@ | 75 | quiet_cmd_image = BUILD $@ |
80 | cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/setup.bin \ | 76 | cmd_image = $(obj)/tools/build $(obj)/setup.bin $(obj)/vmlinux.bin \ |
81 | $(obj)/vmlinux.bin $(ROOT_DEV) > $@ | 77 | $(ROOT_DEV) > $@ |
82 | 78 | ||
83 | $(obj)/zImage $(obj)/bzImage: $(obj)/setup.bin \ | 79 | $(obj)/bzImage: $(obj)/setup.bin $(obj)/vmlinux.bin $(obj)/tools/build FORCE |
84 | $(obj)/vmlinux.bin $(obj)/tools/build FORCE | ||
85 | $(call if_changed,image) | 80 | $(call if_changed,image) |
86 | @echo 'Kernel: $@ is ready' ' (#'`cat .version`')' | 81 | @echo 'Kernel: $@ is ready' ' (#'`cat .version`')' |
87 | 82 | ||
@@ -116,9 +111,11 @@ $(obj)/setup.bin: $(obj)/setup.elf FORCE | |||
116 | $(obj)/compressed/vmlinux: FORCE | 111 | $(obj)/compressed/vmlinux: FORCE |
117 | $(Q)$(MAKE) $(build)=$(obj)/compressed $@ | 112 | $(Q)$(MAKE) $(build)=$(obj)/compressed $@ |
118 | 113 | ||
119 | # Set this if you want to pass append arguments to the zdisk/fdimage/isoimage kernel | 114 | # Set this if you want to pass append arguments to the |
115 | # bzdisk/fdimage/isoimage kernel | ||
120 | FDARGS = | 116 | FDARGS = |
121 | # Set this if you want an initrd included with the zdisk/fdimage/isoimage kernel | 117 | # Set this if you want an initrd included with the |
118 | # bzdisk/fdimage/isoimage kernel | ||
122 | FDINITRD = | 119 | FDINITRD = |
123 | 120 | ||
124 | image_cmdline = default linux $(FDARGS) $(if $(FDINITRD),initrd=initrd.img,) | 121 | image_cmdline = default linux $(FDARGS) $(if $(FDINITRD),initrd=initrd.img,) |
@@ -127,7 +124,7 @@ $(obj)/mtools.conf: $(src)/mtools.conf.in | |||
127 | sed -e 's|@OBJ@|$(obj)|g' < $< > $@ | 124 | sed -e 's|@OBJ@|$(obj)|g' < $< > $@ |
128 | 125 | ||
129 | # This requires write access to /dev/fd0 | 126 | # This requires write access to /dev/fd0 |
130 | zdisk: $(BOOTIMAGE) $(obj)/mtools.conf | 127 | bzdisk: $(obj)/bzImage $(obj)/mtools.conf |
131 | MTOOLSRC=$(obj)/mtools.conf mformat a: ; sync | 128 | MTOOLSRC=$(obj)/mtools.conf mformat a: ; sync |
132 | syslinux /dev/fd0 ; sync | 129 | syslinux /dev/fd0 ; sync |
133 | echo '$(image_cmdline)' | \ | 130 | echo '$(image_cmdline)' | \ |
@@ -135,10 +132,10 @@ zdisk: $(BOOTIMAGE) $(obj)/mtools.conf | |||
135 | if [ -f '$(FDINITRD)' ] ; then \ | 132 | if [ -f '$(FDINITRD)' ] ; then \ |
136 | MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' a:initrd.img ; \ | 133 | MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' a:initrd.img ; \ |
137 | fi | 134 | fi |
138 | MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) a:linux ; sync | 135 | MTOOLSRC=$(obj)/mtools.conf mcopy $(obj)/bzImage a:linux ; sync |
139 | 136 | ||
140 | # These require being root or having syslinux 2.02 or higher installed | 137 | # These require being root or having syslinux 2.02 or higher installed |
141 | fdimage fdimage144: $(BOOTIMAGE) $(obj)/mtools.conf | 138 | fdimage fdimage144: $(obj)/bzImage $(obj)/mtools.conf |
142 | dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=1440 | 139 | dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=1440 |
143 | MTOOLSRC=$(obj)/mtools.conf mformat v: ; sync | 140 | MTOOLSRC=$(obj)/mtools.conf mformat v: ; sync |
144 | syslinux $(obj)/fdimage ; sync | 141 | syslinux $(obj)/fdimage ; sync |
@@ -147,9 +144,9 @@ fdimage fdimage144: $(BOOTIMAGE) $(obj)/mtools.conf | |||
147 | if [ -f '$(FDINITRD)' ] ; then \ | 144 | if [ -f '$(FDINITRD)' ] ; then \ |
148 | MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' v:initrd.img ; \ | 145 | MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' v:initrd.img ; \ |
149 | fi | 146 | fi |
150 | MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) v:linux ; sync | 147 | MTOOLSRC=$(obj)/mtools.conf mcopy $(obj)/bzImage v:linux ; sync |
151 | 148 | ||
152 | fdimage288: $(BOOTIMAGE) $(obj)/mtools.conf | 149 | fdimage288: $(obj)/bzImage $(obj)/mtools.conf |
153 | dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=2880 | 150 | dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=2880 |
154 | MTOOLSRC=$(obj)/mtools.conf mformat w: ; sync | 151 | MTOOLSRC=$(obj)/mtools.conf mformat w: ; sync |
155 | syslinux $(obj)/fdimage ; sync | 152 | syslinux $(obj)/fdimage ; sync |
@@ -158,9 +155,9 @@ fdimage288: $(BOOTIMAGE) $(obj)/mtools.conf | |||
158 | if [ -f '$(FDINITRD)' ] ; then \ | 155 | if [ -f '$(FDINITRD)' ] ; then \ |
159 | MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' w:initrd.img ; \ | 156 | MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' w:initrd.img ; \ |
160 | fi | 157 | fi |
161 | MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) w:linux ; sync | 158 | MTOOLSRC=$(obj)/mtools.conf mcopy $(obj)/bzImage w:linux ; sync |
162 | 159 | ||
163 | isoimage: $(BOOTIMAGE) | 160 | isoimage: $(obj)/bzImage |
164 | -rm -rf $(obj)/isoimage | 161 | -rm -rf $(obj)/isoimage |
165 | mkdir $(obj)/isoimage | 162 | mkdir $(obj)/isoimage |
166 | for i in lib lib64 share end ; do \ | 163 | for i in lib lib64 share end ; do \ |
@@ -170,7 +167,7 @@ isoimage: $(BOOTIMAGE) | |||
170 | fi ; \ | 167 | fi ; \ |
171 | if [ $$i = end ] ; then exit 1 ; fi ; \ | 168 | if [ $$i = end ] ; then exit 1 ; fi ; \ |
172 | done | 169 | done |
173 | cp $(BOOTIMAGE) $(obj)/isoimage/linux | 170 | cp $(obj)/bzImage $(obj)/isoimage/linux |
174 | echo '$(image_cmdline)' > $(obj)/isoimage/isolinux.cfg | 171 | echo '$(image_cmdline)' > $(obj)/isoimage/isolinux.cfg |
175 | if [ -f '$(FDINITRD)' ] ; then \ | 172 | if [ -f '$(FDINITRD)' ] ; then \ |
176 | cp '$(FDINITRD)' $(obj)/isoimage/initrd.img ; \ | 173 | cp '$(FDINITRD)' $(obj)/isoimage/initrd.img ; \ |
@@ -181,12 +178,13 @@ isoimage: $(BOOTIMAGE) | |||
181 | isohybrid $(obj)/image.iso 2>/dev/null || true | 178 | isohybrid $(obj)/image.iso 2>/dev/null || true |
182 | rm -rf $(obj)/isoimage | 179 | rm -rf $(obj)/isoimage |
183 | 180 | ||
184 | zlilo: $(BOOTIMAGE) | 181 | bzlilo: $(obj)/bzImage |
185 | if [ -f $(INSTALL_PATH)/vmlinuz ]; then mv $(INSTALL_PATH)/vmlinuz $(INSTALL_PATH)/vmlinuz.old; fi | 182 | if [ -f $(INSTALL_PATH)/vmlinuz ]; then mv $(INSTALL_PATH)/vmlinuz $(INSTALL_PATH)/vmlinuz.old; fi |
186 | if [ -f $(INSTALL_PATH)/System.map ]; then mv $(INSTALL_PATH)/System.map $(INSTALL_PATH)/System.old; fi | 183 | if [ -f $(INSTALL_PATH)/System.map ]; then mv $(INSTALL_PATH)/System.map $(INSTALL_PATH)/System.old; fi |
187 | cat $(BOOTIMAGE) > $(INSTALL_PATH)/vmlinuz | 184 | cat $(obj)/bzImage > $(INSTALL_PATH)/vmlinuz |
188 | cp System.map $(INSTALL_PATH)/ | 185 | cp System.map $(INSTALL_PATH)/ |
189 | if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi | 186 | if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi |
190 | 187 | ||
191 | install: | 188 | install: |
192 | sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)" | 189 | sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(obj)/bzImage \ |
190 | System.map "$(INSTALL_PATH)" | ||
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index 1771c804e02f..65551c9f8571 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile | |||
@@ -4,10 +4,11 @@ | |||
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 vmlinux.bin vmlinux.bin.gz head_$(BITS).o misc.o piggy.o | 7 | targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma 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 | cflags-$(CONFIG_X86_64) := -mcmodel=small | 12 | cflags-$(CONFIG_X86_64) := -mcmodel=small |
12 | KBUILD_CFLAGS += $(cflags-y) | 13 | KBUILD_CFLAGS += $(cflags-y) |
13 | KBUILD_CFLAGS += $(call cc-option,-ffreestanding) | 14 | KBUILD_CFLAGS += $(call cc-option,-ffreestanding) |
@@ -47,18 +48,35 @@ ifeq ($(CONFIG_X86_32),y) | |||
47 | ifdef CONFIG_RELOCATABLE | 48 | ifdef CONFIG_RELOCATABLE |
48 | $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin.all FORCE | 49 | $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin.all FORCE |
49 | $(call if_changed,gzip) | 50 | $(call if_changed,gzip) |
51 | $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin.all FORCE | ||
52 | $(call if_changed,bzip2) | ||
53 | $(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin.all FORCE | ||
54 | $(call if_changed,lzma) | ||
50 | else | 55 | else |
51 | $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE | 56 | $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE |
52 | $(call if_changed,gzip) | 57 | $(call if_changed,gzip) |
58 | $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE | ||
59 | $(call if_changed,bzip2) | ||
60 | $(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE | ||
61 | $(call if_changed,lzma) | ||
53 | endif | 62 | endif |
54 | LDFLAGS_piggy.o := -r --format binary --oformat elf32-i386 -T | 63 | LDFLAGS_piggy.o := -r --format binary --oformat elf32-i386 -T |
55 | 64 | ||
56 | else | 65 | else |
66 | |||
57 | $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE | 67 | $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE |
58 | $(call if_changed,gzip) | 68 | $(call if_changed,gzip) |
69 | $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE | ||
70 | $(call if_changed,bzip2) | ||
71 | $(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE | ||
72 | $(call if_changed,lzma) | ||
59 | 73 | ||
60 | LDFLAGS_piggy.o := -r --format binary --oformat elf64-x86-64 -T | 74 | LDFLAGS_piggy.o := -r --format binary --oformat elf64-x86-64 -T |
61 | endif | 75 | endif |
62 | 76 | ||
63 | $(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE | 77 | suffix_$(CONFIG_KERNEL_GZIP) = gz |
78 | suffix_$(CONFIG_KERNEL_BZIP2) = bz2 | ||
79 | suffix_$(CONFIG_KERNEL_LZMA) = lzma | ||
80 | |||
81 | $(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix_y) FORCE | ||
64 | $(call if_changed,ld) | 82 | $(call if_changed,ld) |
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c index da062216948a..e45be73684ff 100644 --- a/arch/x86/boot/compressed/misc.c +++ b/arch/x86/boot/compressed/misc.c | |||
@@ -116,71 +116,13 @@ | |||
116 | /* | 116 | /* |
117 | * gzip declarations | 117 | * gzip declarations |
118 | */ | 118 | */ |
119 | |||
120 | #define OF(args) args | ||
121 | #define STATIC static | 119 | #define STATIC static |
122 | 120 | ||
123 | #undef memset | 121 | #undef memset |
124 | #undef memcpy | 122 | #undef memcpy |
125 | #define memzero(s, n) memset((s), 0, (n)) | 123 | #define memzero(s, n) memset((s), 0, (n)) |
126 | 124 | ||
127 | typedef unsigned char uch; | ||
128 | typedef unsigned short ush; | ||
129 | typedef unsigned long ulg; | ||
130 | |||
131 | /* | ||
132 | * Window size must be at least 32k, and a power of two. | ||
133 | * We don't actually have a window just a huge output buffer, | ||
134 | * so we report a 2G window size, as that should always be | ||
135 | * larger than our output buffer: | ||
136 | */ | ||
137 | #define WSIZE 0x80000000 | ||
138 | |||
139 | /* Input buffer: */ | ||
140 | static unsigned char *inbuf; | ||
141 | |||
142 | /* Sliding window buffer (and final output buffer): */ | ||
143 | static unsigned char *window; | ||
144 | |||
145 | /* Valid bytes in inbuf: */ | ||
146 | static unsigned insize; | ||
147 | |||
148 | /* Index of next byte to be processed in inbuf: */ | ||
149 | static unsigned inptr; | ||
150 | |||
151 | /* Bytes in output buffer: */ | ||
152 | static unsigned outcnt; | ||
153 | |||
154 | /* gzip flag byte */ | ||
155 | #define ASCII_FLAG 0x01 /* bit 0 set: file probably ASCII text */ | ||
156 | #define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gz file */ | ||
157 | #define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ | ||
158 | #define ORIG_NAM 0x08 /* bit 3 set: original file name present */ | ||
159 | #define COMMENT 0x10 /* bit 4 set: file comment present */ | ||
160 | #define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */ | ||
161 | #define RESERVED 0xC0 /* bit 6, 7: reserved */ | ||
162 | |||
163 | #define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf()) | ||
164 | |||
165 | /* Diagnostic functions */ | ||
166 | #ifdef DEBUG | ||
167 | # define Assert(cond, msg) do { if (!(cond)) error(msg); } while (0) | ||
168 | # define Trace(x) do { fprintf x; } while (0) | ||
169 | # define Tracev(x) do { if (verbose) fprintf x ; } while (0) | ||
170 | # define Tracevv(x) do { if (verbose > 1) fprintf x ; } while (0) | ||
171 | # define Tracec(c, x) do { if (verbose && (c)) fprintf x ; } while (0) | ||
172 | # define Tracecv(c, x) do { if (verbose > 1 && (c)) fprintf x ; } while (0) | ||
173 | #else | ||
174 | # define Assert(cond, msg) | ||
175 | # define Trace(x) | ||
176 | # define Tracev(x) | ||
177 | # define Tracevv(x) | ||
178 | # define Tracec(c, x) | ||
179 | # define Tracecv(c, x) | ||
180 | #endif | ||
181 | 125 | ||
182 | static int fill_inbuf(void); | ||
183 | static void flush_window(void); | ||
184 | static void error(char *m); | 126 | static void error(char *m); |
185 | 127 | ||
186 | /* | 128 | /* |
@@ -189,13 +131,8 @@ static void error(char *m); | |||
189 | static struct boot_params *real_mode; /* Pointer to real-mode data */ | 131 | static struct boot_params *real_mode; /* Pointer to real-mode data */ |
190 | static int quiet; | 132 | static int quiet; |
191 | 133 | ||
192 | extern unsigned char input_data[]; | ||
193 | extern int input_len; | ||
194 | |||
195 | static long bytes_out; | ||
196 | |||
197 | static void *memset(void *s, int c, unsigned n); | 134 | static void *memset(void *s, int c, unsigned n); |
198 | static void *memcpy(void *dest, const void *src, unsigned n); | 135 | void *memcpy(void *dest, const void *src, unsigned n); |
199 | 136 | ||
200 | static void __putstr(int, const char *); | 137 | static void __putstr(int, const char *); |
201 | #define putstr(__x) __putstr(0, __x) | 138 | #define putstr(__x) __putstr(0, __x) |
@@ -213,7 +150,17 @@ static char *vidmem; | |||
213 | static int vidport; | 150 | static int vidport; |
214 | static int lines, cols; | 151 | static int lines, cols; |
215 | 152 | ||
216 | #include "../../../../lib/inflate.c" | 153 | #ifdef CONFIG_KERNEL_GZIP |
154 | #include "../../../../lib/decompress_inflate.c" | ||
155 | #endif | ||
156 | |||
157 | #ifdef CONFIG_KERNEL_BZIP2 | ||
158 | #include "../../../../lib/decompress_bunzip2.c" | ||
159 | #endif | ||
160 | |||
161 | #ifdef CONFIG_KERNEL_LZMA | ||
162 | #include "../../../../lib/decompress_unlzma.c" | ||
163 | #endif | ||
217 | 164 | ||
218 | static void scroll(void) | 165 | static void scroll(void) |
219 | { | 166 | { |
@@ -282,7 +229,7 @@ static void *memset(void *s, int c, unsigned n) | |||
282 | return s; | 229 | return s; |
283 | } | 230 | } |
284 | 231 | ||
285 | static void *memcpy(void *dest, const void *src, unsigned n) | 232 | void *memcpy(void *dest, const void *src, unsigned n) |
286 | { | 233 | { |
287 | int i; | 234 | int i; |
288 | const char *s = src; | 235 | const char *s = src; |
@@ -293,38 +240,6 @@ static void *memcpy(void *dest, const void *src, unsigned n) | |||
293 | return dest; | 240 | return dest; |
294 | } | 241 | } |
295 | 242 | ||
296 | /* =========================================================================== | ||
297 | * Fill the input buffer. This is called only when the buffer is empty | ||
298 | * and at least one byte is really needed. | ||
299 | */ | ||
300 | static int fill_inbuf(void) | ||
301 | { | ||
302 | error("ran out of input data"); | ||
303 | return 0; | ||
304 | } | ||
305 | |||
306 | /* =========================================================================== | ||
307 | * Write the output window window[0..outcnt-1] and update crc and bytes_out. | ||
308 | * (Used for the decompressed data only.) | ||
309 | */ | ||
310 | static void flush_window(void) | ||
311 | { | ||
312 | /* With my window equal to my output buffer | ||
313 | * I only need to compute the crc here. | ||
314 | */ | ||
315 | unsigned long c = crc; /* temporary variable */ | ||
316 | unsigned n; | ||
317 | unsigned char *in, ch; | ||
318 | |||
319 | in = window; | ||
320 | for (n = 0; n < outcnt; n++) { | ||
321 | ch = *in++; | ||
322 | c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8); | ||
323 | } | ||
324 | crc = c; | ||
325 | bytes_out += (unsigned long)outcnt; | ||
326 | outcnt = 0; | ||
327 | } | ||
328 | 243 | ||
329 | static void error(char *x) | 244 | static void error(char *x) |
330 | { | 245 | { |
@@ -407,12 +322,8 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap, | |||
407 | lines = real_mode->screen_info.orig_video_lines; | 322 | lines = real_mode->screen_info.orig_video_lines; |
408 | cols = real_mode->screen_info.orig_video_cols; | 323 | cols = real_mode->screen_info.orig_video_cols; |
409 | 324 | ||
410 | window = output; /* Output buffer (Normally at 1M) */ | ||
411 | free_mem_ptr = heap; /* Heap */ | 325 | free_mem_ptr = heap; /* Heap */ |
412 | free_mem_end_ptr = heap + BOOT_HEAP_SIZE; | 326 | free_mem_end_ptr = heap + BOOT_HEAP_SIZE; |
413 | inbuf = input_data; /* Input buffer */ | ||
414 | insize = input_len; | ||
415 | inptr = 0; | ||
416 | 327 | ||
417 | #ifdef CONFIG_X86_64 | 328 | #ifdef CONFIG_X86_64 |
418 | if ((unsigned long)output & (__KERNEL_ALIGN - 1)) | 329 | if ((unsigned long)output & (__KERNEL_ALIGN - 1)) |
@@ -430,10 +341,9 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap, | |||
430 | #endif | 341 | #endif |
431 | #endif | 342 | #endif |
432 | 343 | ||
433 | makecrc(); | ||
434 | if (!quiet) | 344 | if (!quiet) |
435 | putstr("\nDecompressing Linux... "); | 345 | putstr("\nDecompressing Linux... "); |
436 | gunzip(); | 346 | decompress(input_data, input_len, NULL, NULL, output, NULL, error); |
437 | parse_elf(output); | 347 | parse_elf(output); |
438 | if (!quiet) | 348 | if (!quiet) |
439 | putstr("done.\nBooting the kernel.\n"); | 349 | putstr("done.\nBooting the kernel.\n"); |
diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S index 7ccff4884a23..5d84d1c74e4c 100644 --- a/arch/x86/boot/header.S +++ b/arch/x86/boot/header.S | |||
@@ -24,12 +24,8 @@ | |||
24 | #include "boot.h" | 24 | #include "boot.h" |
25 | #include "offsets.h" | 25 | #include "offsets.h" |
26 | 26 | ||
27 | SETUPSECTS = 4 /* default nr of setup-sectors */ | ||
28 | BOOTSEG = 0x07C0 /* original address of boot-sector */ | 27 | BOOTSEG = 0x07C0 /* original address of boot-sector */ |
29 | SYSSEG = DEF_SYSSEG /* system loaded at 0x10000 (65536) */ | 28 | SYSSEG = 0x1000 /* historical load address >> 4 */ |
30 | SYSSIZE = DEF_SYSSIZE /* system size: # of 16-byte clicks */ | ||
31 | /* to be loaded */ | ||
32 | ROOT_DEV = 0 /* ROOT_DEV is now written by "build" */ | ||
33 | 29 | ||
34 | #ifndef SVGA_MODE | 30 | #ifndef SVGA_MODE |
35 | #define SVGA_MODE ASK_VGA | 31 | #define SVGA_MODE ASK_VGA |
@@ -97,12 +93,12 @@ bugger_off_msg: | |||
97 | .section ".header", "a" | 93 | .section ".header", "a" |
98 | .globl hdr | 94 | .globl hdr |
99 | hdr: | 95 | hdr: |
100 | setup_sects: .byte SETUPSECTS | 96 | setup_sects: .byte 0 /* Filled in by build.c */ |
101 | root_flags: .word ROOT_RDONLY | 97 | root_flags: .word ROOT_RDONLY |
102 | syssize: .long SYSSIZE | 98 | syssize: .long 0 /* Filled in by build.c */ |
103 | ram_size: .word RAMDISK | 99 | ram_size: .word 0 /* Obsolete */ |
104 | vid_mode: .word SVGA_MODE | 100 | vid_mode: .word SVGA_MODE |
105 | root_dev: .word ROOT_DEV | 101 | root_dev: .word 0 /* Filled in by build.c */ |
106 | boot_flag: .word 0xAA55 | 102 | boot_flag: .word 0xAA55 |
107 | 103 | ||
108 | # offset 512, entry point | 104 | # offset 512, entry point |
@@ -123,14 +119,15 @@ _start: | |||
123 | # or else old loadlin-1.5 will fail) | 119 | # or else old loadlin-1.5 will fail) |
124 | .globl realmode_swtch | 120 | .globl realmode_swtch |
125 | realmode_swtch: .word 0, 0 # default_switch, SETUPSEG | 121 | realmode_swtch: .word 0, 0 # default_switch, SETUPSEG |
126 | start_sys_seg: .word SYSSEG | 122 | start_sys_seg: .word SYSSEG # obsolete and meaningless, but just |
123 | # in case something decided to "use" it | ||
127 | .word kernel_version-512 # pointing to kernel version string | 124 | .word kernel_version-512 # pointing to kernel version string |
128 | # above section of header is compatible | 125 | # above section of header is compatible |
129 | # with loadlin-1.5 (header v1.5). Don't | 126 | # with loadlin-1.5 (header v1.5). Don't |
130 | # change it. | 127 | # change it. |
131 | 128 | ||
132 | type_of_loader: .byte 0 # = 0, old one (LILO, Loadlin, | 129 | type_of_loader: .byte 0 # 0 means ancient bootloader, newer |
133 | # Bootlin, SYSLX, bootsect...) | 130 | # bootloaders know to change this. |
134 | # See Documentation/i386/boot.txt for | 131 | # See Documentation/i386/boot.txt for |
135 | # assigned ids | 132 | # assigned ids |
136 | 133 | ||
@@ -142,11 +139,7 @@ CAN_USE_HEAP = 0x80 # If set, the loader also has set | |||
142 | # space behind setup.S can be used for | 139 | # space behind setup.S can be used for |
143 | # heap purposes. | 140 | # heap purposes. |
144 | # Only the loader knows what is free | 141 | # Only the loader knows what is free |
145 | #ifndef __BIG_KERNEL__ | ||
146 | .byte 0 | ||
147 | #else | ||
148 | .byte LOADED_HIGH | 142 | .byte LOADED_HIGH |
149 | #endif | ||
150 | 143 | ||
151 | setup_move_size: .word 0x8000 # size to move, when setup is not | 144 | setup_move_size: .word 0x8000 # size to move, when setup is not |
152 | # loaded at 0x90000. We will move setup | 145 | # loaded at 0x90000. We will move setup |
@@ -157,11 +150,7 @@ setup_move_size: .word 0x8000 # size to move, when setup is not | |||
157 | 150 | ||
158 | code32_start: # here loaders can put a different | 151 | code32_start: # here loaders can put a different |
159 | # start address for 32-bit code. | 152 | # start address for 32-bit code. |
160 | #ifndef __BIG_KERNEL__ | ||
161 | .long 0x1000 # 0x1000 = default for zImage | ||
162 | #else | ||
163 | .long 0x100000 # 0x100000 = default for big kernel | 153 | .long 0x100000 # 0x100000 = default for big kernel |
164 | #endif | ||
165 | 154 | ||
166 | ramdisk_image: .long 0 # address of loaded ramdisk image | 155 | ramdisk_image: .long 0 # address of loaded ramdisk image |
167 | # Here the loader puts the 32-bit | 156 | # Here the loader puts the 32-bit |
diff --git a/arch/x86/boot/memory.c b/arch/x86/boot/memory.c index 8c3c25f35578..5054c2ddd1a0 100644 --- a/arch/x86/boot/memory.c +++ b/arch/x86/boot/memory.c | |||
@@ -2,6 +2,7 @@ | |||
2 | * | 2 | * |
3 | * Copyright (C) 1991, 1992 Linus Torvalds | 3 | * Copyright (C) 1991, 1992 Linus Torvalds |
4 | * Copyright 2007 rPath, Inc. - All Rights Reserved | 4 | * Copyright 2007 rPath, Inc. - All Rights Reserved |
5 | * Copyright 2009 Intel Corporation; author H. Peter Anvin | ||
5 | * | 6 | * |
6 | * This file is part of the Linux kernel, and is made available under | 7 | * This file is part of the Linux kernel, and is made available under |
7 | * the terms of the GNU General Public License version 2. | 8 | * the terms of the GNU General Public License version 2. |
@@ -16,24 +17,38 @@ | |||
16 | 17 | ||
17 | #define SMAP 0x534d4150 /* ASCII "SMAP" */ | 18 | #define SMAP 0x534d4150 /* ASCII "SMAP" */ |
18 | 19 | ||
20 | struct e820_ext_entry { | ||
21 | struct e820entry std; | ||
22 | u32 ext_flags; | ||
23 | } __attribute__((packed)); | ||
24 | |||
19 | static int detect_memory_e820(void) | 25 | static int detect_memory_e820(void) |
20 | { | 26 | { |
21 | int count = 0; | 27 | int count = 0; |
22 | u32 next = 0; | 28 | u32 next = 0; |
23 | u32 size, id; | 29 | u32 size, id, edi; |
24 | u8 err; | 30 | u8 err; |
25 | struct e820entry *desc = boot_params.e820_map; | 31 | struct e820entry *desc = boot_params.e820_map; |
32 | static struct e820_ext_entry buf; /* static so it is zeroed */ | ||
33 | |||
34 | /* | ||
35 | * Set this here so that if the BIOS doesn't change this field | ||
36 | * but still doesn't change %ecx, we're still okay... | ||
37 | */ | ||
38 | buf.ext_flags = 1; | ||
26 | 39 | ||
27 | do { | 40 | do { |
28 | size = sizeof(struct e820entry); | 41 | size = sizeof buf; |
29 | 42 | ||
30 | /* Important: %edx is clobbered by some BIOSes, | 43 | /* Important: %edx and %esi are clobbered by some BIOSes, |
31 | so it must be either used for the error output | 44 | so they must be either used for the error output |
32 | or explicitly marked clobbered. */ | 45 | or explicitly marked clobbered. Given that, assume there |
33 | asm("int $0x15; setc %0" | 46 | is something out there clobbering %ebp and %edi, too. */ |
47 | asm("pushl %%ebp; int $0x15; popl %%ebp; setc %0" | ||
34 | : "=d" (err), "+b" (next), "=a" (id), "+c" (size), | 48 | : "=d" (err), "+b" (next), "=a" (id), "+c" (size), |
35 | "=m" (*desc) | 49 | "=D" (edi), "+m" (buf) |
36 | : "D" (desc), "d" (SMAP), "a" (0xe820)); | 50 | : "D" (&buf), "d" (SMAP), "a" (0xe820) |
51 | : "esi"); | ||
37 | 52 | ||
38 | /* BIOSes which terminate the chain with CF = 1 as opposed | 53 | /* BIOSes which terminate the chain with CF = 1 as opposed |
39 | to %ebx = 0 don't always report the SMAP signature on | 54 | to %ebx = 0 don't always report the SMAP signature on |
@@ -51,8 +66,14 @@ static int detect_memory_e820(void) | |||
51 | break; | 66 | break; |
52 | } | 67 | } |
53 | 68 | ||
69 | /* ACPI 3.0 added the extended flags support. If bit 0 | ||
70 | in the extended flags is zero, we're supposed to simply | ||
71 | ignore the entry -- a backwards incompatible change! */ | ||
72 | if (size > 20 && !(buf.ext_flags & 1)) | ||
73 | continue; | ||
74 | |||
75 | *desc++ = buf.std; | ||
54 | count++; | 76 | count++; |
55 | desc++; | ||
56 | } while (next && count < ARRAY_SIZE(boot_params.e820_map)); | 77 | } while (next && count < ARRAY_SIZE(boot_params.e820_map)); |
57 | 78 | ||
58 | return boot_params.e820_entries = count; | 79 | return boot_params.e820_entries = count; |
diff --git a/arch/x86/boot/pm.c b/arch/x86/boot/pm.c index 85a1cd8a8ff8..8062f8915250 100644 --- a/arch/x86/boot/pm.c +++ b/arch/x86/boot/pm.c | |||
@@ -33,47 +33,6 @@ static void realmode_switch_hook(void) | |||
33 | } | 33 | } |
34 | 34 | ||
35 | /* | 35 | /* |
36 | * A zImage kernel is loaded at 0x10000 but wants to run at 0x1000. | ||
37 | * A bzImage kernel is loaded and runs at 0x100000. | ||
38 | */ | ||
39 | static void move_kernel_around(void) | ||
40 | { | ||
41 | /* Note: rely on the compile-time option here rather than | ||
42 | the LOADED_HIGH flag. The Qemu kernel loader unconditionally | ||
43 | sets the loadflags to zero. */ | ||
44 | #ifndef __BIG_KERNEL__ | ||
45 | u16 dst_seg, src_seg; | ||
46 | u32 syssize; | ||
47 | |||
48 | dst_seg = 0x1000 >> 4; | ||
49 | src_seg = 0x10000 >> 4; | ||
50 | syssize = boot_params.hdr.syssize; /* Size in 16-byte paragraphs */ | ||
51 | |||
52 | while (syssize) { | ||
53 | int paras = (syssize >= 0x1000) ? 0x1000 : syssize; | ||
54 | int dwords = paras << 2; | ||
55 | |||
56 | asm volatile("pushw %%es ; " | ||
57 | "pushw %%ds ; " | ||
58 | "movw %1,%%es ; " | ||
59 | "movw %2,%%ds ; " | ||
60 | "xorw %%di,%%di ; " | ||
61 | "xorw %%si,%%si ; " | ||
62 | "rep;movsl ; " | ||
63 | "popw %%ds ; " | ||
64 | "popw %%es" | ||
65 | : "+c" (dwords) | ||
66 | : "r" (dst_seg), "r" (src_seg) | ||
67 | : "esi", "edi"); | ||
68 | |||
69 | syssize -= paras; | ||
70 | dst_seg += paras; | ||
71 | src_seg += paras; | ||
72 | } | ||
73 | #endif | ||
74 | } | ||
75 | |||
76 | /* | ||
77 | * Disable all interrupts at the legacy PIC. | 36 | * Disable all interrupts at the legacy PIC. |
78 | */ | 37 | */ |
79 | static void mask_all_interrupts(void) | 38 | static void mask_all_interrupts(void) |
@@ -147,9 +106,6 @@ void go_to_protected_mode(void) | |||
147 | /* Hook before leaving real mode, also disables interrupts */ | 106 | /* Hook before leaving real mode, also disables interrupts */ |
148 | realmode_switch_hook(); | 107 | realmode_switch_hook(); |
149 | 108 | ||
150 | /* Move the kernel/setup to their final resting places */ | ||
151 | move_kernel_around(); | ||
152 | |||
153 | /* Enable the A20 gate */ | 109 | /* Enable the A20 gate */ |
154 | if (enable_a20()) { | 110 | if (enable_a20()) { |
155 | puts("A20 gate not responding, unable to boot...\n"); | 111 | puts("A20 gate not responding, unable to boot...\n"); |
diff --git a/arch/x86/boot/pmjump.S b/arch/x86/boot/pmjump.S index 019c17a75851..3e0edc6d2a20 100644 --- a/arch/x86/boot/pmjump.S +++ b/arch/x86/boot/pmjump.S | |||
@@ -47,6 +47,7 @@ GLOBAL(protected_mode_jump) | |||
47 | ENDPROC(protected_mode_jump) | 47 | ENDPROC(protected_mode_jump) |
48 | 48 | ||
49 | .code32 | 49 | .code32 |
50 | .section ".text32","ax" | ||
50 | GLOBAL(in_pm32) | 51 | GLOBAL(in_pm32) |
51 | # Set up data segments for flat 32-bit mode | 52 | # Set up data segments for flat 32-bit mode |
52 | movl %ecx, %ds | 53 | movl %ecx, %ds |
diff --git a/arch/x86/boot/setup.ld b/arch/x86/boot/setup.ld index df9234b3a5e0..bb8dc2de7969 100644 --- a/arch/x86/boot/setup.ld +++ b/arch/x86/boot/setup.ld | |||
@@ -17,7 +17,8 @@ SECTIONS | |||
17 | .header : { *(.header) } | 17 | .header : { *(.header) } |
18 | .inittext : { *(.inittext) } | 18 | .inittext : { *(.inittext) } |
19 | .initdata : { *(.initdata) } | 19 | .initdata : { *(.initdata) } |
20 | .text : { *(.text*) } | 20 | .text : { *(.text) } |
21 | .text32 : { *(.text32) } | ||
21 | 22 | ||
22 | . = ALIGN(16); | 23 | . = ALIGN(16); |
23 | .rodata : { *(.rodata*) } | 24 | .rodata : { *(.rodata*) } |
diff --git a/arch/x86/boot/tools/build.c b/arch/x86/boot/tools/build.c index 44dc1923c0e3..ee3a4ea923ac 100644 --- a/arch/x86/boot/tools/build.c +++ b/arch/x86/boot/tools/build.c | |||
@@ -130,7 +130,7 @@ static void die(const char * str, ...) | |||
130 | 130 | ||
131 | static void usage(void) | 131 | static void usage(void) |
132 | { | 132 | { |
133 | die("Usage: build [-b] setup system [rootdev] [> image]"); | 133 | die("Usage: build setup system [rootdev] [> image]"); |
134 | } | 134 | } |
135 | 135 | ||
136 | int main(int argc, char ** argv) | 136 | int main(int argc, char ** argv) |
@@ -145,11 +145,6 @@ int main(int argc, char ** argv) | |||
145 | void *kernel; | 145 | void *kernel; |
146 | u32 crc = 0xffffffffUL; | 146 | u32 crc = 0xffffffffUL; |
147 | 147 | ||
148 | if (argc > 2 && !strcmp(argv[1], "-b")) | ||
149 | { | ||
150 | is_big_kernel = 1; | ||
151 | argc--, argv++; | ||
152 | } | ||
153 | if ((argc < 3) || (argc > 4)) | 148 | if ((argc < 3) || (argc > 4)) |
154 | usage(); | 149 | usage(); |
155 | if (argc > 3) { | 150 | if (argc > 3) { |
@@ -216,8 +211,6 @@ int main(int argc, char ** argv) | |||
216 | die("Unable to mmap '%s': %m", argv[2]); | 211 | die("Unable to mmap '%s': %m", argv[2]); |
217 | /* Number of 16-byte paragraphs, including space for a 4-byte CRC */ | 212 | /* Number of 16-byte paragraphs, including space for a 4-byte CRC */ |
218 | sys_size = (sz + 15 + 4) / 16; | 213 | sys_size = (sz + 15 + 4) / 16; |
219 | if (!is_big_kernel && sys_size > DEF_SYSSIZE) | ||
220 | die("System is too big. Try using bzImage or modules."); | ||
221 | 214 | ||
222 | /* Patch the setup code with the appropriate size parameters */ | 215 | /* Patch the setup code with the appropriate size parameters */ |
223 | buf[0x1f1] = setup_sectors-1; | 216 | buf[0x1f1] = setup_sectors-1; |
diff --git a/arch/x86/boot/video-vga.c b/arch/x86/boot/video-vga.c index 5d4742ed4aa2..95d86ce0421c 100644 --- a/arch/x86/boot/video-vga.c +++ b/arch/x86/boot/video-vga.c | |||
@@ -129,41 +129,45 @@ u16 vga_crtc(void) | |||
129 | return (inb(0x3cc) & 1) ? 0x3d4 : 0x3b4; | 129 | return (inb(0x3cc) & 1) ? 0x3d4 : 0x3b4; |
130 | } | 130 | } |
131 | 131 | ||
132 | static void vga_set_480_scanlines(int end) | 132 | static void vga_set_480_scanlines(int lines) |
133 | { | 133 | { |
134 | u16 crtc; | 134 | u16 crtc; /* CRTC base address */ |
135 | u8 csel; | 135 | u8 csel; /* CRTC miscellaneous output register */ |
136 | u8 ovfw; /* CRTC overflow register */ | ||
137 | int end = lines-1; | ||
136 | 138 | ||
137 | crtc = vga_crtc(); | 139 | crtc = vga_crtc(); |
138 | 140 | ||
141 | ovfw = 0x3c | ((end >> (8-1)) & 0x02) | ((end >> (9-6)) & 0x40); | ||
142 | |||
139 | out_idx(0x0c, crtc, 0x11); /* Vertical sync end, unlock CR0-7 */ | 143 | out_idx(0x0c, crtc, 0x11); /* Vertical sync end, unlock CR0-7 */ |
140 | out_idx(0x0b, crtc, 0x06); /* Vertical total */ | 144 | out_idx(0x0b, crtc, 0x06); /* Vertical total */ |
141 | out_idx(0x3e, crtc, 0x07); /* Vertical overflow */ | 145 | out_idx(ovfw, crtc, 0x07); /* Vertical overflow */ |
142 | out_idx(0xea, crtc, 0x10); /* Vertical sync start */ | 146 | out_idx(0xea, crtc, 0x10); /* Vertical sync start */ |
143 | out_idx(end, crtc, 0x12); /* Vertical display end */ | 147 | out_idx(end, crtc, 0x12); /* Vertical display end */ |
144 | out_idx(0xe7, crtc, 0x15); /* Vertical blank start */ | 148 | out_idx(0xe7, crtc, 0x15); /* Vertical blank start */ |
145 | out_idx(0x04, crtc, 0x16); /* Vertical blank end */ | 149 | out_idx(0x04, crtc, 0x16); /* Vertical blank end */ |
146 | csel = inb(0x3cc); | 150 | csel = inb(0x3cc); |
147 | csel &= 0x0d; | 151 | csel &= 0x0d; |
148 | csel |= 0xe2; | 152 | csel |= 0xe2; |
149 | outb(csel, 0x3cc); | 153 | outb(csel, 0x3c2); |
150 | } | 154 | } |
151 | 155 | ||
152 | static void vga_set_80x30(void) | 156 | static void vga_set_80x30(void) |
153 | { | 157 | { |
154 | vga_set_480_scanlines(0xdf); | 158 | vga_set_480_scanlines(30*16); |
155 | } | 159 | } |
156 | 160 | ||
157 | static void vga_set_80x34(void) | 161 | static void vga_set_80x34(void) |
158 | { | 162 | { |
159 | vga_set_14font(); | 163 | vga_set_14font(); |
160 | vga_set_480_scanlines(0xdb); | 164 | vga_set_480_scanlines(34*14); |
161 | } | 165 | } |
162 | 166 | ||
163 | static void vga_set_80x60(void) | 167 | static void vga_set_80x60(void) |
164 | { | 168 | { |
165 | vga_set_8font(); | 169 | vga_set_8font(); |
166 | vga_set_480_scanlines(0xdf); | 170 | vga_set_480_scanlines(60*8); |
167 | } | 171 | } |
168 | 172 | ||
169 | static int vga_set_mode(struct mode_info *mode) | 173 | static int vga_set_mode(struct mode_info *mode) |