ReturnInfinity / BareMetal-OS-legacy

BareMetal is a 64-bit OS for x86-64 based computers. The OS is written entirely in Assembly while applications can be written in Assembly, C/C++, and Rust.
1.74k stars 302 forks source link

os/net/i8254x.asm issue? #69

Closed erfzsven closed 9 years ago

erfzsven commented 9 years ago

hi i am new to github and programming, and reading i8254x.asm try to understand how a network device works, i found this:

  1. mov eax, 0x08008060 mov [rsi+I8254X_REG_TXCW], eax ; TXCW: set ANE, TxConfigWord (Half/Full duplex, Next Page Request) the ANE bit is 31bit, why it is 0x08008060?
  2. os_net_i8254x_init_get_MAC_via_EPROM: mov rsi, [os_NetIOBaseMem] mov eax, 0x00000001 mov [rsi+0x14], eax mov eax, [rsi+0x14] shr eax, 16 mov [os_NetMAC], al shr eax, 8 read eeprom of course needs some time, like several micro seconds i suppose if it is an I2C device. it can not immediately present in eax after one cpu instruction i guess. maybe check this bit first? image

hope it helps.

IanSeyler commented 9 years ago

1) Good find! You are correct. The value should be 0x80008060. Bits 29:16 in TXCW are reserved.

2) Possible, but not necessary. This code only runs once at network card initialization and most systems are able to get the MAC address from the 'Receive Address Low/High' registers.