HaikuArchives / VMwareAddons

VMwareAdd-ons is a set of tools to enhance interaction with Haiku running in VMware
MIT License
7 stars 9 forks source link

Fix build on x86_gcc2 architecture #35

Closed volo-droid closed 2 years ago

volo-droid commented 2 years ago
diversys commented 2 years ago

cc @korli

volo-droid commented 2 years ago

@diversys if you'd like, I can also move the changes to the README file into a separate PR

diversys commented 2 years ago

Fine by me either way :)

volo-droid commented 2 years ago

@korli @diversys FYI, for the x86_64 build there're two more warnings in vmware_video/kernel/device.c that might be worth to investigate in the future:

device.c: In function 'CheckCapabilities':
device.c:75:14: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  si->fbDma = (void *)ReadReg(SVGA_REG_FB_START);
              ^
device.c:78:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  si->fifoDma = (void *)ReadReg(SVGA_REG_MEM_START);
                ^

The ReadReg returns uint32 which is cast to a pointer in those two cases. That probably works just fine for the 32-bit system, but might lead to problems on the 64-bit one. I'll file an issue to keep track of them.

I've found another approach to get the addresses in question, but it's still returns 32-bit addresses: https://github.com/prepare/vmware-svga/blob/eea7ddcd0d34702f8f0a33c1933718706c6318c5/lib/refdriver/svga.c#L88-L96

korli commented 2 years ago

@volo-droid fbDma und fifoDma should be phys_addr_t

korli commented 2 years ago

LGTM

volo-droid commented 2 years ago

@volo-droid fbDma und fifoDma should be phys_addr_t

@korli Yes, and they should be read from BARs instead of I/O regs, like Linux does. Do you have an example on how to do that on Haiku? https://github.com/torvalds/linux/blob/879dbe9ffebc1328717cd66eab7e4918a3f499bd/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c#L764

volo-droid commented 2 years ago

@diversys Let's merge this one 😉

diversys commented 2 years ago

Great!

korli commented 2 years ago

@volo-droid for the base address with index 1: gPd->pcii.u.h0.base_registers[1] for the length: gPd->pcii.u.h0.base_register_sizes[1]

if the BARs are 64-bit (check in the syslog), then a bit more is needed, see for instance: https://github.com/haiku/haiku/blob/69880fc7cb8a103979c9deb2fbc61181ea0b9de3/src/add-ons/kernel/drivers/disk/nvme/compat/libnvme_haiku.cpp#L134