<levitating>
Yes! I did, now I need to remember why...
<zid>
Because it's 32bit code
<zid>
but it explains why when stuffed into a 64bit elf, it disassembles as 64bit code rather cleanly :P
<zid>
err uncleanly
bauen1 has quit [Ping timeout: 246 seconds]
<zid>
Because it isn't, because you told your assembler to lie
<zid>
(which may infact be what you want, you just need to force your disassembler to 32bit mode for that disassembly)
GeDaMo has joined #osdev
<levitating>
Looks fine with objdump configured for i386, thanks!
<levitating>
Now back to figuring out why this code doesn't work..
<zid>
That's the fun bit though
<levitating>
It was, but I've been working on this project on and off for months because I can't get the PAE enabled without it crashing.
<zid>
well, that's very debuggable at least
<zid>
If you're enabling pae, why are you using 64bit elf?
<zid>
like, pae needs to be on to enter 64bit long mode, but you never actually.. use it
<levitating>
Hmm, I am following an outdated guide where they identity page a gigabyte or so before entering long mode and starting the kernel.
<heat>
that sounds reasonable
<zid>
are you starting from real mode or something?
<levitating>
Yes I think so
<zid>
you.. think so
<heat>
what
gog has joined #osdev
Left_Turn has joined #osdev
<zid>
heat, my hubris at having enjoyed the nice thunderstorm the other day has led to it being extremely cold and wimdy today :(
<levitating>
Like I said it's been a long time since I started this projec and I am no expert to say the least. I boot using grub, I think it's already in protected mode at that point?
<heat>
yes
<heat>
can you show us the code?
<zid>
you can literally just make some 64bit page tables you intend to use somewhere, and switch into long mode with them directly
<zid>
from gru
<zid>
as long as you leave the page that runs the cpu mode switch mapped in your new page tables so that you don't rip the memory out from under the instruction pointer, it's gtg
<bslsk05>
github.com: bootstrap/boot/long.asm at master · zid/bootstrap · GitHub
<zid>
Literally identical except I enable NX too, and remembered to lgdt so that it won't explode
<zid>
but he said the cr0 mov on 33 is what crashes him, which is literally the line before I lgdt anyway, so whatever
<heat>
yeah i... i don't see it
<zid>
moving into cr0 shouldn't actually change anything until the ret at the dn
<zid>
end
<zid>
but we haven't heard back from his old 0xffffff yet
<zid>
it might infact be the ret
<heat>
i tried to build it but the obvious cargo build doesn't work so i ran out of options
<heat>
oh well
<levitating>
Actually I just tested it, on the mov cr0 GDB gives an error. But the crash occurs when I try to si after that.
<zid>
I can't build rust either
<zid>
ignore gdb, look at qemu's monitor
<levitating>
Which executes the ret
<zid>
yea, the ret is guarenteed to fail
<zid>
you need to lgdt some 64bit segments, and load your segment selectors, see my github link for reference
<levitating>
No need to build rust, I don't use any rust code yet, I was just testing with building without stdlib. You can build by going into src/boot and running make
<levitating>
It will just create an iso with the bootcode and grub
<heat>
ah ok
<zid>
so will zid/bootstrap.git
<heat>
zid, you don't *need* the ret
<zid>
It uses GRAFTED MOUNT POINTS
<heat>
you'll just run in 32-bit compat
<zid>
heat: the ret will update all those cr0 cr4 etc bits to be live
<zid>
Who needs the second page of my kernel, not me apparently
<heat>
BLOAT
<zid>
one day I will write out my actual memory map and prune this crap and make sure it makes sense
<zid>
I have random acpi tables and framebuffer bits and stuff strewn all over
<zid>
For acpi I literally just picked a pml4e I wasn't using and offset mapped it in I think
<levitating>
Hey thanks a lot for all of your help (again)
heat has quit [Read error: Connection reset by peer]
heat has joined #osdev
<zid>
0xffff800...000 + n -> n or whatever, so that I could read my acpi tables
<zid>
then never unmapped any of it once I was done
<zid>
which again predates the "just map everything", so I think it's in the 'everything' map too and should be using that
<zid>
ffun fun
<heat>
funsafe-math
xenos1984 has quit [Read error: Connection reset by peer]
<zid>
fun-math
<zid>
-ffun-math, randomly adds 0.01 to some results
<zid>
sometimes sqrts them
<zid>
I featured req'd it to wakely
xenos1984 has joined #osdev
<levitating>
The actual reason that it was broken for my local version, was because I was still using EAX as a pointer to PDP even though I had already or'd the present and writable bit on it.
<zid>
yep, as mentioned
<mcrod>
hi
grumbler has quit [Quit: It's time]
netbsduser` has joined #osdev
kof13 has quit [Ping timeout: 252 seconds]
cloudowind has quit [Quit: Lost terminal]
tixlegeek has quit [Quit: tixlegeek]
stolen has joined #osdev
vdamewood has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bradd has quit [Ping timeout: 252 seconds]
bliminse has quit [Quit: leaving]
zxrom has quit [Ping timeout: 244 seconds]
tixlegeek has joined #osdev
bauen1 has joined #osdev
orccoin has quit [Read error: Connection reset by peer]
<bslsk05>
www.kernel.org: What is RCU? -- "Read, Copy, Update" — The Linux Kernel documentation
<gorgonical>
indeed, google bad, kagi good
<mcrod>
also
<mcrod>
maybe I just don’t have a lot of multithreaded experience
<mcrod>
and, I don’t
<mcrod>
but I feel like there’s a *lot* of bullshit around it
nvmd has joined #osdev
<mcrod>
in fact I’m actually not sure how you get really deep into the multithreaded world except “write these enormously complicated things that you won’t understand 5 years from now”
<gorgonical>
one of my biggest pet peeves for c style is when the braces are omitted for single-statement if-elses
melonai3 has joined #osdev
nvmd has quit [Ping timeout: 260 seconds]
theboringkid has joined #osdev
melonai has quit [Ping timeout: 260 seconds]
melonai3 is now known as melonai
<mcrod>
yes
<mcrod>
i agree
nvmd has joined #osdev
theboringkid has quit [Ping timeout: 260 seconds]
goliath has quit [Quit: SIGSEGV]
divine has quit [Ping timeout: 246 seconds]
friedy has quit [Quit: Client closed]
nvmd has quit [Ping timeout: 260 seconds]
divine has joined #osdev
GeDaMo has quit [Quit: That's it, you people have stood in my way long enough! I'm going to clown college!]
gog has joined #osdev
nvmd has joined #osdev
foudfou has quit [Remote host closed the connection]
foudfou has joined #osdev
heat_ has joined #osdev
heat has quit [Ping timeout: 260 seconds]
<heat_>
Ermine, because openbsd sucks harder
heat_ is now known as heat
heat_ has joined #osdev
heat has quit [Ping timeout: 246 seconds]
skipwich has quit [Ping timeout: 260 seconds]
skipwich has joined #osdev
nvmd has quit [Ping timeout: 258 seconds]
heat_ has quit [Read error: Connection reset by peer]
heat has joined #osdev
xenos1984 has quit [Ping timeout: 260 seconds]
xenos1984 has joined #osdev
<geist>
gorgonical: oh that rcu link is quite good
<gorgonical>
first result on kagi with "linux rcu" even
skipwich has quit [Ping timeout: 258 seconds]
skipwich has joined #osdev
heat has quit [Remote host closed the connection]
heat has joined #osdev
rorx has quit [Ping timeout: 264 seconds]
<netbsduser`>
rcu is easy: first you read, then you copy, then you update, then you win
<sbalmos>
huh... did reddit just remove the osdev sub?
<nortti>
still there for me
<sbalmos>
eh, looks like reddit's servers are in a split-brain
<netbsduser`>
sbalmos: is that the one where they are "os deving" by lightly modifying the source code of the windows xp source code leak? if so i am not surprised
<sbalmos>
no
<sbalmos>
it's the one where every other day someone asks "how do I get started writing my own os? I know JS and Python lolz"
nvmd has joined #osdev
<netbsduser`>
interesting you mention that
<netbsduser`>
the famous fenolossa osdev tutorial now has a warning banner on it
xenos1984 has quit [Ping timeout: 260 seconds]
friedy has joined #osdev
<heat>
what's that?
<heat>
never heard of it
<heat>
geist, paul mckenney's book is also really good
<heat>
but in reality what was standardized was the API, not the implementation
<heat>
what will almost surely end up happening is epoch-based reclamation will start popping up
orccoin has quit [Ping timeout: 240 seconds]
<heat>
just like facebook's folly RCU implementation (literally implements the C++26 paper, but in folly:: instead of std::)
<heat>
will it be any good? who knows, but better than no RCU i bet
<Cindy>
fasaboo
<Cindy>
bro, who needs C++
<Cindy>
when you can actually control the object size in C, unlike C++, where after you link the program to STL, it bloats up to 5 MB
<Cindy>
even if you use like one STL function
<heat>
ok
<heat>
is this going to become a C vs C++ discussion?
<Cindy>
sorr
<Cindy>
sorry
<heat>
np
<heat>
i just don't really have the patience for this kind of sillyness really
<heat>
really am just discussing RCU
<Ermine>
what rcu means in context of the language
<heat>
wdym
<Cindy>
real context unit
Gooberpatrol66 has quit [Ping timeout: 245 seconds]
xenos1984 has joined #osdev
skipwich has quit [Ping timeout: 252 seconds]
skipwich has joined #osdev
Matt|home has quit [Ping timeout: 240 seconds]
<mcrod>
hi
<mcrod>
sorry heat
<heat>
together we can stop the his
<mcrod>
no we can’t
nvmd has quit [Ping timeout: 260 seconds]
<mcrod>
i’m a nice person who says hi a lot
nvmd has joined #osdev
Matt|home has joined #osdev
grumbler has joined #osdev
<netbsduser`>
heat: a hugely popular osdev tutorial that gets reddit, hackernews, and similar crowds roaring with wonder
<netbsduser`>
it had been causing some upset in the osdev discord because of a number of problems with it which would lead the unwary to ask about the exact problems in the discord
<jimbzy>
Problems are good, though. That's how we learn.
<sbalmos>
the guy's repo with all of the data even has a warning at the top saying it has many bugs and design issues
<netbsduser`>
jimbzy: the trouble is when the problems get fundamental
<sbalmos>
like a few other "starter libraries" that abuse undefined behavior in C/EFI, are horribly buggy, etc. same questions over and over.
<netbsduser`>
for example most osdev tutorials are really "write a bootsector and do some basic x86 initialisation" tutorials
<sbalmos>
not to mention people who don't know ${language} /at all/, and keep making boneheaded bit-manipulation errors
<gog>
hi
nvmd has quit [Quit: WeeChat 3.8]
<heat>
back in my day we had jamesm's tutorial
<heat>
not these fancy pants tutorials
<jimbzy>
sbalmos, Bad way to learn a language.
<gog>
ah i remember jamesm tutoral
<jimbzy>
ya
<sbalmos>
jimbzy: no kidding
<gog>
mcrod: hi
<sbalmos>
jimbzy: they don't know, say, C. they don't understand bit manipulation, assembly, etc etc etc
<mcrod>
gog: hi
<netbsduser`>
jamesm realised the error of his ways and later plotted to create a teaching kernel which would be an actual kernel
<gog>
can i hug you
<jimbzy>
Yeah, that's not a good way to get started.
<mcrod>
gog: yes of course
<zid>
sbalmos: You get this same issue with people trying to 'learn reverse engineering'
* gog
hug mcq
<gog>
mcrod:
<zid>
Like it isn't all applied knowledge
<sbalmos>
mm hmm
* mcrod
hug gog
<jimbzy>
That's pretty much how I learned assembly, zid.
<gog>
you learn by doing
* sbalmos
puts a plate of gognip over in the corner for gog
<zid>
you learn RE by learning C, binutils, windbg, assembly, reading the manuals, etc, not from 'learning RE'. OSdev is very very similar imo, except a couple of algos that are rare outside of it like some memory stuff.
* gog
rolls around and sniffs the gognip
<gog>
i taught myself everything i know
<jimbzy>
I learned how to read it pretty well, and then I started writing little patches.
<netbsduser`>
doing is helpful but one of the most important things for most people is to have intimate knowledge of an existing OS
<gog>
jk i had problems and asked for advice and found solutions other people did
<heat>
openbsd
* heat
has been banned from #osdev
<gog>
hi
<jimbzy>
For that, you need Andy Mininxbaum's books.
<netbsduser`>
you can imitate openbsd, but by god, implement a unified buffer cache
<heat>
gog has been banned from #osdev
<gog>
linux torvald
<heat>
netbsduser`, did you know their vfork() is still fake?
<netbsduser`>
heat: i didn't, but i am not surprised
<heat>
the man page is even written in a dismissive tone
<jimbzy>
"This shit may, or may not work. I don't know. Try it."
<heat>
>Since fork(2) is now efficient,
<heat>
lads, we've solved fork(2)
<heat>
inefficiency is no more
<netbsduser`>
that's right
<heat>
and apparently mmaped files and write()/read() don't actually sync up automatically
<netbsduser`>
as long as you only go on a texas tlb shootdown massacre and grind potentially gigabytes of address space to set up copy-on-write, you are efficient
<heat>
which is ridonculous
<netbsduser`>
that's the fault of their lack of a unified buffer cache
<heat>
how is that the buffer cache's problem?
<heat>
just sounds like a bad page cache to me...
<netbsduser`>
it's because the code path for filling the filepage cache accesses the buffer cache
<heat>
how does that matter?
<heat>
i would expect the page cache to be divided in pages and for mmap to directly map pages
<heat>
as such touching them on mmap and/or write() would be the same thing
<netbsduser`>
and so if you then modify the file with write(), even after the pages have been mapped shared, if the block you modified belongs to a page that has been faulted in, then the change is not reflected in the file page cache
Burgundy has quit [Ping timeout: 252 seconds]
<netbsduser`>
openbsd still uses the traditional buffer cache, which is block-based, for file page contents
<netbsduser`>
so the data exists in both the block buffer cache and the file page cache
<netbsduser`>
this duplication is why there is incoherence
<heat>
oh so the page cache is not even accessed on read/write?
<heat>
i see
<heat>
it's bizarre
<heat>
i don't think you can unsee the unified page cache after seeing it lol
friedy has quit [Client Quit]
rorx has joined #osdev
TkTech has joined #osdev
<zid>
Does POSIX say anything about how shit should interact btw, specifically stuff like, having two copies of a file open, having one mmaped and one opened, etc, or is it just "idk, the OS does something, glhf"
gog has quit [Ping timeout: 260 seconds]
<heat>
it says you may need to msync()
<netbsduser`>
zid: almost certainly the minimal of requirements
<zid>
m'sync *tips fedora*
[itchyjunk] has joined #osdev
<netbsduser`>
though it's interesting i've never seen anyone serious suggest that you should assume only the minimal requirements set by posix
<heat>
POSIX is useless
<zid>
posix seems pretty underspecified in general
<heat>
linux is the new UNIX, POSIX is a relic
<zid>
and has crappy APIs that can't actually implement useful things for files, like atomicity
<netbsduser`>
i just think it's interesting by comparison to e.g. the C standard
<heat>
the C standard suffers from the same issue though?
<heat>
it's the minimalest of requirements
<zid>
C standard doesn't really "suffer" from it though
<zid>
because it's *very* minimal to begin with
<zid>
so you *know* you're on your own
<netbsduser`>
there exists a lobby of people who will suggest that you will and deserve to have your hard drive formatted and your children and wife murdered in brutal fashion for ever stepping beyond it
<zid>
posix heavily specifies a lot of complex stuff, but leaves all the subtle interactions unsaid, that's the problem
<netbsduser`>
but no such lobby for posix that i know of
<heat>
some people do see POSIX as the big goal
<heat>
and POSIX certification
<heat>
which is silly but to each their own
<mcrod>
hey i said that
<heat>
you're a big copycat mcrod
<netbsduser`>
it's understandable to try to conform to it
<netbsduser`>
but to elevate it to scripture and to gleefully delight in lawyering it to catch out the unwary would be bizarre
<netbsduser`>
and is not done
<netbsduser`>
people spit on the developers of windows for "doing the minimal to be posix compliant", after all
<heat>
yes because micro$hit winblowz
<heat>
but they wouldn't dare say that to a great UNIX descendent such as OpenBSD
<heat>
it's even secure!
Turn_Left has joined #osdev
<heat>
microgarbage winsucks
Left_Turn has quit [Ping timeout: 264 seconds]
Turn_Left has quit [Ping timeout: 258 seconds]
Left_Turn has joined #osdev
simpl_e has quit [Ping timeout: 264 seconds]
<zid>
windows isn't even bare minimum
<zid>
its fwrite/fread have the wrong buffering behavior for posix, it only does C
<netbsduser`>
i mean the Windows Subsystem for POSIX Applications
<netbsduser`>
though it's gone now
<zid>
we have wsl now sorta
<zid>
if they ever add proper hyper-v support for amd's vt tech..
tixlegeek has quit [Quit: tixlegeek]
<netbsduser`>
wsl 2 is a bit boring though
<netbsduser`>
>virtual machine
<zid>
hey, it's INTEGRATED
<zid>
I can copy paste and stuff, and it automounts all my filesystems in both directions
duderonomy has quit [Ping timeout: 244 seconds]
<zid>
and I get native windows
<zid>
like if I were doing X forwarding
<heat>
the giga ideas for WSL1 were truly giga ideas but way too hard