Commit b5635319 authored by Dave Jones's avatar Dave Jones Committed by Linus Torvalds

[PATCH] text.lock -> subsection changes.

Make spinlocks etc use subsections of their parent sections instead of
an ELF section of their own - needed for newer binutils when the parent
sector is removed. 
parent 168c9069
...@@ -332,11 +332,13 @@ include/linux/version.h: ./Makefile ...@@ -332,11 +332,13 @@ include/linux/version.h: ./Makefile
@echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' >>.ver @echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' >>.ver
@mv -f .ver $@ @mv -f .ver $@
comma := ,
init/version.o: init/version.c include/linux/compile.h include/config/MARKER init/version.o: init/version.c include/linux/compile.h include/config/MARKER
$(CC) $(CFLAGS) $(CFLAGS_KERNEL) -DUTS_MACHINE='"$(ARCH)"' -c -o init/version.o init/version.c $(CC) $(CFLAGS) $(CFLAGS_KERNEL) -DUTS_MACHINE='"$(ARCH)"' -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -c -o init/version.o init/version.c
init/main.o: init/main.c include/config/MARKER init/main.o: init/main.c include/config/MARKER
$(CC) $(CFLAGS) $(CFLAGS_KERNEL) $(PROFILING) -c -o $*.o $< $(CC) $(CFLAGS) $(CFLAGS_KERNEL) $(PROFILING) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -c -o $*.o $<
init/do_mounts.o: init/do_mounts.c include/config/MARKER init/do_mounts.o: init/do_mounts.c include/config/MARKER
$(CC) $(CFLAGS) $(CFLAGS_KERNEL) $(PROFILING) -c -o $*.o $< $(CC) $(CFLAGS) $(CFLAGS_KERNEL) $(PROFILING) -c -o $*.o $<
......
...@@ -31,6 +31,8 @@ unexport subdir-m ...@@ -31,6 +31,8 @@ unexport subdir-m
unexport subdir-n unexport subdir-n
unexport subdir- unexport subdir-
comma := ,
# #
# Get things started. # Get things started.
# #
...@@ -54,7 +56,7 @@ ALL_SUB_DIRS := $(sort $(subdir-y) $(subdir-m) $(subdir-n) $(subdir-)) ...@@ -54,7 +56,7 @@ ALL_SUB_DIRS := $(sort $(subdir-y) $(subdir-m) $(subdir-n) $(subdir-))
$(CPP) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) $< > $@ $(CPP) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) $< > $@
%.o: %.c %.o: %.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -c -o $@ $< $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) $(CFLAGS_$@) -c -o $@ $<
@ ( \ @ ( \
echo 'ifeq ($(strip $(subst $(comma),:,$(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@))),$$(strip $$(subst $$(comma),:,$$(CFLAGS) $$(EXTRA_CFLAGS) $$(CFLAGS_$@))))' ; \ echo 'ifeq ($(strip $(subst $(comma),:,$(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@))),$$(strip $$(subst $$(comma),:,$$(CFLAGS) $$(EXTRA_CFLAGS) $$(CFLAGS_$@))))' ; \
echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \ echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \
...@@ -270,7 +272,7 @@ endif # CONFIG_MODVERSIONS ...@@ -270,7 +272,7 @@ endif # CONFIG_MODVERSIONS
ifneq "$(strip $(export-objs))" "" ifneq "$(strip $(export-objs))" ""
$(export-objs): $(export-objs:.o=.c) $(TOPDIR)/include/linux/modversions.h $(export-objs): $(export-objs:.o=.c) $(TOPDIR)/include/linux/modversions.h
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -DEXPORT_SYMTAB -c $(@:.o=.c) $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) $(CFLAGS_$@) -DEXPORT_SYMTAB -c $(@:.o=.c)
@ ( \ @ ( \
echo 'ifeq ($(strip $(subst $(comma),:,$(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -DEXPORT_SYMTAB)),$$(strip $$(subst $$(comma),:,$$(CFLAGS) $$(EXTRA_CFLAGS) $$(CFLAGS_$@) -DEXPORT_SYMTAB)))' ; \ echo 'ifeq ($(strip $(subst $(comma),:,$(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -DEXPORT_SYMTAB)),$$(strip $$(subst $$(comma),:,$$(CFLAGS) $$(EXTRA_CFLAGS) $$(CFLAGS_$@) -DEXPORT_SYMTAB)))' ; \
echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \ echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \
......
...@@ -24,7 +24,6 @@ SECTIONS ...@@ -24,7 +24,6 @@ SECTIONS
*(.fixup) *(.fixup)
*(.text.__*) *(.text.__*)
} }
.text.lock : { *(.text.lock) } /* out-of-line lock text */
_etext = . ; /* End of text section */ _etext = . ; /* End of text section */
__etext = .; __etext = .;
......
...@@ -32,8 +32,10 @@ bvmlinux: piggy.o $(OBJECTS) ...@@ -32,8 +32,10 @@ bvmlinux: piggy.o $(OBJECTS)
head.o: head.S head.o: head.S
$(CC) $(AFLAGS) -traditional -c head.S $(CC) $(AFLAGS) -traditional -c head.S
comma := ,
misc.o: misc.c misc.o: misc.c
$(CC) $(CFLAGS) -c misc.c $(CC) $(CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -c misc.c
piggy.o: $(SYSTEM) piggy.o: $(SYSTEM)
tmppiggy=_tmp_$$$$piggy; \ tmppiggy=_tmp_$$$$piggy; \
......
...@@ -456,12 +456,3 @@ ENTRY(gdt_table) ...@@ -456,12 +456,3 @@ ENTRY(gdt_table)
.quad 0x0000000000000000 /* 0x98 not used */ .quad 0x0000000000000000 /* 0x98 not used */
/* Per CPU segments */ /* Per CPU segments */
.fill NR_CPUS*4,8,0 /* space for TSS's and LDT's */ .fill NR_CPUS*4,8,0 /* space for TSS's and LDT's */
/*
* This is to aid debugging, the various locking macros will be putting
* code fragments here. When an oops occurs we'd rather know that it's
* inside the .text.lock section rather than as some offset from whatever
* function happens to be last in the .text segment.
*/
.section .text.lock
ENTRY(stext_lock)
...@@ -13,7 +13,6 @@ SECTIONS ...@@ -13,7 +13,6 @@ SECTIONS
*(.fixup) *(.fixup)
*(.gnu.warning) *(.gnu.warning)
} = 0x9090 } = 0x9090
.text.lock : { *(.text.lock) } /* out-of-line lock text */
_etext = .; /* End of text section */ _etext = .; /* End of text section */
......
...@@ -18,10 +18,12 @@ obj-y=fprom ...@@ -18,10 +18,12 @@ obj-y=fprom
fprom: $(OBJ) fprom: $(OBJ)
$(LD) -static -Tfprom.lds -o fprom $(OBJ) $(LIB) $(LD) -static -Tfprom.lds -o fprom $(OBJ) $(LIB)
comma := ,
.S.o: .S.o:
$(CC) -D__ASSEMBLY__ $(AFLAGS) $(AFLAGS_KERNEL) -c -o $*.o $< $(CC) -D__ASSEMBLY__ $(AFLAGS) $(AFLAGS_KERNEL) -c -o $*.o $<
.c.o: .c.o:
$(CC) $(CFLAGS) $(CFLAGS_KERNEL) -c -o $*.o $< $(CC) $(CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) $(CFLAGS_KERNEL) -c -o $*.o $<
clean: clean:
rm -f *.o fprom rm -f *.o fprom
......
...@@ -31,8 +31,10 @@ ifeq ($(CROSS_COMPILE),) ...@@ -31,8 +31,10 @@ ifeq ($(CROSS_COMPILE),)
offsets.h: print_offsets offsets.h: print_offsets
./print_offsets > offsets.h ./print_offsets > offsets.h
comma := ,
print_offsets: print_offsets.c FORCE_RECOMPILE print_offsets: print_offsets.c FORCE_RECOMPILE
$(CC) $(CFLAGS) print_offsets.c -o $@ $(CC) $(CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) print_offsets.c -o $@
FORCE_RECOMPILE: FORCE_RECOMPILE:
...@@ -42,7 +44,7 @@ offsets.h: print_offsets.s ...@@ -42,7 +44,7 @@ offsets.h: print_offsets.s
$(AWK) -f print_offsets.awk $^ > $@ $(AWK) -f print_offsets.awk $^ > $@
print_offsets.s: print_offsets.c print_offsets.s: print_offsets.c
$(CC) $(CFLAGS) -S print_offsets.c -o $@ $(CC) $(CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -S print_offsets.c -o $@
endif endif
......
...@@ -10,7 +10,6 @@ SECTIONS ...@@ -10,7 +10,6 @@ SECTIONS
*(.head) *(.head)
*(.text) *(.text)
*(.fixup) *(.fixup)
*(.text.lock) /* out-of-line lock text */
*(.gnu.warning) *(.gnu.warning)
} = 0x4e75 } = 0x4e75
.kstrtab : { *(.kstrtab) } .kstrtab : { *(.kstrtab) }
......
...@@ -9,7 +9,6 @@ SECTIONS ...@@ -9,7 +9,6 @@ SECTIONS
.text : { .text : {
*(.text) *(.text)
*(.fixup) *(.fixup)
*(.text.lock) /* out-of-line lock text */
*(.gnu.warning) *(.gnu.warning)
} = 0x4e75 } = 0x4e75
.rodata : { *(.rodata) *(.rodata.*) } .rodata : { *(.rodata) *(.rodata.*) }
......
...@@ -13,7 +13,6 @@ SECTIONS ...@@ -13,7 +13,6 @@ SECTIONS
*(.fixup) *(.fixup)
*(.gnu.warning) *(.gnu.warning)
} = 0x0700 } = 0x0700
.text.lock : { *(.text.lock) } /* out-of-line lock text */
.rodata : { *(.rodata) } .rodata : { *(.rodata) }
.kstrtab : { *(.kstrtab) } .kstrtab : { *(.kstrtab) }
......
...@@ -13,7 +13,6 @@ SECTIONS ...@@ -13,7 +13,6 @@ SECTIONS
*(.fixup) *(.fixup)
*(.gnu.warning) *(.gnu.warning)
} = 0x0700 } = 0x0700
.text.lock : { *(.text.lock) } /* out-of-line lock text */
.rodata : { *(.rodata) *(.rodata.*) } .rodata : { *(.rodata) *(.rodata.*) }
.kstrtab : { *(.kstrtab) } .kstrtab : { *(.kstrtab) }
......
...@@ -13,7 +13,6 @@ SECTIONS ...@@ -13,7 +13,6 @@ SECTIONS
*(.fixup) *(.fixup)
*(.gnu.warning) *(.gnu.warning)
} = 0x0700 } = 0x0700
.text.lock : { *(.text.lock) } /* out-of-line lock text */
.rodata : { *(.rodata) } .rodata : { *(.rodata) }
.kstrtab : { *(.kstrtab) } .kstrtab : { *(.kstrtab) }
......
...@@ -13,7 +13,6 @@ SECTIONS ...@@ -13,7 +13,6 @@ SECTIONS
*(.fixup) *(.fixup)
*(.gnu.warning) *(.gnu.warning)
} = 0x0700 } = 0x0700
.text.lock : { *(.text.lock) } /* out-of-line lock text */
.rodata : { *(.rodata) *(.rodata.*) } .rodata : { *(.rodata) *(.rodata.*) }
.kstrtab : { *(.kstrtab) } .kstrtab : { *(.kstrtab) }
......
...@@ -23,7 +23,6 @@ SECTIONS ...@@ -23,7 +23,6 @@ SECTIONS
*(.fixup) *(.fixup)
*(.gnu.warning) *(.gnu.warning)
} = 0x0009 } = 0x0009
.text.lock : { *(.text.lock) } /* out-of-line lock text */
.rodata : { *(.rodata) *(.rodata.*) } .rodata : { *(.rodata) *(.rodata.*) }
.kstrtab : { *(.kstrtab) } .kstrtab : { *(.kstrtab) }
......
...@@ -24,23 +24,23 @@ ...@@ -24,23 +24,23 @@
asm volatile(LOCK "subl $1,(%0)\n\t" \ asm volatile(LOCK "subl $1,(%0)\n\t" \
"js 2f\n" \ "js 2f\n" \
"1:\n" \ "1:\n" \
".section .text.lock,\"ax\"\n" \ LOCK_SECTION_START("") \
"2:\tcall " helper "\n\t" \ "2:\tcall " helper "\n\t" \
"jmp 1b\n" \ "jmp 1b\n" \
".previous" \ LOCK_SECTION_END \
::"a" (rw) : "memory") ::"a" (rw) : "memory")
#define __build_read_lock_const(rw, helper) \ #define __build_read_lock_const(rw, helper) \
asm volatile(LOCK "subl $1,%0\n\t" \ asm volatile(LOCK "subl $1,%0\n\t" \
"js 2f\n" \ "js 2f\n" \
"1:\n" \ "1:\n" \
".section .text.lock,\"ax\"\n" \ LOCK_SECTION_START("") \
"2:\tpushl %%eax\n\t" \ "2:\tpushl %%eax\n\t" \
"leal %0,%%eax\n\t" \ "leal %0,%%eax\n\t" \
"call " helper "\n\t" \ "call " helper "\n\t" \
"popl %%eax\n\t" \ "popl %%eax\n\t" \
"jmp 1b\n" \ "jmp 1b\n" \
".previous" \ LOCK_SECTION_END \
:"=m" (*(volatile int *)rw) : : "memory") :"=m" (*(volatile int *)rw) : : "memory")
#define __build_read_lock(rw, helper) do { \ #define __build_read_lock(rw, helper) do { \
...@@ -54,23 +54,23 @@ ...@@ -54,23 +54,23 @@
asm volatile(LOCK "subl $" RW_LOCK_BIAS_STR ",(%0)\n\t" \ asm volatile(LOCK "subl $" RW_LOCK_BIAS_STR ",(%0)\n\t" \
"jnz 2f\n" \ "jnz 2f\n" \
"1:\n" \ "1:\n" \
".section .text.lock,\"ax\"\n" \ LOCK_SECTION_START("") \
"2:\tcall " helper "\n\t" \ "2:\tcall " helper "\n\t" \
"jmp 1b\n" \ "jmp 1b\n" \
".previous" \ LOCK_SECTION_END \
::"a" (rw) : "memory") ::"a" (rw) : "memory")
#define __build_write_lock_const(rw, helper) \ #define __build_write_lock_const(rw, helper) \
asm volatile(LOCK "subl $" RW_LOCK_BIAS_STR ",(%0)\n\t" \ asm volatile(LOCK "subl $" RW_LOCK_BIAS_STR ",(%0)\n\t" \
"jnz 2f\n" \ "jnz 2f\n" \
"1:\n" \ "1:\n" \
".section .text.lock,\"ax\"\n" \ LOCK_SECTION_START("") \
"2:\tpushl %%eax\n\t" \ "2:\tpushl %%eax\n\t" \
"leal %0,%%eax\n\t" \ "leal %0,%%eax\n\t" \
"call " helper "\n\t" \ "call " helper "\n\t" \
"popl %%eax\n\t" \ "popl %%eax\n\t" \
"jmp 1b\n" \ "jmp 1b\n" \
".previous" \ LOCK_SECTION_END \
:"=m" (*(volatile int *)rw) : : "memory") :"=m" (*(volatile int *)rw) : : "memory")
#define __build_write_lock(rw, helper) do { \ #define __build_write_lock(rw, helper) do { \
......
...@@ -101,7 +101,7 @@ static inline void __down_read(struct rw_semaphore *sem) ...@@ -101,7 +101,7 @@ static inline void __down_read(struct rw_semaphore *sem)
LOCK_PREFIX " incl (%%eax)\n\t" /* adds 0x00000001, returns the old value */ LOCK_PREFIX " incl (%%eax)\n\t" /* adds 0x00000001, returns the old value */
" js 2f\n\t" /* jump if we weren't granted the lock */ " js 2f\n\t" /* jump if we weren't granted the lock */
"1:\n\t" "1:\n\t"
".section .text.lock,\"ax\"\n" LOCK_SECTION_START("")
"2:\n\t" "2:\n\t"
" pushl %%ecx\n\t" " pushl %%ecx\n\t"
" pushl %%edx\n\t" " pushl %%edx\n\t"
...@@ -109,7 +109,7 @@ LOCK_PREFIX " incl (%%eax)\n\t" /* adds 0x00000001, returns the old value ...@@ -109,7 +109,7 @@ LOCK_PREFIX " incl (%%eax)\n\t" /* adds 0x00000001, returns the old value
" popl %%edx\n\t" " popl %%edx\n\t"
" popl %%ecx\n\t" " popl %%ecx\n\t"
" jmp 1b\n" " jmp 1b\n"
".previous" LOCK_SECTION_END
"# ending down_read\n\t" "# ending down_read\n\t"
: "+m"(sem->count) : "+m"(sem->count)
: "a"(sem) : "a"(sem)
...@@ -130,13 +130,13 @@ LOCK_PREFIX " xadd %0,(%%eax)\n\t" /* subtract 0x0000ffff, returns the old ...@@ -130,13 +130,13 @@ LOCK_PREFIX " xadd %0,(%%eax)\n\t" /* subtract 0x0000ffff, returns the old
" testl %0,%0\n\t" /* was the count 0 before? */ " testl %0,%0\n\t" /* was the count 0 before? */
" jnz 2f\n\t" /* jump if we weren't granted the lock */ " jnz 2f\n\t" /* jump if we weren't granted the lock */
"1:\n\t" "1:\n\t"
".section .text.lock,\"ax\"\n" LOCK_SECTION_START("")
"2:\n\t" "2:\n\t"
" pushl %%ecx\n\t" " pushl %%ecx\n\t"
" call rwsem_down_write_failed\n\t" " call rwsem_down_write_failed\n\t"
" popl %%ecx\n\t" " popl %%ecx\n\t"
" jmp 1b\n" " jmp 1b\n"
".previous\n" LOCK_SECTION_END
"# ending down_write" "# ending down_write"
: "+d"(tmp), "+m"(sem->count) : "+d"(tmp), "+m"(sem->count)
: "a"(sem) : "a"(sem)
...@@ -154,7 +154,7 @@ static inline void __up_read(struct rw_semaphore *sem) ...@@ -154,7 +154,7 @@ static inline void __up_read(struct rw_semaphore *sem)
LOCK_PREFIX " xadd %%edx,(%%eax)\n\t" /* subtracts 1, returns the old value */ LOCK_PREFIX " xadd %%edx,(%%eax)\n\t" /* subtracts 1, returns the old value */
" js 2f\n\t" /* jump if the lock is being waited upon */ " js 2f\n\t" /* jump if the lock is being waited upon */
"1:\n\t" "1:\n\t"
".section .text.lock,\"ax\"\n" LOCK_SECTION_START("")
"2:\n\t" "2:\n\t"
" decw %%dx\n\t" /* do nothing if still outstanding active readers */ " decw %%dx\n\t" /* do nothing if still outstanding active readers */
" jnz 1b\n\t" " jnz 1b\n\t"
...@@ -162,7 +162,7 @@ LOCK_PREFIX " xadd %%edx,(%%eax)\n\t" /* subtracts 1, returns the old valu ...@@ -162,7 +162,7 @@ LOCK_PREFIX " xadd %%edx,(%%eax)\n\t" /* subtracts 1, returns the old valu
" call rwsem_wake\n\t" " call rwsem_wake\n\t"
" popl %%ecx\n\t" " popl %%ecx\n\t"
" jmp 1b\n" " jmp 1b\n"
".previous\n" LOCK_SECTION_END
"# ending __up_read\n" "# ending __up_read\n"
: "+m"(sem->count), "+d"(tmp) : "+m"(sem->count), "+d"(tmp)
: "a"(sem) : "a"(sem)
...@@ -180,7 +180,7 @@ static inline void __up_write(struct rw_semaphore *sem) ...@@ -180,7 +180,7 @@ static inline void __up_write(struct rw_semaphore *sem)
LOCK_PREFIX " xaddl %%edx,(%%eax)\n\t" /* tries to transition 0xffff0001 -> 0x00000000 */ LOCK_PREFIX " xaddl %%edx,(%%eax)\n\t" /* tries to transition 0xffff0001 -> 0x00000000 */
" jnz 2f\n\t" /* jump if the lock is being waited upon */ " jnz 2f\n\t" /* jump if the lock is being waited upon */
"1:\n\t" "1:\n\t"
".section .text.lock,\"ax\"\n" LOCK_SECTION_START("")
"2:\n\t" "2:\n\t"
" decw %%dx\n\t" /* did the active count reduce to 0? */ " decw %%dx\n\t" /* did the active count reduce to 0? */
" jnz 1b\n\t" /* jump back if not */ " jnz 1b\n\t" /* jump back if not */
...@@ -188,7 +188,7 @@ LOCK_PREFIX " xaddl %%edx,(%%eax)\n\t" /* tries to transition 0xffff0001 -> ...@@ -188,7 +188,7 @@ LOCK_PREFIX " xaddl %%edx,(%%eax)\n\t" /* tries to transition 0xffff0001 ->
" call rwsem_wake\n\t" " call rwsem_wake\n\t"
" popl %%ecx\n\t" " popl %%ecx\n\t"
" jmp 1b\n" " jmp 1b\n"
".previous\n" LOCK_SECTION_END
"# ending __up_write\n" "# ending __up_write\n"
: "+m"(sem->count) : "+m"(sem->count)
: "a"(sem), "i"(-RWSEM_ACTIVE_WRITE_BIAS) : "a"(sem), "i"(-RWSEM_ACTIVE_WRITE_BIAS)
......
...@@ -122,10 +122,10 @@ static inline void down(struct semaphore * sem) ...@@ -122,10 +122,10 @@ static inline void down(struct semaphore * sem)
LOCK "decl %0\n\t" /* --sem->count */ LOCK "decl %0\n\t" /* --sem->count */
"js 2f\n" "js 2f\n"
"1:\n" "1:\n"
".section .text.lock,\"ax\"\n" LOCK_SECTION_START("")
"2:\tcall __down_failed\n\t" "2:\tcall __down_failed\n\t"
"jmp 1b\n" "jmp 1b\n"
".previous" LOCK_SECTION_END
:"=m" (sem->count) :"=m" (sem->count)
:"c" (sem) :"c" (sem)
:"memory"); :"memory");
...@@ -149,10 +149,10 @@ static inline int down_interruptible(struct semaphore * sem) ...@@ -149,10 +149,10 @@ static inline int down_interruptible(struct semaphore * sem)
"js 2f\n\t" "js 2f\n\t"
"xorl %0,%0\n" "xorl %0,%0\n"
"1:\n" "1:\n"
".section .text.lock,\"ax\"\n" LOCK_SECTION_START("")
"2:\tcall __down_failed_interruptible\n\t" "2:\tcall __down_failed_interruptible\n\t"
"jmp 1b\n" "jmp 1b\n"
".previous" LOCK_SECTION_END
:"=a" (result), "=m" (sem->count) :"=a" (result), "=m" (sem->count)
:"c" (sem) :"c" (sem)
:"memory"); :"memory");
...@@ -177,10 +177,10 @@ static inline int down_trylock(struct semaphore * sem) ...@@ -177,10 +177,10 @@ static inline int down_trylock(struct semaphore * sem)
"js 2f\n\t" "js 2f\n\t"
"xorl %0,%0\n" "xorl %0,%0\n"
"1:\n" "1:\n"
".section .text.lock,\"ax\"\n" LOCK_SECTION_START("")
"2:\tcall __down_failed_trylock\n\t" "2:\tcall __down_failed_trylock\n\t"
"jmp 1b\n" "jmp 1b\n"
".previous" LOCK_SECTION_END
:"=a" (result), "=m" (sem->count) :"=a" (result), "=m" (sem->count)
:"c" (sem) :"c" (sem)
:"memory"); :"memory");
...@@ -203,10 +203,11 @@ static inline void up(struct semaphore * sem) ...@@ -203,10 +203,11 @@ static inline void up(struct semaphore * sem)
LOCK "incl %0\n\t" /* ++sem->count */ LOCK "incl %0\n\t" /* ++sem->count */
"jle 2f\n" "jle 2f\n"
"1:\n" "1:\n"
".section .text.lock,\"ax\"\n" LOCK_SECTION_START("")
"2:\tcall __up_wakeup\n\t" "2:\tcall __up_wakeup\n\t"
"jmp 1b\n" "jmp 1b\n"
".previous" LOCK_SECTION_END
".subsection 0\n"
:"=m" (sem->count) :"=m" (sem->count)
:"c" (sem) :"c" (sem)
:"memory"); :"memory");
......
...@@ -33,12 +33,12 @@ do { \ ...@@ -33,12 +33,12 @@ do { \
"jnz 2f;" \ "jnz 2f;" \
"1:;" \ "1:;" \
\ \
".section .text.lock,\"ax\";" \ LOCK_SECTION_START("") \
"2: pushl %%eax; pushl %%ecx; pushl %%edx;" \ "2: pushl %%eax; pushl %%ecx; pushl %%edx;" \
"call %c1;" \ "call %c1;" \
"popl %%edx; popl %%ecx; popl %%eax;" \ "popl %%edx; popl %%ecx; popl %%eax;" \
"jmp 1b;" \ "jmp 1b;" \
".previous;" \ LOCK_SECTION_END \
\ \
: /* no output */ \ : /* no output */ \
: "r" (ptr), "i" (do_softirq) \ : "r" (ptr), "i" (do_softirq) \
......
...@@ -56,13 +56,13 @@ typedef struct { ...@@ -56,13 +56,13 @@ typedef struct {
"\n1:\t" \ "\n1:\t" \
"lock ; decb %0\n\t" \ "lock ; decb %0\n\t" \
"js 2f\n" \ "js 2f\n" \
".section .text.lock,\"ax\"\n" \ LOCK_SECTION_START("") \
"2:\t" \ "2:\t" \
"cmpb $0,%0\n\t" \ "cmpb $0,%0\n\t" \
"rep;nop\n\t" \ "rep;nop\n\t" \
"jle 2b\n\t" \ "jle 2b\n\t" \
"jmp 1b\n" \ "jmp 1b\n" \
".previous" LOCK_SECTION_END
/* /*
* This works. Despite all the confusion. * This works. Despite all the confusion.
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <linux/wait.h> #include <linux/wait.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/rwsem.h> #include <linux/rwsem.h>
#include <linux/stringify.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/atomic.h> #include <asm/atomic.h>
...@@ -94,11 +95,10 @@ extern inline void down(struct semaphore * sem) ...@@ -94,11 +95,10 @@ extern inline void down(struct semaphore * sem)
"subql #1,%0@\n\t" "subql #1,%0@\n\t"
"jmi 2f\n\t" "jmi 2f\n\t"
"1:\n" "1:\n"
".section .text.lock,\"ax\"\n" LOCK_SECTION_START(".even\n\t")
".even\n"
"2:\tpea 1b\n\t" "2:\tpea 1b\n\t"
"jbra __down_failed\n" "jbra __down_failed\n"
".previous" LOCK_SECTION_END
: /* no outputs */ : /* no outputs */
: "a" (sem1) : "a" (sem1)
: "memory"); : "memory");
...@@ -119,11 +119,10 @@ extern inline int down_interruptible(struct semaphore * sem) ...@@ -119,11 +119,10 @@ extern inline int down_interruptible(struct semaphore * sem)
"jmi 2f\n\t" "jmi 2f\n\t"
"clrl %0\n" "clrl %0\n"
"1:\n" "1:\n"
".section .text.lock,\"ax\"\n" LOCK_SECTION_START(".even\n\t")
".even\n"
"2:\tpea 1b\n\t" "2:\tpea 1b\n\t"
"jbra __down_failed_interruptible\n" "jbra __down_failed_interruptible\n"
".previous" LOCK_SECTION_END
: "=d" (result) : "=d" (result)
: "a" (sem1) : "a" (sem1)
: "memory"); : "memory");
...@@ -145,11 +144,10 @@ extern inline int down_trylock(struct semaphore * sem) ...@@ -145,11 +144,10 @@ extern inline int down_trylock(struct semaphore * sem)
"jmi 2f\n\t" "jmi 2f\n\t"
"clrl %0\n" "clrl %0\n"
"1:\n" "1:\n"
".section .text.lock,\"ax\"\n" LOCK_SECTION_START(".even\n\t")
".even\n"
"2:\tpea 1b\n\t" "2:\tpea 1b\n\t"
"jbra __down_failed_trylock\n" "jbra __down_failed_trylock\n"
".previous" LOCK_SECTION_END
: "=d" (result) : "=d" (result)
: "a" (sem1) : "a" (sem1)
: "memory"); : "memory");
...@@ -175,12 +173,11 @@ extern inline void up(struct semaphore * sem) ...@@ -175,12 +173,11 @@ extern inline void up(struct semaphore * sem)
"addql #1,%0@\n\t" "addql #1,%0@\n\t"
"jle 2f\n" "jle 2f\n"
"1:\n" "1:\n"
".section .text.lock,\"ax\"\n" LOCK_SECTION_START(".even\n\t")
".even\n"
"2:\t" "2:\t"
"pea 1b\n\t" "pea 1b\n\t"
"jbra __up_wakeup\n" "jbra __up_wakeup\n"
".previous" LOCK_SECTION_END
: /* no outputs */ : /* no outputs */
: "a" (sem1) : "a" (sem1)
: "memory"); : "memory");
......
...@@ -12,10 +12,6 @@ ...@@ -12,10 +12,6 @@
* *
*/ */
/* if you're going to use out-of-line slowpaths, use .section .lock.text,
* not .text.lock or the -ffunction-sections monster will eat you alive
*/
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/rwsem.h> #include <linux/rwsem.h>
......
...@@ -3,10 +3,6 @@ ...@@ -3,10 +3,6 @@
#include <asm/system.h> #include <asm/system.h>
/* if you're going to use out-of-line slowpaths, use .section .lock.text,
* not .text.lock or the -ffunction-sections monster will eat you alive
*/
/* we seem to be the only architecture that uses 0 to mean locked - but we /* we seem to be the only architecture that uses 0 to mean locked - but we
* have to. prumpf */ * have to. prumpf */
......
...@@ -35,6 +35,23 @@ ...@@ -35,6 +35,23 @@
if (!__r) local_bh_enable(); \ if (!__r) local_bh_enable(); \
__r; }) __r; })
/* Must define these before including other files, inline functions need them */
#include <linux/stringify.h>
#define LOCK_SECTION_NAME \
".text.lock." __stringify(KBUILD_BASENAME)
#define LOCK_SECTION_START(extra) \
".subsection 1\n\t" \
extra \
".ifndef " LOCK_SECTION_NAME "\n\t" \
LOCK_SECTION_NAME ":\n\t" \
".endif\n\t"
#define LOCK_SECTION_END \
".previous\n\t"
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
#include <asm/spinlock.h> #include <asm/spinlock.h>
......
#ifndef __LINUX_STRINGIFY_H
#define __LINUX_STRINGIFY_H
/* Indirect stringification. Doing two levels allows the parameter to be a
* macro itself. For example, compile with -DFOO=bar, __stringify(FOO)
* converts to "bar".
*/
#define __stringify_1(x) #x
#define __stringify(x) __stringify_1(x)
#endif /* !__LINUX_STRINGIFY_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment