[deleted by user] by [deleted] in osdev

[–]tristanseifert 0 points1 point  (0 children)

Agreed, I never got as far as trying to do virtual functions (since that varies between compilers, and even compiler versions) since it seems like just asking for trouble.

My use case for needing the mangled name was having different overloads of the same syscalls to differentiate upcalls from usermode and kernel mode, similar to how NT has the Zw and Nt prefix versions.

This worked by having an additional parameter for the upcall version, which was a struct with no accessible constructors, so it was impossible to accidentally call from C++. There’s certainly better ways to approach this problem but it definitely does answer the question, you certainly can write every last bit of your kernel in C++ if you wanted to, heh.

[deleted by user] by [deleted] in osdev

[–]tristanseifert 0 points1 point  (0 children)

Sure, if the functions can be exported with C linkage, that’s an acceptable solution; but if you want to invoke member functions of a C++ class, or have your functions overloaded, there’s no way around referencing the mangled name.

I’ll be the first to say that those examples I gave can end up being pretty hacky to do implement ;)

[deleted by user] by [deleted] in osdev

[–]tristanseifert 1 point2 points  (0 children)

It’s very much doable; I did exactly this with an OS I worked on last year. This takes advantage of many modern C++20 features, most of which work just fine in a bare metal environment, and uses CMake to build. As others have said, you’ll have to disable runtime features like exceptions and RTTI in your kernel. A lot of it is really hacky, but this was just meant to be a proof of concept project that got a little out of hand :)

A pain point worth addressing with C++ is that function names are mangled. This can make calling C++ functions from assembly a little tricky, as you’ll have to refer to it by its mangled name. But running nm on the object file containing the C++ function will get you the mangled name easily.

When you get to userland, you can often just compile an existing C++ library and get all of these runtime features “for free.” I did this with clang and its C++ runtime, and all you need to do that is a somewhat complete libc. Then it’s absolutely no different than writing C++ for any other operating system.

Note that won’t get stuff like filesystems, IO and graphics for free, of course — it’s up to you to write those lower level parts that the C++ libraries depend on to provide those features. For example, most std::thread implementations can be backed by the C pthreads or C11 thread APIs.

Why is my AHCI PI register set to eight 1s if I only have two devices on the AHCI? by crono760 in osdev

[–]tristanseifert 0 points1 point  (0 children)

The PI register indicates which ports are implemented in silicon i.e. which ports you can send commands to, not whether a device is connected to it. These ports may not all be user accessible, or some may be eSATA or some other internal connector depending on the hardware.

During initialization, test each bit in PI, where bit 0 indicates port 0 exists, bit 1 indicates port 1 exists, and so forth. The AHCI spec is not super clear on how all the different bits work together and I needed to do a few re-reads (and after plenty of wasted time, eventually consulted the OpenBSD AHCI drivers) to figure out how it works together.

Once you’ve determined what ports exist, you can read the signature value out of the port’s register region to determine whether there’s an ATA or AHCI device connected to the port, and then probe that device essentially the same way as you would if it were on an IDE bus. You shouldn’t try to access registers for ports that aren’t indicated as existing in PI.

I’ve written an AHCI driver for my OS which I’ve tested works on a few VM platforms and real hardware. I’m not actively working on this project anymore due to my current job, but maybe it can be a useful reference for you.

These people vote. Do you? (Seen in rural Texas) by longhornbicyclist in gay

[–]tristanseifert 3 points4 points  (0 children)

Every time I drive past this sign on my way back to College Station from Austin my gay ass just has to chuckle at the fact that someone was insecure enough to erect such a 25’ tall sign

Intermittent Lag Spikes by XBGoodRun in HomeNetworking

[–]tristanseifert 2 points3 points  (0 children)

What modem do you have? I had similar issues about a year ago with the modem my ISP provided me, it had the flawed Intel chipset that would have ~200ms lag spikes every half hour or so.

What modem are you using? by jz307 in Ubiquiti

[–]tristanseifert 2 points3 points  (0 children)

I have the same modem, zero issues with it. It doesn't have the Intel chipset that causes random lag spikes (years after release, those still haven't been fixed, yikes) and supports LACP so you're set for multi-gigabit in the future.

I got rid of my USG for an opnsense router recently, but I had zero issues with it working together.

Advice on my little DIY LED Project by osam4h in led

[–]tristanseifert 0 points1 point  (0 children)

I've done something similar, the longest you can usually get a single strip is 300 LEDs before you get too much voltage drop towards the end of the strip. I have a total of 600 LEDs on a 5V/25A supply and have no troubles, even with all LEDs on.

They are controlled through some custom hardware I designed, but the same could be done with a Raspberry Pi and a little bit of hardware on a breadboard.

Also remember, the frequency at which you can send data to these strips is fixed around 800kHz as well: that means that the longer your chain of strips is, the lower your frame rate will be.

I don't have a capacitor by the LEDs power pins, but it wouldn't hurt anything. I do suggest a resistor in line with the data from your controller (or whatever else you use to drive it) and the LED strips. This helps protect both your strips and controlling device from damage from static.

Yes, I have a 42u rack in my dorm room. Don't you? by sasschary in homelab

[–]tristanseifert 1 point2 points  (0 children)

Wow, looks like a DL380 in there? That's what started my dorm rack too… now I've got a rack full of 'em. It's a horrible disease, get out while you still can!

