IRC channel logs

2022-10-14.log

back to list of logs

<oriansj>stikonas: well dereferencing pointers shouldn't be needed for M2-Planet or M2libc
<stikonas>oriansj: well, later we'll need to pass arguments with & to UEFI functions i.e. read(file, &size, &c)
<stikonas>but in bootstrap.c I'll just use inline asm
<stikonas>but as far as I remember, that needs M2
<stikonas>hmm, though even with M2 we probably need inline asm for extra allocation of shadow stack space...
<stikonas>anyway, yesterday I've got something working, can build Hello World now
<stikonas>but I still need sort out command line arguments
<stikonas>and probably file names...
<oriansj>stikonas: or we could make our lives simpler and cheat off of meslibc and just create the globals __argc, __argv, __envp and __UEFI_arguments and then we have no need for dereferencing for arguments. just have the libc.M1 set the __UEFI_arguments to the address of the argument string and we populate everything in the C code then libc.M1 can just push them onto the stack and call main
<oriansj>and for bonus fun that can all be self-contained
<stikonas>oriansj: no, but it's not just main, we need to put everything in the correct registers also when we do e.g. writes to file (or to screen)
<stikonas>in any case, everything will be contained in C library
<stikonas>I'm even thinking that we should replace \ with / in paths...
<stikonas>but maybe once I get to non-bootstrap M2libc
<stikonas>I still need to sort out bootstrap part
<oriansj>well we don't have any hardcoded paths in mescc-tools or mescc-tools-extra do we?
<oriansj>and only untar would need tweaks potentially
<oriansj>(potentially mkdir too)
<oriansj>and the details of the syscalls has always been specific to the architecture and isolated into separate functions to enable easy porting (and if need be prefunctions calling _special_functions to do the bits that require specific values in registers or special stack manipulation)
<oriansj>^architecture^architecture/Operating System^
<stikonas>oriansj: no, we don't have hardcoded paths
<stikonas>though if I replaca \ with POSIX type /
<stikonas>I can reuse \ for line breaks
<stikonas>hmm
<stikonas>or I can use some other line break character
<stikonas>anyway, we'll see how it goes when I reach those parts
<stikonas>I think I have an idea for malloc in UEFI version of M2libc...
<stikonas>though I'll not bother with it in bootstrap.c
<stikonas>it can wait till full M2libc
<stikonas>for bootstrap.c I'll just have a static allocation of 64 MiB
<stikonas>and later I can allocate let's say 4 MiB blocks
<stikonas>if we run out, we allocate another block
<stikonas>and add it to linked list
<stikonas>quite simple, but I think that would work
<stikonas>and allows for cleanup on shutdown