Skip to content

Commit

Permalink
Merge branches 'x86/asm', 'x86/cleanups' and 'x86/headers' into x86/core
Browse files Browse the repository at this point in the history
  • Loading branch information
Ingo Molnar committed Feb 20, 2009
4 parents 3b6f7b9 + cb425af + ecab22a + e9ce0c3 commit 6091628
Show file tree
Hide file tree
Showing 38 changed files with 87 additions and 158 deletions.
8 changes: 4 additions & 4 deletions arch/x86/boot/compressed/head_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@

#include <linux/linkage.h>
#include <asm/segment.h>
#include <asm/page.h>
#include <asm/page_types.h>
#include <asm/boot.h>
#include <asm/asm-offsets.h>

.section ".text.head","ax",@progbits
.globl startup_32

startup_32:
ENTRY(startup_32)
cld
/* test KEEP_SEGMENTS flag to see if the bootloader is asking
* us to not reload segments */
Expand Down Expand Up @@ -113,6 +111,8 @@ startup_32:
*/
leal relocated(%ebx), %eax
jmp *%eax
ENDPROC(startup_32)

.section ".text"
relocated:

Expand Down
10 changes: 4 additions & 6 deletions arch/x86/boot/compressed/head_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,16 @@

#include <linux/linkage.h>
#include <asm/segment.h>
#include <asm/pgtable.h>
#include <asm/page.h>
#include <asm/pgtable_types.h>
#include <asm/page_types.h>
#include <asm/boot.h>
#include <asm/msr.h>
#include <asm/processor-flags.h>
#include <asm/asm-offsets.h>

.section ".text.head"
.code32
.globl startup_32

startup_32:
ENTRY(startup_32)
cld
/* test KEEP_SEGMENTS flag to see if the bootloader is asking
* us to not reload segments */
Expand Down Expand Up @@ -176,6 +174,7 @@ startup_32:

/* Jump from 32bit compatibility mode into 64bit mode. */
lret
ENDPROC(startup_32)

no_longmode:
/* This isn't an x86-64 CPU so hang */
Expand Down Expand Up @@ -295,7 +294,6 @@ relocated:
call decompress_kernel
popq %rsi


/*
* Jump to the decompressed kernel.
*/
Expand Down
40 changes: 14 additions & 26 deletions arch/x86/boot/copy.S
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
*
* ----------------------------------------------------------------------- */

#include <linux/linkage.h>

/*
* Memory copy routines
*/

.code16gcc
.text

.globl memcpy
.type memcpy, @function
memcpy:
GLOBAL(memcpy)
pushw %si
pushw %di
movw %ax, %di
Expand All @@ -31,11 +31,9 @@ memcpy:
popw %di
popw %si
ret
.size memcpy, .-memcpy
ENDPROC(memcpy)

.globl memset
.type memset, @function
memset:
GLOBAL(memset)
pushw %di
movw %ax, %di
movzbl %dl, %eax
Expand All @@ -48,52 +46,42 @@ memset:
rep; stosb
popw %di
ret
.size memset, .-memset
ENDPROC(memset)

.globl copy_from_fs
.type copy_from_fs, @function
copy_from_fs:
GLOBAL(copy_from_fs)
pushw %ds
pushw %fs
popw %ds
call memcpy
popw %ds
ret
.size copy_from_fs, .-copy_from_fs
ENDPROC(copy_from_fs)

.globl copy_to_fs
.type copy_to_fs, @function
copy_to_fs:
GLOBAL(copy_to_fs)
pushw %es
pushw %fs
popw %es
call memcpy
popw %es
ret
.size copy_to_fs, .-copy_to_fs
ENDPROC(copy_to_fs)

#if 0 /* Not currently used, but can be enabled as needed */

.globl copy_from_gs
.type copy_from_gs, @function
copy_from_gs:
GLOBAL(copy_from_gs)
pushw %ds
pushw %gs
popw %ds
call memcpy
popw %ds
ret
.size copy_from_gs, .-copy_from_gs
.globl copy_to_gs
ENDPROC(copy_from_gs)

.type copy_to_gs, @function
copy_to_gs:
GLOBAL(copy_to_gs)
pushw %es
pushw %gs
popw %es
call memcpy
popw %es
ret
.size copy_to_gs, .-copy_to_gs

