I don't know why sys_brk makes you gag - try it with a swallow of beer.
That won't help. I'm used to much finer grained storage and resource management and trying to learn x86 and NIX at the same time is a shocker/disappointment. NASM and you guys are a bright spot, though
You could also use sys_mmap (to an anonymous object) to allocate some memory on-the-fly. Of course, libc and its malloc() are sitting in memory waiting to be used, if you care to (I take it you don't).
Thanks, I read about mmap and may try it first, it sounds interesting and probably less prone to ahhhhh wipeout than break dancing with break. Then again I decided to install Linux in a VM under my main Linux so I can only hurt myself so much. I don't figure there's much point in being slimed by libc or any GNU dependencies since we're coding in assembly, the Man's Programming Language! If I wanted to be a girly man and use libc I would just use C.
Like I saw you write somewhere else, assembly is about freedom from bloat. I really have a problem with dependency after dependency the way a lot of the gnu crap is written. I'm used to just me and the OS so I'm trying to get things done the same way in x86 Linux land. No middleware, no dependencies, no problem
But section .bss is the right place to reserve some "permanent" (for the life of your process) memory. You can also subtract something from esp to get some memory on the stack - often used for "local"/"automatic" variables within a function ("automatic" because it's "automatically" freed when the function exits).
Oh, if .bss is life of process than it is not what I am thinking of. I want to be able to allocate and free during the process. I think from your example the structures are defined ahead of anything else so they are pure mappings. That is what I am looking for.
Here's an example (prints a "ctime-like" string) which uses some structures... I don't know if it's "clear" or not. Memory for some of the structures is reserved in section .bss, and also on the stack (in the "time2string" function). If it doesn't clear up how to do it, perhaps we could try a more "purpose-built" example...
Thank you. If I understand what you did, you defined some mappings and then used the names to offset from the base address of the structure after you had its address. If so, this is exactly what I am looking for. Of course managing the storage is a whole separate issue, but I believe you answered my main question. I'll monkey around with the storage stuff now that I have an approach.
Thanks a lot Frank.
Joe