Accessing UNDI without PXE???

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
djmauretto
Member
Member
Posts: 116
Joined: Wed Oct 22, 2008 2:21 am
Location: Roma,Italy

Re: Accessing UNDI without PXE???

Post by djmauretto »

Just one more question; how does the checksum within the PXEROMID structure work please?
It's a simple Byte checksum,
you have to add each byte for the entire length of the structure, and if the result is zero then the checksum is correct and the structure is valid :-)
leejbaxter
Member
Member
Posts: 25
Joined: Sat Jan 15, 2011 8:40 pm

Re: Accessing UNDI without PXE???

Post by leejbaxter »

djmauretto wrote:
Just one more question; how does the checksum within the PXEROMID structure work please?
It's a simple Byte checksum,
you have to add each byte for the entire length of the structure, and if the result is zero then the checksum is correct and the structure is valid :-)
How does that work (sorry, I've never played around with checksums before), because surely the contents of each byte will add together to equal a value greater than zero; is it the first lower 'N' bits that will be equal to zero (i.e. the result will be a multiple of 256, setting the lower byte of the result to 0)?

Sorry, and thankyou again djmauretto; it's times like this I realise how much of a n00b I am! :roll:

In return for all of your help, I'll also post the code for my uint printing code, as I think it's fairly useful for printing uints in any base using interrupt 0x10 :)
Lee.J.Baxter - Designer of CHAOS (Cybernetic Hivemind Adaptive Operating System)
djmauretto
Member
Member
Posts: 116
Joined: Wed Oct 22, 2008 2:21 am
Location: Roma,Italy

Re: Accessing UNDI without PXE???

Post by djmauretto »

ok,
this is a example di byte checksum:

Code: Select all

; This structure is an example

Structure:
DATA_1   DW 1
DATA_2   DW 5
Length    DW 7
DATA_3   DB  2


; Here the code

                xor ax,ax                                  ; AX = 0
                mov cx,[Length]                        ; Load Structure Length
                mov si, OFFSET Structure           ; SI = Offset Structure
Checksum:
                add   al, [si]
                add   si,1
                sub   cx,1
                jnz    Checksum
 
                test  al,al                                ; IF AL = 0 , STRUCTURE IS VALID
                jz     CHECKSUM_SUCCESS

                
Simple :-)
leejbaxter
Member
Member
Posts: 25
Joined: Sat Jan 15, 2011 8:40 pm

Re: Accessing UNDI without PXE???

Post by leejbaxter »

Okay, I know it's been a long time, but here's that code that I promised back then!!!

Code: Select all

