[SeaBIOS] [PATCH 0/5] SMM improvements

Paolo Bonzini pbonzini at redhat.com
Thu May 15 18:36:08 CEST 2014

Il 15/05/2014 17:05, Kevin O'Connor ha scritto:
> On Thu, May 15, 2014 at 01:22:25PM +0200, Paolo Bonzini wrote:
>> Hi,
>> these patches provide a small set of improvements and cleanups for the
>> current SMM code, making it more consistent with the chipset's datasheets.
>> QEMU does not yet implement most of the new registers used here, but it
>> might soon...
> Thanks.  Looks good to me.
> I think this series would be better for the next release though.


> Also, have you seen the patch I have to convert the SMM handler to C
> code?
> https://github.com/KevinOConnor/seabios/commit/67fd7b76ec5b511589afb909b421cbb625dd3355
> I think the later parts of your series might be better applied after
> the handler is in C.

Yes, I have seen it.

A simple way to reconcile the C code with the changes I'm making could 
be to make the relocation code associated to one particular value of APMC.

So the assembly trampoline would be just (untested):

	xorl	%eax, %eax
	movl	%ax, %cs
	shl	$4, eax
	data32 ljmp $0, 1f		# make flat code segment
	data32 call smm_handler		# near call

and the C handler like this:

smm_handler(void *smbase)
     switch (inb(0xb2)) {
     case 0xAA:
         if (smbase != (void *)0xA0000L) {
	outb(PORT_SMI_STATUS, 0);
     outl(smm_eos_port, inl(smm_eos_port)|smm_eos_value);
     outl(smm_status_port, smm_status_value);

I think this is more easily visible on top of these patches more than 
the other way round, but I'm biased of course...


More information about the SeaBIOS mailing list