ENDPROC(copy_to_gs)
#endif
2 changes: 1 addition & 1 deletion arch/x86/boot/header.S
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <linux/utsrelease.h>
#include <asm/boot.h>
#include <asm/e820.h>
#include <asm/page.h>
#include <asm/page_types.h>
#include <asm/setup.h>
#include "boot.h"
#include "offsets.h"
Expand Down
16 changes: 5 additions & 11 deletions arch/x86/boot/pmjump.S
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,15 @@
#include <asm/boot.h>
#include <asm/processor-flags.h>
#include <asm/segment.h>
#include <linux/linkage.h>

.text

.globl protected_mode_jump
.type protected_mode_jump, @function

.code16

/*
* void protected_mode_jump(u32 entrypoint, u32 bootparams);
*/
protected_mode_jump:
GLOBAL(protected_mode_jump)
movl %edx, %esi # Pointer to boot_params table

xorl %ebx, %ebx
Expand All @@ -47,12 +44,10 @@ protected_mode_jump:
.byte 0x66, 0xea # ljmpl opcode
2: .long in_pm32 # offset
.word __BOOT_CS # segment

.size protected_mode_jump, .-protected_mode_jump
ENDPROC(protected_mode_jump)

.code32
.type in_pm32, @function
in_pm32:
GLOBAL(in_pm32)
# Set up data segments for flat 32-bit mode
movl %ecx, %ds
movl %ecx, %es
Expand All @@ -78,5 +73,4 @@ in_pm32:
lldt %cx

jmpl *%eax # Jump to the 32-bit entrypoint

.size in_pm32, .-in_pm32
ENDPROC(in_pm32)
11 changes: 8 additions & 3 deletions arch/x86/include/asm/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,15 @@ static inline void *phys_to_virt(phys_addr_t address)

/*
* ISA I/O bus memory addresses are 1:1 with the physical address.
* However, we truncate the address to unsigned int to avoid undesirable
* promitions in legacy drivers.
*/
#define isa_virt_to_bus (unsigned long)virt_to_phys
#define isa_page_to_bus page_to_phys
#define isa_bus_to_virt phys_to_virt
static inline unsigned int isa_virt_to_bus(volatile void *address)
{
return (unsigned int)virt_to_phys(address);
}
#define isa_page_to_bus(page) ((unsigned int)page_to_phys(page))
#define isa_bus_to_virt phys_to_virt

/*
* However PCI ones are not necessarily 1:1 and therefore these interfaces
Expand Down
64 changes: 4 additions & 60 deletions arch/x86/include/asm/linkage.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,70 +52,14 @@

#endif

#define GLOBAL(name) \
.globl name; \
name:

#ifdef CONFIG_X86_ALIGNMENT_16
#define __ALIGN .align 16,0x90
#define __ALIGN_STR ".align 16,0x90"
#endif

/*
* to check ENTRY_X86/END_X86 and
* KPROBE_ENTRY_X86/KPROBE_END_X86
* unbalanced-missed-mixed appearance
*/
#define __set_entry_x86 .set ENTRY_X86_IN, 0
#define __unset_entry_x86 .set ENTRY_X86_IN, 1
#define __set_kprobe_x86 .set KPROBE_X86_IN, 0
#define __unset_kprobe_x86 .set KPROBE_X86_IN, 1

#define __macro_err_x86 .error "ENTRY_X86/KPROBE_X86 unbalanced,missed,mixed"

#define __check_entry_x86 \
.ifdef ENTRY_X86_IN; \
.ifeq ENTRY_X86_IN; \
__macro_err_x86; \
.abort; \
.endif; \
.endif

#define __check_kprobe_x86 \
.ifdef KPROBE_X86_IN; \
.ifeq KPROBE_X86_IN; \
__macro_err_x86; \
.abort; \
.endif; \
.endif

#define __check_entry_kprobe_x86 \
__check_entry_x86; \
__check_kprobe_x86

#define ENTRY_KPROBE_FINAL_X86 __check_entry_kprobe_x86

#define ENTRY_X86(name) \
__check_entry_kprobe_x86; \
__set_entry_x86; \
.globl name; \
__ALIGN; \
name:

#define END_X86(name) \
__unset_entry_x86; \
__check_entry_kprobe_x86; \
.size name, .-name

#define KPROBE_ENTRY_X86(name) \
__check_entry_kprobe_x86; \
__set_kprobe_x86; \
.pushsection .kprobes.text, "ax"; \
.globl name; \
__ALIGN; \
name:

