Re: Wrong definition for the "x86_x32_tss_t" class ?

Raphael Neider <[email protected]> Sun, 19 Oct 2008 22:56:18 +0200
Newsgroups gmane.comp.micro-kernel.l4.l4ka.general
Message-ID <20081019205618.GA21178@neider-desktop>
Hi Willy,

> u8_t io_bitmap[IOPERMBITMAP_SIZE+1] X86_X32_IOPERMBITMAP_ALIGNMENT;
>
> I suppose the next member named "stopper" is necessary to avoid the  
> processor to generate an exception when dealing with the last byte of the 
> io bitmap array, like said in the Intel documentation. In that case,

I guess so, too.

> adding one byte is not necessary and lead to a problem: the  
> "init_io_space()" function only fill 'IOPERMBITMAP_SIZE' bytes. So, there 
> is a byte that has an undefined contents between the "io_bitmap" array and 
> the "stopper" byte.

You are probably right. Luckily this will only be a problem if one of
the I/O ports 65528..65535 (0xFFF8..0xFFFF) is accessed. Probably this
never happens (I am not aware of any device using these ports).
This should eventually be fixed (or documented) both in the x32 and the
x64 variants. Thank you for the report.

> Why do you use an alignment restriction ? I didn't see it in the Intel  
> documentation.

Looking at the definition of X86_X32_IOPERMBITMAP_ALIGNMENT in lines 36--42
I conclude that the alignment has to do with I/O flexpages. Possibly
our implementation of mapping I/O permissions simply require(d|s) that the
bitmap is page aligned. I did not check this, though ...

Regards,
Raphael