cr: i386 support
PATCH 11/30 cr: i386 support
Segment registers abstraction is done to allow i386 => x86_64 COMPAT=y migration.
What is unsupported is in cr_arch_check_task_struct().
FIXME: support more that busyloop.
Signed-off-by Alexey Dobriyan <[email protected]>
---
arch/x86/include/asm/unistd_32.h | 2 arch/x86/kernel/syscall_table_32.S | 2 include/linux/cr.h | 39 ++++++ kernel/cr/Makefile | 1 kernel/cr/cr-x86_32.c | 211 +++++++++++++++++++++++++++++++++++++ kernel/cr/cr.h | 2 6 files changed, 256 insertions(+), 1 deletion(-)
arch/x86/include/asm/unistd_32.h +2 -0
@@ -340,6 +340,8 @@#define __NR_inotify_init1 332#define __NR_preadv 333#define __NR_pwritev 334 +#define __NR_checkpoint 335 +#define __NR_restart 336#ifdef __KERNEL__
arch/x86/kernel/syscall_table_32.S +2 -0
@@ -334,3 +334,5 @@ ENTRY(sys_call_table) .long sys_inotify_init1 .long sys_preadv .long sys_pwritev + .long sys_checkpoint /* 335 */ + .long sys_restart
include/linux/cr.h +39 -0
@@ -17,6 +17,7 @@ struct cr_image_header {/* Mutable part. */ /* Arch of the kernel which dumped the image. */ +#define CR_ARCH_X86_32 1__le32 cr_arch;/* * Distributions are expected to leave image version alone and
@@ -59,6 +60,44 @@ struct cr_image_task_struct {__u32 cr_len_arch; } __packed; +#define CR_SEG_NULL 0 +#define CR_SEG_USER32_CS 1 +#define CR_SEG_USER32_DS 2 +#define CR_SEG_USER64_CS 3 +#define CR_SEG_USER64_DS 4 +#define CR_SEG_TLS 0x4000/* 0100 0000 0000 00xx */ +#define CR_SEG_LDT 0x8000/* 100x xxxx xxxx xxxx */ + +struct cr_image_arch_x86_32 { +__u32 cr_ebx; +__u32 cr_ecx; +__u32 cr_edx; +__u32 cr_esi; +__u32 cr_edi; +__u32 cr_ebp; +__u32 cr_eax; +__u32 cr_orig_eax; +__u32 cr_eip; +__u32 cr_eflags; +__u32 cr_esp; + +__u16 cr_cs; +__u16 cr_ds; +__u16 cr_es; +__u16 cr_fs; +__u16 cr_gs; +__u16 cr_ss; + +__u32 cr_dr0; +__u32 cr_dr1; +__u32 cr_dr2; +__u32 cr_dr3; +__u32 cr_dr6; +__u32 cr_dr7; + +__u64 cr_tls_array[3 ]; +} __packed; +struct cr_image_mm_struct {struct cr_object_header cr_hdr;
kernel/cr/Makefile +1 -0
@@ -4,3 +4,4 @@ cr-y += cr-context.o cr-y += cr-file.o cr-y += cr-mm.o cr-y += cr-task.o +cr-$(CONFIG_X86_32) += cr-x86_32.o
new file mode 100644
kernel/cr/cr-x86_32.c new file +211 -0
211 lines not on this page · raw message
kernel/cr/cr.h +1 -1
@@ -78,7 +78,7 @@ int cr_restore_file(struct cr_context *ctx, loff_t pos);int cr_restore_mm_struct (struct cr_context *ctx,loff_t pos);int cr_restore_task_struct (struct cr_context *ctx,loff_t pos); -#if 0 +#if defined(CONFIG_X86_32 )__u32 cr_image_header_arch (void );int cr_arch_check_image_header (struct cr_image_header *i);