The MASM Forum

General => The Campus => Topic started by: Manohar on July 10, 2014, 09:08:46 PM

Title: MASM Assembly calling function
Post by: Manohar on July 10, 2014, 09:08:46 PM
Hello All,

I am new to the forum, I worked in U-boot, Linux Device Drivers and Firmware Development. I am interested to work in Assembly, Presently I am working in BIOS UEFI Tiano core project.

It holds 100's of .asm files, I am stuck in the warm reset functionality of the Intel Xeon Processor (2648L) 0xCF9 register.

I wanted to understand, Where does these global function (hookBiosReset) get called and get initiated, how to know the entry point of the BIOS ASM functions.

I have minimal experience of Assembly coding.

hookBiosReset    PROC    FAR    PUBLIC

;
; Check if this is the BSP. If not BSP then stay in a tight loop.
;
IF OPTION_WARM_RESET_SUPPORT EQ 1      ;CD_20110712_01A_EC703931+
  mov     ecx, MSR_APIC_BASE
  rdmsr
  test    ah, 1
  jz      waitForInit

;
; If the FLAG is not 0x1234 (warm reboot) force a cold boot.
; If the COUNT is 0x0000 force a cold boot.
;

  mov     bx, BDA_SEGMENT
  mov     ds, bx
  mov     bx, offset BDA_WARM_BOOT_FLAG_LOC
  mov     ax, [bx]
  cmp     ax, WARM_BOOT_FLAG
  jne     forceColdBootPath
 
  mov     bx, offset BDA_WARM_BOOT_COUNT_LOC
  mov     ax, [bx]
  cmp     ax, 0
  je      forceColdBootPath

warmBootPath:

;
; Set CMOS_WARMBOOT_FLAG to 0x5A.
;

  mov     al, CMOS_WARMBOOT_FLAG
  mov     dx, RTC_UPPER_INDEX
  out     dx, al
  inc     dx
  mov     al, 5Ah
  out     dx, al

Thanks and Regards,
Manohar.K
Title: Re: MASM Assembly calling function
Post by: dedndave on July 10, 2014, 09:26:18 PM
that is set up by the BIOS when the user presses Ctl-Alt-Del (BIOS keyboard handler code)
well - windows intercepts that key sequence and typically brings up the task manager
but, if it weren't for that, the key sequence places 1234h at a certain location in the BIOS data segment, as i recall
there is also a bit set in the CMOS RAM data area

you can probably google around and find a listing for the original IBM AT BIOS
it was published in the IBM AT Technical Reference Manual

you might like to use osdev.org as a reference - they have a forum and a wiki
i don't suggest you ask questions in the forum unless you have researched a subject well   :P
Title: Re: MASM Assembly calling function
Post by: FORTRANS on July 10, 2014, 10:59:44 PM
Hi,

   On processor reset the 8086 executes the code at 0FFFF0H.
The 80386 (and the rest of the 32-bit processors) start at
0FFFFFFF0H.  So those would be the initial BIOS entry points.

HTH,

Steve N.
Title: Re: MASM Assembly calling function
Post by: GoneFishing on July 10, 2014, 11:19:22 PM
Quote from: Manohar on July 10, 2014, 09:08:46 PM
...
I wanted to understand, Where does these global function (hookBiosReset) get called and get initiated, how to know the entry point of the BIOS ASM functions.
...

[EDIT]: It seems like "hookBiosReset" has something to do with BIOS DEBUG TOOL (http://komposter.com.ua/documents/phoenix_phdebug.pdf):
QuoteInstall Debug Engine
   BCP.ASM
• INSTALL_DEBUG Macro
• INSTALL_DEBUG_OLD Macro
  Necessary hooks
• hookBiosReset
• I/O Initialization
• I/O testing
Are you trying to debug BIOS with it?