lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101215140558.GA9736@huya.qualcomm.com>
Date:	Wed, 15 Dec 2010 06:05:58 -0800
From:	David Brown <davidb@...eaurora.org>
To:	Pavel Machek <pavel@....cz>
Cc:	Jeff Ohlstein <johlstei@...eaurora.org>,
	Daniel Walker <dwalker@...eaurora.org>,
	linux-arm-msm@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	Stephen Boyd <sboyd@...eaurora.org>,
	Abhijeet Dharmapurikar <adharmap@...eaurora.org>,
	David Brown <davidb@...eaurora.org>,
	Bryan Huntsman <bryanh@...eaurora.org>,
	Russell King <linux@....linux.org.uk>
Subject: Re: [PATCH 1/5] msm: Secure Channel Manager (SCM) support

On Wed, Dec 15, 2010 at 08:48:11AM +0100, Pavel Machek wrote:

> > +static u32 smc(dma_addr_t cmd_addr)
> > +{
> > +	int context_id;
> > +	register u32 r0 asm("r0") = 1;
> > +	register u32 r1 asm("r1") = (u32)&context_id;
> > +	register u32 r2 asm("r2") = (u32)cmd_addr;
> 
> Are these neccessary?

The values have to be in specific registers.  Without them it doesn't
generate the right code.

> > +	asm(
> > +		__asmeq("%0", "r0")
> > +		__asmeq("%1", "r0")
> > +		__asmeq("%2", "r1")
> > +		__asmeq("%3", "r2")
> > +		"smc	#0	@ switch to secure world\n"
> > +		: "=r" (r0)
> > +		: "r" (r0), "r" (r1), "r" (r2)
> > +		: "r3");
> > +	return r0;
> > +}
> 
> > +u32 scm_get_version(void)
> > +{
> > +	int context_id;
> > +	static u32 version = -1;
> > +	register u32 r0 asm("r0") = 0x1 << 8;
> > +	register u32 r1 asm("r1") = (u32)&context_id;
> 
> And does this even work?

In what sense?  It generates the desired code.

> > +	if (version != -1)
> > +		return version;
> > +
> > +	mutex_lock(&scm_lock);
> > +	asm(
> > +		__asmeq("%0", "r1")
> > +		__asmeq("%1", "r0")
> > +		__asmeq("%2", "r1")
> > +		"smc	#0	@ switch to secure world\n"
> > +		: "=r" (r1)
> > +		: "r" (r0), "r" (r1)
> > +		: "r2", "r3");
> > +	version = r1;
> > +	mutex_unlock(&scm_lock);
> > +
> > +	return version;
> > +}

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