<Ali_A>
what is the difference between linear address and physical address space?
<Ali_A>
I know physical address is : your ram storage, but that implies, linear address can be bigger or different than your physical address?
<Ali_A>
or is it the address space, that the program currently running does see? which will be translated later by the pages to a physical address?
<geist>
yes, with segmentation on x86 they call the translated address linear
<geist>
ie, linear address -> (translate through segmentation) -> physical address
<Mutabah>
... that's a little unclear
<Mutabah>
On x86: Virtual addresses are Segment:Offset, these are translated by segmentation into linear addresses, then translated by paging into physical addresses
SGautam has quit [Quit: Connection closed for inactivity]
<geist>
right, yeah. it's basically an intermediate translation that only really exists on x86
<Ali_A>
is it safe to read from amd manual to learn about intel's 64 bit processors? as far as I have read few chapters of each volume of intel's manual, the focus seems to be really on IA 32 instead of 64-bit mode
<Ali_A>
I currently only have access to intel's processor so I don' want to be jumping between two different architecture, but wanted to know if things are mostly cross-compatible (I mostly need the information for my 64 bit kernel development)
<moon-child>
Ali_A: I suggest to keep on hand a copy of both the intel and amd manual, to cross-reference in any case when either is incomprehensible
<kazinsal>
a lot of the core concepts are similar between 32 and 64 bit modes on x86(_64) machines
<kazinsal>
64-bit mode really is more about the addressing and the primary register file width than anything else
<kazinsal>
in 32-bit mode on an modern x86-64 machine you still have access to the whole system, just your word size and virtual address width is 32 bits wide
<zid>
64bit mode changes are miniscule
<zid>
it's mainly "Ignore all the 32bit stuff, write a 7 here instead or you will #GP"
<zid>
and that replaces 200 pages of 32bit
<kazinsal>
yeah you're mostly worried about canonical address space and that's the main difference
<kazinsal>
and you have a different depth of paging structures
<zid>
and those structures are the same as 32bit pae but with an extra 4 bytes of address on top
<zid>
which is.. easily documented
<kazinsal>
yeah
<kazinsal>
64-bit x86 is really about extending the address space and the register width. everything else is pretty mode agnostic
<kazinsal>
in theory you could do 16-bit real mode SMP
<kazinsal>
should you? christ on the proverbial fucking bike no
<kazinsal>
could you? yeah
<zid>
16 -> 32 is basically a full system level rewrite
<zid>
32 -> 64 is a couple of tweaks to simplfy
gog has joined #osdev
* kazinsal
. o O ( april fools 2023 idea: 16-bit real mode SMP unix )
<Ali_A>
kazinsal just wanted to be sure, what do u mean by canonical address space, In chapter 3 vol 1 intel's, it says that such address is when u have the addresses from bit 48 to 63 being zero, is this what u refer to ?
<zid>
-128TB to +128TB, if you have pml4 paging
<kazinsal>
sort of -- in 64-bit modes, there's a number of "valid" virtual address space bits. every "invalid" bit has to be the same. I think in the standard four-level paging mode of x86_64 0:47 are your valid bits and 48:63 must be the same
<zid>
anything outside that is yea, invalid
<zid>
so no 0b1010001010.... addresses
<zid>
only 0b000000... and 0b11111...
Ermine has quit [Quit: Cya!]
<Ali_A>
oh, so it doesn't have to be 0?
<zid>
-1 is all 1s
<Ali_A>
48:63 can be something like fffffff?
<zid>
it just has to be a sign extended 48bit value
<Ali_A>
will be negative something, that is usually used by the kernel, I never understood how is it allowed, but then my understanding of that term was wrong, so thanks!
<zid>
the middle will get filled in as more address bits become valid with the pml5 and pml6
GeDaMo has joined #osdev
<Ali_A>
great stuff
<zid>
It makes testing if an address is kernel or user nice and easy at least
diamondbond has joined #osdev
<kazinsal>
PML6 is gonna be neat but at the same time for everything I'm into even PML4 is enough haha
<zid>
just check the top bit
<zid>
it'll be kinda cool just for things like using the MMU as a hardware trie
<zid>
Which I've done a couple of times for 32bit hashes
<kazinsal>
ha, yeah, as someone who looks at a lot of tries, yeah
<zid>
32bit hash -> shift it up by 2 -> cast to int * -> store an int there
<zid>
Bam, hardware trie acceleration
pretty_dumm_guy has joined #osdev
<kazinsal>
now I'm thinking of ways to hardware accelerate my 256-way IPv4 route cache trie, thanks...
Vercas has quit [Remote host closed the connection]
Vercas has joined #osdev
Ali_A has quit [Quit: Connection closed]
Burgundy has joined #osdev
pretty_d1 has joined #osdev
pretty_dumm_guy has quit [Ping timeout: 240 seconds]
pretty_d1 has quit [Client Quit]
mahmutov has quit [Ping timeout: 246 seconds]
vdamewood has joined #osdev
not_not has joined #osdev
<not_not>
hai
mahmutov has joined #osdev
vinleod has joined #osdev
vdamewood has quit [Killed (osmium.libera.chat (Nickname regained by services))]
vinleod is now known as vdamewood
<gog>
hi
<vdamewood>
Hi
* vdamewood
gives gog a fishy
* gog
chomps fishy
* kazinsal
pets gog
* gog
prrs
* kazinsal
gives scritchies
<vdamewood>
hahaha kitty go prrr
* kazinsal
writes down "determine headpats/scritchies response for lady I've been seeing" on his to-do list
<gog>
o:
heat has joined #osdev
gildasio has joined #osdev
<vdamewood>
I have 'Pick up kitty from vet' on my to-do list.
<not_not>
awww
<not_not>
i have smuggle beer inside coke bottles into the insane asylum on my to do list
<vdamewood>
oh, oops. I mean s/skitty/kitty's ashes/
<kazinsal>
D:
<not_not>
:(
<not_not>
dw it will be reborn as a higher being
<not_not>
lets consort the 13th chapter of baghavad gita
<not_not>
nature the enjoyer and consciousness
<not_not>
Those who understand the diffrence between the body, the soul and the supersoul wich stands above both, achives liberation from this material world
heat has quit [Ping timeout: 260 seconds]
Ali_A has joined #osdev
diamondbond has quit [Read error: Connection reset by peer]
diamondbond has joined #osdev
<gog>
our neighborhood cat is chilling on the corner of my bed
<gog>
she's very good
<mjg>
speaking of neighborhood cats, there was one black cat walking around
doorzan has joined #osdev
<mjg>
or at least i thought it was one
<mjg>
few days ago i spotted *two* identical black cats chilling
<gog>
:o twins
<mjg>
i don';t know which one (or maybe both?) also visit my building's backyard
<mjg>
there is a small ladder there which they use to get out later
diamondbond has quit [Quit: Leaving]
<gog>
we have two visitors, the other one is a big grey/black floof named krummi
<gog>
but he hasn't been around in a couple weeks, we had to kick him out because we were leaving for a couple days and he was so offended he hasn't come back :(
<mjg>
elsewhere there was a pack of homeless dogs wandering about
<mjg>
there was a small dog living in a backyard of one house
<mjg>
they jumped in and killed it
<mjg>
the owner was not particularly happy about that, but guess what
<mjg>
few weeks later a huge half-dead dog showed up at his doorstep
<mjg>
the guy nursed it back to 100%
<mjg>
the homeless dogs were no longer a problem
gildasio has quit [Quit: WeeChat 3.5]
gildasio has joined #osdev
parrott has joined #osdev
srjek has joined #osdev
parrott has quit [Read error: Connection reset by peer]
<yasar11732>
I can link 32 bit assembly into 64 bit elf executable. Can I do the same with 32 bit C code?
<vdamewood>
What do you mean by 32 bit C code?
<yasar11732>
It is supposed to work before I enable long mode and paging, with rest of my kernel running in long mode
<yasar11732>
I want to copy multiboot2 structures and acpi table to known location before enabling paging
<yasar11732>
I want to avoid assembly if possible
<not_not>
the c should compile into assembly?
<FatalNIX>
Why would C even care
<FatalNIX>
What do you think the code looks like inside the ELF? It's not C for sure.
<not_not>
i think i linked 32 bit and 16 bit code on the gameboy advanced
<yasar11732>
it should generate code for 32 bit, but must be included inside 64 bit elf. I don't know how to make compiler do that
<not_not>
how did i do this stuff on the gba hmmmmm
<not_not>
can't you
<FatalNIX>
for one you probably don't want the C compiler to initiate the linking
<not_not>
instead of
<not_not>
^
<not_not>
ye maybe LD can do it
<FatalNIX>
LD will complain when mixing 32 bit and 64 bit ELFs together but it can be done.
<not_not>
secondably id LD can't fix it binarily wich I THINK IT CAN actually
<not_not>
ye u just have to make a linker script
<FatalNIX>
in fact, you can create a 64bit ELF with 32 bit code and link it against 64 bit ELF objects too
<not_not>
but when it comes to bootloaders u have to make an ld script ANYHOW i think
<yasar11732>
FatalNIX, that is exactly what I need to do
<not_not>
sec sec sec
<not_not>
think the LD script on the boot loader tutorial should work
<not_not>
ye its doable what u want u just need to use ld and do some ld script magic to do it but i dont remember how to do ld scripts
<not_not>
should be a google away tho
<FatalNIX>
Just make sure the alignment comes out alright
<not_not>
yeah
<not_not>
thats what the link scripts do
<FatalNIX>
you don't want some 64 bit instructions being offset by 4 byte boundries that aren't aligned to 8
<not_not>
^
<FatalNIX>
usually its not a worry
<yasar11732>
I am already using custom linker script. Just need to figure out how to create suitable object file
<not_not>
oh u can do -m32
<not_not>
and -m64
<FatalNIX>
for the most part you'll be aligning by say like 4K or some power of 2 where 64 bit alignment will be no problem
<FatalNIX>
-m32 by default will generate an ELF32
<not_not>
and it will compile the object 32 bit or 64 bit respectively
<FatalNIX>
you could also use objcopy if ld really complains
wootehfoot has joined #osdev
<FatalNIX>
with fasmg I don't have to worry about it since I can just include elf64 support but in like nasm and other assemblers you can specify bits 64 or bits 32 etc and still make an elf64 regardless
<FatalNIX>
which will link cleanly
<FatalNIX>
so i.e. nasm -f elf64 ... and in the file you have your bits 32 to specify the instruction set
<heat>
yasar11732, yes you can
<heat>
gog, noice catto
<gog>
she's a known killer
<heat>
yasar11732, you need to compile your 32-bit code just as you would with your 64-bit code, but with -m32 I think
<heat>
then it Just Works(tm)
<not_not>
i wanna use as much asm as possible
<FatalNIX>
I am loving fasmg, since I can just include sets of instructions by set or by architecture, i.e. I can ask for a pentium 3 set of instructions, or I can just be like, I need mmx, and sse, and 80386 instructions, ok I'm good, then if I want I can include a format like elf64 or something to pick up my macros and figure out the output data.
<FatalNIX>
it's super modular and very minimal
<not_not>
ye i think ill use fasmg
<not_not>
saw someone make a point about gas
<not_not>
that like cmp %eax %ebx jlt label
bauen1 has quit [Ping timeout: 276 seconds]
<FatalNIX>
I'm not recommending it unless you are prepared to figure things out without tons of documentation on specific architectures
<FatalNIX>
I just like it because I am okay with maintaining it as a fork and for making my own instruction set for my OS
<not_not>
oh
<not_not>
well im set for life in cash so i dont have any obligations
<FatalNIX>
Unless you have a lot of computer engineering or low level experience I'd highly recommend nasm or something else, but fasmg is incredible
<not_not>
when it comes to programming from here on out its pure rest and development
<not_not>
i dont have TONS of experience but
<not_not>
i did write a 200 byte program that downloaded a file and executed it and it didnt have any 0 bytes
<FatalNIX>
I want my proejct to be a virtual machine presented to processes instead of running x86 process code on bare metal other than the OS itself, so I chose fasmg as it was intended for building custom architectures.
<FatalNIX>
fasmg is architecture independent
<not_not>
and ran it on a remote server injecting in through a string, does engineering shellcode qualify as enough low level experience to use fasmg?
<FatalNIX>
I also use it for the boot code though
<not_not>
ye im writing a vm too maybe
<FatalNIX>
It was just a recommendation. I went to school for ECE so I have spent a lot of time on small architectures
<not_not>
im atleast building a custom chip
<not_not>
never been to school for computer shit but
<heat>
its a good idea to use gas
<not_not>
i did change the outcome of the surveilance laws in my country with low level code XD
<heat>
you need one less tool
<not_not>
ye i like gas
yasar11732 has quit [Ping timeout: 248 seconds]
<not_not>
thats true gas is what i always use for that reason
<FatalNIX>
I hate gas so much XD
<heat>
and you support like every arch out there
<not_not>
¨^
<not_not>
yeah and im very much a fan of RMS
<FatalNIX>
I am much more fond of the destination, source notation
<FatalNIX>
gas's notation confuses me all the time
<not_not>
when richard stallman eats stuff from his foot in front of a whole classroom as if its completely normal im like "ahh yeah thats normal"
<FatalNIX>
ha
<not_not>
wait gas is source -> destination?
<FatalNIX>
using what's existing is definitely useful. That's a call you gotta make. I personally give zero shits about what other people have as long as it isn't difficult to set up, but that's just me.
<not_not>
ye, im a big fan of using the newest tools
<not_not>
and being prepared for the future
<heat>
yes gas is source dest
<not_not>
ok then i like gas
<not_not>
and i like stuff that falls of my foot
<FatalNIX>
heat isn't wrong in that, putting your users in the fenced in free range toddlers area is going to make for a better experience for your users.
<FatalNIX>
So it's going to depend on how much you care about that
<not_not>
my users are turing complete
<FatalNIX>
One of the questions that I usually ask myself when working with a project and adding stuff to it is "Am I willing to support this"
<heat>
probably not
<not_not>
oh ye
<not_not>
ye ye ye me too
<not_not>
thats why i never use python2 nymore
<FatalNIX>
In fact, we had this one project once where we were considering on adopting an OS for our PLC project and Linux went off the table as the base system almost as fast as it was put on it.
<heat>
my project compiles exclusively using whatever I have in github.com/heatd/toolchains at the moment the commit is pushed
<bslsk05>
heatd/toolchains - Toolchain utilities/patches for the Onyx operating system (0 forks/0 stargazers)
<FatalNIX>
we put BSD on the table instead, because we considered the work and said "Linux is not worth maintaining"
<not_not>
ahhh
<FatalNIX>
it's a large codebase with a lot of stuff
<not_not>
ya ya ya
<not_not>
havent used any of the BSD's yet
<heat>
depends if you need the stuff
<FatalNIX>
Right, and we didn't, so we went with a stripped down FreeBSD kernel instead
<FatalNIX>
afaik they still use it
<heat>
so, netbsd? :P
<FatalNIX>
haha
<not_not>
i need a good brain reset before i do any more projects
<not_not>
i got this weird visual lobe eplepsia thing wich makes gazing at a computer screen PURE torture but i am drawn to it like flies to dead flesh
<not_not>
like a flashbang going off in my head every 3 seconds
<heat>
my biggest nitpick with the bsd's is that they got stuck in the 90's hwmnylettrscanyousave() mode
<heat>
i find it hard to read any of their code
<heat>
also few comments
<not_not>
ahhh yes yes yes
<not_not>
but
<not_not>
im also stuck in the 90's
<not_not>
i even plan on making a time machine to go back to the 90's
<heat>
grab yourself 4.4BSD and start hacking on it then
<not_not>
kill ipod in its crib
<not_not>
yes
<heat>
"guys, listening to music sucks"
<heat>
ipod dead on arrival as millions reject music
<sbalmos>
heat: aww c'mon, at that rate don't you love OS/400's 7-letter vowel-less verb phrase commands?
<not_not>
no, make something that doesnt have the "i" in it
<not_not>
l33t
<heat>
uspod comrade?
<sbalmos>
wrksrcdft *lib qsysopr
<not_not>
no, just the whole sterile ipod future path gonna b smashed and steve jobs dying of radiation
<heat>
sbalmos, oh what the fuck is that
<heat>
this is so cursed
<sbalmos>
heat: OS/400
<heat>
dspaccaut
<heat>
guess what this does
<not_not>
i want more used car future
<sbalmos>
heat: Display account authorizations
<not_not>
not ipads with twerking miley curus on em
<heat>
display access code authority
<heat>
YOU. LOSE.
<sbalmos>
crap, I'm finally rid myself of my 3 years of AS/400 knowledge, only 14 years later
<heat>
i don't know if "everything is a command" is better than "everything is a file"
<sbalmos>
everything is an object!
<heat>
everything is an OOP pattern
<heat>
true enterprise OS
<sbalmos>
where no bitstream has gone before
yasar11732 has joined #osdev
<not_not>
ye true enterprise os
<yasar11732>
So, I did some experiments. -m32 switch creates 32bit elf object files so I can't link them together with 64 bit elf objects. I tried creating only assembly file with -S and -m32 swithes, then to convert it to object file using 64 bit x-compiler but it didn't assemble. I tried giving -Wa,--32 option to gcc to make it assemble but it also created an 32 bit elf file.
* FatalNIX
hides their TRS-80s
<heat>
yasar11732, have you tried passing -Wl,-melf64 or something like that?
<gog>
there's another option
<yasar11732>
I wasn't aware of that option
<gog>
you could have two files
<gog>
one with the 32 bit code and then the other loaded as a module
<gog>
that's a little more complicated to deal with
bauen1 has joined #osdev
<heat>
actually that probably won't work
<yasar11732>
heat, still creates 32 bit elf
<heat>
yasar11732, i know, just objcopy the object file into a 64-bit elf
<heat>
that will 100% work
<heat>
(inb4 it fails)
h4zel has quit [Ping timeout: 272 seconds]
<yasar11732>
heat, I actually never used objcopy before. What it is supposed to do?
<heat>
do stuff to executables/object files, convert, etc
<yasar11732>
ok, so I can compile my c code with -m32 and copy .text section over to another object file?
<heat>
you copy everything over
<heat>
not just .text
bauen1 has quit [Ping timeout: 276 seconds]
x88x88x has quit [Remote host closed the connection]
<yasar11732>
heat, thanks I think it works
<heat>
np
bauen1 has joined #osdev
<yasar11732>
You can even change section name from .text to something else. It is handy for linker scripts.
<yasar11732>
Because my .text section's VMA is -2GB.