* PATCH: Fix 2.6 kernel for the new ia64 assembler
@ 2005-10-07 18:01 H. J. Lu
2005-10-07 18:05 ` David Mosberger-Tang
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: H. J. Lu @ 2005-10-07 18:01 UTC (permalink / raw)
To: linux ia64 kernel; +Cc: linux kernel
[-- Attachment #1: Type: text/plain, Size: 304 bytes --]
The new ia64 assembler uses slot 1 for the offset of a long (2-slot)
instruction and the old assembler uses slot 2. The 2.6 kernel assumes
slot 2 and won't boot when the new assembler is used:
http://sources.redhat.com/bugzilla/show_bug.cgi?id=1433
This patch will work with either slot 1 or 2.
H.J.
[-- Attachment #2: linux-2.6-ia64-slo1-1.patch --]
[-- Type: text/plain, Size: 1510 bytes --]
--- linux/arch/ia64/kernel/patch.c.slot 2004-10-18 14:54:39.000000000 -0700
+++ linux/arch/ia64/kernel/patch.c 2005-10-07 09:23:04.000000000 -0700
@@ -64,22 +64,30 @@ ia64_patch (u64 insn_addr, u64 mask, u64
void
ia64_patch_imm64 (u64 insn_addr, u64 val)
{
- ia64_patch(insn_addr,
+ /* The assembler may generate offset pointing to either slot 1
+ or slot 2 for a long (2-slot) instruction, occupying slots 1
+ and 2. */
+ insn_addr &= -16UL;
+ ia64_patch(insn_addr + 2,
0x01fffefe000UL, ( ((val & 0x8000000000000000UL) >> 27) /* bit 63 -> 36 */
| ((val & 0x0000000000200000UL) << 0) /* bit 21 -> 21 */
| ((val & 0x00000000001f0000UL) << 6) /* bit 16 -> 22 */
| ((val & 0x000000000000ff80UL) << 20) /* bit 7 -> 27 */
| ((val & 0x000000000000007fUL) << 13) /* bit 0 -> 13 */));
- ia64_patch(insn_addr - 1, 0x1ffffffffffUL, val >> 22);
+ ia64_patch(insn_addr + 1, 0x1ffffffffffUL, val >> 22);
}
void
ia64_patch_imm60 (u64 insn_addr, u64 val)
{
- ia64_patch(insn_addr,
+ /* The assembler may generate offset pointing to either slot 1
+ or slot 2 for a long (2-slot) instruction, occupying slots 1
+ and 2. */
+ insn_addr &= -16UL;
+ ia64_patch(insn_addr + 2,
0x011ffffe000UL, ( ((val & 0x0800000000000000UL) >> 23) /* bit 59 -> 36 */
| ((val & 0x00000000000fffffUL) << 13) /* bit 0 -> 13 */));
- ia64_patch(insn_addr - 1, 0x1fffffffffcUL, val >> 18);
+ ia64_patch(insn_addr + 1, 0x1fffffffffcUL, val >> 18);
}
/*
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PATCH: Fix 2.6 kernel for the new ia64 assembler
2005-10-07 18:01 PATCH: Fix 2.6 kernel for the new ia64 assembler H. J. Lu
@ 2005-10-07 18:05 ` David Mosberger-Tang
2005-10-07 18:19 ` James E Wilson
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: David Mosberger-Tang @ 2005-10-07 18:05 UTC (permalink / raw)
To: H. J. Lu; +Cc: linux ia64 kernel, linux kernel
Looks fine to me.
--david
On 10/7/05, H. J. Lu <hjl@lucon.org> wrote:
> The new ia64 assembler uses slot 1 for the offset of a long (2-slot)
> instruction and the old assembler uses slot 2. The 2.6 kernel assumes
> slot 2 and won't boot when the new assembler is used:
>
> http://sources.redhat.com/bugzilla/show_bug.cgi?id\x1433
>
> This patch will work with either slot 1 or 2.
>
>
> H.J.
>
>
>
--
Mosberger Consulting LLC, voice/fax: 510-744-9372,
http://www.mosberger-consulting.com/
35706 Runckel Lane, Fremont, CA 94536
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PATCH: Fix 2.6 kernel for the new ia64 assembler
2005-10-07 18:01 PATCH: Fix 2.6 kernel for the new ia64 assembler H. J. Lu
2005-10-07 18:05 ` David Mosberger-Tang
@ 2005-10-07 18:19 ` James E Wilson
2005-10-07 19:27 ` Magenheimer, Dan (HP Labs Fort Collins)
2005-10-07 19:56 ` James E Wilson
3 siblings, 0 replies; 5+ messages in thread
From: James E Wilson @ 2005-10-07 18:19 UTC (permalink / raw)
To: linux-ia64
On Fri, 2005-10-07 at 11:01, H. J. Lu wrote:
> The new ia64 assembler uses slot 1 for the offset of a long (2-slot)
> instruction and the old assembler uses slot 2. The 2.6 kernel assumes
> slot 2 and won't boot when the new assembler is used:
Specifically, this is in reference to tags occurring immediately before
a long instruction.
Given something like
.text
nop
[L1:]
movl
The value of L1 should be .text+1 but it was incorrectly .text+2 until
about 2 weeks ago. Unfortunately, there is code in the kernel that
relies on the incorrect value, and needs to be fixed. H.J.'s patch
fixes this.
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: PATCH: Fix 2.6 kernel for the new ia64 assembler
2005-10-07 18:01 PATCH: Fix 2.6 kernel for the new ia64 assembler H. J. Lu
2005-10-07 18:05 ` David Mosberger-Tang
2005-10-07 18:19 ` James E Wilson
@ 2005-10-07 19:27 ` Magenheimer, Dan (HP Labs Fort Collins)
2005-10-07 19:56 ` James E Wilson
3 siblings, 0 replies; 5+ messages in thread
From: Magenheimer, Dan (HP Labs Fort Collins) @ 2005-10-07 19:27 UTC (permalink / raw)
To: linux-ia64
Will the fixed code work on both old and new assemblers?
If not, isn't there a potential gcc/kernel version mismatch
problem?
> -----Original Message-----
> From: linux-ia64-owner@vger.kernel.org
> [mailto:linux-ia64-owner@vger.kernel.org] On Behalf Of James E Wilson
> Sent: Friday, October 07, 2005 12:20 PM
> Cc: linux ia64 kernel
> Subject: Re: PATCH: Fix 2.6 kernel for the new ia64 assembler
>
> On Fri, 2005-10-07 at 11:01, H. J. Lu wrote:
> > The new ia64 assembler uses slot 1 for the offset of a long (2-slot)
> > instruction and the old assembler uses slot 2. The 2.6
> kernel assumes
> > slot 2 and won't boot when the new assembler is used:
>
> Specifically, this is in reference to tags occurring
> immediately before
> a long instruction.
>
> Given something like
> .text
> nop
> [L1:]
> movl
> The value of L1 should be .text+1 but it was incorrectly .text+2 until
> about 2 weeks ago. Unfortunately, there is code in the kernel that
> relies on the incorrect value, and needs to be fixed. H.J.'s patch
> fixes this.
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe
> linux-ia64" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: PATCH: Fix 2.6 kernel for the new ia64 assembler
2005-10-07 18:01 PATCH: Fix 2.6 kernel for the new ia64 assembler H. J. Lu
` (2 preceding siblings ...)
2005-10-07 19:27 ` Magenheimer, Dan (HP Labs Fort Collins)
@ 2005-10-07 19:56 ` James E Wilson
3 siblings, 0 replies; 5+ messages in thread
From: James E Wilson @ 2005-10-07 19:56 UTC (permalink / raw)
To: linux-ia64
On Fri, 2005-10-07 at 12:27, Magenheimer, Dan (HP Labs Fort Collins)
wrote:
> Will the fixed code work on both old and new assemblers?
Yes. It is independent of the assembler, at the expense of being
slightly slower than necessary. The code does an &=-16 to get a bundle
address, then adds 1 or 2 as appropriate to reach each slot. Ideally,
the &=-16 should not be needed, but it is there to work around the
assembler problem.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-10-07 19:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-07 18:01 PATCH: Fix 2.6 kernel for the new ia64 assembler H. J. Lu
2005-10-07 18:05 ` David Mosberger-Tang
2005-10-07 18:19 ` James E Wilson
2005-10-07 19:27 ` Magenheimer, Dan (HP Labs Fort Collins)
2005-10-07 19:56 ` James E Wilson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox