k0valski1883 has quit [Quit: Ping timeout (120 seconds)]
Coldberg has joined #osdev
C-Man has quit [Ping timeout: 240 seconds]
skipwich has joined #osdev
X-Scale` has joined #osdev
X-Scale has quit [Ping timeout: 256 seconds]
X-Scale` is now known as X-Scale
<geist>
hmm, whoever planted the idea of the Rosco 68k in my head i can't get it out
<geist>
i might have to get one
<geist>
looks like a nice little board
<Bitweasil>
What's it got?
X-Scale` has joined #osdev
<klange>
> Get your retro on and build yourself a brand new, state-of-the-art, forty-year-old computer! The Really Old-School Computer™ (rosco_m68k®) is a simple yet powerful 16/32-bit computer with a base spec that compares with home computers of the late 1980s and early 1990s.
<Bitweasil>
Well, shit, let's host #osdev on it! :D
<klange>
If you wired up a NIC to the expansion port, that's probably enough to run an IRC server with a single channel of a few dozen people. It's basically the sort of thing IRC was on when it was just the one IRC.
<geist>
yah i should be able to get LK on it just fine
<Bitweasil>
I know you can run a perfectly good IRC network on a 68030 with 12MB RAM.
<klange>
but this is 68010 with 1MB of RAM, so a little more constrained
<Bitweasil>
So you'd better write a tigher IRC server! ;)
<Bitweasil>
"No, I don't *boot into IRC.* My kernel *is* ircd!"
<klange>
I did the inverse, my kernel was an IRC client.
<klange>
I could set it up to log directly to a channel.
<Bitweasil>
:D
nyah has quit [Ping timeout: 240 seconds]
<geist>
1MB should be enough to run a medium sized network at least
<geist>
probably thelargest user of it is outstanding TCP buffers
<Bitweasil>
I would expect, done tightly, you could handle a few hundred "typical users."
<geist>
yah exactly
<Bitweasil>
Yeah, TCP buffers would be rough, you'd almost have to do those dynamically, 1MB / 100 users isn't much. Hm.
<geist>
maybe not with all the bells and whistles folks expect
<klange>
It's IRC, what bells and whistles?
<Bitweasil>
^^ Exactly!
<geist>
well, nickserv/chanserv/etc
<klange>
there's a reason those aren't in the server!
<Bitweasil>
lol. Cluster of them would do!
<klange>
you'll just need another rosco for nickserver, another for chanserv...
<geist>
and probalby not SSL for all your sockets
<geist>
always thought it'd be kinda fun to write an irc server from scratch
<geist>
though it's probably not so fun
<klange>
done enough clients, a server is just closing the loop
<Bitweasil>
I expect SSL performance at 10MHz would be... poor.
<klange>
I expect SSL throughput with 1MB of RAM would be snail's pace.
<Bitweasil>
"It's not that the bear dances well; it's that the bear dances at all!"
<geist>
that being said you can buy more ram for the rosco, looks like an additional 4MB is just another board
<geist>
but that would go where the ethernet board would have to go
<geist>
or could use SLIP i guess, but that'd be even more fun running an irc server over SLIP
kaichiuchi has joined #osdev
<klange>
I'm already annoyed enough trying to type at a 921600 baud serial link, I can't imagine running a network over a 115200
<klange>
People in the 80s had way more patience than me.
<klange>
Okay, it's time to be awake and productive. Last day of the 4-day weekend. What can we get done... I got a nice pink theme for my editor for the upcoming 4/1, I still need to port ponysay for it, and maybe adapt the editor theme to the line editor in the shell...
[itchyjunk] has quit [Remote host closed the connection]
[itchyjunk] has joined #osdev
gildasio has quit [Ping timeout: 240 seconds]
Matt|home has joined #osdev
mlombard has quit [Remote host closed the connection]
freakazoid12345 has quit [Ping timeout: 256 seconds]
sonny has left #osdev [#osdev]
smeso has quit [Quit: smeso]
k8yun has joined #osdev
smeso has joined #osdev
[itchyjunk] has quit [Ping timeout: 256 seconds]
[itchyjunk] has joined #osdev
zaquest has quit [Remote host closed the connection]
zaquest has joined #osdev
elastic_dog has quit [Ping timeout: 252 seconds]
elastic_dog has joined #osdev
k8yun has quit [Read error: Connection reset by peer]
ElectronApps has joined #osdev
toulene has quit [Ping timeout: 256 seconds]
toulene has joined #osdev
ravan has joined #osdev
SikkiLadho has joined #osdev
ravan has quit [Quit: Leaving]
<SikkiLadho>
I'm trying to trap and forward SMCs. I have been able to forward all SMCs successfully, however PSCI_CPU_ON_AARCH64 is not being forwarded. I know I have to handle this in a special case later so that I don't have inconsistent CPU nodes. For now, I'm just forwarding all CPUs to see if trapping and forwarding works correctly. All 3 secondary CPUs
<bslsk05>
github.com: Leo/handler.c at ef95047547c8a37f7a603b8d2d538535be457788 · SikkiLadho/Leo · GitHub
sonny has joined #osdev
ravan has joined #osdev
<SikkiLadho>
clever j`ey
Coldberg has quit [Ping timeout: 240 seconds]
bradd has quit [Ping timeout: 256 seconds]
C-Man has joined #osdev
SikkiLadho has quit [Ping timeout: 256 seconds]
aejsmith has joined #osdev
les has quit [Quit: Adios]
les has joined #osdev
sonny has quit [Quit: Client closed]
j00ru has joined #osdev
ElectronApps has quit [Quit: Leaving]
dormito has quit [Quit: WeeChat 3.3]
dennis95 has joined #osdev
pretty_dumm_guy has joined #osdev
dormito has joined #osdev
dormito10 has joined #osdev
joe9 has quit [Quit: Lost terminal]
dormito has quit [Ping timeout: 252 seconds]
joe9 has joined #osdev
ravan_ has joined #osdev
ravan has quit [Remote host closed the connection]
mlombard has joined #osdev
toulene has quit [Quit: Ping timeout (120 seconds)]
toulene has joined #osdev
toulene has quit [Quit: Ping timeout (120 seconds)]
toulene has joined #osdev
GeDaMo has joined #osdev
Burgundy has joined #osdev
the_lanetly_052 has joined #osdev
terminalpusher has joined #osdev
dormito has joined #osdev
dormito10 has quit [Ping timeout: 250 seconds]
vdamewood has quit [Quit: Life beckons]
gildasio has joined #osdev
toulene has quit [Read error: Connection reset by peer]
toulene has joined #osdev
dormito has quit [Quit: WeeChat 3.3]
dormito has joined #osdev
terminalpusher has quit [Remote host closed the connection]
Ali_A has joined #osdev
<Ali_A>
so the bios checks the first sector of any connected device, sees if there is magic number at the last two bytes
<Ali_A>
and if that is the case, it shows some availability to boot that device
<Ali_A>
my question is, a bootlaoder like grub or something, when you install it, it is going into the hard-drive, so how does it know about other connected devices?
<Ali_A>
when I make my own OS I pass the OS image ( kernel ) to qemu, so it does executes my bootloader, and then I jump somewhere to run the kernel code.
<Ali_A>
but if I install other bootlaoders I don't understand how exactly they get executed and run even tho, they are inside the hard drive and the harddrive have not yet booted (maybe I want to load from CD or USB how would a program that resides in the hard drive run before the hard drive itself being booted?)
<clever>
Ali_A: typically, grub on a legacy install comes in 3 parts
<clever>
first, you have the MBR stub, that goes into that 1st sector
<clever>
second, you have the grub kernel, typically living in the free space between the 1st sector, and the 1st partition, and the kernel has some drivers pre-appended to it, enough to mount /boot
<Ali_A>
first, what is exactly a legacy install? (you mean a system that uses BIOS and not UEFI?)
<clever>
the LBA# of that 2nd part, is embedded in the first part
<clever>
exactly
<clever>
and then 3rd, you have more grub modules in /boot
<clever>
[root@amd-nixos:/boot/grub/i386-pc]# ls -lh boot.img
<clever>
-rw-r--r-- 1 root root 512 Aug 9 2019 boot.img
<clever>
this is the 1st part, a pre-compiled MBR stub
<clever>
-rw-r--r-- 1 root root 26K Aug 9 2019 core.img
<clever>
and the 2nd part, the core of the grub kernel
<clever>
-rw-r--r-- 1 root root 4.7K Aug 9 2019 biosdisk.mod
<clever>
-rw-r--r-- 1 root root 5.9K Aug 9 2019 ext2.mod
<clever>
-rw-r--r-- 1 root root 2.5K Aug 9 2019 msdospart.mod
<clever>
then, depending on your fs choice, those 3 modules, plus core.img, get written to "unused space" between the 1st sector, and the 1st partition
<clever>
and also in that region, is the sector list
<clever>
and the 1st sector of that list, is baked into a copy of boot.img, placed in the 1st sector
<clever>
so grub can load its pieces, and gain the ability to read /boot
<clever>
-rw-r--r-- 1 root root 113K Aug 9 2019 normal.mod
<clever>
and then the "normal" module, contains the final UI and scripting core
<clever>
it needs to parse your /boot filesystem, and load normal.mod as a true file
<clever>
then other modules are loaded on-demand, based on your config
<Ali_A>
hmm I kind of get it (still not sure about few things, but at least now I can start google stuff) Thanks
<Ali_A>
clever
<clever>
under normal conditions, all of that is done relative to whatever disk the MBR was loaded from, the bios will leave that disk# in a specific register
<clever>
let me see if i can find that old pastebin...
<clever>
and this is an example from how my machine was configured 3 years ago
<clever>
line 6, it found a boot.img in sector 0, and its configured to load core.img from sector 1
<clever>
core.img is then configured to mount (,msdos2)/grub, the hdd name is missing, so its relative to the current disk, msdos2 means partition 2 via the MBR scheme, and /grub is a subdir of that partition
<clever>
line 12, the core.img at sector 1, also includes 4 modules, fshelp, ext2, part_msdos and biosdisk
<clever>
biosdisk allows doing legacy bios int based disk IO, part_msdos lets it read MBR disks, and ext2 is for ext2/3/4 FS's
<Ali_A>
great!
<clever>
line 14, sdb also has a copy of grub!, its core.img is instead at sector 2048, has gpt and zfs support!, and will scan every device until it finds one with a given UUID!!
<clever>
sdc has a windows bootloader
<clever>
and then it goes on to list every single partition, what fs is contained within, and other relevant info
<clever>
Ali_A: grub can also do legacy booting on gpt, which you can see in my above paste
<clever>
Device Start End Sectors Size Type
<clever>
/dev/sdb1 2048 67583 65536 32M BIOS boot
<Ali_A>
I ma going through the first link now, and try to run it and see.
<clever>
because GPT tables are bigger then 1 sector, you cant cheat and use the "unused" space between sector0 and partition 1
<clever>
instead, you must create a dedicated partition, with the "bios boot" type-code
<clever>
and behind the schemes, every type-code in GPT is a UUID
<clever>
gone are the days of everybody fighting over an 8 bit type-code!
<clever>
but, if you take the "bios boot" type-code, and convert the hex in its UUID to binary....
<clever>
00000400 48 61 68 21 49 64 6f 6e 74 4e 65 65 64 45 46 49 |Hah!IdontNeedEFI|
<clever>
you get this string!
<clever>
that then just holds the raw core.img from before
xenos1984 has quit [Read error: Connection reset by peer]
<clever>
line 2, the currently booted OS came from entry 4, so you can edit yourself safely, and not harm other OS's
<clever>
lne 9, entry 4 says to find a partition with a given partuuid, mount it, and execute a file at a given path within it
<clever>
the firmware then just does that, and your done, your binary is now in control of the cpu, and you have a whole array of libc functions and drivers already loaded for you!
<clever>
each OS can add its own entry to this list, and manipulate the BootOrder
<klange>
absolutely terrible python code, littered with semicolons in places I don't accept them, lots of % formatting which I don't support, tons of other little oddities I had to work around
<klange>
and all the normal declaration stuff
sbalmos has joined #osdev
Coldberg has joined #osdev
C-Man has quit [Ping timeout: 256 seconds]
dennis95 has quit [Read error: Connection reset by peer]
dennis95 has joined #osdev
Burgundy has quit [Ping timeout: 256 seconds]
Coldberg is now known as C-Man
eddof13 has joined #osdev
[itchyjunk] has joined #osdev
gog has joined #osdev
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eddof13 has joined #osdev
papaya_ has joined #osdev
papaya_ has quit [Client Quit]
sonny has joined #osdev
papaya_ has joined #osdev
bauen1 has quit [Ping timeout: 240 seconds]
jimbzy has quit [Ping timeout: 240 seconds]
sonny has quit [Ping timeout: 256 seconds]
mahmutov has joined #osdev
sonny has joined #osdev
Burgundy has joined #osdev
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sonny has quit [Quit: Client closed]
sonny has joined #osdev
dude12312414 has joined #osdev
vin1 has quit [Quit: WeeChat 2.8]
sortie has quit [Ping timeout: 256 seconds]
xenos1984 has quit [Read error: Connection reset by peer]
k0valski188 has joined #osdev
<gorgonical>
why did nobody ever tell me how preposterously small m.2 drives are
<blockhead>
because it's a secret
xenos1984 has joined #osdev
sortie has joined #osdev
freakazoid12345 has joined #osdev
<geist>
uh oh who let gorgonical know about the m.2 thing?
<sonny>
What do you think about a call like fork() doing copy-on-write?
gildasio has quit [Remote host closed the connection]
<geist>
that's what it does
<sonny>
oh
<sonny>
I thought it copied regardless
<geist>
ah no. well the model is that it makes a copy of the process
gildasio has joined #osdev
<sonny>
ok cool :-)
<geist>
but it can be implemented as doing a symmetric copy on write of both the parent and the child process
<brynet>
implementation detail :)
<geist>
right
dennis95 has quit [Ping timeout: 245 seconds]
<sonny>
I like copying ... I am thinking apps should not create files as a user, instead users and apps gets a unique place to store data and there will be methods to transfer data. This won't work across the kernel boundary though
<geist>
i'd tend to think fork() is fairly incompatible with that model
<geist>
since the assumption is the process on the other side of the fork is also pretty much equal in terms of ability to access things
<sonny>
good point
<sonny>
I'd need to segment the memory in the process (to store metadata)
<sonny>
that won't work actually
* sonny
thinks
<sonny>
yeah it would just be something really different
garrit has quit [Ping timeout: 240 seconds]
garrit has joined #osdev
xenos1984 has quit [Remote host closed the connection]
sonny6 has joined #osdev
<geist>
unless you're going to implement posix, i would not attempt to implement fork
dude12312414 has quit [Quit: THE RAM IS TOO DAMN HIGH]
sonny has quit [Ping timeout: 256 seconds]
<sonny6>
I'm not going to do posix, just brainstorming
<Bitweasil>
Heh. I have one of those in my office.
<geist>
it's a teensy bit more annoying for me: if i go WFH i take a bit of a pay cut, because my house is in a different county
<geist>
which is a bit annoying
<Bitweasil>
I grumbled to my wife that my crystal ball was getting fuzzy, so I got one a year or two back for a birthday or something.
<Bitweasil>
geist, commuting ain't cheap.
<Bitweasil>
Should geist WFH? *shakes* "Signs point to yes."
<geist>
otherwise it would make no real difference, the main diff between officially being WFH vs WFO is i'd either have a desk reserved or not
<mjg>
commuting ain't cheap on your time
<kazinsal>
yeah I live way out in the boonies and it saves me $500/month on rent
<geist>
oh well, this is based on the idea that i'm still living in the same place, etc. so yeah the 2+ hours a day has some cost
<kazinsal>
tradeoff is an hour and change of commute by bus->train->walking though
<gog>
train good
<geist>
and yeah commuting in is something like $5/day post-reimbursements
<Bitweasil>
Uh. 2h+/day of *commute?
<geist>
its closer to $13 but company reimburses some of that
<Bitweasil>
Screeeeewwwww that!
<kazinsal>
right, you've gotta hop a ferry for the most direct route
<geist>
yep. the ferry is nice, but it does take time
<Bitweasil>
I enjoyed the ferries, but wouldn't want to be on one daily.
<Bitweasil>
Do you drive it or walk/bike?
<geist>
can do all, but driving is really expensive.
<Bitweasil>
*nods*
<geist>
could ride scooter on during summer, which is less expensive
<Bitweasil>
Segway!
<geist>
but walking on is not too bad. the $5 extra comes from parking the scooter at the ferry terminal
<geist>
if i was willing to walk 2mi to the ferry terminal it'd be zero
<Bitweasil>
I would take a significant pay cut to not have to deal with that on a daily basis.
<geist>
yah and it's entirely self inflicted by moving when i did
<Bitweasil>
I mean, I took a significant pay cut to move to rural farm country and work remotely, and couldn't be happier.
<kazinsal>
yeah parking is always the big pain point
<geist>
yah i know. like i said i want to get it out of my system before deciding what to officially do
<geist>
give it a real go before deciding
<geist>
also i do like my cow-orkers
<kazinsal>
it's a 30 minute drive into the office or 1:10 by public transit, but a monthly transit pass is $80 and a monthly parking pass at my office is $195
<geist>
but depends on which ones come back, etc
* Bitweasil
talks loudly about his weekend plans by geist.
<Bitweasil>
Hey, lunch!
<Bitweasil>
I don't miss the regular distactions.
<Bitweasil>
I can turn my music off and dig in if I feel like it.
<Bitweasil>
I listen to radically less "high acoustical energy metal" that, as it turns out, was mostly to drown out the open office din.
<kazinsal>
the thing I miss the most is being able to throw a nerf dart at someone to get their attention and then wheel my chair over to ask them a question
<Bitweasil>
The problem there is that often enough, they're not really interruptible at that point.
<Bitweasil>
And nobody bothers checking the interrupt flags.
<kazinsal>
yeah, at least back in the office you could look over to see if they were on the phone or a webex
<j`ey>
kazinsal: yeah thats why I enjoy the rare times Im in the office
* gog
sets cli; hlt;
<mjg>
do you have your own rooms?
<mjg>
in the office
* kazinsal
defibrillates gog
<geist>
yah the last few weeks i've gone in it's been fairly pleasant and actually productive. since there's nota lot of us in it
<mjg>
i used to have a 4 person room
<Bitweasil>
That would improve things a lot, for sure.
<geist>
it's just a handful of people in a huge room, so not distracting, but can still go get lunch, talk a bit, etc
<geist>
actually kinda nice
<mjg>
but it was next to an openspace, so...
<Bitweasil>
I think I could see 50-70 people from my desk, and the new Building D was nuts, several *hundred* people in line of sight.
dude12312414 has joined #osdev
<kazinsal>
our old office had two small huddle rooms and a conference room that you could use whenever
<geist>
but once it packs in like it used to it probably turns into a distracting mess, like i remember it
<kazinsal>
not sure what our new one looks like but it's probably similar
<j`ey>
mjg: nope. the room im in has about 14 desks, but the most ive seen is about 5 heh
<mjg>
geist: ye, that's my problem with the office work
<geist>
there's an idea density, but it's far too low for old office spaces
<mjg>
at one job it got to a point where i would fuck around with wikis or responding to mail until 5 pm
<geist>
or at least modern sea of desks
<mjg>
at that time people would leave
<mjg>
and i would do my prorgramming work for 1h
<mjg>
and i was still more productive than the rest
<geist>
yah i used to do that a bit, but then the frickin flourescent lights would kick in as the sun went down and i couldn't stand it
<kazinsal>
yeah we had a couple people gradually rotate from 9-5 to 11-7 so they could get two hours of quiet time
<mjg>
that was me, except i was leaving early :)
<mjg>
i mean clocking less than 8
<geist>
trouoble with me is my usual really productive time starts about 9pm+
<geist>
and i'm really just not gonna be there then
<kazinsal>
yeah
<geist>
in the old days when i wa syounger i'd just work all hours of the night
<j`ey>
kazinsal: then everyone moves to 11-7, so some people start doing 9-5 again :P
<geist>
but i dont do that anymore. or at least i'm not going to dedicate that time to work
<geist>
or the weekend
<kazinsal>
my brain's about four hours behind pacific time
<mjg>
geist: i used to keep going to to sleep later and later, cycling through the entire 24h timespan
<Bitweasil>
Harder to do that sort of stuff when you ahve other people in your life to interact with.
<mjg>
geist: best period was when i was sleeping 9-5 ;)
<geist>
mjg: yep. i still have a natural tendency to do that. about 25h day if i just let it go
<geist>
so feels like i have to fight it all the time
<mjg>
🎵to be young again🎵
<mjg>
i remember it felt great, but it happens to be rather counterproudtive if your intent is to do stuff
<mjg>
unfortunately the body wants regular & quality sleep
<Bitweasil>
The older I get, the more I understand the observation, "Youth is wasted on the young." ;)
<mjg>
Bitweasil: +1
<geist>
yah that's part of the problem. i can't skim on hours of sleep, so as i keep wanting to stay up later, it tends to push the time out
<kazinsal>
yep
<geist>
since i still really need 8h sleep
<kazinsal>
suddenly it's 3am and I'm realizing I need to add a few fake meetings into my calendar so I can get my eight hours
<sonny6>
lol
<mjg>
:D
<mjg>
how big is your workplace?
<Bitweasil>
Who?
<mjg>
kazinsal:
<kazinsal>
whole company's about 120 people, my office is ~40
<kazinsal>
my home "office" is my living room
<mjg>
bummer, that's small enough to require fakery
<kazinsal>
yeah
<kazinsal>
I have a recurring 9-9:30 meeting called "task prioritization" that's really "finish waking up"
<mjg>
maybe you can grab 2 other people for a daily 1h "scrum"
<gog>
lol my wife does that, she'll send a message to the group chat at 9am, snooze until 9:30, make coffee and then get started
<mjg>
gog: years ago i had a friend working remotely, but he could not be arsed to wake up before 10
<gog>
i mean as long as the thing gets done what's the big deal?
<mjg>
gog: i wrote a script for the guy so that he gets an sms if he gets a message from his boss
<gog>
unless it's time-sensitive things :p
<kazinsal>
my current team's weekly time entry goal is like, 20 hours
<kazinsal>
which gives me half a day to sleep and half a day to do things
<kazinsal>
lol
<gog>
nice
<mjg>
i heard people use remote work to grift at 2 jobs at the same time
<gog>
yes
<gog>
i would do that
<kazinsal>
set up an onlyfans and you can do THREE jobs at the same time!
<GeDaMo>
"Outsourced: Employee Sends Own Job To China; Surfs Web"
<mjg>
heh ye, i remember that guy
<mjg>
hilarious
<kazinsal>
ha. reminds me of the classic goon story "the forgotten employee" wherein a dude found himself accidentally assigned a quasi-invalid department code so he reported to nobody but still got paid to manage a department that didn't actually exist
<mjg>
lol
<gog>
lol nice
<mjg>
i find it believable, however that sounds
<gog>
yeah it seems easy enough for something like that to get lost in the shuffle of a restructure
<Bitweasil>
Profits down? People upset with your company? Time to reorg!
<Bitweasil>
Gotta get a reorg consultant, though.
<Bitweasil>
I'm still reminded of an old Dilbert, in which Dogbert was pondering: "I like to con people out of money... but I also like to insult them. Hm... con... insult... con... sult... I know, I'll consult people!"
<kingoffrance>
is noone going to mention milton sounds like he was inspired by this?
<Bitweasil>
Huh, I've not seen that before, I'll toss that in the reading queue, thanks!
sonny6 has quit [Quit: Client closed]
GeDaMo has quit [Remote host closed the connection]
sonny has joined #osdev
<zid>
I've read the complete opposite story to that before also
<zid>
someone who got fired from apple but kept going to work anyway
<kingoffrance>
again...
<kingoffrance>
that explains the red stapler
<gog>
office space is gen x's citizen kane
<kingoffrance>
citizen kane is always messed up for me because there was an old ghostbuster cartoon where the ghost would say "rosebud" :/ so my mind associates it with ghosts/ghost hunting
<kingoffrance>
which one did i see first as an impressionable child? which version sticks? lol
<zid>
The Matrix is my generation's The Matrix.
<gog>
true
<zid>
Crazy if true imo
<sortie>
Ah yes rosebud(7)
sonny has left #osdev [#osdev]
<mrvn>
kazinsal: forget 9-5 work, do a 28/6 week.
<gog>
420/69 week
<mjg>
now that's a millenial joke
<mrvn>
gog: if you don't sleep for a few days you die so I don't think 420/69 is even possible.
<gog>
i think my record is 55 hours
zid has quit [Ping timeout: 260 seconds]
dude12312414 has quit [Remote host closed the connection]
dude12312414 has joined #osdev
<papaya_>
I am building a somewhat barebone kernel and was using Ubuntu 20.04 as my host system and it was actually working fine with the system compiler but I recently tried to move it to an Arch host and I get all sorts of corruption in char buffers. I ended up building a cross-compiler using both current versions of gcc/ld and the versions from Ubuntu 20.04 and still get some form of corruption with string data.
<papaya_>
I'm baffled how it could have worked with Ubuntu's system compiler but not with more updated software or cross compilers...
<j`ey>
UB?
<papaya_>
Sorry what is UB?
<j`ey>
undefined behaviour
<klange>
show us the code
pretty_dumm_guy has quit [Quit: WeeChat 3.4.1]
<papaya_>
okay, let me make the repo sharable and I'll give the link
<bslsk05>
gitlab.com: Papaya / Sandbox OS · GitLab
<papaya_>
with the right combination of compiler and settings I can get the banner and prompt to print correctly when it loads but as soon as I try to type any command on the prompt it does nothing, I added some code to print back the char buffer after entering commands and saw it was always corrupt
<papaya_>
ubuntu 20.04 uses gcc 9.4 for system compiler and thats the only setup that produces a working build for me without string corruption atm
<gog>
papaya_: string.c:22, is BufferIndex meant to be signed?
mahmutov has quit [Ping timeout: 260 seconds]
<papaya_>
There was an unsigned/signed comparison there I thought might be the issue but changing it did nothing
<gog>
ok
xenos1984 has quit [Read error: Connection reset by peer]
<geist>
do you have a lot of warnings enabled?
<geist>
if not, i'd start with that and then systematically fix every one of them
<geist>
another guess that may be happening is you might be corrupting the kernel itself, such that global variables are getting screwed up. sometimes i fyou're not loaded at the right address, for example, things might appear to work but references to global variables are messed up
<papaya_>
I just changed it back to unsigned as a sanity check, still corrupts input
<geist>
and then based on how the compiler generated code it may or may not show up on any given build or compiler, for a while
<geist>
ie, might be changing compiler just tickles the existing problem, but isn't the problem itself
<papaya_>
the kernel it should always be loading at 1MiB by grub I think
<geist>
should and is may be different
<papaya_>
the warnings I have set are -Wall and -Wextra
<papaya_>
I do have it report the address it loads to on the banner and seems to always be where expected
dude12312414 has quit [Remote host closed the connection]
<geist>
if you're happy with that as verification, then okay
<geist>
just sayin
<papaya_>
whats another way I can verify it
<geist>
you should be extremely paranoid right now that something isn't set up correctly. these sort of heisenbugs tend to point to stuff like that
<geist>
bad stack address would do it too. are you setting the stack pointer right?
dude12312414 has joined #osdev
<geist>
that's extremely common mistake
<papaya_>
I think the build on the repo puts the stack at around 500 KiB but I've also tried reserving some space above 1MiB and putting it there with the same outcome
<geist>
okay
<papaya_>
the stack pointer is set in boot.s before kmain is called
<geist>
are you running on an emulator?
<papaya_>
virtualized, using virtualbox
<geist>
ah so hard to debug. can you try using something like bochs or qemu?
<geist>
something where you canmanually stop and inspect the cpu?
<papaya_>
oh, that's a good idea. which one do you think is easier to debug with?
<klange>
gods the debugger in virtualbox is so bad...
<klange>
QEMU is very easy to get gdb attached to and it's a fantastic debugging experience once you do that
<geist>
i usually use qemu, and if you're on linux you ca also run it in virtualized mode
<geist>
or in emulation mode, so i'd generally recommend that
<klange>
Bochs has a pretty solid integrated debugger and is good for super low-level stuff where its predictable software emulation is a benefit
<geist>
also in general if you see different behavior between emulators and virtual machines that's also a good input to your debugging
<geist>
or if it fails identically between them
<geist>
also note: your boot.s tries to clear the PIC and then enables interrupts before calling kmain
<geist>
i'd highly suggest removig all of that, keep interrupts off, get into kmain first
<geist>
then when you're ready (after some amount of hardware setup, including clearing the PIC) enable ints then
<papaya_>
I do know that the host OS seems to make no dif for these builds in virtualbox, if I built it from ubuntu 20.04 w/ system gcc then it just works even if I copy it to Arch, Windows, etc and toss it in virtualbox there. I'm seting up qemu now tho to try
<geist>
lots of early kernel init on most systems happens with ints disabled
<geist>
it's possible you have an irq firing that is trashing your state
<gog>
i can't even get virtualbox to run smh
<geist>
if you remove the sti in your boot.s does it change anything?
<papaya_>
if I remove the sti wont I be unable to get kb input?
<geist>
perhaps, but the point is to debug your problem
<geist>
perhaps interrupts firing is precisely the problem. if your IRQ save state code is incorrect it can trash state in unpredicatable ways
<geist>
trying to reduce the variables to see if you can narrow it down
<papaya_>
yea tho the unsolvable issue occurs w/ ReadLine buffer corruption which reads keyboard input and places it in a string buffer
<gog>
ok i would have to reboot in order to use vbox modules
<gog>
cba
<geist>
papaya_: but why would that trash the banner printing?
<geist>
unless the irq fires there
<geist>
and then your register state is trashed
<papaya_>
not sure tho that is one issue I did manage to fix w/ cross compiler and adjusting compiler flags
<papaya_>
however input continued to corrupt
<geist>
sure. so that would tend to point to it not being a compiler issue
<geist>
not proof, but a hint
<papaya_>
maybe, tho it also works with ubuntu's system compiler, which is what really boggles my mind
<geist>
indeed. but it's just data. doesnt' mean you dont have to debug it
<geist>
it's not proof, just a hint. but it can also be noise.
<geist>
may be they all generate valid code, but something is stepping on your binary (IRQ handling is a strong suspect here) and based on how the code is laid out it may or may not be fatal
<papaya_>
true
<papaya_>
what kind of disk image should I use on qemu, raw?
<geist>
raw is fine yeah
<geist>
that's just a flat image with no headers
<klange>
I generally build CD ISOs.
xenos1984 has joined #osdev
<papaya_>
my scripts do produce a raw img btw if you also wanted to try it, I make a raw image then convert to VDI but if not using virtualbox then ofc that step is unnecessary
<geist>
yah qemu may understand vdi but raw is fine if you already have it
<gog>
in GetKey you're clobbering EBX but it's a callee-saved register
<papaya_>
I did 'qemu-system-x86_64 -m 4096 -ctrl-grab -no-reboot disk.img' and was able to boot it up, identical behavior
<gog>
in keyboard.s
<gog>
that's one idea
bauen1 has joined #osdev
<papaya_>
I'll take a look at that. Does qemu run in virtual or emulator mode by default?
<gog>
i think it'll check and try to run with kvm by default
<gog>
and warn if kvm is not available
<klange>
tcg by default
<gog>
ok
<papaya_>
tcg is emulation?
<geist>
oooh yeah clobbering ebx would be bad
<geist>
and that would be a case of different compilers may or may not generate code that cares
<geist>
TCG is emulation. means something like 'tiny code generator'
<papaya_>
does it matter if GetKey overwrites EAX as well?
<gog>
no
<gog>
EAX is a scratch register
<gog>
and the return register so it's expected that it clobbers
<geist>
you should *really* understand the calling convention very well before writing asm
<papaya_>
so I should just push EBX at the start and pop it before returning, yea?
<gog>
yeah
<geist>
or use a different register, like EDX which is i think also callee trashed
<gog>
yeah EDX is a scratch
<gog>
and sometimes a return register
<gog>
like if you're returning a uint64_t on ia32
<geist>
question: why are you writing so many of these drivers in assembly?
<papaya_>
holy hell it was the EBX reg
<papaya_>
it works!
<gog>
:D
<geist>
yay
<gog>
am smort
* geist
pets gog
* gog
prrrrs
* papaya_
also pets gog
* gog
prrs more
<j`ey>
gog: bug spotter!
<gog>
but eah the significance of ebx is gonna vary widely
<geist>
who was that bad guy in inspector gadget that was always petting the cat?
<papaya_>
I guess the ubuntu lts system compiler just didnt care about that
<gog>
oh uhhh
<gog>
claw
<gog>
george claw
<geist>
Dr Claw!
<geist>
yeah
<geist>
papaya_: not that it doesn't care, it depends on exactly the codegen round where it called that routine
<geist>
if it happened to leave something vital in EBX (like, say the column of the print code) then it gets trashed by the function call
<papaya_>
as for writing them in assembler, I guess it just felt better for tinkering and learning how to interact with the hardware
<geist>
but since the compiler can allocate registers how it wants following the ABI, it totally depends on what it was feeling that day
<gog>
it's gonna vary depending on how the host compiler is built too
<geist>
it's possible it could just leave nothing particularly valuable in the register, and reload it in a subsequent set of instructions
<gog>
what its default codegen is set up for
<gog>
also ia32 bad
<geist>
i'd say switch to 64bit, but you'll have to rewrite all of your assembly :)
<gog>
also stack alignment matters more--guess who shot herself in the foot with a stack alignment bug last week :D
<papaya_>
well, I started this a long time ago and recently picked it back up and started going thru it again
<gog>
worked on gcc but not after switching to clang
<papaya_>
If I had started it today I would have gone 64bit, and perhaps I will XD
<papaya_>
does the stack just need to be aligned to 4 byte ?
<gog>
according to the SYSV abi it's actually supposed to 16 bytes
<gog>
even on ia32
<gog>
and what happened to me is that clang was emitting a call to memcpy and trashing some other adjacent values on my stack because it was misaligned
<geist>
eep, yeah
<geist>
that's a case where it was assuming alignment
<papaya_>
btw ty also for the qemu suggestion it seems a lot easier to use, I'll probably go with that from here on
<gog>
yes, that one confused me for less time than the EFI headers undefining __attribute__ underneath me
<geist>
yah if you are running it from the command line you can also get a nice console to debug it
<geist>
`-monitor stdio` i think with default VGA graphics will get you what you want
<geist>
then you can do stuff like 'info registers' and whatnot
<papaya_>
awesome, ty
<gog>
info tlb, info registers and info mem are indispensible
<gog>
still need's doug's info tlb extension patches though
dude12312414 has quit [Quit: THE RAM IS TOO DAMN HIGH]
<papaya_>
EFI is another thing I should probably figure out if I go to 64-bit, right now just using MBR/BIOS
<gog>
it's so much nicer
<gog>
it has drawbacks but it sets up page tables and long mode for you
<gog>
no screwing around with trampolines
<gog>
also you can load files from FAT partitions straight away
Arthuria has joined #osdev
<Arthuria>
Hi small q about Intel naming. The chipset==platform controller hub (PCH) right. However when I look at BDF 00.00.0 I read documentation online referring that to as the 'chipset', but the DID of 00.00.0 is different from chipset I see at 00.1f.5 on Windows
<Arthuria>
So my Q is is 00.00.0 the core processor 'as a whole'? not the chipset?
<papaya_>
so out of curiosity, how far have you managed to take your own os projects?
<gog>
depends on what you consider "far" lol
<mrvn>
papaya_: just support multiboot and use grub-efi to cover that part
<papaya_>
gog: what you mean? lol
<klange>
both versions of multiboot only load in protected mode
<gog>
well i have some rudimentary memory management and task scheduling
<klange>
my efi loader jumps back to protected mode to start the kernel through the normal multiboot entrypoint and then jumps back to long mode on its own
<gog>
the task scheduling is pretty rough but it works
<papaya_>
thats pretty cool, I'd like to get to that point
* klange
has been served perfectly well with just good ol' single-queue round robin
<papaya_>
wasn't minix round robin?
<geist>
Arthuria: a lot of that is based on the notion that the cpu and the chipset used to be separate chips
<geist>
but now a lot of that is shoved onto the same physical package, or same die
<geist>
so it's all blurred
<geist>
in general over time more and more of what used to be external was moved into the socket itself
<geist>
such that modern PCs are largely single chip with external stuff mostly being extra peripherals and support stuff for sockets and memory dimms
<Arthuria>
geist: Hmmm what would you call the device at 00.00.0, as it's not just the chipset as that lives in a separate BDF
* papaya_
remembers systems having two chipsets and memory controler external to cpu
<bslsk05>
adachristine/sophia - uefi bootloader and kernel for x64 (1 forks/13 stargazers)
<geist>
or pci root complex. look at it's function/subfunction ids
<geist>
i think it'll call out pretty much what it is based on that if nothing else
<papaya_>
oo and its x64
<klange>
"chipset" because it was a set of chips, ya know... now even if it is separate it's usually a single chip
<geist>
yah. in the era when there was a north and southbridge, the cpu(s) would have had a private bus to the northbridge, and the northbridge was probably where PCI root was along with memory controllers
<Arthuria>
geist: When I look at 00.00.0 in Windows they refer to it as the 'Intel Host Bridge', yet the VID DID are exactly the same as the core processor VID DID, which is confusingly referred to as platform, which I thought was related to PCH. So confusing the nam
<geist>
and southbridge woud have been a bunch of standard peripherals
<geist>
over time the northbridge got merged into the cpu socket itself
<geist>
Arthuria: yep. welcome to PCs
<geist>
but again i thik what actually matters is the function/subfunction ids
<geist>
and it'll say it's a pci root complex and thus that's what a driver would bind to, etc
<geist>
same with things like pci bridges. PCI bus drivers look for function/subfunction that describes things like 'pci-to-pci bridge, subtractive decoding' which is all that matters. not the VID:DID
<gog>
the PCH is literally in the CPU now though
<geist>
some stuff matches VID:DID but some stuff its irrelevant
<geist>
yah, it's what used to be the northbridge, now it's inside the cpu socket
<gog>
just as the PCH was the fusion of the MCH and the ICH
<geist>
but what sort of atters is not where it physically is located, but the virtual model of what's going on
<geist>
and the virtual model is still more or less the same thing
<Arthuria>
So is there no generic device that is the 'core processor'? Even 00.00.0 is just a part of the processor, not the processor as a whole
<gog>
yes
<geist>
Arthuria: there is no generic PCI device call the core processor, no.
<geist>
nor was there ever
<papaya_>
gog: so why clang/llvm over gcc?
<geist>
there's the boot processor, (BSP sometimes) and that usually has APIC ID 0, but that's a different bus
Burgundy has quit [Ping timeout: 240 seconds]
<gog>
papaya_: a few weeks ago i was playing with clang and it caught a bug where a pair of comparisons were overlapping
<geist>
think of PCI as just one of many busses that many devices talk to and participate in. it's not special to any given CPU
<gog>
gcc never warned me about it
<gog>
i was sold ever since
<geist>
(though in odern multi socket machines that's not entirely true, but really dont wanna talk about it)
<gog>
also building the UEFI image depended on an ugly hack from gnu-efi which i want to cut ties with
<Arthuria>
Is there only ever 1 Host Bridge per CPU socket. Is that why the Host Bridge CPUDID are the same as the core processor VID DID in Intel docs?
<geist>
Arthuria: if that's the anwer you want then yes
<geist>
but the real answer is a combination of 'beats me' and 'doesn't really matter'
<geist>
maybe now, maybe not in 5 years, maybe was 5 years ago. there's no rules
<geist>
all that matters is that there are tables (ACPI/etc) that tell the OS what to do with it
<papaya_>
does clang require llvm installed or is llvm-libs enough? was surprised llvm didn't show up as a dependency when installing
<gog>
idk really
<geist>
AMD and intel do it differently at different times. the only thing that matters is that software can deal with it
<papaya_>
gog: I guess I shall find out :D
<Arthuria>
Okay, and the terms 'Platform' and 'Platform Controller Hub' (PCH), would you expect them to be the same device or different?
<geist>
Arthuria: i can personally come up with counterexamples of what you said, so i think the answer is there are no hard rules at all
<geist>
Arthuria: the answer depends on how much it matters. is this just for curious sake or are you trying to write some driver that codifies these rules?
<gog>
also if you're trying to build my OS you might want to install your distro's package of gnu-efi edit efi.mk to point to /usr/include/efi
<gog>
s/edit/and edit/
<geist>
for the latter, probably not. for the former, maybe sure
<gog>
i have it set to my /usr/local copy of it still
<gog>
need to fix that
<gog>
also it doesn't "do" anything
<geist>
for curious sake there's probably a PCH per socket. whether or not in a multisocket system both are active, or the BIOS disables one of them so that it still appears to have a single PCH, dunno
<gog>
like it starts, initializes memory management, spawns a thread and starts a timer
<gog>
and just idles
<geist>
whether or not you want to call that 'the platform'. i wouldn't, but it's just a name
<geist>
AMD machines i dont think have PCHes, but then PCH is mostly an intel term for a thing they do. AMD has some sort of equivalent but they call it something else
<gog>
they had FCH
<papaya_>
gog: yea just hit the error not finding efi.h b/c the wrong location lol
<geist>
Arthuria: sorry i'm not giving you hard answers. depends on how tightly you want to scope it
<Arthuria>
Thanks, it is a little relevant, but reading docs and online resources these names threw me off as everyone is using different terms and some completely wrong in modern platforms. So be it. I'll just read more into Intel docs and use theirs
<geist>
but remember, PCI is not the root bus that everything sits on. it's simply a bus bolted onto the side. PCs existed prior to PCI coming into existance, so there's no rule that *everything* has to have a PCI node