#define KPROBE_END_X86(name) \
__unset_kprobe_x86; \
__check_entry_kprobe_x86; \
.size name, .-name; \
.popsection

#endif /* _ASM_X86_LINKAGE_H */

2 changes: 0 additions & 2 deletions arch/x86/include/asm/page_32_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@
/* 44=32+12, the limit we can fit into an unsigned long pfn */
#define __PHYSICAL_MASK_SHIFT 44
#define __VIRTUAL_MASK_SHIFT 32
#define PAGETABLE_LEVELS 3

#else /* !CONFIG_X86_PAE */
#define __PHYSICAL_MASK_SHIFT 32
#define __VIRTUAL_MASK_SHIFT 32
#define PAGETABLE_LEVELS 2
#endif /* CONFIG_X86_PAE */

#ifndef __ASSEMBLY__
Expand Down
2 changes: 0 additions & 2 deletions arch/x86/include/asm/page_64_types.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#ifndef _ASM_X86_PAGE_64_DEFS_H
#define _ASM_X86_PAGE_64_DEFS_H

#define PAGETABLE_LEVELS 4

#define THREAD_ORDER 1
#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
#define CURRENT_MASK (~(THREAD_SIZE - 1))
Expand Down
6 changes: 0 additions & 6 deletions arch/x86/include/asm/page_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@
(ie, 32-bit PAE). */
#define PHYSICAL_PAGE_MASK (((signed long)PAGE_MASK) & __PHYSICAL_MASK)

/* PTE_PFN_MASK extracts the PFN from a (pte|pmd|pud|pgd)val_t */
#define PTE_PFN_MASK ((pteval_t)PHYSICAL_PAGE_MASK)

/* PTE_FLAGS_MASK extracts the flags from a (pte|pmd|pud|pgd)val_t */
#define PTE_FLAGS_MASK (~PTE_PFN_MASK)

#define PMD_PAGE_SIZE (_AC(1, UL) << PMD_SHIFT)
#define PMD_PAGE_MASK (~(PMD_PAGE_SIZE-1))

Expand Down
2 changes: 2 additions & 0 deletions arch/x86/include/asm/pgtable-2level_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ typedef union {
#endif /* !__ASSEMBLY__ */

#define SHARED_KERNEL_PMD 0
#define PAGETABLE_LEVELS 2

/*
* traditional i386 two-level paging structure:
Expand All @@ -25,6 +26,7 @@ typedef union {
#define PGDIR_SHIFT 22
#define PTRS_PER_PGD 1024


/*
* the i386 is two-level, so we don't really have any
* PMD directory physically.
Expand Down
2 changes: 2 additions & 0 deletions arch/x86/include/asm/pgtable-3level_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ typedef union {
#define SHARED_KERNEL_PMD 1
#endif

#define PAGETABLE_LEVELS 3

/*
* PGDIR_SHIFT determines what a top-level page table entry can map
*/
Expand Down
1 change: 1 addition & 0 deletions arch/x86/include/asm/pgtable_64_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ typedef struct { pteval_t pte; } pte_t;
#endif /* !__ASSEMBLY__ */

#define SHARED_KERNEL_PMD 0
#define PAGETABLE_LEVELS 4

/*
* PGDIR_SHIFT determines what a top-level page table entry can map
Expand Down
6 changes: 6 additions & 0 deletions arch/x86/include/asm/pgtable_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@

#include <linux/types.h>

/* PTE_PFN_MASK extracts the PFN from a (pte|pmd|pud|pgd)val_t */
#define PTE_PFN_MASK ((pteval_t)PHYSICAL_PAGE_MASK)

/* PTE_FLAGS_MASK extracts the flags from a (pte|pmd|pud|pgd)val_t */
#define PTE_FLAGS_MASK (~PTE_PFN_MASK)

typedef struct pgprot { pgprotval_t pgprot; } pgprot_t;

typedef struct { pgdval_t pgd; } pgd_t;
Expand Down
1 change: 0 additions & 1 deletion arch/x86/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,6 @@ DECLARE_PER_CPU(unsigned long, stack_canary);
#endif
#endif /* X86_64 */

extern void print_cpu_info(struct cpuinfo_x86 *);
extern unsigned int xstate_size;
extern void free_thread_xstate(struct task_struct *);
extern struct kmem_cache *task_xstate_cachep;
Expand Down
Loading

0 comments on commit 6091628

Please sign in to comment.