~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Bochs x86 Emulator
bochs/bios/rombios32start.S

Version: ~ [ 2.3.5 ] ~ [ 2.3 ] ~

  1 /////////////////////////////////////////////////////////////////////////
  2 // $Id: rombios32start.S,v 1.3 2006/10/02 06:29:38 vruppert Exp $
  3 /////////////////////////////////////////////////////////////////////////
  4 //
  5 //  32 bit Bochs BIOS init code
  6 //  Copyright (C) 2006 Fabrice Bellard
  7 //
  8 //  This library is free software; you can redistribute it and/or
  9 //  modify it under the terms of the GNU Lesser General Public
 10 //  License as published by the Free Software Foundation; either
 11 //  version 2 of the License, or (at your option) any later version.
 12 //
 13 //  This library is distributed in the hope that it will be useful,
 14 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
 15 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 16 //  Lesser General Public License for more details.
 17 //
 18 //  You should have received a copy of the GNU Lesser General Public
 19 //  License along with this library; if not, write to the Free Software
 20 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 21 #include "rombios.h"
 22 
 23 .globl _start
 24 .globl smp_ap_boot_code_start
 25 .globl smp_ap_boot_code_end
 26 .global smm_relocation_start
 27 .global smm_relocation_end
 28 .global smm_code_start
 29 .global smm_code_end
 30 
 31 _start:
 32   /* clear bss section */
 33   xor %eax, %eax
 34   mov $__bss_start, %edi
 35   mov $_end, %ecx
 36   sub %edi, %ecx
 37   rep stosb
 38 
 39   jmp rombios32_init
 40 
 41   .code16                        
 42 smp_ap_boot_code_start:
 43   xor %ax, %ax
 44   mov %ax, %ds
 45   incw CPU_COUNT_ADDR
 46 1:
 47   hlt
 48   jmp 1b
 49 smp_ap_boot_code_end:
 50 
 51 /* code to relocate SMBASE to 0xa0000 */
 52 smm_relocation_start:
 53   mov $0x38000 + 0x7efc, %ebx
 54   addr32 mov (%ebx), %al  /* revision ID to see if x86_64 or x86 */
 55   cmp $0x64, %al
 56   je 1f
 57   mov $0x38000 + 0x7ef8, %ebx
 58   jmp 2f
 59 1:
 60   mov $0x38000 + 0x7f00, %ebx
 61 2:
 62   movl $0xa0000, %eax
 63   addr32 movl %eax, (%ebx)
 64   /* indicate to the BIOS that the SMM code was executed */
 65   mov $0x00, %al
 66   movw $0xb3, %dx
 67   outb %al, %dx
 68   rsm                
 69 smm_relocation_end:
 70         
 71 /* minimal SMM code to enable or disable ACPI */
 72 smm_code_start:
 73   movw $0xb2, %dx
 74   inb %dx, %al
 75   cmp $0xf0, %al
 76   jne 1f
 77 
 78   /* ACPI disable */
 79   mov $PM_IO_BASE + 0x04, %dx /* PMCNTRL */
 80   inw %dx, %ax
 81   andw $~1, %ax
 82   outw %ax, %dx
 83 
 84   jmp 2f
 85 
 86 1:
 87   cmp $0xf1, %al
 88   jne 2f
 89 
 90   /* ACPI enable */
 91   mov $PM_IO_BASE + 0x04, %dx /* PMCNTRL */
 92   inw %dx, %ax
 93   orw $1, %ax
 94   outw %ax, %dx
 95   
 96 2:
 97   rsm
 98 smm_code_end:

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.