[libc] Improve copying system vectors to the GPU
authorJoseph Huber <jhuber6@vols.utk.edu>
Mon, 3 Apr 2023 15:08:32 +0000 (10:08 -0500)
committerJoseph Huber <jhuber6@vols.utk.edu>
Mon, 3 Apr 2023 15:10:43 +0000 (10:10 -0500)
commitcd4e8884edefd37d3c3fd42c7740ef2a82a6592b
treea804c867468b50a4b744d8c7825aa28914451bde
parent192c2c5c89477e28d0129f37a7d262112585b353
[libc] Improve copying system vectors to the GPU

Summary:
This implementation was buggy and inefficient. Fine-grained memory can
only be allocated on a page-level granularity. Which means that each
allocated string used about 4096 bytes. This is wasteful in general, and
also allowed for buggy behaviour. The previous copying of the
environment vector only worked because the large buffer size meant that
we would typically have a null byte after the allocated memory. However
this would break if the vector was larger than a page. This patch
allocates everything into a single buffer. It makes it easier to free,
use, and it more correct.
libc/utils/gpu/loader/Loader.h