Fixed up network stack and drivers for x86_64.

* Various compilation fixes.
* Fixes to the FreeBSD compatibility layer (from comparing the x86-
  specific bits with the equivalent amd64 sources in FreeBSD).
* Compile all the Ethernet drivers except for sis900 and wb840, these
  require a bit more work to fix (will file a ticket soon). Tested
  ipro1000 and rtl81xx, no issues.
This commit is contained in:
Alex Smith 2012-08-10 14:30:54 +01:00
parent 2b861dd2a5
commit 6d796a84bd
30 changed files with 164 additions and 103 deletions

View File

@ -24,15 +24,15 @@ SYSTEM_BIN = "[" addattr base64 basename bash beep cal cat catattr chgrp chmod
copyattr cp csplit cut date dd diff diff3 dircolors dirname df du
dumpcatalog echo eject env error expand expr factor false find finddir
fmt fold fortune gawk gdb gzip gzexe getlimits groups head hostname id
<bin>install isvolume join kernel_debugger kill less lessecho lesskey link
linkcatkeys listdev ln locale locate logger logname ls md5sum mkdir mkfifo
mktemp mount mountvolume mv nl nohup nproc od paste patch pathchk pr
printenv printf ps ptx pwd readlink ReadOnlyBootPrompt rm rmattr rmdir
safemode sdiff seq sha1sum shred shuf sleep sort split stat strace stty su
sum sync sysinfo tac tail tee test timeout touch tr true truncate tsort tty
unexpand uname uniq unlink unmount unzip <bin>updatedb waitfor wc whoami
xargs xres yes zdiff zforce zgrep zip zipcloak <bin>zipgrep zipnote
zipsplit zmore znew
ifconfig <bin>install isvolume join kernel_debugger kill less lessecho
lesskey link linkcatkeys listdev ln locale locate logger logname ls md5sum
mkdir mkfifo mktemp mount mountvolume mv nl nohup nproc od paste patch
pathchk ping pr printenv printf ps ptx pwd readlink ReadOnlyBootPrompt rm
rmattr rmdir safemode sdiff seq sha1sum shred shuf sleep sort split stat
strace stty su sum sync sysinfo tac tail tee test timeout touch tr true
truncate tsort tty unexpand uname uniq unlink unmount unzip <bin>updatedb
waitfor wc wget whoami xargs xres yes zdiff zforce zgrep zip zipcloak
<bin>zipgrep zipnote zipsplit zmore znew
;
SYSTEM_APPS = AboutSystem Terminal ;
@ -55,9 +55,14 @@ SYSTEM_LIBS = libbe.so libbnetapi.so libdebug.so libjpeg.so libnetwork.so
PRIVATE_SYSTEM_LIBS = libilmimf.so ;
SYSTEM_SERVERS = app_server debug_server input_server mount_server
notification_server registrar syslog_daemon
net_server notification_server registrar syslog_daemon
;
SYSTEM_NETWORK_DEVICES = ethernet loopback ;
SYSTEM_NETWORK_DATALINK_PROTOCOLS = ethernet_frame <module>arp loopback_frame
ipv6_datagram ;
SYSTEM_NETWORK_PROTOCOLS = ipv4 tcp udp icmp unix icmp6 ipv6 ;
SYSTEM_ADD_ONS_ACCELERANTS = vesa.accelerant ;
SYSTEM_ADD_ONS_TRANSLATORS = BMPTranslator EXRTranslator GIFTranslator
HVIFTranslator ICOTranslator JPEGTranslator JPEG2000Translator
@ -67,6 +72,11 @@ SYSTEM_ADD_ONS_TRANSLATORS = BMPTranslator EXRTranslator GIFTranslator
;
SYSTEM_ADD_ONS_DRIVERS_GRAPHICS = vesa ;
SYSTEM_ADD_ONS_DRIVERS_NET = 3com atheros813x ar81xx attansic_l1 attansic_l2
broadcom440x broadcom570x dec21xxx etherpci ipro100 ipro1000 jmicron2x0
marvell_yukon nforce pcnet pegasus rtl8139 rtl81xx sis19x syskonnect
via_rhine
;
SYSTEM_ADD_ONS_BUS_MANAGERS = $(ATA_ONLY)ata pci ps2 isa scsi config_manager
usb ;
@ -105,6 +115,7 @@ AddDriversToHaikuImage : console dprintf null
AddDriversToHaikuImage graphics : $(SYSTEM_ADD_ONS_DRIVERS_GRAPHICS) ;
AddDriversToHaikuImage disk usb : usb_disk ;
AddDriversToHaikuImage input : ps2_hid usb_hid ;
AddDriversToHaikuImage net : $(SYSTEM_ADD_ONS_DRIVERS_NET) ;
# kernel
AddFilesToHaikuImage system : kernel_$(TARGET_ARCH) ;
@ -310,6 +321,14 @@ AddFilesToHaikuHybridImage system add-ons Translators
: $(SYSTEM_ADD_ONS_TRANSLATORS) : : true ;
AddFilesToHaikuImage system add-ons input_server devices
: <input>keyboard <input>mouse <input>tablet <input>wacom ;
AddFilesToHaikuImage system add-ons kernel network
: <net>notifications stack ;
AddFilesToHaikuImage system add-ons kernel network devices
: $(SYSTEM_NETWORK_DEVICES) ;
AddFilesToHaikuImage system add-ons kernel network datalink_protocols
: $(SYSTEM_NETWORK_DATALINK_PROTOCOLS) ;
AddFilesToHaikuImage system add-ons kernel network protocols
: $(SYSTEM_NETWORK_PROTOCOLS) ;
# create directories that will remain empty
AddDirectoryToHaikuImage common bin ;

