From: "Andreas Färber" <andreas.faerber@web.de>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [4932] Preliminary PPC64/Linux host support
Date: Sat, 26 Jul 2008 22:42:07 +0200 [thread overview]
Message-ID: <ACD4162C-778D-4C03-80F8-EE08719C326B@web.de> (raw)
In-Reply-To: <Pine.LNX.4.64.0807262249240.2328@linmac.oyster.ru>
[-- Attachment #1: Type: text/plain, Size: 570 bytes --]
Am 26.07.2008 um 20:54 schrieb malc:
>> there are currently numbers hardcoded for Linux.
>
> It's not just about numbers, last time i looked (cursory) the ABIs
> where
> a lot different (PPC32 case) just changing the numbers wont get one
> very
> far i think.
Of course not only, but it's one step that could be applied. The stack
alignment is 16 Bytes for both, and the prolog in my ppc(32) branch
seems to match the referenced Apple pseudocode now.
Where else do you have differences in mind? Which additional functions
may need to be adjusted?
Andreas
[-- Attachment #2: qemu-osx-ppc-tcg-2008-07-26b.diff --]
[-- Type: application/octet-stream, Size: 3005 bytes --]
diff --git a/tcg/ppc/tcg-target.c b/tcg/ppc/tcg-target.c
index 7dfb17f..3ebe68c 100644
--- a/tcg/ppc/tcg-target.c
+++ b/tcg/ppc/tcg-target.c
@@ -806,23 +806,22 @@ void tcg_target_qemu_prologue (TCGContext *s)
int i, frame_size;
frame_size = 0
- + 4 /* back chain */
- + 4 /* LR */
+ + TCG_TARGET_CALL_STACK_OFFSET
+ TCG_STATIC_CALL_ARGS_SIZE
+ ARRAY_SIZE (tcg_target_callee_save_regs) * 4
;
frame_size = (frame_size + 15) & ~15;
tcg_out32 (s, MFSPR | RT (0) | LR);
+ tcg_out32 (s, STW | RS (0) | RA (1) | (TCG_TARGET_CALL_LR_OFFSET));
tcg_out32 (s, STWU | RS (1) | RA (1) | (-frame_size & 0xffff));
for (i = 0; i < ARRAY_SIZE (tcg_target_callee_save_regs); ++i)
tcg_out32 (s, (STW
| RS (tcg_target_callee_save_regs[i])
| RA (1)
- | (i * 4 + 8 + TCG_STATIC_CALL_ARGS_SIZE)
+ | (TCG_TARGET_CALL_STACK_OFFSET + TCG_STATIC_CALL_ARGS_SIZE + i * 4)
)
);
- tcg_out32 (s, STW | RS (0) | RA (1) | (frame_size + 4));
tcg_out32 (s, MTSPR | RS (3) | CTR);
tcg_out32 (s, BCCTR | BO_ALWAYS);
@@ -832,10 +831,10 @@ void tcg_target_qemu_prologue (TCGContext *s)
tcg_out32 (s, (LWZ
| RT (tcg_target_callee_save_regs[i])
| RA (1)
- | (i * 4 + 8 + TCG_STATIC_CALL_ARGS_SIZE)
+ | (TCG_TARGET_CALL_STACK_OFFSET + TCG_STATIC_CALL_ARGS_SIZE + i * 4)
)
);
- tcg_out32 (s, LWZ | RT (0) | RA (1) | (frame_size + 4));
+ tcg_out32 (s, LWZ | RT (0) | RA (1) | (frame_size + TCG_TARGET_CALL_LR_OFFSET));
tcg_out32 (s, MTSPR | RS (0) | LR);
tcg_out32 (s, ADDI | RT (1) | RA (1) | frame_size);
tcg_out32 (s, BCLR | BO_ALWAYS);
diff --git a/tcg/ppc/tcg-target.h b/tcg/ppc/tcg-target.h
index e21b992..7e2c8bd 100644
--- a/tcg/ppc/tcg-target.h
+++ b/tcg/ppc/tcg-target.h
@@ -65,7 +65,13 @@ enum {
/* used for function call generation */
#define TCG_REG_CALL_STACK TCG_REG_R1
#define TCG_TARGET_STACK_ALIGN 16
+#ifdef __APPLE__
+#define TCG_TARGET_CALL_STACK_OFFSET 24
+#define TCG_TARGET_CALL_LR_OFFSET 8
+#else
#define TCG_TARGET_CALL_STACK_OFFSET 8
+#define TCG_TARGET_CALL_LR_OFFSET 4
+#endif
#define TCG_TARGET_CALL_ALIGN_ARGS 1
/* optional instructions */
diff --git a/tcg/tcg.h b/tcg/tcg.h
index bc5b902..860bce9 100644
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -413,7 +413,7 @@ uint64_t tcg_helper_divu_i64(uint64_t arg1, uint64_t arg2);
uint64_t tcg_helper_remu_i64(uint64_t arg1, uint64_t arg2);
extern uint8_t code_gen_prologue[];
-#if defined(__powerpc__) && !defined(__powerpc64__)
+#if (defined(__powerpc__) || defined(__ppc__)) && !defined(__powerpc64__)
#define tcg_qemu_tb_exec(tb_ptr) \
((long REGPARM __attribute__ ((longcall)) (*)(void *))code_gen_prologue)(tb_ptr)
#else
[-- Attachment #3: Type: text/plain, Size: 1 bytes --]
next prev parent reply other threads:[~2008-07-26 20:42 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-23 19:17 [Qemu-devel] [4932] Preliminary PPC64/Linux host support malc
2008-07-24 6:01 ` René Rebe
2008-07-24 17:41 ` malc
2008-07-24 18:42 ` Andreas Färber
2008-07-25 8:41 ` René Rebe
2008-07-25 18:15 ` malc
2008-07-26 19:32 ` René Rebe
2008-07-27 18:17 ` malc
[not found] ` <1964D914-95C1-4A3E-AE40-2DE082D40C24@hotmail.com>
2008-07-24 23:33 ` C.W. Betts
2008-07-25 18:18 ` malc
2008-07-26 13:08 ` Andreas Färber
[not found] ` <F41A287D-66CA-42E4-A191-CD5381987301@hotmail.com>
2008-07-26 17:36 ` C.W. Betts
2008-07-26 18:00 ` Andreas Färber
2008-07-26 18:54 ` malc
2008-07-26 20:42 ` Andreas Färber [this message]
2008-07-27 18:14 ` malc
2008-07-29 16:28 ` [Qemu-devel] Mac OS X PPC host support (was: [4932] Preliminary PPC64/Linux host support) Andreas Färber
2008-07-29 20:23 ` malc
2008-07-30 18:45 ` Blue Swirl
2008-07-31 17:15 ` malc
2008-07-31 18:57 ` malc
2008-07-31 21:50 ` Andreas Färber
2008-08-01 18:52 ` malc
2008-08-02 21:29 ` Andreas Färber
2008-08-03 18:56 ` malc
2008-08-02 16:35 ` Andreas Färber
[not found] ` <E3E8B39E-1924-465D-AA4A-9250D835C932@hotmail.com>
2008-08-02 19:43 ` C.W. Betts
2008-07-26 13:39 ` [Qemu-devel] [4932] Preliminary PPC64/Linux host support Andreas Färber
[not found] ` <1D9DD99A-96CE-4570-B8EE-428CDBAE5FE3@hotmail.com>
2008-07-26 17:13 ` C.W. Betts
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=ACD4162C-778D-4C03-80F8-EE08719C326B@web.de \
--to=andreas.faerber@web.de \
--cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).