From: Chris Wright <chrisw@sous-sol.org>
To: linux-kernel@vger.kernel.org
Cc: xen-devel@lists.xensource.com, virtualization@lists.osdl.org,
Ian Pratt <ian.pratt@xensource.com>,
Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
Subject: [RFC PATCH 10/35] Add a new head.S start-of-day file for booting on Xen.
Date: Tue, 21 Mar 2006 22:30:50 -0800 [thread overview]
Message-ID: <20060322063748.490176000@sorel.sous-sol.org> (raw)
In-Reply-To: <20060322063040.960068000@sorel.sous-sol.org>
[-- Attachment #1: 09-i386-head.S --]
[-- Type: text/plain, Size: 7230 bytes --]
When running on Xen, the kernel is started with paging enabled. Also
don't check for cpu features which are present on all cpus supported
by Xen.
Don't define segments which are not supported when running on Xen.
Define the __xen_guest section which exports information about the
kernel to the domain builder.
Signed-off-by: Ian Pratt <ian.pratt@xensource.com>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
---
arch/i386/Makefile | 7 +
arch/i386/mach-xen/Makefile | 2
arch/i386/mach-xen/head.S | 184 ++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 191 insertions(+), 2 deletions(-)
--- xen-subarch-2.6.orig/arch/i386/Makefile
+++ xen-subarch-2.6/arch/i386/Makefile
@@ -45,6 +45,9 @@ CFLAGS += $(shell if [ $(call cc-vers
CFLAGS += $(cflags-y)
+# Default subarch head files
+head-y := arch/i386/kernel/head.o arch/i386/kernel/init_task.o
+
# Default subarch .c files
mcore-y := mach-default
@@ -71,6 +74,8 @@ mcore-$(CONFIG_X86_SUMMIT) := mach-defa
# Xen subarch support
mflags-$(CONFIG_X86_XEN) := -Iinclude/asm-i386/mach-xen
mcore-$(CONFIG_X86_XEN) := mach-xen
+head-$(CONFIG_X86_XEN) := arch/i386/mach-xen/head.o \
+ arch/i386/kernel/init_task.o
# generic subarchitecture
mflags-$(CONFIG_X86_GENERICARCH) := -Iinclude/asm-i386/mach-generic
@@ -85,8 +90,6 @@ core-$(CONFIG_X86_ES7000) := arch/i386/m
# default subarch .h files
mflags-y += -Iinclude/asm-i386/mach-default
-head-y := arch/i386/kernel/head.o arch/i386/kernel/init_task.o
-
libs-y += arch/i386/lib/
core-y += arch/i386/kernel/ \
arch/i386/mm/ \
--- xen-subarch-2.6.orig/arch/i386/mach-xen/Makefile
+++ xen-subarch-2.6/arch/i386/mach-xen/Makefile
@@ -2,6 +2,8 @@
# Makefile for the linux kernel.
#
+extra-y := head.o
+
obj-y := setup.o
setup-y := ../mach-default/setup.o
--- /dev/null
+++ xen-subarch-2.6/arch/i386/mach-xen/head.S
@@ -0,0 +1,184 @@
+
+
+.text
+#include <linux/config.h>
+#include <linux/threads.h>
+#include <linux/linkage.h>
+#include <asm/segment.h>
+#include <asm/page.h>
+#include <asm/thread_info.h>
+#include <asm/asm-offsets.h>
+#include <xen/interface/arch-x86_32.h>
+
+/*
+ * References to members of the new_cpu_data structure.
+ */
+
+#define X86 new_cpu_data+CPUINFO_x86
+#define X86_VENDOR new_cpu_data+CPUINFO_x86_vendor
+#define X86_MODEL new_cpu_data+CPUINFO_x86_model
+#define X86_MASK new_cpu_data+CPUINFO_x86_mask
+#define X86_HARD_MATH new_cpu_data+CPUINFO_hard_math
+#define X86_CPUID new_cpu_data+CPUINFO_cpuid_level
+#define X86_CAPABILITY new_cpu_data+CPUINFO_x86_capability
+#define X86_VENDOR_ID new_cpu_data+CPUINFO_x86_vendor_id
+
+ENTRY(startup_32)
+ movl %esi,xen_start_info
+ cld
+
+ /* Set up the stack pointer */
+ movl $(init_thread_union+THREAD_SIZE),%esp
+
+ /* get vendor info */
+ xorl %eax,%eax # call CPUID with 0 -> return vendor ID
+ cpuid
+ movl %eax,X86_CPUID # save CPUID level
+ movl %ebx,X86_VENDOR_ID # lo 4 chars
+ movl %edx,X86_VENDOR_ID+4 # next 4 chars
+ movl %ecx,X86_VENDOR_ID+8 # last 4 chars
+
+ movl $1,%eax # Use the CPUID instruction to get CPU type
+ cpuid
+ movb %al,%cl # save reg for future use
+ andb $0x0f,%ah # mask processor family
+ movb %ah,X86
+ andb $0xf0,%al # mask model
+ shrb $4,%al
+ movb %al,X86_MODEL
+ andb $0x0f,%cl # mask mask revision
+ movb %cl,X86_MASK
+ movl %edx,X86_CAPABILITY
+
+ movb $1,X86_HARD_MATH
+
+ xorl %eax,%eax # Clear FS/GS and LDT
+ movl %eax,%fs
+ movl %eax,%gs
+ cld # gcc2 wants the direction flag cleared at all times
+
+ call start_kernel
+L6:
+ jmp L6 # main should never return here, but
+ # just in case, we know what happens.
+
+#define HYPERCALL_PAGE_OFFSET 0x1000
+.org HYPERCALL_PAGE_OFFSET
+ENTRY(hypercall_page)
+.skip 0x1000
+
+/*
+ * Real beginning of normal "text" segment
+ */
+ENTRY(stext)
+ENTRY(_stext)
+
+/*
+ * BSS section
+ */
+.section ".bss.page_aligned","w"
+ENTRY(swapper_pg_dir)
+ .fill 1024,4,0
+ENTRY(empty_zero_page)
+ .fill 4096,1,0
+
+/*
+ * This starts the data section.
+ */
+.data
+
+ ALIGN
+ .word 0 # 32 bit align gdt_desc.address
+ .globl cpu_gdt_descr
+cpu_gdt_descr:
+ .word GDT_SIZE
+ .long cpu_gdt_table
+
+ .fill NR_CPUS-1,8,0 # space for the other GDT descriptors
+
+/*
+ * The Global Descriptor Table contains 28 quadwords, per-CPU.
+ */
+ .align PAGE_SIZE_asm
+ENTRY(cpu_gdt_table)
+ .quad 0x0000000000000000 /* NULL descriptor */
+ .quad 0x0000000000000000 /* 0x0b reserved */
+ .quad 0x0000000000000000 /* 0x13 reserved */
+ .quad 0x0000000000000000 /* 0x1b reserved */
+ .quad 0x0000000000000000 /* 0x20 unused */
+ .quad 0x0000000000000000 /* 0x28 unused */
+ .quad 0x0000000000000000 /* 0x33 TLS entry 1 */
+ .quad 0x0000000000000000 /* 0x3b TLS entry 2 */
+ .quad 0x0000000000000000 /* 0x43 TLS entry 3 */
+ .quad 0x0000000000000000 /* 0x4b reserved */
+ .quad 0x0000000000000000 /* 0x53 reserved */
+ .quad 0x0000000000000000 /* 0x5b reserved */
+
+ .quad 0x00cf9a000000ffff /* 0x60 kernel 4GB code at 0x00000000 */
+ .quad 0x00cf92000000ffff /* 0x68 kernel 4GB data at 0x00000000 */
+ .quad 0x00cffa000000ffff /* 0x73 user 4GB code at 0x00000000 */
+ .quad 0x00cff2000000ffff /* 0x7b user 4GB data at 0x00000000 */
+
+ .quad 0x0000000000000000 /* 0x80 TSS descriptor */
+ .quad 0x0000000000000000 /* 0x88 LDT descriptor */
+
+ /*
+ * Segments used for calling PnP BIOS have byte granularity.
+ * They code segments and data segments have fixed 64k limits,
+ * the transfer segment sizes are set at run time.
+ */
+ .quad 0x0000000000000000 /* 0x90 32-bit code */
+ .quad 0x0000000000000000 /* 0x98 16-bit code */
+ .quad 0x0000000000000000 /* 0xa0 16-bit data */
+ .quad 0x0000000000000000 /* 0xa8 16-bit data */
+ .quad 0x0000000000000000 /* 0xb0 16-bit data */
+
+ /*
+ * The APM segments have byte granularity and their bases
+ * are set at run time. All have 64k limits.
+ */
+ .quad 0x0000000000000000 /* 0xb8 APM CS code */
+ .quad 0x0000000000000000 /* 0xc0 APM CS 16 code (16 bit) */
+ .quad 0x0000000000000000 /* 0xc8 APM DS data */
+
+ .quad 0x0000000000000000 /* 0xd0 - ESPFIX 16-bit SS */
+ .quad 0x0000000000000000 /* 0xd8 - unused */
+ .quad 0x0000000000000000 /* 0xe0 - unused */
+ .quad 0x0000000000000000 /* 0xe8 - unused */
+ .quad 0x0000000000000000 /* 0xf0 - unused */
+ .quad 0x0000000000000000 /* 0xf8 - GDT entry 31: double-fault TSS */
+
+ /* Be sure this is zeroed to avoid false validations in Xen */
+ .fill PAGE_SIZE_asm / 8 - GDT_ENTRIES,8,0
+
+
+/*
+ * __xen_guest information
+ */
+.macro utoa value
+ .if (\value) < 0 || (\value) >= 0x10
+ utoa (((\value)>>4)&0x0fffffff)
+ .endif
+ .if ((\value) & 0xf) < 10
+ .byte '0' + ((\value) & 0xf)
+ .else
+ .byte 'A' + ((\value) & 0xf) - 10
+ .endif
+.endm
+
+.section __xen_guest
+ .ascii "GUEST_OS=linux,GUEST_VER=2.6"
+ .ascii ",XEN_VER=xen-3.0"
+ .ascii ",VIRT_BASE=0x"
+ utoa __PAGE_OFFSET
+ .ascii ",HYPERCALL_PAGE=0x"
+ utoa ((__PHYSICAL_START+HYPERCALL_PAGE_OFFSET)>>PAGE_SHIFT)
+ .ascii ",FEATURES=!writable_page_tables"
+ .ascii "|!auto_translated_physmap"
+#ifdef CONFIG_X86_PAE
+ .ascii ",PAE=yes"
+#else
+ .ascii ",PAE=no"
+#endif
+ .ascii ",LOADER=generic"
+ .byte 0
--
next prev parent reply other threads:[~2006-03-22 6:49 UTC|newest]
Thread overview: 109+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-22 6:30 [RFC PATCH 00/35] Xen i386 paravirtualization support Chris Wright
2006-03-22 6:30 ` [RFC PATCH 01/35] Add XEN config options and disable unsupported config options Chris Wright
2006-03-22 6:30 ` [RFC PATCH 02/35] Makefile support to build Xen subarch Chris Wright
2006-03-22 6:30 ` [RFC PATCH 03/35] Add Xen interface header files Chris Wright
2006-03-22 6:30 ` [RFC PATCH 04/35] Hypervisor " Chris Wright
2006-03-22 8:28 ` Arjan van de Ven
2006-03-22 9:31 ` Keir Fraser
2006-03-22 9:46 ` Arjan van de Ven
2006-03-22 11:32 ` David Schwartz
2006-03-22 14:29 ` Keir Fraser
2006-03-22 6:30 ` [RFC PATCH 05/35] Add sync bitops Chris Wright
2006-03-22 6:30 ` [RFC PATCH 06/35] Add vmlinuz build target Chris Wright
2006-03-22 6:30 ` [RFC PATCH 07/35] Make LOAD_OFFSET defined by subarch Chris Wright
2006-03-22 22:57 ` Dan Hecht
2006-03-27 8:18 ` Gerd Hoffmann
2006-03-22 6:30 ` [RFC PATCH 08/35] Add Xen-specific memory management definitions Chris Wright
2006-03-22 6:30 ` [RFC PATCH 09/35] Change __FIXADDR_TOP to leave room for the hypervisor Chris Wright
2006-03-22 17:27 ` Anthony Liguori
2006-03-22 17:32 ` Chris Wright
2006-03-22 6:30 ` Chris Wright [this message]
2006-03-22 13:43 ` [RFC PATCH 10/35] Add a new head.S start-of-day file for booting on Xen Andi Kleen
2006-03-22 18:58 ` Chris Wright
2006-03-22 18:45 ` Andi Kleen
2006-03-22 19:26 ` Chris Wright
2006-03-22 6:30 ` [RFC PATCH 11/35] Add support for Xen to entry.S Chris Wright
2006-03-22 13:55 ` Andi Kleen
2006-03-22 17:24 ` [Xen-devel] " Zachary Amsden
2006-03-22 6:30 ` [RFC PATCH 12/35] Add start-of-day setup hooks to subarch Chris Wright
2006-03-22 6:30 ` [RFC PATCH 13/35] Support loading an initrd when running on Xen Chris Wright
2006-03-22 14:22 ` Andi Kleen
2006-03-22 19:20 ` Chris Wright
2006-03-22 6:30 ` [RFC PATCH 14/35] subarch modify CPU capabilities Chris Wright
2006-03-22 8:35 ` [Xen-devel] " Zachary Amsden
2006-03-22 9:33 ` Keir Fraser
2006-03-22 19:29 ` Chris Wright
2006-03-22 6:30 ` [RFC PATCH 15/35] subarch support for controlling interrupt delivery Chris Wright
2006-03-22 6:30 ` [RFC PATCH 16/35] subarch support for interrupt and exception gates Chris Wright
2006-03-22 13:45 ` Andi Kleen
2006-03-22 20:54 ` Chris Wright
2006-03-22 6:30 ` [RFC PATCH 17/35] Segment register changes for Xen Chris Wright
2006-03-22 14:24 ` Andi Kleen
2006-03-22 19:33 ` Chris Wright
2006-03-23 0:16 ` Zachary Amsden
2006-03-22 6:30 ` [RFC PATCH 18/35] Support gdt/idt/ldt handling on Xen Chris Wright
2006-03-22 14:30 ` Andi Kleen
2006-03-22 17:51 ` [Xen-devel] " Zachary Amsden
2006-03-22 17:36 ` Andi Kleen
2006-03-22 6:30 ` [RFC PATCH 19/35] subarch support for control register accesses Chris Wright
2006-03-22 8:55 ` Zachary Amsden
2006-03-22 21:45 ` Chris Wright
2006-03-22 6:31 ` [RFC PATCH 20/35] subarch stack pointer update Chris Wright
2006-03-22 6:31 ` [RFC PATCH 21/35] subarch TLB support Chris Wright
2006-03-22 6:31 ` [RFC PATCH 22/35] subarch suport for idle loop (NO_IDLE_HZ for Xen) Chris Wright
2006-03-22 6:31 ` [RFC PATCH 23/35] Add support for Xen event channels Chris Wright
2006-03-22 8:36 ` Arjan van de Ven
2006-03-22 11:30 ` Keir Fraser
2006-03-22 14:07 ` Andi Kleen
2006-03-22 6:31 ` [RFC PATCH 24/35] subarch support for mask value for irq nubmers Chris Wright
2006-03-22 6:31 ` [RFC PATCH 25/35] Add Xen time abstractions Chris Wright
2006-03-22 8:38 ` Arjan van de Ven
2006-03-22 19:37 ` Chris Wright
2006-03-22 22:26 ` [Xen-devel] " Dan Hecht
2006-03-23 3:23 ` [Xen-devel] " Eli Collins
2006-03-23 6:47 ` Chris Wright
2006-03-22 6:31 ` [RFC PATCH 26/35] Add Xen subarch reboot support Chris Wright
2006-03-22 8:40 ` Arjan van de Ven
2006-03-22 10:22 ` Keir Fraser
2006-03-22 10:39 ` Arjan van de Ven
2006-03-22 10:52 ` Keir Fraser
2006-03-22 14:21 ` Andi Kleen
2006-03-22 20:59 ` Pavel Machek
2006-03-22 6:31 ` [RFC PATCH 27/35] Add nosegneg capability to the vsyscall page notes Chris Wright
2006-03-22 6:31 ` [RFC PATCH 28/35] add support for Xen feature queries Chris Wright
2006-03-22 8:42 ` Arjan van de Ven
2006-03-22 6:31 ` [RFC PATCH 29/35] Add the Xen virtual console driver Chris Wright
2006-03-22 8:43 ` Arjan van de Ven
2006-03-22 9:29 ` Keir Fraser
2006-03-22 14:17 ` Andi Kleen
2006-03-22 16:00 ` Anthony Liguori
2006-03-22 16:07 ` Keir Fraser
2006-03-22 16:14 ` Anthony Liguori
2006-03-22 6:31 ` [RFC PATCH 30/35] Add generic_page_range() function Chris Wright
2006-03-22 8:51 ` Zachary Amsden
2006-03-22 9:27 ` [Xen-devel] " Keir Fraser
2006-03-22 11:21 ` Nick Piggin
2006-03-22 14:33 ` Keir Fraser
2006-03-22 15:35 ` Keir Fraser
2006-03-23 0:15 ` Nick Piggin
2006-03-23 0:26 ` Nick Piggin
2006-03-22 6:31 ` [RFC PATCH 31/35] Add Xen grant table support Chris Wright
2006-03-22 8:45 ` Arjan van de Ven
2006-03-22 18:38 ` Chris Wright
2006-03-22 6:31 ` [RFC PATCH 32/35] Add Xen driver utility functions Chris Wright
2006-03-22 14:12 ` Andi Kleen
2006-03-22 6:31 ` [RFC PATCH 33/35] Add the Xenbus sysfs and virtual device hotplug driver Chris Wright
2006-03-22 8:53 ` Arjan van de Ven
2006-03-22 11:14 ` Keir Fraser
2006-03-22 6:31 ` [RFC PATCH 34/35] Add the Xen virtual network device driver Chris Wright
2006-03-22 8:59 ` Arjan van de Ven
2006-03-22 15:29 ` James Morris
2006-03-22 17:17 ` Stephen Hemminger
2006-03-22 6:31 ` [RFC PATCH 35/35] Add Xen virtual block " Chris Wright
2006-03-22 16:39 ` Anthony Liguori
2006-03-22 16:54 ` Christoph Hellwig
2006-03-27 8:42 ` Gerd Hoffmann
2006-03-22 17:15 ` [RFC PATCH 00/35] Xen i386 paravirtualization support Anthony Liguori
2006-03-22 17:27 ` Chris Wright
2006-03-22 17:50 ` Anthony Liguori
2006-05-09 8:49 Chris Wright
2006-05-09 7:00 ` [RFC PATCH 10/35] Add a new head.S start-of-day file for booting on Xen Chris Wright
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060322063748.490176000@sorel.sous-sol.org \
--to=chrisw@sous-sol.org \
--cc=Christian.Limpach@cl.cam.ac.uk \
--cc=ian.pratt@xensource.com \
--cc=linux-kernel@vger.kernel.org \
--cc=virtualization@lists.osdl.org \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®