ia64/xen-unstable

changeset 19088:c9dc7dcacc1d

rombios: fix pointer argument to PMM

The pointer to PMM function arguments must be flattened for protected
mode with zero-based segments.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Jan 26 11:22:03 2009 +0000 (2009-01-26)
parents f2ad1a7ca582
children 055c589f4791
files tools/firmware/rombios/rombios.c
line diff
     1.1 --- a/tools/firmware/rombios/rombios.c	Mon Jan 26 11:16:52 2009 +0000
     1.2 +++ b/tools/firmware/rombios/rombios.c	Mon Jan 26 11:22:03 2009 +0000
     1.3 @@ -10366,19 +10366,35 @@ pmm_structure:
     1.4    db 0,0,0,0,0 ;; reserved
     1.5  
     1.6  pmm_entry_point:
     1.7 +  pushf
     1.8    pushad
     1.9 -  mov   eax, esp
    1.10 -  add   eax, #(8*4+2+2) ;; skip regs of pushad, ip, cs
    1.11 -  push  eax ;; pointer to PMM function args
    1.12 +; Calculate protected-mode address of PMM function args
    1.13 +  xor	eax, eax
    1.14 +  mov	ax, sp
    1.15 +  xor	ebx, ebx
    1.16 +  mov	bx, ss
    1.17 +  shl	ebx, 4
    1.18 +  lea	ebx, [eax+ebx+38] ;; ebx=(ss<<4)+sp+4(far call)+2(pushf)+32(pushad)
    1.19 +  push	ebx
    1.20 +;
    1.21 +; Stack layout at this point:
    1.22 +;
    1.23 +;        : +0x0    +0x2    +0x4    +0x6    +0x8    +0xa    +0xc    +0xe
    1.24 +; -----------------------------------------------------------------------
    1.25 +; sp     : [&arg1         ][edi           ][esi           ][ebp           ]
    1.26 +; sp+0x10: [esp           ][ebx           ][edx           ][ecx           ]
    1.27 +; sp+0x20: [eax           ][flags ][ip    ][cs    ][arg1  ][arg2, ...
    1.28 +;
    1.29    call _pmm
    1.30 -  mov   bx, sp
    1.31 +  mov	bx, sp
    1.32  SEG SS
    1.33 -  mov   [bx+(4+7*4)], ax
    1.34 +  mov	[bx+0x20], ax
    1.35  SEG SS
    1.36 -  mov   [bx+(4+5*4)], dx
    1.37 -  pop   eax
    1.38 +  mov	[bx+0x18], dx
    1.39 +  pop	ebx
    1.40    popad
    1.41 -  db 0xcb ;; lret
    1.42 +  popf
    1.43 +  retf
    1.44  #endif // BX_PMM
    1.45  
    1.46  ; parallel port detection: base address in DX, index in BX, timeout in CL