From: ralf@uni-koblenz.de
To: Harald Koerfgen <harald.koerfgen@netcologne.de>,
linux-mips@fnet.fr, linux@cthulhu.engr.sgi.com
Subject: R3000 glibc
Date: Thu, 5 Mar 1998 21:31:44 +0100 [thread overview]
Message-ID: <19980305213144.33306@uni-koblenz.de> (raw)
In-Reply-To: <XFMail.980305202951.harald.koerfgen@netcologne.de>; from Harald Koerfgen on Thu, Mar 05, 1998 at 08:29:51PM +0100
Thought this might as well be interesting to other as well, so I copy this
to the usual lists.
On Thu, Mar 05, 1998 at 08:29:51PM +0100, Harald Koerfgen wrote:
> BTW Eine Sache, die ich schon immer wissen wollte, aber nie zu fragen wagte:
>
> Wie sieht das eigentlich mit der CPU-Abhaengigkeit der glibc aus?
>
> Ich habe gerade damit anfgefangen, mich mit dem Ramdisk-Support fuer linux/MIPS zu
> beschaeftigen und moechte spaeter einmal ein Ramdisk-Image zum Kernel-Image
> dazulinken, welches als root gemountet werden soll. Auf diesem moechte ich eine
> statisch gelinkte bash unterbringen. Meine eigentliche Frage ist nun, wuerde das mit
> der existierenden glibc funktionieren, oder muesste ich eine R3000-spezifische glibc
> bauen?
All the published userland binaries have been compiled using MIPS ISA 1. The
sole exception is glibc. As it is usual for Linux, the MIPS binaries of
glibc have been built using the three add-ons crypt, localedata and
linuxthreads. In order to be threadsafe LinuxThreads has to use some kind of
semaphores etc.. Since it is the natural way of doing things for R6000 and
better, I choose to implement this using the ll and sc instructions.
For the members of the MIPS CPU family which are lacking these two
instructions I suggest to simulate them in the reserved instruction handler.
This will work for all uniprocessor systems and using the special hardware
which is part of old R2000/R3000 systems it would even be SMP proof - if
we ever do R3000 SMP ... It wouldn't be interrupt safe as well.
The implementation could roughly look like:
unsigned long ll_bit, lladdr;
void simulate_ll(struct pt_regs *regs)
{
unsigned long addr;
/*
* analyse the ll instruction that just caused a ri exception
* and put the referenced address to addr.
*/
[...]
lladdr = addr;
ll_bit = 1;
regs[reg_to_be_loaded] = *addr;
}
void simulate_sc(struct pt_regs *regs)
{
/*
* analyse the ll instruction that just caused a ri exception
* and put the referenced address to addr.
*/
[...]
lladdr = addr;
if (ll_bit = 0) {
regs[reg_to_be_stored] = 0;
return;
}
*addr = regs[reg_to_be_loaded];
regs[reg_to_be_loaded] = 1;
}
The scheduler would have to clear ll_bit on every context switch in order
to take care of shared memory and threads sharing their mm_struct.
There are for shure better ways of doing this, but this implementation would
keep the 100% binary compatibility. The way not to do it is to use
sysmips(MIPS_ATOMIC_SET, ...) syscall which would result in the full
syscall overhead. Even though Linux's is way less than RISC/OS's ...
Ralf
next parent reply other threads:[~1998-03-05 20:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <19980305003010.18771@uni-koblenz.de>
[not found] ` <XFMail.980305202951.harald.koerfgen@netcologne.de>
1998-03-05 20:31 ` ralf [this message]
1998-03-05 21:57 ` R3000 glibc Greg Chesson
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=19980305213144.33306@uni-koblenz.de \
--to=ralf@uni-koblenz.de \
--cc=harald.koerfgen@netcologne.de \
--cc=linux-mips@fnet.fr \
--cc=linux@cthulhu.engr.sgi.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox