[LUGA] Mit freundlicher Unterstützung von:
Linux New Media AG

Mail Thread Index


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[luga] gcc reg allocator



Hi,

in einem meiner projekte hab' ich folgenden code:

--snip--
/*
 * This doesn't resolve any symbols and doesn't use
 * any libc features. So it's the perfect debug function
 * for our purposes.
 */
static void wrapper_debug_out(char *txt) {
        long len = 0;

        while (txt[len]) len++;

        asm volatile (
                        "int $0x80"
                : /* output */
                : /* input */
                        "a" ((long)(4)),        /* write  */
                        "b" ((long)(2)),        /* stderr */
                        "c" ((long)(txt)),      /* text   */
                        "d" ((long)(len))       /* length */
        );
}
--snap--

dafuer bekomm' ich vom compiler die meldung

wrapper.c:37: error: can't find a register in class `BREG' while reloading `asm'

das ganze funktioniert wenn ich statt dessen folgendes assembler template
verwende:

--snip--
        asm volatile (
                        "pushl %%ebx\n\t"
                        "mov $2, %%ebx\n\t"     /* stderr */
                        "int $0x80\n\t"
                        "popl %%ebx"
                : /* output */
                : /* input */
                        "a" ((long)(4)),        /* write  */
                        "c" ((long)(txt)),      /* text   */
                        "d" ((long)(len))       /* length */
        );
--snap--

kann ich dem register allocator irgendwie sagen dass er %ebx gefaelligst
selbst pushen soll wenn es gerade nicht frei ist?

lg,
 - clifford

--
 ____   ___   ____ _  __  _     _ www.rocklinux.org
|  _ \ / _ \ / ___| |/ / | |   (_)_ __  _   ___  __
| |_) | | | | |   | ' /  | |   | | '_ \| | | \ \/ /
|  _ <| |_| | |___| . \  | |___| | | | | |_| |>  <         Clifford Wolf
|_| \_\\___/ \____|_|\_\ |_____|_|_| |_|\__,_/_/\_\      www.clifford.at

I would rather use Java than Python. And I'd rather be eaten by a crocodile
than use Java.




powered by LINUX the choice of a gnu generation
linux user group austria;
Suche
Suche
Letzte Änderung:
webmaster@luga.at
Mai 2009