All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Joel Soete" <jsoe0708@tiscali.be>
To: "Grant Grundler" <grundler@parisc-linux.org>
Cc: parisc-linux@lists.parisc-linux.org
Subject: Re: [parisc-linux] byte swapping redux
Date: Wed, 2 Jul 2003 17:10:13 +0200	[thread overview]
Message-ID: <3ED70CF10000D286@ocpmta2.freegates.net> (raw)
In-Reply-To: <20030701181327.GC14683@dsl2.external.hp.com>

[-- Attachment #1: Type: text/plain, Size: 1800 bytes --]


> Maybe our userspace will encounter this problem as well since I've
> ripped out the __STRICT_ANSI__ test...can you work this out?

I will see what I can do for this 

> > I also write this small testcase to try to point out the pb in 32bits
mode:
> ...
> > And here is the results:
> > Val of TU64: fedcba9876543210
> > Val of ___arch__swab64(TU64): 76543210fedcba98
> > Val of __fswab64(TU64): 1032547698badcfe
[...]
> __fswab64() is correct.
> ___arch__swab64() didn't actually swap within the  32-bit word
[...]

static __inline__ __const__ __u64 ___arch__swab64(__u64 x)
{
	__u32 t1 = (__u32) x;
	__u32 t2 = (__u32) ((x) >> 32);
	return ((__u64) ___arch__swab32(t1) << 32) + ((__u64) ___arch__swab32(t2))
>     
}

That works for my 32bits kernel on my b2k :-) (just replace 't1' by 'l' and
't2' by 'h' ;) )

btw here is also a small patch I just test also for cdrom pb encounter by
somebody else:
--- system_irqsave.h.orig	2003-07-02 17:34:02.000000000 +0200
+++ system_irqsave.h	2003-07-02 17:35:59.000000000 +0200
@@ -7,8 +7,13 @@
 #define __cli()	__asm__ __volatile__("rsm %0,%%r0\n" : : "i" (PSW_I) : "memory"
)
 #define __sti()	__asm__ __volatile__("ssm %0,%%r0\n" : : "i" (PSW_I) : "memory"
)
 
+#define __save_and_cli(x)  do { __save_flags(x); __cli(); } while(0);
+#define __save_and_sti(x)  do { __save_flags(x); __sti(); } while(0);
+
+/* For spinlocks etc */
 #define local_irq_save(x) \
 	__asm__ __volatile__("rsm %1,%0" : "=r" (x) :"i" (PSW_I) : "memory" )
+#define local_irq_set(x)   __save_and_sti(x)
 #define local_irq_restore(x) \
 	__asm__ __volatile__("mtsm %0" : : "r" (x) : "memory" )
 #define local_irq_disable() __cli()

( may be possible to do better ??)

Joel





---------------------------------
Tiscali ADSL: 19,50 euros/mois...abonnez-vous sur www.tiscali.be



[-- Attachment #2: system_irqsave-patch --]
[-- Type: application/octet-stream, Size: 747 bytes --]

--- system_irqsave.h.orig	2003-07-02 17:34:02.000000000 +0200
+++ system_irqsave.h	2003-07-02 17:35:59.000000000 +0200
@@ -7,8 +7,13 @@
 #define __cli()	__asm__ __volatile__("rsm %0,%%r0\n" : : "i" (PSW_I) : "memory" )
 #define __sti()	__asm__ __volatile__("ssm %0,%%r0\n" : : "i" (PSW_I) : "memory" )
 
+#define __save_and_cli(x)  do { __save_flags(x); __cli(); } while(0);
+#define __save_and_sti(x)  do { __save_flags(x); __sti(); } while(0);
+
+/* For spinlocks etc */
 #define local_irq_save(x) \
 	__asm__ __volatile__("rsm %1,%0" : "=r" (x) :"i" (PSW_I) : "memory" )
+#define local_irq_set(x)   __save_and_sti(x)
 #define local_irq_restore(x) \
 	__asm__ __volatile__("mtsm %0" : : "r" (x) : "memory" )
 #define local_irq_disable() __cli()

  reply	other threads:[~2003-07-02 15:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3ED70CF10000BCAA@ocpmta2.freegates.net>
2003-06-30 16:36 ` [parisc-linux] byte swapping redux Grant Grundler
2003-07-01 16:33   ` Joel Soete
2003-07-01 18:13     ` Grant Grundler
2003-07-02 15:10       ` Joel Soete [this message]
2003-06-29 18:14 Grant Grundler
2003-06-29 18:33 ` Grant Grundler
2003-06-29 18:41 ` Matthew Wilcox
2003-06-29 21:33   ` Grant Grundler
2003-06-30 10:19     ` Joel Soete
2003-06-30 16:39       ` Grant Grundler
2003-07-01  7:29         ` Joel Soete

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3ED70CF10000D286@ocpmta2.freegates.net \
    --to=jsoe0708@tiscali.be \
    --cc=grundler@parisc-linux.org \
    --cc=parisc-linux@lists.parisc-linux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.