%ifndef __X86LIB_RMVIDEO__
%define __X86LIB_RMVIDEO__

    ;===========================================================================
    ; Description: Prints a null-terminated string to the screen.
    ;---------------------------------------------------------------------------
    ; Parameters:-
    ;     DS:SI - The segment:offset of the null-terminated string.
    ;     BL    - The foreground colour.
    ;     BH    - The page number.
    ;===========================================================================
    rmPrintString:
            push ax
            push ds
            push si
            mov ah, 0x0E
        .printCharacter:
            lodsb
            or al, al
            jz .done
            int 0x10
            jmp .printCharacter
        .done:
            pop si
            pop ds
            pop ax
            ret

    ;===========================================================================
    ; Description: Prints an 8-bit unsigned integer to the screen.
    ;---------------------------------------------------------------------------
    ; Parameters:-
    ;     AL - The 8-bit unsigned integer.
    ;     BL - The foreground colour.
    ;     BH - The page number.
    ;     CL - The base to print in (2 to 16).
    ;     CH - The minimum number of digits to print (use 0 for no padding).
    ;===========================================================================
    rmPrintUInt8:
        push eax
        movzx eax, al
        jmp rmPrintUInt32.initialise
            
    ;===========================================================================
    ; Description: Prints a 16-bit unsigned integer to the screen.
    ;---------------------------------------------------------------------------
    ; Parameters:-
    ;     AX - The 16-bit unsigned integer.
    ;     BL - The foreground colour.
    ;     BH - The page number.
    ;     CL - The base to print in (2 to 16).
    ;     CH - The minimum number of digits to print (use 0 for no padding).
    ;===========================================================================
    rmPrintUInt16:
        push eax
        movzx eax, ax
        jmp rmPrintUInt32.initialise
            
    ;===========================================================================
    ; Description: Prints a 32-bit unsigned integer to the screen.
    ;---------------------------------------------------------------------------
    ; Parameters:-
    ;     EAX - The 32-bit unsigned integer.
    ;     BL  - The foreground colour.
    ;     BH  - The page number.
    ;     CL  - The base to print in (2 to 16).
    ;     CH  - The minimum number of digits to print (use 0 for no padding).
    ;===========================================================================
    rmPrintUInt32:
            push eax
        .initialise:
            push ebx
            push cx
            push edx
            mov [cs:.tempBX], bx
            movzx ebx, cl
            xor cl, cl
            jmp .pushDigit
        .tempBX: dw 0
        .pushDigit:
            xor edx, edx
            div ebx
            push dx
            inc cl
            or eax, eax
            jnz .pushDigit
            mov al, '0'
            mov ah, 0x0E
            mov bx, [cs:.tempBX]
        .printPadding:
            cmp cl, ch
            jge .popDigit
            int 0x10
            dec ch
            jmp .printPadding
        .popDigit:
            pop ax
            dec cl
            and al, 0x0F
            add al, 0x30
            cmp al, 0x39
            jle .printDigit
            add al, 0x07
        .printDigit:
            mov ah, 0x0E
            int 0x10
            or cl, cl
            jnz .popDigit
            pop edx
            pop cx
            pop ebx
            pop eax
            ret
            
%endif
Anyways, I seem to have hit a dead end. I've written some code to scan from physical addresses C0000 to EFFFF (segmented addresses C000:0000 to E000:FFFF) at every 2kb boundry (e.g. C000:0000, C000:0800, C000:1000 .etc.) and read in the first 2 bytes, comparing them to 0xAA55 (I also tried 0x55AA), but my code didn't find anything...

I've attached the code files for searching for option ROMs. The rmConvertAddressToSegmentOffset (which is confirmed as working) takes a physical address in EBX and returns its segment in DS and its offset in SI (e.g. if EBX = 0x000F1234, calling the function would set DS = 0xF000 and SI = 0x1234).
Attachments
rmorom.asm
(1.65 KiB) Downloaded 65 times
orom.asm
(274 Bytes) Downloaded 36 times
Lee.J.Baxter - Designer of CHAOS (Cybernetic Hivemind Adaptive Operating System)
ccheng
Posts: 5
Joined: Sat Jan 22, 2011 1:28 pm

Re: Accessing UNDI without PXE???

Post by ccheng »

Hi leejbaxter,

Have you made any progress on this PXE driver thing? I also come across to need such a driver to extend the GRUB such that I can use a disk-based bootloader to perform some simple network communication.

Thanks,
Cheng
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Accessing UNDI without PXE???

Post by Brendan »

Hi,
Brendan wrote:The network card's own ROM is only initialised if the computer is being booted from network, and if the computer boots from hard drive or something else then nothing is setup. This leaves you with 2 choices - implement your own network card driver/s for each different network card; or implement special code for each different chipset to mess with the memory controllers and trick the network card's ROM into thinking you are the BIOS and that the computer will be booting from the network. For these choices, the first (have your own network drivers) would be more work but would also be a lot more reliable - there's too many "corner cases" that can mess up the latter (e.g. some or all of an "onboard" network device's ROM built into the system ROM itself preventing you from finding it).

Of course the first choice doesn't need PXE at all. It's the same as every other OS- e.g. boot from hard drive, setup network card drivers, then start processes (e.g. DHCP and TFTP servers) that use those drivers.
leejbaxter wrote:Anyways, I seem to have hit a dead end. I've written some code to scan from physical addresses C0000 to EFFFF (segmented addresses C000:0000 to E000:FFFF) at every 2kb boundry (e.g. C000:0000, C000:0800, C000:1000 .etc.) and read in the first 2 bytes, comparing them to 0xAA55 (I also tried 0x55AA), but my code didn't find anything...
ccheng wrote:Have you made any progress on this PXE driver thing? I also come across to need such a driver to extend the GRUB such that I can use a disk-based bootloader to perform some simple network communication.
To me, it looks like the only progress was proving that it can't work (confirming what I said previously).


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
djmauretto
Member
Member
Posts: 116
Joined: Wed Oct 22, 2008 2:21 am
Location: Roma,Italy

