Search logs:

channel logs for 2004 - 2010 are archived at ·· can't be searched

#osdev2 = #osdev @ Libera from 23may2021 to present

#osdev @ OPN/FreeNode from 3apr2001 to 23may2021

all other channels are on OPN/FreeNode from 2004 to present

Monday, 2 May 2022

03:27:00 <Ali_A> Uploaded file:
03:27:00 <Ali_A> what is the difference between linear address and physical address space?
03:28:00 <Ali_A> I know physical address is : your ram storage, but that implies, linear address can be bigger or different than your physical address?
03:29:00 <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?
03:43:00 <geist> yes, with segmentation on x86 they call the translated address linear
03:43:00 <geist> ie, linear address -> (translate through segmentation) -> physical address
03:51:00 <Mutabah> ... that's a little unclear
03:52:00 <Mutabah> On x86: Virtual addresses are Segment:Offset, these are translated by segmentation into linear addresses, then translated by paging into physical addresses
04:00:00 <geist> right, yeah. it's basically an intermediate translation that only really exists on x86
04:01:00 <geist> paging -> segmentation -> physical (virtual, linear, physical)
04:02:00 <geist> er yeah shit. sorry disregard. backwards
04:03:00 <geist> Mutabah is correct
04:38:00 <Jari--> I will print my operating system source code. Helps a lot to read it at the balcony in clean air.
04:56:00 <jjuran> The air is cleaner if you leave the trees standing :-/
06:28:00 <geist> +1
10:15:00 <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
10:15:00 <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)
10:19:00 <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
10:20:00 <kazinsal> a lot of the core concepts are similar between 32 and 64 bit modes on x86(_64) machines
10:20:00 <kazinsal> 64-bit mode really is more about the addressing and the primary register file width than anything else
10:21:00 <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
10:21:00 <zid> 64bit mode changes are miniscule
10:21:00 <zid> it's mainly "Ignore all the 32bit stuff, write a 7 here instead or you will #GP"
10:22:00 <zid> and that replaces 200 pages of 32bit
10:22:00 <kazinsal> yeah you're mostly worried about canonical address space and that's the main difference
10:22:00 <kazinsal> and you have a different depth of paging structures
10:22:00 <zid> and those structures are the same as 32bit pae but with an extra 4 bytes of address on top
10:22:00 <zid> which is.. easily documented
10:22:00 <kazinsal> yeah
10:23:00 <kazinsal> 64-bit x86 is really about extending the address space and the register width. everything else is pretty mode agnostic
10:23:00 <kazinsal> in theory you could do 16-bit real mode SMP
10:24:00 <kazinsal> should you? christ on the proverbial fucking bike no
10:24:00 <kazinsal> could you? yeah
10:25:00 <zid> 16 -> 32 is basically a full system level rewrite
10:25:00 <zid> 32 -> 64 is a couple of tweaks to simplfy
10:26:00 * kazinsal . o O ( april fools 2023 idea: 16-bit real mode SMP unix )
10:30:00 <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 ?
10:31:00 <zid> -128TB to +128TB, if you have pml4 paging
10:31:00 <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
10:31:00 <zid> anything outside that is yea, invalid
10:31:00 <zid> so no 0b1010001010.... addresses
10:31:00 <zid> only 0b000000... and 0b11111...
10:32:00 <Ali_A> oh, so it doesn't have to be 0?
10:32:00 <zid> -1 is all 1s
10:32:00 <Ali_A> 48:63 can be something like fffffff?
10:32:00 <zid> it just has to be a sign extended 48bit value
10:32:00 <zid> so either all 1s, or all 0s
10:32:00 <zid> -128TB to +128TB
10:33:00 <kazinsal>
10:33:00 <bslsk05> ​ Memory layout – CS 161 doc
10:33:00 <Ali_A> yeah, addresses like ffffff
10:33:00 <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!
10:33:00 <kazinsal> go read this
10:34:00 <zid> random google image result
10:35:00 <zid>
10:35:00 <zid> the middle will get filled in as more address bits become valid with the pml5 and pml6
10:36:00 <Ali_A> great stuff
10:37:00 <zid> It makes testing if an address is kernel or user nice and easy at least
10:37:00 <kazinsal> PML6 is gonna be neat but at the same time for everything I'm into even PML4 is enough haha
10:37:00 <zid> just check the top bit
10:37:00 <zid> it'll be kinda cool just for things like using the MMU as a hardware trie
10:37:00 <zid> Which I've done a couple of times for 32bit hashes
10:37:00 <kazinsal> ha, yeah, as someone who looks at a lot of tries, yeah
10:38:00 <zid> 32bit hash -> shift it up by 2 -> cast to int * -> store an int there
10:38:00 <zid> Bam, hardware trie acceleration
10:52:00 <kazinsal> now I'm thinking of ways to hardware accelerate my 256-way IPv4 route cache trie, thanks...
11:52:00 <not_not> hai
12:02:00 <gog> hi
12:03:00 <vdamewood> Hi
12:03:00 * vdamewood gives gog a fishy
12:03:00 * gog chomps fishy
12:04:00 * kazinsal pets gog
12:04:00 * gog prrs
12:04:00 * kazinsal gives scritchies
12:04:00 <vdamewood> hahaha kitty go prrr
12:05:00 * kazinsal writes down "determine headpats/scritchies response for lady I've been seeing" on his to-do list
12:05:00 <gog> o:
12:07:00 <vdamewood> I have 'Pick up kitty from vet' on my to-do list.
12:08:00 <not_not> awww
12:08:00 <not_not> i have smuggle beer inside coke bottles into the insane asylum on my to do list
12:08:00 <vdamewood> oh, oops. I mean s/skitty/kitty's ashes/
12:08:00 <kazinsal> D:
12:08:00 <not_not> :(
12:09:00 <not_not> dw it will be reborn as a higher being
12:11:00 <not_not> lets consort the 13th chapter of baghavad gita
12:12:00 <not_not> nature the enjoyer and consciousness
12:13:00 <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
12:53:00 <gog> our neighborhood cat is chilling on the corner of my bed
12:53:00 <gog> she's very good
12:53:00 <mjg> speaking of neighborhood cats, there was one black cat walking around
12:53:00 <mjg> or at least i thought it was one
12:54:00 <mjg> few days ago i spotted *two* identical black cats chilling
12:54:00 <gog> :o twins
12:55:00 <mjg> i don';t know which one (or maybe both?) also visit my building's backyard
12:55:00 <mjg> there is a small ladder there which they use to get out later
13:00:00 <gog> we have two visitors, the other one is a big grey/black floof named krummi
13:00:00 <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 :(
13:04:00 <mjg> elsewhere there was a pack of homeless dogs wandering about
13:04:00 <mjg> there was a small dog living in a backyard of one house
13:04:00 <mjg> they jumped in and killed it
13:04:00 <mjg> the owner was not particularly happy about that, but guess what
13:05:00 <mjg> few weeks later a huge half-dead dog showed up at his doorstep
13:05:00 <mjg> the guy nursed it back to 100%
13:05:00 <mjg> the homeless dogs were no longer a problem
13:56:00 <GeDaMo>
13:56:00 <bslsk05> ​'ea2w9s2sfmv81' by [idk] (--:--:--)
14:52:00 <gog> the parent trap
15:07:00 <vdamewood> I hope I never get confused over which one is my ped like that.
15:07:00 <vdamewood> pet*
16:12:00 <gog> she loaf
16:13:00 <yasar11732> I can link 32 bit assembly into 64 bit elf executable. Can I do the same with 32 bit C code?
16:14:00 <vdamewood> What do you mean by 32 bit C code?
16:15:00 <yasar11732> It is supposed to work before I enable long mode and paging, with rest of my kernel running in long mode
16:15:00 <yasar11732> I want to copy multiboot2 structures and acpi table to known location before enabling paging
16:16:00 <yasar11732> I want to avoid assembly if possible
16:16:00 <not_not> the c should compile into assembly?
16:17:00 <FatalNIX> Why would C even care
16:17:00 <FatalNIX> What do you think the code looks like inside the ELF? It's not C for sure.
16:17:00 <not_not> i think i linked 32 bit and 16 bit code on the gameboy advanced
16:18:00 <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
16:19:00 <not_not> how did i do this stuff on the gba hmmmmm
16:19:00 <not_not> can't you
16:19:00 <FatalNIX> for one you probably don't want the C compiler to initiate the linking
16:19:00 <not_not> instead of
16:19:00 <not_not> ^
16:19:00 <not_not> ye maybe LD can do it
16:19:00 <FatalNIX> LD will complain when mixing 32 bit and 64 bit ELFs together but it can be done.
16:20:00 <not_not> secondably id LD can't fix it binarily wich I THINK IT CAN actually
16:20:00 <not_not> ye u just have to make a linker script
16:20:00 <FatalNIX> in fact, you can create a 64bit ELF with 32 bit code and link it against 64 bit ELF objects too
16:20:00 <not_not> but when it comes to bootloaders u have to make an ld script ANYHOW i think
16:20:00 <yasar11732> FatalNIX, that is exactly what I need to do
16:20:00 <not_not> sec sec sec
16:21:00 <not_not> think the LD script on the boot loader tutorial should work
16:21:00 <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
16:21:00 <not_not> should be a google away tho
16:21:00 <FatalNIX> Just make sure the alignment comes out alright
16:21:00 <not_not> yeah
16:21:00 <not_not> thats what the link scripts do
16:22:00 <FatalNIX> you don't want some 64 bit instructions being offset by 4 byte boundries that aren't aligned to 8
16:22:00 <not_not> ^
16:22:00 <FatalNIX> usually its not a worry
16:22:00 <yasar11732> I am already using custom linker script. Just need to figure out how to create suitable object file
16:22:00 <not_not> oh u can do -m32
16:22:00 <not_not> and -m64
16:22:00 <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
16:23:00 <FatalNIX> -m32 by default will generate an ELF32
16:23:00 <not_not> and it will compile the object 32 bit or 64 bit respectively
16:24:00 <FatalNIX> you could also use objcopy if ld really complains
16:26:00 <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
16:26:00 <FatalNIX> which will link cleanly
16:27:00 <FatalNIX> so i.e. nasm -f elf64 ... and in the file you have your bits 32 to specify the instruction set
16:30:00 <heat> yasar11732, yes you can
16:30:00 <heat> gog, noice catto
16:31:00 <gog> she's a known killer
16:31:00 <heat> yasar11732, you need to compile your 32-bit code just as you would with your 64-bit code, but with -m32 I think
16:31:00 <heat> then it Just Works(tm)
16:32:00 <not_not> i wanna use as much asm as possible
16:32:00 <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.
16:33:00 <FatalNIX> it's super modular and very minimal
16:33:00 <not_not> ye i think ill use fasmg
16:33:00 <not_not> saw someone make a point about gas
16:33:00 <not_not> that like cmp %eax %ebx jlt label
16:34:00 <FatalNIX> I'm not recommending it unless you are prepared to figure things out without tons of documentation on specific architectures
16:34:00 <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
16:34:00 <not_not> oh
16:34:00 <not_not> well im set for life in cash so i dont have any obligations
16:35:00 <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
16:35:00 <not_not> when it comes to programming from here on out its pure rest and development
16:35:00 <not_not> i dont have TONS of experience but
16:36:00 <not_not> i did write a 200 byte program that downloaded a file and executed it and it didnt have any 0 bytes
16:36:00 <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.
16:36:00 <FatalNIX> fasmg is architecture independent
16:36:00 <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?
16:36:00 <FatalNIX> I also use it for the boot code though
16:37:00 <not_not> ye im writing a vm too maybe
16:37:00 <FatalNIX> It was just a recommendation. I went to school for ECE so I have spent a lot of time on small architectures
16:37:00 <not_not> im atleast building a custom chip
16:37:00 <not_not> never been to school for computer shit but
16:37:00 <heat> its a good idea to use gas
16:37:00 <not_not> i did change the outcome of the surveilance laws in my country with low level code XD
16:37:00 <heat> you need one less tool
16:37:00 <not_not> ye i like gas
16:38:00 <not_not> thats true gas is what i always use for that reason
16:38:00 <FatalNIX> I hate gas so much XD
16:38:00 <heat> and you support like every arch out there
16:38:00 <not_not> ¨^
16:38:00 <not_not> yeah and im very much a fan of RMS
16:38:00 <FatalNIX> I am much more fond of the destination, source notation
16:38:00 <FatalNIX> gas's notation confuses me all the time
16:38:00 <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"
16:39:00 <FatalNIX> ha
16:39:00 <not_not> wait gas is source -> destination?
16:40:00 <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.
16:40:00 <not_not> ye, im a big fan of using the newest tools
16:40:00 <not_not> and being prepared for the future
16:40:00 <heat> yes gas is source dest
16:40:00 <not_not> ok then i like gas
16:40:00 <not_not> and i like stuff that falls of my foot
16:41:00 <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.
16:42:00 <FatalNIX> So it's going to depend on how much you care about that
16:42:00 <not_not> my users are turing complete
16:43:00 <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"
16:43:00 <heat> probably not
16:43:00 <not_not> oh ye
16:43:00 <not_not> ye ye ye me too
16:43:00 <not_not> thats why i never use python2 nymore
16:44:00 <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.
16:44:00 <heat> my project compiles exclusively using whatever I have in at the moment the commit is pushed
16:44:00 <bslsk05> ​heatd/toolchains - Toolchain utilities/patches for the Onyx operating system (0 forks/0 stargazers)
16:44:00 <FatalNIX> we put BSD on the table instead, because we considered the work and said "Linux is not worth maintaining"
16:44:00 <not_not> ahhh
16:44:00 <FatalNIX> it's a large codebase with a lot of stuff
16:45:00 <not_not> ya ya ya
16:45:00 <not_not> havent used any of the BSD's yet
16:45:00 <heat> depends if you need the stuff
16:45:00 <FatalNIX> Right, and we didn't, so we went with a stripped down FreeBSD kernel instead
16:45:00 <FatalNIX> afaik they still use it
16:46:00 <heat> so, netbsd? :P
16:46:00 <FatalNIX> haha
16:46:00 <not_not> i need a good brain reset before i do any more projects
16:46:00 <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
16:47:00 <not_not> like a flashbang going off in my head every 3 seconds
16:47:00 <heat> my biggest nitpick with the bsd's is that they got stuck in the 90's hwmnylettrscanyousave() mode
16:47:00 <heat> i find it hard to read any of their code
16:48:00 <heat> also few comments
16:48:00 <not_not> ahhh yes yes yes
16:48:00 <not_not> but
16:48:00 <not_not> im also stuck in the 90's
16:48:00 <not_not> i even plan on making a time machine to go back to the 90's
16:48:00 <heat> grab yourself 4.4BSD and start hacking on it then
16:48:00 <not_not> kill ipod in its crib
16:48:00 <not_not> yes
16:49:00 <heat> "guys, listening to music sucks"
16:49:00 <heat> ipod dead on arrival as millions reject music
16:49:00 <sbalmos> heat: aww c'mon, at that rate don't you love OS/400's 7-letter vowel-less verb phrase commands?
16:49:00 <not_not> no, make something that doesnt have the "i" in it
16:50:00 <not_not> l33t
16:50:00 <heat> uspod comrade?
16:50:00 <sbalmos> wrksrcdft *lib qsysopr
16:50:00 <not_not> no, just the whole sterile ipod future path gonna b smashed and steve jobs dying of radiation
16:50:00 <heat> sbalmos, oh what the fuck is that
16:51:00 <heat> this is so cursed
16:51:00 <sbalmos> heat: OS/400
16:51:00 <heat> dspaccaut
16:51:00 <heat> guess what this does
16:51:00 <not_not> i want more used car future
16:51:00 <sbalmos> heat: Display account authorizations
16:51:00 <not_not> not ipads with twerking miley curus on em
16:51:00 <heat> display access code authority
16:52:00 <heat> YOU. LOSE.
16:52:00 <sbalmos> crap, I'm finally rid myself of my 3 years of AS/400 knowledge, only 14 years later
16:53:00 <heat> i don't know if "everything is a command" is better than "everything is a file"
16:54:00 <sbalmos> everything is an object!
16:54:00 <heat> everything is an OOP pattern
16:54:00 <heat> true enterprise OS
16:55:00 <sbalmos> where no bitstream has gone before
17:02:00 <not_not> ye true enterprise os
17:02:00 <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.
17:04:00 * FatalNIX hides their TRS-80s
17:04:00 <heat> yasar11732, have you tried passing -Wl,-melf64 or something like that?
17:04:00 <gog> there's another option
17:04:00 <yasar11732> I wasn't aware of that option
17:05:00 <gog> you could have two files
17:05:00 <gog> one with the 32 bit code and then the other loaded as a module
17:05:00 <gog> that's a little more complicated to deal with
17:05:00 <heat> actually that probably won't work
17:06:00 <yasar11732> heat, still creates 32 bit elf
17:06:00 <heat> yasar11732, i know, just objcopy the object file into a 64-bit elf
17:06:00 <heat> that will 100% work
17:06:00 <heat> (inb4 it fails)
17:07:00 <yasar11732> heat, I actually never used objcopy before. What it is supposed to do?
17:08:00 <heat> do stuff to executables/object files, convert, etc
17:09:00 <yasar11732> ok, so I can compile my c code with -m32 and copy .text section over to another object file?
17:11:00 <heat> you copy everything over
17:11:00 <heat> not just .text
17:23:00 <yasar11732> heat, thanks I think it works
17:24:00 <heat> np
17:38:00 <yasar11732> You can even change section name from .text to something else. It is handy for linker scripts.
17:38:00 <yasar11732> Because my .text section's VMA is -2GB.
17:39:00 <heat> i place all my "pre standard environment" boot stuff in .boot
17:39:00 <heat> you can do it using __attribute__((section(".boot"))
17:39:00 <yasar11732> does it work for code too, I thought it only affected data.
17:41:00 <heat> yup
18:24:00 <heat>
18:24:00 <heat> ssh'd to my raspberry pi from my OS^^
18:25:00 <j`ey> heat: v cool
18:26:00 <heat> indeed
18:26:00 <heat> the tcp stack is starting to mature
18:27:00 <zid> now ssh back and forth
18:27:00 <zid> see how many layers you can get going
18:28:00 <heat> i don't have sshd yet cuz it doesn't actually listen for connections
18:28:00 <heat> probably one of the next steps
18:29:00 <heat> also, fun thing i found out the other day: syncookies aren't great because you end up losing some information sent on SYN
18:29:00 <heat> linux only uses them when you've reached the backlog limit on the socket's syn queue
18:30:00 <clever> i assume syn cookies works by hashing some of the state, and encoding it into the seq#?
18:31:00 <clever> so you can syn+ack+forget
18:31:00 <clever> and when you later get an ack back, you can assume you did the whole syn then syn+ack shake?
18:31:00 <heat> yes + some weird pseudo-crypto thing it uses to know it's legit
18:32:00 <heat> they don't have many bits available on the seq
18:32:00 <clever> yeah, so kind of a salted hash
18:32:00 <heat> when you enable TCP timestamps you can store more (like the MSS I believe)
18:33:00 <heat>
18:33:00 <bslsk05> ​ Just a moment...