@@ -35,9 +35,9 @@ impl<'a> VesaInfo<'a> {
3535 . split_at_mut ( core:: mem:: size_of :: < VbeInfoBlock > ( ) ) ;
3636 slice. fill ( 0 ) ;
3737 let block_ptr = slice. as_mut_ptr ( ) ;
38- let mut ret: u16 = 0 ;
38+ let ret;
3939 unsafe {
40- asm ! ( "mov es, bx " , "int 0x10" , inout( "ax" ) 0x4f00u16 => ret, in ( "bx" ) 0 , in( "di" ) block_ptr)
40+ asm ! ( "mov es, {:x} " , "int 0x10" , in ( reg ) 0 , inout( "ax" ) 0x4f00u16 => ret, in( "di" ) block_ptr)
4141 } ;
4242 match ret {
4343 0x4f => {
@@ -165,16 +165,16 @@ impl VesaModeInfo {
165165 slice. fill ( 0 ) ;
166166 let block_ptr = slice. as_mut_ptr ( ) ;
167167
168- let mut ret: u16 = 0 ;
168+ let mut ret: u16 ;
169169 let mut target_addr = block_ptr as u32 ;
170- let segment = ( target_addr >> 4 ) ;
170+ let segment = target_addr >> 4 ;
171171 target_addr -= segment << 4 ;
172172 unsafe {
173173 asm ! (
174- "mov es, bx" , "int 0x10" ,
174+ "mov es, {:x}" , "int 0x10" ,
175+ in( reg) segment as u16 ,
175176 inout( "ax" ) 0x4f01u16 => ret,
176177 in( "cx" ) mode,
177- in( "bx" ) segment as u16 ,
178178 in( "di" ) target_addr as u16
179179 )
180180 } ;
@@ -210,8 +210,17 @@ impl VesaModeInfo {
210210 }
211211
212212 pub fn enable ( & self ) -> Result < ( ) , u16 > {
213- let mut ret: u16 = 0 ;
214- unsafe { asm ! ( "int 0x10" , inout( "ax" ) 0x4f02u16 => ret, in( "bx" ) self . mode) } ;
213+ let mut ret: u16 ;
214+ unsafe {
215+ asm ! (
216+ "push bx" ,
217+ "mov bx, {:x}" ,
218+ "int 0x10" ,
219+ "pop bx" ,
220+ in( reg) self . mode,
221+ inout( "ax" ) 0x4f02u16 => ret,
222+ )
223+ } ;
215224 match ret {
216225 0x4f => Ok ( ( ) ) ,
217226 other => Err ( other) ,
0 commit comments