Re: Accessing UNDI without PXE???

Post by djmauretto »

Brendan wrote:To me, it looks like the only progress was proving that it can't work (confirming what I said previously).


Cheers,

Brendan
I've always used PXE, and it works for me ..
Try ....:-)
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Accessing UNDI without PXE???

Post by Combuster »

And the title says without PXE :wink:
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
djmauretto
Member
Member
Posts: 116
Joined: Wed Oct 22, 2008 2:21 am
Location: Roma,Italy

Re: Accessing UNDI without PXE???

Post by djmauretto »

Of course UNDI.
I wrote PXE. (sorry)
but if you read the entire post, which by the way is a few years ago, I explain how to do it and it works. :)
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Accessing UNDI without PXE???

Post by Brendan »

Hi,
djmauretto wrote:Of course UNDI.
I wrote PXE. (sorry)
but if you read the entire post, which by the way is a few years ago, I explain how to do it and it works. :)
Are you saying that you boot from hard drive (not PXE); then search the ROM space (2 KiB boundaries from 0x000C0000) and find nothing because it doesn't exist because you didn't boot from network; and this "works" on all computers that you've never tested?

If you didn't boot from network there's no reason for firmware copy anything (UNDI, base code or PXE) into the ROM space area at all, and no guarantee that the BIOS has wasted its time doing pointless work for no reason.


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
djmauretto
Member
Member
Posts: 116
Joined: Wed Oct 22, 2008 2:21 am
Location: Roma,Italy

Re: Accessing UNDI without PXE???

Post by djmauretto »

Of course I have not tried all of the computers in the world, which of course is impossible.
But 80% of the computers I have found the structure UNDI, so it works ..
Try before you judge.
Also MS Virtual PC works in this way, and QEMU...
I remember QEMU is bugged..
All the computers I have at home support this function.
In all the computer BIOS is AMI
Last edited by djmauretto on Mon Feb 17, 2014 4:01 am, edited 1 time in total.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Accessing UNDI without PXE???

Post by Brendan »

Hi,
djmauretto wrote:Of course I have not tried all of the computers in the world, which of course is impossible.
But 80% of the computers I have found the structure UNDI, so it works ..
Try before you judge
No thanks - 80% is well below my idea of "acceptable reliability".


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
djmauretto
Member
Member
Posts: 116
Joined: Wed Oct 22, 2008 2:21 am
Location: Roma,Italy

Re: Accessing UNDI without PXE???

Post by djmauretto »

Brendan wrote:No thanks - 80% is well below my idea of "acceptable reliability".


Cheers,

Brendan
ok, every person has his own approach to things, but that does not mean it does not work :wink:
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Accessing UNDI without PXE???

Post by Brendan »

Hi,
djmauretto wrote:
Brendan wrote:No thanks - 80% is well below my idea of "acceptable reliability".
ok, every person has his own approach to things, but that does not mean it does not work :wink:
I'm sorry - I thought you said it didn't work 20% of the time (for the hardware you've tested)... 8)


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
djmauretto
Member
Member
Posts: 116
Joined: Wed Oct 22, 2008 2:21 am
Location: Roma,Italy

Re: Accessing UNDI without PXE???

Post by djmauretto »

Brendan wrote:I'm sorry - I thought you said it didn't work 20% of the time (for the hardware you've tested)... 8)


Cheers,

Brendan

20% of the time I have not found UNDI, and considering that the computers that I tested were not mine, I could not do the checks deeper.
In any case, what is your problem?
Instead of sitting here talking, why do not you do a little test?
As I told you before even MS Virtual PC and Qemu support this function.
I remenber that Qemu is bugged, but MS virtual PC works fine :-)
Post Reply