Mailing List Archive

[PATCH 3/12] VTPM mini-os: Add ioread() and iowrite() functions to mini-os
Mini-os currently doesn't have very many facilities for reading and
writing to hardware io memory. This patch addes a new header file
iorw.h which when included gives access to
the ioread8(), iread32(), iowrite8(), iowrite32() family of functions.
Each has a separate implementation
for each architecture supported by mini-os.

Currently only x86 has been implemented. ia64 is stubbed out for now.

Signed off by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Re: [PATCH 3/12] VTPM mini-os: Add ioread() and iowrite() functions to mini-os [ In reply to ]
Matthew Fioravante, le Fri 11 Mar 2011 17:38:32 -0500, a écrit :
> Mini-os currently doesn't have very many facilities for reading and
> writing to hardware io memory. This patch addes a new header file
> iorw.h which when included gives access to
> the ioread8(), iread32(), iowrite8(), iowrite32() family of functions.


> +void iowrite8(void* addr, uint8_t val)
> +{
> + *((uint8_t*)addr) = val;
> +}
> +void iowrite32(void* addr, uint32_t val)
> +{
> + *((uint32_t*)addr) = val;
> +}

Don't you need a volatile qualifier on the cast pointer to not let the
compiler optimize it away?

Samuel

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Re: [PATCH 3/12] VTPM mini-os: Add ioread() and iowrite() functions to mini-os [ In reply to ]
Yeah your right, sorry about that! Heres a patch that applies on top of
the previous one to add volatile.

Signed off by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>

On 03/11/2011 07:29 PM, Samuel Thibault wrote:
> Matthew Fioravante, le Fri 11 Mar 2011 17:38:32 -0500, a écrit :
>> Mini-os currently doesn't have very many facilities for reading and
>> writing to hardware io memory. This patch addes a new header file
>> iorw.h which when included gives access to
>> the ioread8(), iread32(), iowrite8(), iowrite32() family of functions.
>
>> +void iowrite8(void* addr, uint8_t val)
>> +{
>> + *((uint8_t*)addr) = val;
>> +}
>> +void iowrite32(void* addr, uint32_t val)
>> +{
>> + *((uint32_t*)addr) = val;
>> +}
> Don't you need a volatile qualifier on the cast pointer to not let the
> compiler optimize it away?
>
> Samuel
Re: [PATCH 3/12] VTPM mini-os: Add ioread() and iowrite() functions to mini-os [ In reply to ]
Matthew Fioravante, le Mon 14 Mar 2011 13:10:54 -0400, a écrit :
> Yeah your right, sorry about that! Heres a patch that applies on top of
> the previous one to add volatile.

Ok, but you'll rather have to submit an updated patch instead.

Samuel

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel