IRC channel logs
2024-01-30.log
back to list of logs
<damo22>youpi: how do i make ljmpl take a memory location as the second param? <damo22>{standard input}: Assembler messages: <damo22>{standard input}:2: Error: operand type mismatch for `ljmp' <damo22>if it requires an immediate, i dont know how to refer to a variable containing the address <damo22>unless i really need the 0xff op code <damo22>but i dont think gas assembles it <damo22>netbsd uses something like this: ./netboot/start_rom.S: ljmpl $(reloc>>4), $1f-reloc /* Jmp to RELOC:1f */ <damo22>maybe i can " jmp 1f; 1: " to clear the instruction cache <damo22>Setting up python3-packaging (23.2-1) ... <damo22>but unfortunately, i have been using the CI box to test ACPI <damo22>interesting i didnt get an email from the ping <solid_black>do I understand it right that your recent work is for / related to SMP? <damo22>ugh dont make him trigger it right now <solid_black>then whenever it comes up,it will pick the job up and run it <damo22>i better make sure i dont have the gitlab runner running while i test gnumach <solid_black>how do you debug these things on real hardware without qemu / gdb, btw? <damo22>but for some reason the serial output is causing a crash <damo22>the reason i need self-modifying code is because the ljmpl instruction only takes an immediate as the memory address <damo22>so i need to write the memory location it needs to jump to at runtim <damo22>because it depends on what gnumach allocates as a free memory page <damo22>i made the boot code relocatable <solid_black>hm, yes, I see you're allocating a code page dynamically <damo22>because i dont want to use a random page, gnumach might use it too <solid_black>why do you need it to be dynamically allocated, why can't it be just regular static instructions in .text? <solid_black>not saying this is wrong, just curious to understand <damo22>because it needs to be 16 bit addressable <damo22>so i allocate a page in first 16MB ram, pray that its lower than 1MB and then relocate the boot code there <damo22>but the exact offsets are not known until runtime <solid_black>do all the APs really really always start up in 16-bit/real mode? <damo22>so much legacy stuff to deal with <solid_black>yeah, but I hoped that'd be the case only for the main CPU core, since it has to keep compatibility, but not for other cores which could just have an explicit flag for starting in 32-bit/64-bit mode <damo22>pretty sure the IPI that is sent to wake up the AP is given an 8 bit number as the (start address >> 12) <youpi>damo22: a mere jmp won't clear the instruction cache <damo22>i saw that in netbsd code, i thought it would <youpi>dumb pipelined processors would indeed flush the pipeline, but if processors nowadays were like that we'd lose a lot of time in ifs/loops/etc. <damo22>isnt real mode x86 a dumb pipelined processor? <solid_black>an older OS written for pre-speculation processors wouldn't be aware that theu need to flush? <damo22> * Flush instruction pipelines by doing an intersegment (far) return. <youpi>intersegment would indeed flush <anatoly>solid_black: have you seen my message re. new images, etc after your message re. new changes? :-D <solid_black>I haven't tried pulling & using the images themselves though <youpi>it's very common that people assume that the behavior they see is the expected behavior, and rely on that, but that has also commonly posed problem when the reality has changed <youpi>e.g. people using memcpy for areas that do overlap <anatoly>solid_black: all good, no worries :-) <youpi>this looks plain broken to me <youpi>if that was really flushing the prefetch queue, our processors would lose a *lot* of time for each if we perform <damo22>maybe it applies only in real/protected mode but not in long mode <youpi>the pipeline flush performance hit would be the same <damo22>maybe x86 just does suck that badly <damo22>ive asked netbsd, see what they reply soon <youpi>self-modifying code is really a thing fro mthe past <youpi>I don't see how intel could have made so long pipelines in pentium 4 without properly predicting jumps <youpi>yes, but conversely, I find people saying that e.g. 486 is hit by the self-modification issue <youpi>« IA-32 processors exhibit model-specific behavior when executing self modified code » <damo22>from everything you posted, i still think my code is correct :) <damo22>alternatively, could we reserve a page or two of memory at an absolute address below 1MB and tell gnumach vm to avoid it? <anatoly>solid_black: do you have instructions of how to build qemu image from the result of cross-building? <anatoly>solid_black: what is the issue with building grub package? <damo22>(08:35:16 PM) mlelstv: damo22, it still works and is necessary in 32bit protected mode. not sure about 64bit. <--- i trust what this guy says more than what i can come up with from reading specs sometimes <youpi>damo22: I rather think that the code might work just by luck. We don't want code that just works by luck <etno>damo22: low memory areas typically used by DOS should be available. Telling gnumach to not use them would consist in asking gnumach to reserve that physical location. I believe that this is what is done in the deep of vremap() <youpi>as of reserving a fixed-address page, e820 might tell you that no it's actually reserved for the bios <youpi>"works" is not good enough for building an OS... <damo22>cant we use e820 to locate a page that is below 1MB? <youpi>yes but then it'll be dynamic <damo22>0xff opcode, apparently works on "/5" models <damo22>its the same as 0xea but allows memory location to be passed in <youpi>it's not "allows", but "expects" :) <damo22>i dont know how to assemble it though <youpi>you'd put .byte 0xff so as to modify the adresse anyway, won't you? <damo22>yes, but how do you pass a register value to something that is not an instruction? <youpi>the assembler doesn't know what value to put there <damo22>so how do i code the 0xff instruction <youpi>I don't know what exactly you want to assemble <youpi>if you want to use a register, you're doomed, it seems that far jumps don't want registers <youpi>that's memory-only, not registers <youpi>so it's the processor itself that doesn't support registers <damo22>yes, but we can load the value into memory <youpi>you'll probably need the absolute address of that variable <youpi>that won't work once you have loaded the first bootup segment <youpi>really, can't you just write the relocation from the C code? <damo22>i dont know what that would involve <youpi>just put a label and a .globl <youpi>and then you'll be able to write to it from C code after a extern declaration <damo22>but can i refer to the variable in the ljmpl? <damo22>(08:47:26 PM) mlelstv: n.b. the comment is misleading. <solid_black>anatoly: I did add some instructions to README.hurd.md last time, have you seen them? <youpi>damo22: actually you don't need the 0xff variant if you're relocating from the C code <youpi>you can just use the current v2 patch, but write to ljmp_offset32 from C code <anatoly>solid_black: sorry, haven't check the diff, will do <solid_black>I have made quite some progress on building those too, I have e.g. libpng and python3 and libxcb and libx11 <solid_black>basically all the dependencies required to build freetype, but freetype itself doesn't yet build <damo22>(09:02:31 PM) mlelstv: in 8086 a jump obviously has to drop a prefetched instruction. But if your CPU got a deeper pipeline, it may also need to flush at least part of the pipeline state. But that depends on what state actually changed. A switch to a different mode <damo22>(09:02:32 PM) mlelstv: affects how instructions are interpreted, so there you need to flush most things. <damo22>(09:02:51 PM) mlelstv: but not necessarily the "prefetch buffer" which is a cache nowadays. <damo22>(09:05:08 PM) mlelstv: my guess is that a jump (that stays in the same mode) currently flushes the speculative buffers, but only if the branch was mispredicted. <anatoly>solid_black: so it's so far matter of going the tree up and build deps <youpi>damo22: yes, and a jmp 1f; 1: is always predicted <solid_black>it may be easier to wait until we can build packages natively rather than cross-compiling, because most alpine packages outside of the core bootstrap path were never written with cross-compiling in mind <solid_black>but that's just a "might", it might also be easier to make it cross-compile, who knows <solid_black>I think that while CI / packages repo is surely important, the most pressing issue to work on is making OpenRC boot fully work, and ensuring we have networking <anatoly>solid_black: I meant only grub's deps tree not whole distro <solid_black>for that, we might need to build/package netdde, which is a good idea anyway <solid_black>also we want to build/package rump, and whatever was needed for acpi <solid_black>help welcome, but I should be able to figure that out myself eventually, too <solid_black>have you seen my magnificent hack for ldconfig / glibc.trigger? <anatoly>not yet, but most likely I won't get the idea how the hack is hacky :-) <anatoly>solid_black: so next for me is to create vm image and then I'll be able to experience all of that <solid_black>would be cool to see if you would be able to reproduce the same issues / get the same things working <solid_black>please let me know if the instructions are not clear enough <anatoly>solid_black: I han an issue pushing the repo to gitlab, seems like history is too big so it times out on one of their checks during push. <solid_black>you could try to sync things with the apstream alpine on GitLab side? <anatoly>solid_black: so i went the other way and imported project in gitlab by URL from alpines gitlab that went well and then I was able to add your remote and also move my commit. <anatoly>solid_black: dunno. I will add their remote as upstream as some point but so far I follow your branch as upstream <damo22>0xff opcode does not jump interseg <damo22>so it doesnt go into protected mode <anatoly>solid_black: right, mounting a disk image, hm, that's not that straightforward to execute within a container :-) <solid_black>or, the way I did it, mount it outside of the container, and pass it intside as a volume <anatoly>solid_black: yeah, I know :-) the second options is the option <solid_black>quick quiz: how would you bind-mount an fs on the Hurd? <solid_black>we don't have busybox udhcp, because of course it's Linux-specific :( <anatoly>solid_black: why do you need to "apk fix" things? <solid_black>'apk fix' reinstalls the packgage, running the scripts this time <solid_black>so you get all the symlinks to busybox, glibc gets to generate /etc/ld.so.cache, and the Hurd gets to install the translator nodes and blow up the filesystem <solid_black>also be aware that PATH is just /bin:/sbin by default for some reason, i.e. no /usr there, but some binaries are in /usr <solid_black>you can 'aok add bash' for a better shell experience, it totally works :) <solid_black>run 'setup-hostname' to rename the host, and reexec bash ('exec bash') to have it update in your prompt <gnu_srs>Hello, the following statement causes problems with dhcpcd: <gnu_srs>ctx->link_fd = xsocket(PF_ROUTE, SOCK_RAW | SOCK_CLOEXEC | SOCK_NONBLOCK, AF_UNSPEC) <gnu_srs>Problem is that PF_ROUTE is defined in socket.h but not implemented, causing an error. <gnu_srs> Any hints of a workaround/replacement? <youpi>gnu_srs: the SIOCADDRT ioctl, probably <gnu_srs>Maybe the entry of PF_ROUTE in socket.h should be commented out as PF_LINK is? <damo22>youpi: ljmpl *(%eax) does not cause the processor to switch modes <damo22>do you want me to use C code to write to ljmp_offset32 ?