<mrvn>
How come shops are still allowed to sell washing machines? They are so racists, you have to separate the whites from the colors.
pmaz_ has joined #osdev
pmaz has quit [Ping timeout: 256 seconds]
pmaz_ has quit [Ping timeout: 248 seconds]
gog has joined #osdev
innegatives has joined #osdev
listentolist has joined #osdev
wootehfoot has joined #osdev
innegatives has quit [Ping timeout: 246 seconds]
innegatives has joined #osdev
goliath has joined #osdev
<innegatives>
Since C++ compiler tends to generate more code than C, is it safe to say that kernel written purely in C++ will be slower than counterpart in C?
dude12312414 has joined #osdev
<gog>
no
<gog>
more code isn't necessarily slower
<nortti>
also it is not hard to write c++ that desugars down to exact same code as less-easy-to-read c
<gog>
yes
<innegatives>
nortti: how would one achieve that?
<nortti>
do you know how to program in c++?
<innegatives>
somewhat
<nortti>
okay so for example non-virtual methods are the exact same thing as normal function calls, just with a scoped name and implicit self parameter
<innegatives>
but then what about vtable?
<nortti>
if it's a case that needs virtual functions, you'll get a vtable in C too. if it's not, then don't make them virtual, and you will not have vtable
<innegatives>
oh okay
<gog>
but at the same time a vtable is a single indirection
<gog>
it's a function pointer
<gog>
it's one more load before a call
<gog>
that can either be ok or wreak havoc on the cache
<nortti>
(like for example VFS code in unices at least makes heavy use of vtables = arrays of function pointers to allow calling different filesystems' implementations)
<gog>
same with c standard streams
bauen1 has quit [Ping timeout: 265 seconds]
bauen1 has joined #osdev
<Ermine>
gog: may I pet you
<Ermine>
gog: I did what you said, didn't I?
<gog>
Ermine: yes, i reread your code
<gog>
it was v late and i was tired when i read it the first time :P
<gog>
and you may pet me
<Ermine>
Happens
* Ermine
pets gog to make her feel relaxed
* gog
prr
Left_Turn has joined #osdev
foudfou has joined #osdev
xenos1984 has quit [Ping timeout: 240 seconds]
xenos1984 has joined #osdev
Burgundy has quit [Ping timeout: 240 seconds]
innegatives has quit [Ping timeout: 248 seconds]
[itchyjunk] has joined #osdev
innegatives has joined #osdev
<innegatives>
I get framebuffer from GOP and clear screen by writing FFFFFFFF to all framebuffer memory. Issue is it only colors like half the screen, and that half is either more or less between each runs. Is this an QEMU issue? I mean the portion of screen it colors changes between runs. Sometimes "Tianocore" logo does not go away
<sham1>
Do you use the proper stride
<innegatives>
what is stride
<innegatives>
for (unsigned long long i = 0; i < this->framebuffer->HorizontalRes * this->framebuffer->VerticalRes; i++)
<innegatives>
*(unsigned int *)(pixel + i) = 0x00000000;
<innegatives>
change 0000 to ffff
<innegatives>
pixel is FrameBufferBase
<sham1>
A stride on a bitmap tells you how many bytes to skip to get to the next line
<sham1>
Because especially on hardware like what is being emulated here, it's not just a clean width * bytes_per_pixel
<GeDaMo>
I don't see bytes per pixel there
<sham1>
Well I do. They're attempting to go with 4 bytes per pixel
<sham1>
Of course, the pointer arithmetic is also wrong for that
<GeDaMo>
They're just adding 1 to i
<sham1>
Yes. I suppose what they mean is something like *(((unsigned int *)pixel) + i)
<GeDaMo>
If i was a pointer, that should work
<sham1>
Where each unsigned int being pointed to is a single pixel
<GeDaMo>
Maybe better with a separate counter and pointer
<GeDaMo>
innegatives: you're storing 4 bytes but only increasing the address by 1 each iteration
<innegatives>
right, thnaks
<innegatives>
even with *(((unsigned int *)pixel) + i) it does something different on each run
<mrvn>
innegatives: that code is implementation defined behavior.
<mrvn>
If pixel is a pointer other than unsigned int * then it's wrong. If pixel is uintptr_t then it's also wrong. Only way it's clen code is if pixel is unsigned int * and then you don't need to cast.
<GeDaMo>
What type is pixel?
<innegatives>
it's void * casted to unsigned int *
<mrvn>
You should use uint32_t or define a color_t with r,g,b,a
<mrvn>
cast it once so you limit the implementation defined behavior to one place.
<mrvn>
and "unsigned long long"? Unless "this->framebuffer->HorizontalRes" or "this->framebuffer->VerticalRes" is unsigned long long that does nothing good.
<mrvn>
Maybe your product overflows and you only clear the remainder
<innegatives>
how come it draws up to certain point and this point changes each time I run qemu?
<innegatives>
res are unsigned ints
<mrvn>
So everything up to 4 billion pixels will work.
<mrvn>
Not sure why it's different every time but maybe stride changes between runs
<mrvn>
Does gcc/clang turn that whole loop into a memset() call?
<innegatives>
no idea
<mrvn>
well, check it
<mrvn>
when something goes fooey you have to check your source and what the compiler makes out of it.
<innegatives>
do i just disassemble the elf and look for memset?
<mrvn>
if you see a CALL memset then it's obvious.
<innegatives>
i dont think it does
<sham1>
You think or you know? You should know
<innegatives>
the file is really small and i see 3 unique call addresses none of which look like memset
<mrvn>
do you compile with -g?
<innegatives>
no
<innegatives>
does ndisasm show the symbols when you compile with g?
<mrvn>
gnu tools do
<mrvn>
check the .o file first, that won't have been linked yet so it must have the memset symbol.
<innegatives>
no, none of the calls are memset or an unknown symbol
<innegatives>
so next course of action would be to query PixelFormat from UEFI and pass it to kernel then use it as stride?
<sham1>
Wait, you *didn't* pass the GOP data to the kernel?
<innegatives>
I did, but not PixelFormat
<mrvn>
pixel format sounds like what each pixel has as format. Not how much gap is between lines.
<innegatives>
To get the same value as scanline in VESA (also commonly called pitch in many graphics libraries), you have to multiply PixelsPerScanLine by the number of bytes per pixel. That can be detected by examining the gop->Mode->Info->PixelFormat field. For example with 32 bit packed pixel formats,
<mrvn>
You will need PixelFormat to know what bits are red, green, blue and alpha though.
<innegatives>
isnt number of bytes per pixel == stride?
<mrvn>
PixelsPerScanLine == stride
<mrvn>
Your code doesn't use PixelsPerScanLine
<innegatives>
i already multiplied with pixelsperscanline and it still did different shit each run
<innegatives>
sometimes it fills the whole screen
<innegatives>
most of the time it fills only half or so
<mrvn>
You need "pixel[x + y * PixelsPerScanLine]"
<mrvn>
and printf() all the framebuffer configuration
<mrvn>
Do you get different address and size every time or something?
<innegatives>
let me check
<innegatives>
i dont have any facility for printing or serial
<mrvn>
I recommend implementing serial before graphics
<innegatives>
will do, thanks
<innegatives>
even when i multiply the loop iteration count by 10000 it still most of the time fill like half the screen
<mrvn>
try drawing a square
<innegatives>
how does that help?
<mrvn>
it shows you how screwed up your pixel calculation is
<innegatives>
why pixel calculation matters, i fill everything starting from framebufferbase
<mrvn>
because if they are wrong you don't know what you are clearing
<mrvn>
plus you have to start checking somewhere
<innegatives>
isnt it all some distance away from framebufferbase? i cleared billion bytes starting from the base
<mrvn>
the fact that that doesn't crash tells me you are doing something wrong.
<mrvn>
Different topic: When I bind a AF_INET socket to ANY it gets data from any IPv4 source. If I bind an AF_INET6 socket to ANY it gets data from IPv4 + IPv6. What if I want IPv6 only? Do I have to bind to the individual IPv6 of the host?
<mrvn>
What if I want to bind to IP, IPX and AppleTalk? Do I need 3 sockets?
<bslsk05>
www.man7.org: ipv6(7) - Linux manual page
<mrvn>
GeDaMo: yes, missed that.
heat has joined #osdev
heat has quit [Remote host closed the connection]
heat has joined #osdev
bauen1 has quit [Ping timeout: 264 seconds]
bas1l has joined #osdev
basil has quit [Remote host closed the connection]
pharonix71 has quit [Ping timeout: 240 seconds]
pharonix71 has joined #osdev
<gog>
oh he's gone
<gog>
i was gonna show him the correct algo for calculating the pixel position
<gog>
maybe i shouldn't be so eager to help
<heat>
hi gog
<gog>
hi heat
<gog>
how's it heating
<heat>
wahts heating
<gog>
making something's molecules vibrate faster
<heat>
poggers
* mrvn
is thinking of importing the faster vibrating molecules.
bgs has joined #osdev
<mrvn>
Have to decide between china and italy
<mrvn>
Chicken Chop-Suey or Pizza, decisions, decisions, ...
bas1l is now known as basil
xenos1984 has quit [Ping timeout: 240 seconds]
xenos1984 has joined #osdev
<mrvn>
I'm trying to open a bi-directional DGRAM socket to a host. SO I do getaddrinfo and then for each result I try to create a socket + bind + connect. But bind needs a "sockaddr" matching the ai_family of the result. Is there a better way than a switch/case over all ai_family types?
<mrvn>
Something to get the local sockaddr that will be used when sending to the sockaddr in the result?
<mrvn>
Never mind, I believe I need to run getaddrinfo with AI_PASSIVE and then match the results for that with the results for the host I want to talk to.
brunothedev has joined #osdev
slidercrank has quit [Ping timeout: 248 seconds]
xenos1984 has quit [Ping timeout: 240 seconds]
xenos1984 has joined #osdev
<Ameisen>
I'm trying to figure out how to fix the licensing on vemips -- vemips' license is different from the libc++/libunwind/etc licenses that are required for the SDK part
<Ameisen>
I'm guessing I need to turn those into their own projects
<Ameisen>
vemips + vemips sdk
<Ameisen>
apache2 vs mpl2
innegatives has joined #osdev
Ali_A has joined #osdev
<brunothedev>
so, are you saying that the license of your project is different than the dependencies?
<Ameisen>
the project itself doesn't technically have any LLVM dependencies, but the SDK I provide so people can actually target it effectively is LLVM-based
<Ameisen>
(since it's basically clang + the libraries)
<Ameisen>
the only dependency that vemips has directly, iirc, is xbyak
<Ameisen>
and that's BSD-3
<brunothedev>
i think gpl v3 and bsd is compatible
<Ameisen>
I'm wanting to move it to MPL2
<heat>
hottest legal take
<Ameisen>
but that's also compatible, I believe
<Ameisen>
hey, it's all my code.
<Ameisen>
:||
<Ameisen>
previous versions can (and would) stay GPL-3
<Ameisen>
I'd been playing fast and loose with licensing but I want to fix it
<mcrod>
hi
<Ameisen>
my _guess_ is that I need to move the SDK components to their own project to make sure that they're distinct from vemips itself
<heat>
ok so real question: how do i train my cat to give massages
<Ameisen>
there are a few vemips things that I wrote that are specific to the sdk (like vevcbridge which lets MSVC build MIPS stuff)
<heat>
his paws are perfect for massages
<Ameisen>
cats give massages naturally
<Ameisen>
it's called kneading
<Ameisen>
it's usually very painful because they use their claws
<heat>
nah, they only do that on soft shit
<Ameisen>
but you grin and accept it because they're adorable.
<bnchs>
Ameisen: if someone wanted to use your CPU emulator, then they would just fork a older version of it where GPL was used
<Ameisen>
make yourself soft.
<bnchs>
and update it that way
<heat>
i want back massages
<Ameisen>
bnchs - if they wanted GPL3
<heat>
and he's not doing it there cuz IM FUCKIN RIPPED
<Ameisen>
I'm guessing that most people would prefer MPL2 (which is what most of my stuff is licensed under)
<brunothedev>
it says that it is both osi and fsf approved, aka: the vast majority of foss licenses are compatible
<heat>
no
<Ameisen>
I'm mainly wanting the licensing of my projects to be more consistent (and accurate)
<heat>
GPLv3 and BSD are in no way shape or form compatible
<Ameisen>
they don't even share any letters in their acronyms!
<Ameisen>
which is the standard legal criteria for compatibility, I believe.
<bnchs>
heat: are you talking about the crappy 4-clause BSD license that nobody uses?
<heat>
i'm talking about every freaking clause
<heat>
BSD doesn't even force you to share source code
<mrvn>
If you are distributing source then the GPL doesn't infect anything and you can mix it with any license you want as long as you keep it to separate files.
<heat>
GPL forces you to share sauce, "infects" based on binary linking, etc
<bnchs>
3-clause BSD license is compatible with GPLv3, but the other way around is not compatible
<bnchs>
using BSD in GPLv3
<heat>
GPL can use BSD shit, because BSD licenses/MIT/whatever are very weak
Arthuria has joined #osdev
<mrvn>
BSD with the advertising clause is totaly non-free
<heat>
but they are not compatible
<mrvn>
and if you use BSD source in your project it becomes GPL.
<bslsk05>
www.fsf.org: The Mozilla Public License version 2.0 is out—and GPL-compatible! — Free Software Foundation — Working together for free software
<heat>
MPL is a budget GPL
<mcrod>
it is hot
<mcrod>
very hot
<bnchs>
i think GPL was invented to make BSD people cry
<brunothedev>
mcrod: ?
<mcrod>
temperature wise, it is hot
<mcrod>
in my area
<brunothedev>
mcrod: where do u live?
<mcrod>
the east coast of the united states
<brunothedev>
isn't the east coast pretty chill?
<heat>
BSD was invented to make BSD people cry
<mcrod>
brunothedev: not in the summer, no
<brunothedev>
here, it is around 25 to 30 (celsius)
<innegatives>
mrvn: I fixed the issue by disabling interrupts
<mcrod>
heat: also yay my toolchain script has life
<sham1>
Oh this is annoying. My new chair can lean back, but I can't lock it when I'm leaning back
<mcrod>
and yes for the record, I would like this script to be as portable as possible
<heat>
i wonder... what if
<heat>
>/dev/tty
<mcrod>
but who the fuck is on Linux and _doesn't_ have bash somewhere
<gog>
i'm not sure you should be redirecting cmake's stdout, only stderr
<sham1>
If you want it to be portable: perl
<heat>
wait, actually
* sham1
runs
<heat>
>/dev/stdout
<brunothedev>
mcrod: luke smith
<mcrod>
gog: unless the user passes --verbose, they shouldn't see anything other than stderr in case something goes wrong
<heat>
mcrod, like my idea right now is something like > $FILE, where FILE is either /dev/stdout or /dev/null
<gog>
hm
<mcrod>
i see
<mcrod>
is there an example you can demonstrate
<heat>
no
<mcrod>
oh.
<mcrod>
well
* mcrod
sulks
<heat>
redirecting to stdout by default should be a noop
<mcrod>
sham1: I have to write a powershell script to do a similar thing as I'm doing here
<mcrod>
for Windows hosts
<mcrod>
.
<heat>
so the idea is that $FILE expands based on -v
<heat>
hahaha
<mcrod>
and I don't know how well that's going to turn out
<brunothedev>
run your script in a podman container
<mcrod>
in a who
<sham1>
On one hand, it should be nicer since Powershell actually has data structures worth a damn. On the other hand, it's Microsoft so you never know
<mcrod>
to be clear, the whole point of this was to avoid docker/containerization
<mcrod>
the user either builds or downloads a pre-built toolchain
<mcrod>
and they're off to the races
<mcrod>
and since it's been done since the 90s
<mcrod>
i'm not going to just not do it
<heat>
prebuilts are cringe
<sham1>
^
<mcrod>
you're cringe
<gog>
i'm based
<heat>
hi based, im heat
<mcrod>
i will come back to this in a bit
<mcrod>
but
brunothedev is now known as based
<mcrod>
i won't sleep until I figure out this monstrocity out.
<based>
whos impersonating me?
<sham1>
basedthedev
based is now known as brunothedev
<brunothedev>
the nick is protected by nickserv sooooo
* brunothedev
is smashed by a ban hammer
<sham1>
Anyway, integrating an existing event loop to C++20 stop tokens was pain. Irritating
<sham1>
Threads and event loops, what a bunch of fun!
<brunothedev>
after i entered the linux mailing list i am getting a ton of spam
slidercrank has joined #osdev
ptrc has quit [Remote host closed the connection]
ptrc has joined #osdev
* mrvn
vodes for: exec 2>/dev/null
<mrvn>
votes even
<mrvn>
Is there any way pre-c++23 to read some data into a string without initializing the storage for the string first?
<mrvn>
s.resize_and_overwrite() replacement
<heat>
mcrod, why is your project something that's erm, like, illegal to do
<mrvn>
.oO(And who thought it a good idea to only "recommended to avoid unnecessary copies and allocations" in s.resize_and_overwrite()?
<gog>
hi
<brunothedev>
hi
<geist>
huh that's odd. reading about the TMS9900 cpu. i had some sort of SPI looking IO port bus for talking to perpiherals
<geist>
called CRU
Ali_A has quit [Ping timeout: 245 seconds]
<geist>
basically you select a device via the A lines like you'd expect (presumably by your logic) but then within that there are 6 dediced register select lines (CRU S0-S5) and then you clock 32 bits of data via 3 CRU SPI looking things (CLOCK, IN, OUT)
<geist>
so kinda like mmio *except* the data bus doesn't play
dutch has quit [Quit: WeeChat 3.8]
GeDaMo has quit [Quit: That's it, you people have stood in my way long enough! I'm going to clown college!]
brunothedev has quit [Quit: WeeChat 3.8]
mctpyt has joined #osdev
<heat>
geist, did you think about that vma merging problem thing again?
wootehfoot has quit [Quit: Leaving]
<heat>
i'm not sure if there's value in explicitly supporting softmmu systems...
innegatives has joined #osdev
<heat>
or, better, supporting softmmu systems in the "we don't know if there's a page table" way
<heat>
because linux supports them just fine
gmacd has joined #osdev
bgs has quit [Remote host closed the connection]
slidercrank has quit [Remote host closed the connection]
slidercrank has joined #osdev
gmacd has quit [Ping timeout: 268 seconds]
gmacd has joined #osdev
<innegatives>
If you write to serial, and then triple fault occurs, is it possible to QEMU not to flush serial into stdio before rebooting?
mctpyt has quit [Ping timeout: 264 seconds]
gmacd has quit [Ping timeout: 264 seconds]
<gog>
are you certain that writing to serial isn't causing the triple fault?
<gog>
or the initial fault at least?
<innegatives>
it was faulting without any serial impl
<innegatives>
i think it was faulting anyway, cuz it just reboot loops
<innegatives>
i did -d int to qemu and it says Servicing interrupt 0x20
<gog>
-no-reboot
<gog>
get the IP
<gog>
find where in the code it's faulting
<innegatives>
with -no-reboot it just exits
<innegatives>
SDM says 0x20 interrupt is virtualization fault in protected mode
<innegatives>
is it same in long mode?
<gog>
do -no-shutdown too
<gog>
are you using uefi?
<innegatives>
yes
<gog>
0x20 is the timer interrupt
<gog>
that's where efi maps it
<heat>
gog
<heat>
bazel
<gog>
heat
<innegatives>
It says check_exception old: 0xffffffff new 0xd
<innegatives>
What does that mean
<gog>
0xd is gpf
<gog>
old 0xffff means there's no contributory fault
<heat>
i'm putting a tenner on "doing naughty stuff without exiting boot services"
<innegatives>
oh, i need to call ExitBootServices?
<gog>
develop a more thorough understaning of programming
<gog>
don't just copypaste code, grok what you're copypasting
<mjg>
DOORS MOTHERFUCKER
<heat>
solaris internals is a good good good good book
<heat>
and solaris is a great operating system
<gog>
what
<FireFly>
solaris seems cute, also illumos
Left_Turn has quit [Read error: Connection reset by peer]
innegatives has quit [Ping timeout: 256 seconds]
<heat>
mjg, what do you think of this take
innegatives has joined #osdev
<innegatives>
In here https://wiki.osdev.org/C%2B%2B#Global_objects is "object1.object1()" means that you should call the constructor? When I do that I get "invalid use of constructor" error
<bslsk05>
wiki.osdev.org: C++ - OSDev Wiki
<heat>
that's bogus
<innegatives>
you mean osdev entry?
<innegatives>
how am i supposed to get global objects to work then?
<heat>
wow that whole article is full of misinformation
<heat>
"Note: This appears to be specific to the Itanium platform. For IA-32/x86/i386 and amd64/x86_64, please check out Calling_Global_Constructors instead."