Skip to content

Commit 5579a78

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6: math-emu: Fix thinko in _FP_DIV math-emu: Fix signalling of underflow and inexact while packing result. sparc: Add checkstack support sparc: correct section of current_pc() sparc: correct section of apc_no_idle sparc64: Fix race in arch/sparc64/kernel/trampoline.S
2 parents 969907a + 60b8267 commit 5579a78

File tree

5 files changed

+35
-9
lines changed

5 files changed

+35
-9
lines changed

arch/sparc/kernel/apc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#define APC_DEVNAME "apc"
3232

3333
static u8 __iomem *regs;
34-
static int apc_no_idle __initdata = 0;
34+
static int apc_no_idle __devinitdata = 0;
3535

3636
#define apc_readb(offs) (sbus_readb(regs+offs))
3737
#define apc_writeb(val, offs) (sbus_writeb(val, regs+offs))

arch/sparc/kernel/head.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@ gokernel:
465465
mov %o7, %g4 ! Save %o7
466466

467467
/* Jump to it, and pray... */
468+
__INIT
468469
current_pc:
469470
call 1f
470471
nop

arch/sparc64/kernel/trampoline.S

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,12 @@ after_lock_tlb:
328328

329329
wrpr %g0, 0, %wstate
330330

331+
sethi %hi(prom_entry_lock), %g2
332+
1: ldstub [%g2 + %lo(prom_entry_lock)], %g1
333+
membar #StoreLoad | #StoreStore
334+
brnz,pn %g1, 1b
335+
nop
336+
331337
/* As a hack, put &init_thread_union into %g6.
332338
* prom_world() loads from here to restore the %asi
333339
* register.
@@ -337,7 +343,7 @@ after_lock_tlb:
337343

338344
sethi %hi(is_sun4v), %o0
339345
lduw [%o0 + %lo(is_sun4v)], %o0
340-
brz,pt %o0, 1f
346+
brz,pt %o0, 2f
341347
nop
342348

343349
TRAP_LOAD_TRAP_BLOCK(%g2, %g3)
@@ -369,10 +375,10 @@ after_lock_tlb:
369375
call %o1
370376
add %sp, (2047 + 128), %o0
371377

372-
ba,pt %xcc, 2f
378+
ba,pt %xcc, 3f
373379
nop
374380

375-
1: sethi %hi(sparc64_ttable_tl0), %o0
381+
2: sethi %hi(sparc64_ttable_tl0), %o0
376382
set prom_set_trap_table_name, %g2
377383
stx %g2, [%sp + 2047 + 128 + 0x00]
378384
mov 1, %g2
@@ -386,7 +392,11 @@ after_lock_tlb:
386392
call %o1
387393
add %sp, (2047 + 128), %o0
388394

389-
2: ldx [%l0], %g6
395+
3: sethi %hi(prom_entry_lock), %g2
396+
stb %g0, [%g2 + %lo(prom_entry_lock)]
397+
membar #StoreStore | #StoreLoad
398+
399+
ldx [%l0], %g6
390400
ldx [%g6 + TI_TASK], %g4
391401

392402
mov 1, %g5

include/math-emu/op-common.h

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,18 +139,27 @@ do { \
139139
if (X##_e <= _FP_WFRACBITS_##fs) \
140140
{ \
141141
_FP_FRAC_SRS_##wc(X, X##_e, _FP_WFRACBITS_##fs); \
142-
_FP_ROUND(wc, X); \
143142
if (_FP_FRAC_HIGH_##fs(X) \
144143
& (_FP_OVERFLOW_##fs >> 1)) \
145144
{ \
146145
X##_e = 1; \
147146
_FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
148-
FP_SET_EXCEPTION(FP_EX_INEXACT); \
149147
} \
150148
else \
151149
{ \
152-
X##_e = 0; \
153-
_FP_FRAC_SRL_##wc(X, _FP_WORKBITS); \
150+
_FP_ROUND(wc, X); \
151+
if (_FP_FRAC_HIGH_##fs(X) \
152+
& (_FP_OVERFLOW_##fs >> 1)) \
153+
{ \
154+
X##_e = 1; \
155+
_FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
156+
FP_SET_EXCEPTION(FP_EX_INEXACT); \
157+
} \
158+
else \
159+
{ \
160+
X##_e = 0; \
161+
_FP_FRAC_SRL_##wc(X, _FP_WORKBITS); \
162+
} \
154163
} \
155164
if ((FP_CUR_EXCEPTIONS & FP_EX_INEXACT) || \
156165
(FP_TRAPPING_EXCEPTIONS & FP_EX_UNDERFLOW)) \
@@ -494,6 +503,8 @@ do { \
494503
R##_c = FP_CLS_NAN; \
495504
_FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
496505
FP_SET_EXCEPTION(FP_EX_INVALID | FP_EX_INVALID_IDI);\
506+
break; \
507+
\
497508
case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO): \
498509
R##_s = _FP_NANSIGN_##fs; \
499510
R##_c = FP_CLS_NAN; \

scripts/checkstack.pl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
# M68k port by Geert Uytterhoeven and Andreas Schwab
1515
# AVR32 port by Haavard Skinnemoen <[email protected]>
1616
# PARISC port by Kyle McMartin <[email protected]>
17+
# sparc port by Martin Habets <[email protected]>
1718
#
1819
# Usage:
1920
# objdump -d vmlinux | scripts/checkstack.pl [arch]
@@ -94,6 +95,9 @@
9495
} elsif ($arch =~ /^blackfin$/) {
9596
# 0: 00 e8 38 01 LINK 0x4e0;
9697
$re = qr/.*[[:space:]]LINK[[:space:]]*(0x$x{1,8})/o;
98+
} elsif ($arch eq 'sparc' || $arch eq 'sparc64') {
99+
# f0019d10: 9d e3 bf 90 save %sp, -112, %sp
100+
$re = qr/.*save.*%sp, -(([0-9]{2}|[3-9])[0-9]{2}), %sp/o;
97101
} else {
98102
print("wrong or unknown architecture \"$arch\"\n");
99103
exit

0 commit comments

Comments
 (0)