Page 1 of 1

Strange problem with PXE_GET_CACHED_INFO

Posted: Sat Aug 18, 2012 8:04 am
by Congdm
Hi, I am writing my PXE boot loader but when calling PXE_GET_CACHED_INFO, I always get PXE_EXIT_FAILURE:

Code: Select all

push ds    ; DS is 0
push t_PXENV_GET_CACHED_INFO
push PXENV_GET_CACHED_INFO
call dword [Var.EntryPointSP]
Here is t_PXENV_GET_CACHED_INFO structure:

Code: Select all

t_PXENV_GET_CACHED_INFO:
        .Status dw 0
        .PacketType dw PXENV_PACKET_TYPE_DHCP_ACK
        .BufferSize dw Cached_Packet_End - Cached_Packet + 1
        .Buffer_Off dw Cached_Packet
        .Buffer_Seg dw 0
        .BufferLimit dw 0
Everything stay in same segment and the code run at ORG $7C00. But when I change .Buffer_Off, .Buffer_Seg and .BufferSize to 0, it works and return PXE_EXIT_SUCCESS. Anyone knows about this problem? Also, I running it on ASRock P4i45GV with RTL8139 onboard.

Re: Strange problem with PXE_GET_CACHED_INFO

Posted: Sun Aug 19, 2012 5:39 am
by Nable
http://wiki.osdev.org/PXE#PXE_API
The PXE Entry Point uses the Pascal calling convention - push the parameters on the stack, far call the entry point, clean up the stack - while the older PXENV+ Entry Point uses registers.
I don't know if that's the cause of your problem but it's better to check.

> .BufferSize to 0, it works
What do you mean when you say 'it works' ? As I think, call with buffer size = 0 would return no data.

Then, could you post values of the constants that you use?

Re: Strange problem with PXE_GET_CACHED_INFO

Posted: Sun Aug 19, 2012 7:59 am
by Congdm
Constants:

Code: Select all

PXENV_GET_CACHED_INFO = $0071
PXENV_PACKET_TYPE_DHCP_DISCOVER = 1
PXENV_PACKET_TYPE_DHCP_ACK = 2
PXENV_PACKET_TYPE_CACHED_REPLY = 3
Nable wrote:What do you mean when you say 'it works' ?
When I set BufferSize, Buffer_Off and Buffer_Seg to 0, it returned PXENV_EXIT_SUCCESS in AX and the address of bootph was fill into t_PXENV_GET_CACHED_INFO structure.