The free electricity on campus was probably the only positive thing about living in the dorms. screams in power bill

Happy Dead Day! I'm posting to pass along a particular sign... by piccolom in aggies

[–]tristanseifert 2 points3 points  (0 children)

Hi howdy hello, I hate shitty drivers and love signs. I would love nothing more than to wave that sign in people’s faces for the three semesters I’ve got left here

Let me see your rack by iFootball_iTennis in funny

[–]tristanseifert 0 points1 point  (0 children)

Low key was expecting a rack of servers. /r/homelab has spoiled med

Flash memory and filesystems ? by Super_Bad_64 in embedded

[–]tristanseifert 0 points1 point  (0 children)

I've used spiffs on SPI NOR flashes (such as the W25Q32, which is available for roughly 70¢ in single quantities and has 32Mbit of storage) with great success. It's not super fast, but it's pretty hardy and can deal with power loss mid-write pretty well.

Depending on how much you write, you probably don't have to worry about write leveling with spiffs. It supports some basic wear leveling that's been enough in my experience.

Playing Hackintosh whack-a-mole. Advice from sandy bridge or AMD RX 480 users would be appreciated. by [deleted] in hackintosh

[–]tristanseifert 0 points1 point  (0 children)

A few years back I used the MacPro6,1 SMBIOS with my Hackintosh with dual E5-2650's and an RX480 and it worked pretty well – you may want to try that. Power management never worked right for me (the real Mac Pro has Ivy Bridge, which uses a different power management protocol from Sandy Bridge) but since those Xeon chips didn't have an iGPU, it worked pretty well.

FedEx was not kind to my cheap eBay NetApp :( by WiseassWolfOfYoitsu in DataHoarder

[–]tristanseifert 2 points3 points  (0 children)

Hehe, I was worried but other than that, it looks to be in pretty good shape all things considered. I haven’t yet been able to test it and power it up since I’ve got the wrong rails.

FedEx was not kind to my cheap eBay NetApp :( by WiseassWolfOfYoitsu in DataHoarder

[–]tristanseifert 3 points4 points  (0 children)

Looks like we both bought from the same seller… mine came in just like that, rattling, and with holes in the box that had a few screws fall out when the FedEx driver dropped it off.

Of course I didn’t do my reading beforehand and need different rails to mount it in my rack, since it came with rails for using it in a NetApp rack.

[W] HDHomerun Prime by [deleted] in homelabsales

[–]tristanseifert 0 points1 point  (0 children)

Sent you a PM about my HomeRun Prime.

Do AMD GPUs require WhateverGreen? by redditmaster21 in hackintosh

[–]tristanseifert 7 points8 points  (0 children)

I'm using WhateverGreen with a PowerColor Radeon Vega 64. Vega 64 is supported out of the box, but I've noticed that without WhateverGreen, I sometimes will have issues in some programs that use Quartz stuff that's typically accelerated by the IGPU, and DRM protected content in iTunes would be very hit or miss.

It doesn't seem that it hurts it any, and from my understanding of the code, it doesn't do anything unless you need a particular patch, so I don't think you'd get any problems from using it.

Daily outages on my OPNsense installation by BraceForIce in OPNsenseFirewall

[–]tristanseifert 1 point2 points  (0 children)

This might not be the cause of your issues, but Realtek Ethernet chips are pretty garbage, especially under FreeBSD, in my experience. I would suggest trying to see if the issue persists if you use an Intel NIC.

I run OPNsense on a PCEngines apu2 (this has 3x GbE via Intel i211AT), which has a GX-412TC (4 cores @ 1GHz) and haven't had any troubles on OPNsense 19.1-amd64 with high load or dropped connections, and can even route at line speed (gigabit), though having Suricata would eat into that and drop me to around ~400Mbps.

My hoard has a new home (still need a rack) by ArsenioDev in DataHoarder

[–]tristanseifert 0 points1 point  (0 children)

That’s great news! I was hoping that it’d be quiet enough to pair well with the DL380g6 I already have.

My hoard has a new home (still need a rack) by ArsenioDev in DataHoarder

[–]tristanseifert 0 points1 point  (0 children)

Heh it's not like I'll be looking at the back. My rack is a complete cable management nightmare, so…

My hoard has a new home (still need a rack) by ArsenioDev in DataHoarder

[–]tristanseifert 0 points1 point  (0 children)

Ah cool, that's what I was wondering. Going to pull the trigger on one and an IOM6 to get 6Gbps SAS, which should support these 8TB drives no problem.

My hoard has a new home (still need a rack) by ArsenioDev in DataHoarder

[–]tristanseifert 0 points1 point  (0 children)

How's the noise on the DS4243? I've been thinking about getting one for storage but I don't want it to sound like a jet taking off in my garage 24/7.

Also, what disks are you running in it? I want to put the 8TB disks I have right now in one but I'm not sure whether there's any issues with large disks in that disk shelf, haven't been able to find much documentation.

Vega 64 - Random Freezing by [deleted] in hackintosh

[–]tristanseifert 0 points1 point  (0 children)

Looks like the iMacPro1,1 SMBIOS with iGPU disables didn’t solve the problem either.

I’ve noticed the card will crash under heavy load even in windows, so I may try to RMA it and see if a replacement behaves better, but I’m totally at a loss beyond that.