[SeaBIOS] [PATCH 0/5] SMM improvements
Kevin O'Connor
kevin at koconnor.net
Thu May 15 20:57:11 CEST 2014
On Thu, May 15, 2014 at 06:36:08PM +0200, Paolo Bonzini wrote:
> 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.
It's not hard to pass in the %cs segment to the C code - this works
(with some other minor changes):
-// ljmpw $SEG_BIOS, $(entry_smi - BUILD_BIOS_ADDR)
-#define SMI_INSN (0xea | ((u64)SEG_BIOS<<24) \
- | (((u32)entry_smi - BUILD_BIOS_ADDR) << 8))
+// movw %cs, %ax; ljmpw $SEG_BIOS, $(entry_smi - BUILD_BIOS_ADDR)
+#define SMI_INSN (0xeac88c | ((u64)SEG_BIOS<<40) \
+ | ((u64)((u32)entry_smi - BUILD_BIOS_ADDR) << 24))
[...]
> 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...
I was referring to your patch 5, which adds a bunch of assembler
variables - I think it would be clearer to add them in C to start.
-Kevin
More information about the SeaBIOS
mailing list