On Mon, Aug 05, 2024 at 04:15:00PM +0200, william pecnik wrote:
> the patch is in attach file
> to apply use "*patch src/farptr.h < farptr.patch*" from seabios directory
>
> This will fix the problem of calling bios service int 0x13 AH=0x42 when the
> drive is a ATAPI
>
> (because Outs should use DS:SI and not ES:DI)
>
> This bug affect all Outs() when called from real mode 16bits !
>
> i save DS and restore it after, because Seabios use it
Hi,
This change does not look correct. Take a look at x86.h, where
outsb(), outsw(), and outsl() explicitly use the %es segment.
-Kevin
> diff --git a/src/farptr.h b/src/farptr.h
> index 0a4db68b..4fbe66c3 100644
> --- a/src/farptr.h
> +++ b/src/farptr.h
> @@ -161,16 +161,22 @@ static inline void insl_fl(u16 port, void *ptr_fl, u16
> count) {
> insl(port, (u32*)FLATPTR_TO_OFFSET(ptr_fl), count);
> }
> static inline void outsb_fl(u16 port, void *ptr_fl, u16 count) {
> - SET_SEG(ES, FLATPTR_TO_SEG(ptr_fl));
> + u16 ds = GET_SEG(DS);
> + SET_SEG(DS, FLATPTR_TO_SEG(ptr_fl));
> outsb(port, (u8*)FLATPTR_TO_OFFSET(ptr_fl), count);
> + SET_SEG(DS, ds);
> }
> static inline void outsw_fl(u16 port, void *ptr_fl, u16 count) {
> - SET_SEG(ES, FLATPTR_TO_SEG(ptr_fl));
> + u16 ds = GET_SEG(DS);
> + SET_SEG(DS, FLATPTR_TO_SEG(ptr_fl));
> outsw(port, (u16*)FLATPTR_TO_OFFSET(ptr_fl), count);
> + SET_SEG(DS, ds);
> }
> static inline void outsl_fl(u16 port, void *ptr_fl, u16 count) {
> - SET_SEG(ES, FLATPTR_TO_SEG(ptr_fl));
> + u16 ds = GET_SEG(DS);
> + SET_SEG(DS, FLATPTR_TO_SEG(ptr_fl));
> outsl(port, (u32*)FLATPTR_TO_OFFSET(ptr_fl), count);
> + SET_SEG(DS, ds);
> }
>
> #else
> _______________________________________________
> SeaBIOS mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
_______________________________________________
SeaBIOS mailing list -- [email protected]
To unsubscribe send an email to [email protected]