View File

@ -85,9 +85,9 @@ struct net_buffer_module_info {
status_t (*direct_access)(net_buffer* buffer, uint32 offset,
size_t bytes, void** _data);
status_t (*read)(net_buffer* buffer, uint32 offset, void* data,
status_t (*read)(net_buffer* buffer, size_t offset, void* data,
size_t bytes);
status_t (*write)(net_buffer* buffer, uint32 offset,
status_t (*write)(net_buffer* buffer, size_t offset,
const void* data, size_t bytes);
int32 (*checksum)(net_buffer* buffer, uint32 offset, size_t bytes,

View File

@ -370,10 +370,10 @@ output_count(etherpci_private_t *data)
/*
* How many waiting for input?
*/
static long
static int32
input_count(etherpci_private_t *data)
{
long count;
int32 count;
get_sem_count(data->ilock, &count);
return (count);
@ -1207,7 +1207,7 @@ enable_addressing(etherpci_private_t *data)
data->reg_base = data->reg_base + offset;
#endif
dprintf(kDevName ": reg_base=%lx\n", data->reg_base);
dprintf(kDevName ": reg_base=%" B_PRIx32 "\n", data->reg_base);
/* enable pci address access */
cmd = (gPCIModInfo->read_pci_config)(data->pciInfo->bus, data->pciInfo->device, data->pciInfo->function, PCI_command, 2);
@ -1377,7 +1377,7 @@ init_driver(void)
/* Create device name list*/
for (i=0; i<entries; i++ )
{
sprintf(devName, "%s%ld", kDevDir, i );
sprintf(devName, "%s%" B_PRId32, kDevDir, i );
gDevNameList[i] = (char *)malloc(strlen(devName)+1);
strcpy(gDevNameList[i], devName);
}

View File

@ -186,14 +186,14 @@ create_device(const usb_device dev, const usb_interface_info *ii, uint16 ifno)
device->sem_lock = sem = create_sem(1, DRIVER_NAME "_lock");
if (sem < B_OK) {
DPRINTF_ERR("create_sem() failed 0x%lx\n", sem);
DPRINTF_ERR("create_sem() failed 0x%" B_PRIx32 "\n", sem);
free(device);
return NULL;
}
device->rx_sem = sem = create_sem(1, DRIVER_NAME"_receive");
if (sem < B_OK) {
DPRINTF_ERR("create_sem() failed 0x%lx\n", sem);
DPRINTF_ERR("create_sem() failed 0x%" B_PRIx32 "\n", sem);
delete_sem(device->sem_lock);
free(device);
return NULL;
@ -202,7 +202,7 @@ create_device(const usb_device dev, const usb_interface_info *ii, uint16 ifno)
device->rx_sem_cb = sem = create_sem(0, DRIVER_NAME"_receive_cb");
if (sem < B_OK) {
DPRINTF_ERR("create_sem() failed 0x%lx\n", sem);
DPRINTF_ERR("create_sem() failed 0x%" B_PRIx32 "\n", sem);
delete_sem(device->rx_sem);
delete_sem(device->sem_lock);
free(device);
@ -499,7 +499,7 @@ pegasus_device_read(driver_cookie *cookie, off_t position, void *buffer, size_t
// block until receive is available (if blocking is allowed)
if ((status = acquire_sem_etc(dev->rx_sem, 1, B_CAN_INTERRUPT | blockFlag, 0)) != B_NO_ERROR) {
DPRINTF_ERR("cannot acquire read sem: %lx, %s\n", status, strerror(status));
DPRINTF_ERR("cannot acquire read sem: %" B_PRIx32 ", %s\n", status, strerror(status));
#ifndef __HAIKU__
*_length = 0;
#endif
@ -510,13 +510,13 @@ pegasus_device_read(driver_cookie *cookie, off_t position, void *buffer, size_t
status = usb->queue_bulk(dev->pipe_in, dev->rx_buffer, MAX_FRAME_SIZE, &pegasus_rx_callback, dev);
if (status != B_OK) {
DPRINTF_ERR("queue_bulk:failed:%08lx\n", status);
DPRINTF_ERR("queue_bulk:failed:%08" B_PRIx32 "\n", status);
goto rx_done;
}
// block until data is available (if blocking is allowed)
if ((status = acquire_sem_etc(dev->rx_sem_cb, 1, B_CAN_INTERRUPT | blockFlag, 0)) != B_NO_ERROR) {
DPRINTF_ERR("cannot acquire read sem: %lx, %s\n", status, strerror(status));
DPRINTF_ERR("cannot acquire read sem: %" B_PRIx32 ", %s\n", status, strerror(status));
#ifndef __HAIKU__
*_length = 0;
#endif
@ -567,7 +567,7 @@ pegasus_device_write(driver_cookie *cookie, off_t position, const void *buffer,
// block until a free tx descriptor is available
if ((status = acquire_sem_etc(dev->tx_sem, 1, B_TIMEOUT, ETHER_TRANSMIT_TIMEOUT)) < B_NO_ERROR) {
DPRINTF_ERR("write: acquiring sem failed: %lx, %s\n", status, strerror(status));
DPRINTF_ERR("write: acquiring sem failed: %" B_PRIx32 ", %s\n", status, strerror(status));
return status;
}
@ -594,13 +594,13 @@ pegasus_device_write(driver_cookie *cookie, off_t position, const void *buffer,
&pegasus_tx_callback, dev);
if (status != B_OK){
DPRINTF_ERR("queue_bulk:failed:%08lx\n", status);
DPRINTF_ERR("queue_bulk:failed:%08" B_PRIx32 "\n", status);
goto tx_done;
}
// block until data is sent (if blocking is allowed)
if ((status = acquire_sem_etc(dev->tx_sem_cb, 1, B_CAN_INTERRUPT, 0)) != B_NO_ERROR) {
DPRINTF_ERR("cannot acquire write done sem: %lx, %s\n", status, strerror(status));
DPRINTF_ERR("cannot acquire write done sem: %" B_PRIx32 ", %s\n", status, strerror(status));
#ifndef __HAIKU__
*_length = 0;
#endif

View File

@ -197,8 +197,8 @@ DataRing<TxDescriptor, TxDescriptorsCount>::Dump()
{
int32 count = 0;
get_sem_count(fSemaphore, &count);
kprintf("Tx:[count:%ld] head:%lu tail:%lu dirty:%lu\n",
count, fHead, fTail, fHead - fTail);
kprintf("Tx:[count:%" B_PRId32 "] head:%" B_PRIu32 " tail:%" B_PRIu32 " "
"dirty:%" B_PRIu32 "\n", count, fHead, fTail, fHead - fTail);
kprintf("\tPktSize\t\tCmdStat\t\tBufPtr\t\tEOD\n");
@ -206,8 +206,9 @@ DataRing<TxDescriptor, TxDescriptorsCount>::Dump()
volatile TxDescriptor& D = fDescriptors[i];
char marker = ((fTail % TxDescriptorsCount) == i) ? '=' : ' ';
marker = ((fHead % TxDescriptorsCount) == i) ? '>' : marker;
kprintf("%02lx %c\t%08lx\t%08lx\t%08lx\t%08lx\n", i, marker,
D.fPacketSize, D.fCommandStatus, D.fBufferPointer, D.fEOD);
kprintf("%02lx %c\t%08" B_PRIx32 "\t%08" B_PRIx32 "\t%08" B_PRIx32
"\t%08" B_PRIx32 "\n", i, marker, D.fPacketSize,
D.fCommandStatus, D.fBufferPointer, D.fEOD);
}
}
@ -335,8 +336,8 @@ DataRing<RxDescriptor, RxDescriptorsCount>::Dump()
{
int32 count = 0;
get_sem_count(fSemaphore, &count);
kprintf("Rx:[count:%ld] head:%lu tail:%lu dirty:%lu\n",
count, fHead, fTail, fHead - fTail);
kprintf("Rx:[count:%" B_PRId32 "] head:%" B_PRIu32 " tail:%" B_PRIu32 " "
"dirty:%" B_PRIu32 "\n", count, fHead, fTail, fHead - fTail);
for (size_t i = 0; i < 2; i++) {
kprintf("\tStatSize\tPktInfo\t\tBufPtr\t\tEOD %c",
@ -344,7 +345,8 @@ DataRing<RxDescriptor, RxDescriptorsCount>::Dump()
}
for (size_t i = 0; i < RxDescriptorsCount / 2; i++) {
const char* mask = "%02lx %c\t%08lx\t%08lx\t%08lx\t%08lx %c";
const char* mask = "%02" B_PRIx32 " %c\t%08" B_PRIx32 "\t%08" B_PRIx32
"\t%08" B_PRIx32 "\t%08" B_PRIx32 " %c";
for (size_t ii = 0; ii < 2; ii++) {
size_t index = ii == 0 ? i : (i + RxDescriptorsCount / 2);

View File

@ -736,7 +736,8 @@ Device::DumpRegisters()
for (size_t i = 0; i < _countof(RegisterEntries); i++) {
uint32 registerContents = ReadPCI32(RegisterEntries[i].Base);
kprintf("%s:\t%08lx\n", RegisterEntries[i].Name, registerContents);
kprintf("%s:\t%08" B_PRIx32 "\n", RegisterEntries[i].Name,
registerContents);
if (RegisterEntries[i].writeBack) {
WritePCI32(RegisterEntries[i].Base, registerContents);
}

View File

@ -83,7 +83,7 @@ static int SiS19X_DebuggerCommand(int argc, char** argv)
}
if (cardId >= numCards) {
kprintf("%lld - invalid index.\n", cardId);
kprintf("%" B_PRId64 " - invalid index.\n", cardId);
kprintf(usageInfo);
return 0;
}

View File

@ -101,7 +101,7 @@ void SiS19X_trace(bool force, const char* func, const char *fmt, ...)
bigtime_t time = system_time();
uint32 msec = time / 1000;
uint32 sec = msec / 1000;
sprintf(buf_ptr, "%02ld.%02ld.%03ld:",
sprintf(buf_ptr, "%02" B_PRId32 ".%02" B_PRId32 ".%03" B_PRId32 ":",
sec / 60, sec % 60, msec % 1000);
buf_ptr += strlen(buf_ptr);
}

View File

@ -218,7 +218,8 @@ get_domain(struct net_buffer* buffer)
status_t
icmp6_receive_data(net_buffer *buffer)
{
TRACE(("ICMPv6 received some data, buffer length %lu\n", buffer->size));
TRACE(("ICMPv6 received some data, buffer length %" B_PRIu32 "\n",
buffer->size));
net_domain* domain = get_domain(buffer);
if (domain == NULL)

View File

@ -310,8 +310,8 @@ BufferQueue::Get(net_buffer *buffer, tcp_sequence sequence, size_t bytes)
if (source == NULL)
panic("we should have had that data...");
if (tcp_sequence(source->sequence) > sequence) {
panic("source %p, sequence = %lu (%lu)\n", source, source->sequence,
sequence.Number());
panic("source %p, sequence = %" B_PRIu32 " (%" B_PRIu32 ")\n", source,
source->sequence, sequence.Number());
}
// clone the data
@ -481,8 +481,8 @@ BufferQueue::Dump() const
SegmentList::ConstIterator iterator = fList.GetIterator();
int32 number = 0;
while (net_buffer* buffer = iterator.Next()) {
kprintf(" %ld. buffer %p, sequence %lu, size %lu\n", ++number,
buffer, buffer->sequence, buffer->size);
kprintf(" %" B_PRId32 ". buffer %p, sequence %" B_PRIu32 ", size %"
B_PRIu32 "\n", ++number, buffer, buffer->sequence, buffer->size);
}
}

View File

@ -2330,45 +2330,50 @@ TCPEndpoint::Dump() const
{
kprintf("TCP endpoint %p\n", this);
kprintf(" state: %s\n", name_for_state(fState));
kprintf(" flags: 0x%lx\n", fFlags);
kprintf(" flags: 0x%" B_PRIx32 "\n", fFlags);
#if KDEBUG
kprintf(" lock: { %p, holder: %ld }\n", &fLock, fLock.holder);
kprintf(" lock: { %p, holder: %" B_PRId32 " }\n", &fLock, fLock.holder);
#endif
kprintf(" accept sem: %ld\n", fAcceptSemaphore);
kprintf(" options: 0x%lx\n", (uint32)fOptions);
kprintf(" accept sem: %" B_PRId32 "\n", fAcceptSemaphore);
kprintf(" options: 0x%" B_PRIx32 "\n", (uint32)fOptions);
kprintf(" send\n");
kprintf(" window shift: %u\n", fSendWindowShift);
kprintf(" unacknowledged: %lu\n", fSendUnacknowledged.Number());
kprintf(" next: %lu\n", fSendNext.Number());
kprintf(" max: %lu\n", fSendMax.Number());
kprintf(" urgent offset: %lu\n", fSendUrgentOffset.Number());
kprintf(" window: %lu\n", fSendWindow);
kprintf(" max window: %lu\n", fSendMaxWindow);
kprintf(" max segment size: %lu\n", fSendMaxSegmentSize);
kprintf(" unacknowledged: %" B_PRIu32 "\n",
fSendUnacknowledged.Number());
kprintf(" next: %" B_PRIu32 "\n", fSendNext.Number());
kprintf(" max: %" B_PRIu32 "\n", fSendMax.Number());
kprintf(" urgent offset: %" B_PRIu32 "\n", fSendUrgentOffset.Number());
kprintf(" window: %" B_PRIu32 "\n", fSendWindow);
kprintf(" max window: %" B_PRIu32 "\n", fSendMaxWindow);
kprintf(" max segment size: %" B_PRIu32 "\n", fSendMaxSegmentSize);
kprintf(" queue: %lu / %lu\n", fSendQueue.Used(), fSendQueue.Size());
#if DEBUG_BUFFER_QUEUE
fSendQueue.Dump();
#endif
kprintf(" last acknowledge sent: %lu\n", fLastAcknowledgeSent.Number());
kprintf(" initial sequence: %lu\n", fInitialSendSequence.Number());
kprintf(" last acknowledge sent: %" B_PRIu32 "\n",
fLastAcknowledgeSent.Number());
kprintf(" initial sequence: %" B_PRIu32 "\n",
fInitialSendSequence.Number());
kprintf(" receive\n");
kprintf(" window shift: %u\n", fReceiveWindowShift);
kprintf(" next: %lu\n", fReceiveNext.Number());
kprintf(" max advertised: %lu\n", fReceiveMaxAdvertised.Number());
kprintf(" window: %lu\n", fReceiveWindow);
kprintf(" max segment size: %lu\n", fReceiveMaxSegmentSize);
kprintf(" next: %" B_PRIu32 "\n", fReceiveNext.Number());
kprintf(" max advertised: %" B_PRIu32 "\n",
fReceiveMaxAdvertised.Number());
kprintf(" window: %" B_PRIu32 "\n", fReceiveWindow);
kprintf(" max segment size: %" B_PRIu32 "\n", fReceiveMaxSegmentSize);
kprintf(" queue: %lu / %lu\n", fReceiveQueue.Available(),
fReceiveQueue.Size());
#if DEBUG_BUFFER_QUEUE
fReceiveQueue.Dump();
#endif
kprintf(" initial sequence: %lu\n", fInitialReceiveSequence.Number());
kprintf(" duplicate acknowledge count: %lu\n",
kprintf(" initial sequence: %" B_PRIu32 "\n",
fInitialReceiveSequence.Number());
kprintf(" duplicate acknowledge count: %" B_PRIu32 "\n",
fDuplicateAcknowledgeCount);
kprintf(" round trip time: %ld (deviation %ld)\n", fRoundTripTime,
fRoundTripDeviation);
kprintf(" retransmit timeout: %lld\n", fRetransmitTimeout);
kprintf(" congestion window: %lu\n", fCongestionWindow);
kprintf(" slow start threshold: %lu\n", fSlowStartThreshold);
kprintf(" round trip time: %" B_PRId32 " (deviation %" B_PRId32 ")\n",
fRoundTripTime, fRoundTripDeviation);
kprintf(" retransmit timeout: %" B_PRId64 "\n", fRetransmitTimeout);
kprintf(" congestion window: %" B_PRIu32 "\n", fCongestionWindow);
kprintf(" slow start threshold: %" B_PRIu32 "\n", fSlowStartThreshold);
}

View File

@ -739,7 +739,7 @@ UdpEndpointManager::ReceiveError(status_t error, net_buffer* buffer)
// original packet
udp_header header;
if (gBufferModule->read(buffer, 0, &header,
std::min(buffer->size, sizeof(udp_header))) != B_OK)
std::min((size_t)buffer->size, sizeof(udp_header))) != B_OK)
return B_BAD_VALUE;
net_domain* domain = buffer->interface_address->domain;

View File

@ -30,9 +30,11 @@ UnixAddress::ToString(char *buffer, size_t bufferSize) const
if (!IsValid())
strlcpy(buffer, "<empty>", bufferSize);
else if (IsInternalAddress())
snprintf(buffer, bufferSize, "<%05lx>", fInternalID);
else
snprintf(buffer, bufferSize, "<%ld, %lld>", fVolumeID, fNodeID);
snprintf(buffer, bufferSize, "<%05" B_PRIx32 ">", fInternalID);
else {
snprintf(buffer, bufferSize, "<%" B_PRIdDEV ", %" B_PRIdINO ">",
fVolumeID, fNodeID);
}
return buffer;
}

View File

@ -182,7 +182,7 @@ UnixEndpoint::Bind(const struct sockaddr *_address)
sockaddr_un* outAddress = (sockaddr_un*)&socket->address;
outAddress->sun_path[0] = '\0';
sprintf(outAddress->sun_path + 1, "%05lx", internalID);
sprintf(outAddress->sun_path + 1, "%05" B_PRIx32, internalID);
outAddress->sun_len = INTERNAL_UNIX_ADDRESS_LEN;
// null-byte + 5 hex digits

View File

@ -399,7 +399,7 @@ size_t
UnixFifo::Readable() const
{
size_t readable = fBuffer.Readable();
return readable > fReadRequested ? readable - fReadRequested : 0;
return (off_t)readable > fReadRequested ? readable - fReadRequested : 0;
}
@ -407,7 +407,7 @@ size_t
UnixFifo::Writable() const
{
size_t writable = fBuffer.Writable();
return writable > fWriteRequested ? writable - fWriteRequested : 0;
return (off_t)writable > fWriteRequested ? writable - fWriteRequested : 0;
}

View File

@ -241,12 +241,12 @@ dump_device_interface(int argc, char** argv)
= (net_device_interface*)parse_expression(argv[1]);
kprintf("device: %p\n", interface->device);
kprintf("reader_thread: %ld\n", interface->reader_thread);
kprintf("reader_thread: %" B_PRId32 "\n", interface->reader_thread);
kprintf("up_count: %" B_PRIu32 "\n", interface->up_count);
kprintf("ref_count: %" B_PRId32 "\n", interface->ref_count);
kprintf("deframe_func: %p\n", interface->deframe_func);
kprintf("deframe_ref_count: %" B_PRId32 "\n", interface->ref_count);
kprintf("consumer_thread: %ld\n", interface->consumer_thread);
kprintf("consumer_thread: %" B_PRId32 "\n", interface->consumer_thread);
kprintf("monitor_count: %" B_PRId32 "\n", interface->monitor_count);
kprintf("monitor_lock: %p\n", &interface->monitor_lock);

View File

@ -77,8 +77,8 @@ dump_domains(int argc, char** argv)
RouteList::Iterator routeIterator = domain->routes.GetIterator();
while (net_route_private* route = routeIterator.Next()) {
kprintf(" %p: dest %s, mask %s, gw %s, flags %lx, address %p\n",
route, AddressString(domain, route->destination
kprintf(" %p: dest %s, mask %s, gw %s, flags %" B_PRIx32 ", "
"address %p\n", route, AddressString(domain, route->destination
? route->destination : NULL).Data(),
AddressString(domain, route->mask ? route->mask : NULL).Data(),
AddressString(domain, route->gateway

View File

@ -148,7 +148,7 @@ dump_local(int argc, char** argv)
size_t i = 0;
while (InterfaceAddress* address = iterator.Next()) {
address->Dump(++i);
dprintf(" hash: %lu\n",
dprintf(" hash: %" B_PRIu32 "\n",
address->domain->address_module->hash_address(address->local,
false));
}

View File

@ -610,7 +610,7 @@ dump_buffer(net_buffer* _buffer)
net_buffer_private* buffer = (net_buffer_private*)_buffer;
dprintf("buffer %p, size %" B_PRIu32 ", flags %" B_PRIx32 ", stored header "
"%" B_PRIu32 ", interface address %p\n", buffer, buffer->size,
"%" B_PRIuSIZE ", interface address %p\n", buffer, buffer->size,
buffer->flags, buffer->stored_header_length, buffer->interface_address);
dump_address("source", buffer->source, buffer->interface_address);
@ -652,11 +652,11 @@ dump_net_buffer(int argc, char** argv)
static int
dump_net_buffer_stats(int argc, char** argv)
{
kprintf("allocated data headers: %7ld / %7ld, peak %7ld\n",
sAllocatedDataHeaderCount, sEverAllocatedDataHeaderCount,
kprintf("allocated data headers: %7" B_PRId32 " / %7" B_PRId32 ", peak %7"
B_PRId32 "\n", sAllocatedDataHeaderCount, sEverAllocatedDataHeaderCount,
sMaxAllocatedDataHeaderCount);
kprintf("allocated net buffers: %7ld / %7ld, peak %7ld\n",
sAllocatedNetBufferCount, sEverAllocatedNetBufferCount,
kprintf("allocated net buffers: %7" B_PRId32 " / %7" B_PRId32 ", peak %7"
B_PRId32 "\n", sAllocatedNetBufferCount, sEverAllocatedNetBufferCount,
sMaxAllocatedNetBufferCount);
return 0;
}

View File

@ -341,7 +341,7 @@ static void
print_socket_line(net_socket_private* socket, const char* prefix)
{
BReference<net_socket_private> parent = socket->parent.GetReference();
kprintf("%s%p %2d.%2d.%2d %6ld %p %p %p%s\n", prefix, socket,
kprintf("%s%p %2d.%2d.%2d %6" B_PRId32 " %p %p %p%s\n", prefix, socket,
socket->family, socket->type, socket->protocol, socket->owner,
socket->first_protocol, socket->first_info, parent.Get(),
parent.Get() != NULL ? socket->is_connected ? " (c)" : " (p)" : "");
@ -368,10 +368,10 @@ dump_socket(int argc, char** argv)
kprintf(" options: %x\n", socket->options);
kprintf(" linger: %d\n", socket->linger);
kprintf(" bound to device: %" B_PRIu32 "\n", socket->bound_to_device);
kprintf(" owner: %ld\n", socket->owner);
kprintf(" max backlog: %ld\n", socket->max_backlog);
kprintf(" owner: %" B_PRId32 "\n", socket->owner);
kprintf(" max backlog: %" B_PRId32 "\n", socket->max_backlog);
kprintf(" is connected: %d\n", socket->is_connected);
kprintf(" child_count: %lu\n", socket->child_count);
kprintf(" child_count: %" B_PRIu32 "\n", socket->child_count);
if (socket->child_count == 0)
return 0;

View File

@ -146,7 +146,7 @@ family::Release()
family::Compare(void* _family, const void* _key)
{
struct family* family = (struct family*)_family;
int key = (int)_key;
int key = (addr_t)_key;
if (family->type == key)
return 0;
@ -159,7 +159,7 @@ family::Compare(void* _family, const void* _key)
family::Hash(void* _family, const void* _key, uint32 range)
{
struct family* family = (struct family*)_family;
int key = (int)_key;
int key = (addr_t)_key;
if (family != NULL)
return family->type % range;
@ -171,7 +171,7 @@ family::Hash(void* _family, const void* _key, uint32 range)
/*static*/ struct family*
family::Lookup(int type)
{
return (struct family*)hash_lookup(sFamilies, (void*)type);
return (struct family*)hash_lookup(sFamilies, (void*)(addr_t)type);
}

View File

@ -312,7 +312,7 @@ Fifo::Dequeue(bool clone)
}
ssize_t
status_t
Fifo::Clear()
{
return base_fifo_clear(this);
@ -632,7 +632,7 @@ dump_timer(int argc, char** argv)
if (timer == NULL)
break;
kprintf("%p %p %p %Ld\n", timer, timer->hook, timer->data,
kprintf("%p %p %p %" B_PRId64 "\n", timer, timer->hook, timer->data,
timer->due > 0 ? timer->due - system_time() : -1);
}

View File

@ -152,7 +152,7 @@ bus_alloc_resource(device_t dev, int type, int *rid, unsigned long start,
return NULL;
device_printf(dev, "bus_alloc_resource(%i, [%i], 0x%lx, 0x%lx, 0x%lx,"
"0x%lx)\n", type, *rid, start, end, count, flags);
"0x%" B_PRIx32 ")\n", type, *rid, start, end, count, flags);
// maybe a local array of resources is enough
res = (struct resource *)malloc(sizeof(struct resource));

View File

@ -74,9 +74,9 @@ find_own_image()
int32 cookie = 0;
image_info info;
while (get_next_image_info(B_SYSTEM_TEAM, &cookie, &info) == B_OK) {
if (((uint32)info.text <= (uint32)find_own_image
&& (uint32)info.text + (uint32)info.text_size
> (uint32)find_own_image)) {
if (((addr_t)info.text <= (addr_t)find_own_image
&& (addr_t)info.text + (addr_t)info.text_size
> (addr_t)find_own_image)) {
// found our own image
return info.id;
}
@ -635,8 +635,8 @@ pmap_kextract(vm_offset_t virtualAddress)
physical_entry entry;
status_t status = get_memory_map((void *)virtualAddress, 1, &entry, 1);
if (status < B_OK) {
panic("fbsd compat: get_memory_map failed for %p, error %08lx\n",
(void *)virtualAddress, status);
panic("fbsd compat: get_memory_map failed for %p, error %08" B_PRIx32
"\n", (void *)virtualAddress, status);
}
return (vm_paddr_t)entry.address;

View File

@ -7,10 +7,26 @@
#define _FBSD_COMPAT_MACHINE__BUS_H_
#ifdef B_HAIKU_64_BIT
typedef uint64_t bus_addr_t;
typedef uint64_t bus_size_t;
typedef uint64_t bus_space_tag_t;
typedef uint64_t bus_space_handle_t;
#else
typedef uint32_t bus_addr_t;
typedef uint32_t bus_size_t;
typedef int bus_space_tag_t;
typedef unsigned int bus_space_handle_t;
#endif
#endif /* _FBSD_COMPAT_MACHINE__BUS_H_ */

View File

@ -120,7 +120,11 @@
#define I386_BUS_SPACE_MEM 1
#define BUS_SPACE_MAXADDR_32BIT 0xffffffff
#define BUS_SPACE_MAXADDR 0xffffffff
#ifdef __x86_64__
# define BUS_SPACE_MAXADDR 0xffffffffffffffffull
#else
# define BUS_SPACE_MAXADDR 0xffffffff
#endif
#define BUS_SPACE_MAXSIZE_32BIT 0xffffffff
#define BUS_SPACE_MAXSIZE 0xffffffff

View File

@ -10,11 +10,18 @@
#include <KernelExport.h>
// TODO at the moment for 32 bit machines only
#ifdef B_HAIKU_64_BIT
typedef uint64_t vm_offset_t;
typedef uint64_t vm_paddr_t;
#else
typedef uint32_t vm_offset_t;
typedef uint32_t vm_paddr_t;
#endif
typedef void *pmap_t;

View File

@ -41,7 +41,7 @@ compat_open(const char *name, uint32 flags, void **cookie)
return B_ERROR;
ifp = gDevices[i];
if_printf(ifp, "compat_open(0x%lx)\n", flags);
if_printf(ifp, "compat_open(0x%" B_PRIx32 ")\n", flags);
if (atomic_or(&ifp->open_count, 1)) {
put_module(NET_STACK_MODULE_NAME);

View File

@ -43,7 +43,11 @@ __FBSDID("$FreeBSD: src/sys/i386/i386/busdma_machdep.c,v 1.74.2.4 2006/10/21 16:
#include <machine/atomic.h>
#include <machine/bus.h>
#define MAX_BPAGES 512
#ifdef __x86_64__
# define MAX_BPAGES 8192
#else
# define MAX_BPAGES 512
#endif
/* -hugo */
#define malloc(a, b, c) kernel_malloc(a, b, c)
@ -60,7 +64,7 @@ struct bounce_zone;
struct bus_dma_tag {
bus_dma_tag_t parent;
bus_size_t alignment;
bus_size_t boundary;
bus_addr_t boundary;
bus_addr_t lowaddr;
bus_addr_t highaddr;
bus_dma_filter_t *filter;
@ -97,7 +101,7 @@ struct bounce_zone {
int total_bounced;
int total_deferred;
bus_size_t alignment;
bus_size_t boundary;
bus_addr_t boundary;
bus_addr_t lowaddr;
char zoneid[8];
char lowaddrid[20];

View File

@ -341,7 +341,7 @@ Services::_StopService(struct service& service)
// Shutdown the running server, if any
if (service.process != -1) {
printf(" Sending SIGTERM to process %ld\n", service.process);
printf(" Sending SIGTERM to process %" B_PRId32 "\n", service.process);
kill(-service.process, SIGTERM);
}