[Cbe-oss-dev] [PATCH 2/2] libspe2 : Add emulated isolation support RESEND
Kazunori Asayama
asayama at sm.sony.co.jp
Mon Jul 2 14:37:42 EST 2007
kannas at ofb.net (Kanna Shimizu) wrote:
> libspe2: Add emulated isolated mode support
>
> Using a userspace loader, we can add an 'emulated' isolated mode, which
> provides a facility to run contexts with an isolated-mode environment,
> but without restricted access to SPE hardware. Contexts can be created
> in emulated isolated mode by providing the SPE_ISOLATE_EMULATE flag to
> spe_context_create.
>
> This functionality depends on an emulated loader - a SPE program to
> load the "emulated isolated" SPE application, using the same ABI as the
> real isolated mode loader. We check for this in the file:
>
> $libdir/spe/emulated-loader.bin
>
> - if this isn't present (or isn't a valid SPE binary) then we refuse to
> create emulated-isolated contexts.
(snip)
> Index: libspe2/spebase/run.c
> ===================================================================
> --- libspe2.orig/spebase/run.c
> +++ libspe2/spebase/run.c
> @@ -102,7 +102,7 @@ int _base_spe_context_run(spe_context_pt
> spe_stop_info_t *stopinfo)
> {
> int retval = 0, run_rc;
> - unsigned int run_status;
> + unsigned int run_status, tmp_entry;
> spe_stop_info_t stopinfo_buf;
> struct spe_context_info this_context_info __attribute__((cleanup(cleanupspeinfo)));
>
> @@ -111,13 +111,20 @@ int _base_spe_context_run(spe_context_pt
> if (!stopinfo)
> stopinfo = &stopinfo_buf;
>
> - if (*entry == SPE_DEFAULT_ENTRY)
> - *entry = spe->base_private->entry;
> +
> + /* In emulated isolated mode, the npc will always return as zero.
> + * use our private entry point instead */
> + if (spe->base_private->flags & SPE_ISOLATE_EMULATE)
> + tmp_entry = spe->base_private->emulated_entry;
> +
> + else if (*entry == SPE_DEFAULT_ENTRY)
> + tmp_entry = spe->base_private->entry;
The tmp_entry is never initialized in other cases. It must be
initialized as:
--
else
tmp_entry = *entry;
--
The other parts look good.
--
(ASAYAMA Kazunori
(asayama at sm.sony.co.jp))
t
More information about the cbe-oss-dev
mailing list