|
From: kosmirror <kos...@us...> - 2025-08-04 17:06:33
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "A pseudo Operating System for the Dreamcast.".
The branch, master has been updated
via 6b306eb2fb8054fc60b46cc06ea09eb45fa4cb4a (commit)
via 33ff624892394b8ab29091f46b7739ddf8575178 (commit)
via b500e5cc8b56ab021a4515909cafe9c766716793 (commit)
via c419e767c4902aa5dba3ea633d143aa2a9d2818a (commit)
via 453e3a89db2ea72b11810c94ed06e30ef97d6927 (commit)
via 318f9046880693cd3c6a3b4d6c70cbd99fb452d6 (commit)
via ac2f4def7af390cf15ac53a5009344a338edfecf (commit)
from d8b442870398cd20937a7dcce4d23b3f3da5bc1c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 6b306eb2fb8054fc60b46cc06ea09eb45fa4cb4a
Author: QuzarDC <qu...@co...>
Date: Wed Jul 30 17:22:35 2025 -0400
elf: Expand Sections and section flag defines
These are all aspirational. Also fixed a typo.
commit 33ff624892394b8ab29091f46b7739ddf8575178
Author: QuzarDC <qu...@co...>
Date: Wed Jul 30 16:54:09 2025 -0400
elf: Refactor and update header validation.
Move header validation to its own internal function.
Additionally remove magic numbers by adding defines
to back the values in the header.
Finally, expanded the number of internal defines being used
per-arch so that it includes the bit width and endianness
fields. This should make it simple to add new ones, though
I removed the old archs at the same time.
commit b500e5cc8b56ab021a4515909cafe9c766716793
Author: QuzarDC <qu...@co...>
Date: Wed Jul 30 15:20:58 2025 -0400
elf: Add and use header ident defines.
Additionally clean up the ident code slightly by
providing fixed character width to the printf
rather than doctoring the header to NUL terminate.
commit c419e767c4902aa5dba3ea633d143aa2a9d2818a
Author: QuzarDC <qu...@co...>
Date: Tue Jul 29 23:45:43 2025 -0400
elf: Check for `fs_read` failure.
commit 453e3a89db2ea72b11810c94ed06e30ef97d6927
Author: QuzarDC <qu...@co...>
Date: Tue Jul 29 21:52:04 2025 -0400
elf: Replace custom debug output with dbglog.
I've set it to `KDEBUG` so it's only if you want
all the output.
commit 318f9046880693cd3c6a3b4d6c70cbd99fb452d6
Author: QuzarDC <qu...@co...>
Date: Tue Jul 29 21:50:54 2025 -0400
elf: Typedef structs and clean up whitespace.
commit ac2f4def7af390cf15ac53a5009344a338edfecf
Author: QuzarDC <qu...@co...>
Date: Tue Jul 29 20:59:39 2025 -0400
fs_elf: Move to stdint types.
-----------------------------------------------------------------------
Summary of changes:
include/kos/elf.h | 164 +++++++++++++++++++++++++++++----------------
kernel/fs/elf.c | 194 +++++++++++++++++++++++++++++-------------------------
2 files changed, 210 insertions(+), 148 deletions(-)
diff --git a/include/kos/elf.h b/include/kos/elf.h
index a9398f96..43b0499a 100644
--- a/include/kos/elf.h
+++ b/include/kos/elf.h
@@ -25,38 +25,72 @@
__BEGIN_DECLS
#include <stdint.h>
-#include <arch/types.h>
#include <sys/queue.h>
+#include <kos/regfield.h>
/** \defgroup elf ELF File Format
\brief API for loading and managing ELF files
\ingroup system_libraries
*/
+/** \defgroup elf_ident ELF Identification Bytes
+ \ingroup elf
+
+ Initial bytes of the ELF file, specifying how it should be
+ interpreted. This group contains first the indexes of each
+ ident field, then defines for the values they can contain.
+
+ Some of these are shared by other header fields.
+ @{
+*/
+#define EI_MAG0 0 /**< \brief File identification: 0x7f */
+#define EI_MAG1 1 /**< \brief File identification: 'E' */
+#define EI_MAG2 2 /**< \brief File identification: 'L' */
+#define EI_MAG3 3 /**< \brief File identification: 'F' */
+#define EI_CLASS 4 /**< \brief File class (32/64-bit) */
+#define EI_DATA 5 /**< \brief Data encoding (LSB/MSB) */
+#define EI_VERSION 6 /**< \brief File version (must be 1) */
+#define EI_OSABI 7 /**< \brief Operating System/ABI identification */
+#define EI_ABIVERSION 8 /**< \brief ABI version */
+#define EI_PAD 9 /**< \brief Start of padding bytes */
+
+#define EI_NIDENT 16 /**< \brief Size of elf_hdr::ident */
+
+#define ELFCLASSNONE 0 /**< \brief Invalid class */
+#define ELFCLASS32 1 /**< \brief 32-bit objects */
+#define ELFCLASS64 2 /**< \brief 64-bit objects */
+
+#define ELFDATANONE 0 /**< \brief Invalid encoding */
+#define ELFDATA2LSB 1 /**< \brief 2's complement, little endian */
+#define ELFDATA2MSB 2 /**< \brief 2's complement, big Endian */
+
+#define EV_NONE 0 /**< \brief Invalid version */
+#define EV_CURRENT 1 /**< \brief Current version */
+/** @} */
+
/** \brief ELF file header.
\ingroup elf
This header is at the beginning of any valid ELF binary and serves to
identify the architecture of the binary and various data about it.
- \headerfile kos/elf.h
*/
-struct elf_hdr_t {
- uint8 ident[16]; /**< \brief ELF identifier */
- uint16 type; /**< \brief ELF file type */
- uint16 machine; /**< \brief ELF file architecture */
- uint32 version; /**< \brief Object file version */
- uint32 entry; /**< \brief Entry point */
- uint32 phoff; /**< \brief Program header offset */
- uint32 shoff; /**< \brief Section header offset */
- uint32 flags; /**< \brief Processor flags */
- uint16 ehsize; /**< \brief ELF header size in bytes */
- uint16 phentsize; /**< \brief Program header entry size */
- uint16 phnum; /**< \brief Program header entry count */
- uint16 shentsize; /**< \brief Section header entry size */
- uint16 shnum; /**< \brief Section header entry count */
- uint16 shstrndx; /**< \brief String table section index */
-};
+typedef struct elf_hdr {
+ uint8_t ident[EI_NIDENT]; /**< \brief ELF identifier */
+ uint16_t type; /**< \brief ELF file type */
+ uint16_t machine; /**< \brief ELF file architecture */
+ uint32_t version; /**< \brief Object file version */
+ uint32_t entry; /**< \brief Entry point */
+ uint32_t phoff; /**< \brief Program header offset */
+ uint32_t shoff; /**< \brief Section header offset */
+ uint32_t flags; /**< \brief Processor flags */
+ uint16_t ehsize; /**< \brief ELF header size in bytes */
+ uint16_t phentsize; /**< \brief Program header entry size */
+ uint16_t phnum; /**< \brief Program header entry count */
+ uint16_t shentsize; /**< \brief Section header entry size */
+ uint16_t shnum; /**< \brief Section header entry count */
+ uint16_t shstrndx; /**< \brief String table section index */
+} elf_hdr_t;
/** \defgroup elf_archs Architecture Types
\brief Relevant ELF architecture type codes
@@ -67,6 +101,7 @@ struct elf_hdr_t {
@{
*/
#define EM_386 3 /**< \brief x86 (IA32) */
+#define EM_PPC 20 /**< \brief PowerPC */
#define EM_ARM 40 /**< \brief ARM */
#define EM_SH 42 /**< \brief SuperH */
/** @} */
@@ -90,9 +125,16 @@ struct elf_hdr_t {
#define SHT_NOTE 7 /**< \brief Notes section */
#define SHT_NOBITS 8 /**< \brief A section that occupies no space in
the file */
-#define SHT_REL 9 /**< \brief Relocation table, no addends */
-#define SHT_SHLIB 10 /**< \brief Reserved */
-#define SHT_DYNSYM 11 /**< \brief Dynamic-only sym tab */
+#define SHT_REL 9 /**< \brief Relocation table, no addends */
+#define SHT_SHLIB 10 /**< \brief Reserved */
+#define SHT_DYNSYM 11 /**< \brief Dynamic linker symbol table */
+#define SHT_INIT_ARRAY 14 /**< \brief Array of constructors */
+#define SHT_FINI_ARRAY 15 /**< \brief Array of destructors */
+#define SHT_PREINIT_ARRAY 16 /**< \brief Array of pre-constructors */
+#define SHT_GROUP 17 /**< \brief Section group */
+#define SHT_SYMTAB_SHNDX 18 /**< \brief Extended section indices */
+#define SHT_NUM 19 /**< \brief Number of defined types. */
+
#define SHT_LOPROC 0x70000000 /**< \brief Start of processor specific types */
#define SHT_HIPROC 0x7fffffff /**< \brief End of processor specific types */
#define SHT_LOUSER 0x80000000 /**< \brief Start of program specific types */
@@ -108,9 +150,15 @@ the file */
@{
*/
-#define SHF_WRITE 1 /**< \brief Writable data */
-#define SHF_ALLOC 2 /**< \brief Resident */
-#define SHF_EXECINSTR 4 /**< \brief Executable instructions */
+#define SHF_WRITE BIT(0) /**< \brief Writable data */
+#define SHF_ALLOC BIT(1) /**< \brief Resident */
+#define SHF_EXECINSTR BIT(2) /**< \brief Executable instructions */
+#define SHF_MERGE BIT(4) /**< \brief Might be merged */
+#define SHF_STRINGS BIT(5) /**< \brief Contains nul-terminated strings */
+#define SHF_INFO_LINK BIT(6) /**< \brief `sh_info' contains SHT index */
+#define SHF_LINK_ORDER BIT(7) /**< \brief Preserve order after combining */
+#define SHF_GROUP BIT(9) /**< \brief Section is member of a group. */
+#define SHF_TLS BIT(10) /**< \brief Section hold thread-local data. */
#define SHF_MASKPROC 0xf0000000 /**< \brief Processor specific mask */
/** @} */
@@ -133,18 +181,18 @@ the file */
\headerfile kos/elf.h
*/
-struct elf_shdr_t {
- uint32 name; /**< \brief Index into string table */
- uint32 type; /**< \brief Section type \see elf_sections */
- uint32 flags; /**< \brief Section flags \see elf_hdrflags */
- uint32 addr; /**< \brief In-memory offset */
- uint32 offset; /**< \brief On-disk offset */
- uint32 size; /**< \brief Size (if SHT_NOBITS, amount of 0s needed) */
- uint32 link; /**< \brief Section header table index link */
- uint32 info; /**< \brief Section header extra info */
- uint32 addralign; /**< \brief Alignment constraints */
- uint32 entsize; /**< \brief Fixed-size table entry sizes */
-};
+typedef struct elf_shdr {
+ uint32_t name; /**< \brief Index into string table */
+ uint32_t type; /**< \brief Section type \see elf_sections */
+ uint32_t flags; /**< \brief Section flags \see elf_hdrflags */
+ uint32_t addr; /**< \brief In-memory offset */
+ uint32_t offset; /**< \brief On-disk offset */
+ uint32_t size; /**< \brief Size (if SHT_NOBITS, amount of 0s needed) */
+ uint32_t link; /**< \brief Section header table index link */
+ uint32_t info; /**< \brief Section header extra info */
+ uint32_t addralign; /**< \brief Alignment constraints */
+ uint32_t entsize; /**< \brief Fixed-size table entry sizes */
+} elf_shdr_t;
/* Link and info fields:
switch (sh_type) {
@@ -205,14 +253,14 @@ switch (sh_type) {
\headerfile kos/elf.h
*/
-struct elf_sym_t {
- uint32 name; /**< \brief Index into file's string table */
- uint32 value; /**< \brief Value of the symbol */
- uint32 size; /**< \brief Size of the symbol */
- uint8 info; /**< \brief Symbol type and binding */
- uint8 other; /**< \brief 0. Holds no meaning. */
- uint16 shndx; /**< \brief Section index */
-};
+typedef struct elf_sym {
+ uint32_t name; /**< \brief Index into file's string table */
+ uint32_t value; /**< \brief Value of the symbol */
+ uint32_t size; /**< \brief Size of the symbol */
+ uint8_t info; /**< \brief Symbol type and binding */
+ uint8_t other; /**< \brief 0. Holds no meaning. */
+ uint16_t shndx; /**< \brief Section index */
+} elf_sym_t;
/** \brief Retrieve the binding type for a symbol.
\ingroup elf
@@ -241,11 +289,11 @@ struct elf_sym_t {
\headerfile kos/elf.h
*/
-struct elf_rela_t {
- uint32 offset; /**< \brief Offset within section */
- uint32 info; /**< \brief Symbol and type */
- int32 addend; /**< \brief Constant addend for the symbol */
-};
+typedef struct elf_rela {
+ uint32_t offset; /**< \brief Offset within section */
+ uint32_t info; /**< \brief Symbol and type */
+ int32_t addend; /**< \brief Constant addend for the symbol */
+} elf_rela_t;
/** \brief ELF Relocation entry (without explicit addend).
\ingroup elf
@@ -256,10 +304,10 @@ struct elf_rela_t {
\headerfile kos/elf.h
*/
-struct elf_rel_t {
- uint32 offset; /**< \brief Offset within section */
- uint32 info; /**< \brief Symbol and type */
-};
+typedef struct elf_rel {
+ uint32_t offset; /**< \brief Offset within section */
+ uint32_t info; /**< \brief Symbol and type */
+} elf_rel_t;
/** \defgroup elf_reltypes Relocation Types
\brief ELF relocation type values
@@ -290,7 +338,7 @@ struct elf_rel_t {
\return The relocation type of that relocation.
\see elf_reltypes
*/
-#define ELF32_R_TYPE(i) ((uint8)(i))
+#define ELF32_R_TYPE(i) ((uint8_t)(i))
struct klibrary;
@@ -303,8 +351,8 @@ struct klibrary;
\headerfile kos/elf.h
*/
typedef struct elf_prog {
- void *data; /**< \brief Pointer to program in memory */
- uint32 size; /**< \brief Memory image size (rounded up to page size) */
+ void *data; /**< \brief Pointer to program in memory */
+ uint32_t size; /**< \brief Memory image size (rounded up to page size) */
/* Library exports */
uintptr_t lib_get_name; /**< \brief Pointer to get_name() function */
@@ -312,7 +360,7 @@ typedef struct elf_prog {
uintptr_t lib_open; /**< \brief Pointer to library's open function */
uintptr_t lib_close; /**< \brief Pointer to library's close function */
- char fn[256]; /**< \brief Filename of library */
+ char fn[256]; /**< \brief Filename of library */
} elf_prog_t;
/** \brief Load an ELF binary.
@@ -339,5 +387,5 @@ void elf_free(elf_prog_t *prog);
__END_DECLS
-#endif /* __OS_ELF_H */
+#endif /* __KOS_ELF_H */
diff --git a/kernel/fs/elf.c b/kernel/fs/elf.c
index 2d40db4b..c652806c 100644
--- a/kernel/fs/elf.c
+++ b/kernel/fs/elf.c
@@ -19,24 +19,16 @@
/* What's our architecture code we're expecting? */
#if defined(_arch_dreamcast)
-# define ARCH_CODE EM_SH
-#elif defined(_arch_ia32)
-# define ARCH_CODE EM_386
-#elif defined(_arch_gba)
-# define ARCH_CODE EM_ARM
+# define ARCH_ELFCLASS ELFCLASS32 /* Dreamcast is 32-bit */
+# define ARCH_ELFDATA ELFDATA2LSB /* and little endian */
+# define ARCH_CODE EM_SH /* and uses an SH processor. */
#else
# error Unknown architecture
#endif
-#define ELF_DEBUG 0
-
-#define DBG(x) do { \
- if(__is_defined(ELF_DEBUG)) \
- printf x; \
-} while(0)
/* Finds a given symbol in a relocated ELF symbol table */
-static int find_sym(char *name, struct elf_sym_t* table, int tablelen) {
+static int find_sym(char *name, elf_sym_t *table, int tablelen) {
int i;
for(i = 0; i < tablelen; i++) {
@@ -47,25 +39,51 @@ static int find_sym(char *name, struct elf_sym_t* table, int tablelen) {
return -1;
}
+/* This function tests the header to determine if it's valid. It's separated
+ out as this is the section of the header whose parsing needs to test
+ against arch-specific values.
+*/
+static bool elf_hdr_validate(elf_hdr_t *hdr) {
+ /* First four bytes are a magic number */
+ if(strncmp((char *)hdr->ident, "\177ELF", 4)) {
+ dbglog(DBG_ERROR, "elf_load: file is not a valid ELF file\n");
+ dbglog(DBG_ERROR, " hdr->ident is %d/%.3s\n", hdr->ident[EI_MAG0], hdr->ident + 1);
+ return false;
+ }
+
+ if(hdr->ident[EI_CLASS] != ARCH_ELFCLASS || hdr->ident[EI_DATA] != ARCH_ELFDATA) {
+ dbglog(DBG_ERROR, "elf_load: invalid architecture flags in ELF file\n");
+ return false;
+ }
+
+ if(hdr->machine != ARCH_CODE) {
+ dbglog(DBG_ERROR, "elf_load: invalid architecture %02x in ELF file\n", hdr->machine);
+ return false;
+ }
+
+ return true;
+}
+
/* Pass in a file descriptor from the virtual file system, and the
result will be NULL if the file cannot be loaded, or a pointer to
the loaded and relocated executable otherwise. The second variable
will be set to the entry point. */
/* There's a lot of shit in here that's not documented or very poorly
documented by Intel.. I hope that this works for future compilers. */
-int elf_load(const char * fn, klibrary_t * shell, elf_prog_t * out) {
- uint8 *img, *imgout;
- int sz, i, j, sect;
- struct elf_hdr_t *hdr;
- struct elf_shdr_t *shdrs, *symtabhdr;
- struct elf_sym_t *symtab;
+int elf_load(const char *fn, klibrary_t *shell, elf_prog_t *out) {
+ uint8_t *img, *imgout;
+ size_t sz, rsz;
+ int i, j, sect;
+ elf_hdr_t *hdr;
+ elf_shdr_t *shdrs, *symtabhdr;
+ elf_sym_t *symtab;
int symtabsize;
- struct elf_rel_t *reltab;
- struct elf_rela_t *relatab;
+ elf_rel_t *reltab;
+ elf_rela_t *relatab;
int reltabsize;
- char *stringtab;
- uint32 vma;
- file_t fd;
+ char *stringtab;
+ uint32_t vma;
+ file_t fd;
(void)shell;
@@ -78,7 +96,7 @@ int elf_load(const char * fn, klibrary_t * shell, elf_prog_t * out) {
}
sz = fs_total(fd);
- DBG(("Loading ELF file of size %d\n", sz));
+ dbglog(DBG_KDEBUG, "Loading ELF file of size %d\n", sz);
img = aligned_alloc(32, sz);
@@ -88,46 +106,41 @@ int elf_load(const char * fn, klibrary_t * shell, elf_prog_t * out) {
return -1;
}
- fs_read(fd, img, sz);
- fs_close(fd);
+ rsz = fs_read(fd, img, sz);
- /* Header is at the front */
- hdr = (struct elf_hdr_t *)(img + 0);
+ /* We close it regardless. */
+ fs_close(fd);
- if(hdr->ident[0] != 0x7f || strncmp((char *)hdr->ident + 1, "ELF", 3)) {
- dbglog(DBG_ERROR, "elf_load: file is not a valid ELF file\n");
- hdr->ident[4] = 0;
- dbglog(DBG_ERROR, " hdr->ident is %d/%s\n", hdr->ident[0], hdr->ident + 1);
- goto error1;
+ if(rsz < sz) {
+ dbglog(DBG_ERROR, "elf_load: only read %d of %d bytes\n", rsz, sz);
+ free(img);
+ return -1;
}
- if(hdr->ident[4] != 1 || hdr->ident[5] != 1) {
- dbglog(DBG_ERROR, "elf_load: invalid architecture flags in ELF file\n");
- goto error1;
- }
+ /* Header is at the front */
+ hdr = (elf_hdr_t *)(img + 0);
- if(hdr->machine != ARCH_CODE) {
- dbglog(DBG_ERROR, "elf_load: invalid architecture %02x in ELF file\n", hdr->machine);
+ /* Test if the header is valid */
+ if(!elf_hdr_validate(hdr))
goto error1;
- }
/* Print some debug info */
- DBG(("File size is %d bytes\n", sz));
- DBG((" entry point %08lx\n", hdr->entry));
- DBG((" ph offset %08lx\n", hdr->phoff));
- DBG((" sh offset %08lx\n", hdr->shoff));
- DBG((" flags %08lx\n", hdr->flags));
- DBG((" ehsize %08x\n", hdr->ehsize));
- DBG((" phentsize %08x\n", hdr->phentsize));
- DBG((" phnum %08x\n", hdr->phnum));
- DBG((" shentsize %08x\n", hdr->shentsize));
- DBG((" shnum %08x\n", hdr->shnum));
- DBG((" shstrndx %08x\n", hdr->shstrndx));
+ dbglog(DBG_KDEBUG, "File size is %d bytes\n", sz);
+ dbglog(DBG_KDEBUG, " entry point %08lx\n", hdr->entry);
+ dbglog(DBG_KDEBUG, " ph offset %08lx\n", hdr->phoff);
+ dbglog(DBG_KDEBUG, " sh offset %08lx\n", hdr->shoff);
+ dbglog(DBG_KDEBUG, " flags %08lx\n", hdr->flags);
+ dbglog(DBG_KDEBUG, " ehsize %08x\n", hdr->ehsize);
+ dbglog(DBG_KDEBUG, " phentsize %08x\n", hdr->phentsize);
+ dbglog(DBG_KDEBUG, " phnum %08x\n", hdr->phnum);
+ dbglog(DBG_KDEBUG, " shentsize %08x\n", hdr->shentsize);
+ dbglog(DBG_KDEBUG, " shnum %08x\n", hdr->shnum);
+ dbglog(DBG_KDEBUG, " shstrndx %08x\n", hdr->shstrndx);
/* Locate the string table; SH elf files ought to have
two string tables, one for section names and one for object
string names. We'll look for the latter. */
- shdrs = (struct elf_shdr_t *)(img + hdr->shoff);
+ shdrs = (elf_shdr_t *)(img + hdr->shoff);
stringtab = NULL;
for(i = 0; i < hdr->shnum; i++) {
@@ -156,12 +169,12 @@ int elf_load(const char * fn, klibrary_t * shell, elf_prog_t * out) {
goto error1;
}
- symtab = (struct elf_sym_t *)(img + symtabhdr->offset);
- symtabsize = symtabhdr->size / sizeof(struct elf_sym_t);
+ symtab = (elf_sym_t *)(img + symtabhdr->offset);
+ symtabsize = symtabhdr->size / sizeof(elf_sym_t);
/* Relocate symtab entries for quick access */
for(i = 0; i < symtabsize; i++)
- symtab[i].name = (uint32)(stringtab + symtab[i].name);
+ symtab[i].name = (uint32_t)(stringtab + symtab[i].name);
/* Build the final memory image */
sz = 0;
@@ -172,7 +185,7 @@ int elf_load(const char * fn, klibrary_t * shell, elf_prog_t * out) {
sz += shdrs[i].size;
if(shdrs[i].addralign && (shdrs[i].addr % shdrs[i].addralign)) {
- uint32 orig = shdrs[i].addr;
+ uint32_t orig = shdrs[i].addr;
shdrs[i].addr = (shdrs[i].addr + shdrs[i].addralign)
& ~(shdrs[i].addralign - 1);
sz += shdrs[i].addr - orig;
@@ -180,7 +193,7 @@ int elf_load(const char * fn, klibrary_t * shell, elf_prog_t * out) {
}
}
- DBG(("Final image is %d bytes\n", sz));
+ dbglog(DBG_KDEBUG, "Final image is %d bytes\n", sz);
out->data = imgout = malloc(sz);
if(out->data == NULL) {
@@ -189,18 +202,18 @@ int elf_load(const char * fn, klibrary_t * shell, elf_prog_t * out) {
}
out->size = sz;
- vma = (uint32)imgout;
+ vma = (uint32_t)imgout;
for(i = 0; i < hdr->shnum; i++) {
if(shdrs[i].flags & SHF_ALLOC) {
if(shdrs[i].type == SHT_NOBITS) {
- DBG((" setting %ld bytes of zeros at %08lx\n",
- shdrs[i].size, shdrs[i].addr));
+ dbglog(DBG_KDEBUG, " setting %ld bytes of zeros at %08lx\n",
+ shdrs[i].size, shdrs[i].addr);
memset(imgout + shdrs[i].addr, 0, shdrs[i].size);
}
else {
- DBG((" copying %ld bytes from %08lx to %08lx\n",
- shdrs[i].size, shdrs[i].offset, shdrs[i].addr));
+ dbglog(DBG_KDEBUG, " copying %ld bytes from %08lx to %08lx\n",
+ shdrs[i].size, shdrs[i].offset, shdrs[i].addr);
memcpy(imgout + shdrs[i].addr,
img + shdrs[i].offset,
shdrs[i].size);
@@ -212,14 +225,14 @@ int elf_load(const char * fn, klibrary_t * shell, elf_prog_t * out) {
for(i = 1; i < symtabsize; i++) {
export_sym_t * sym;
- /* DBG((" symbol '%s': value %04lx, size %04lx, info %02x, other %02x, shndx %04lx\n",
+ /* dbglog(DBG_KDEBUG, " symbol '%s': value %04lx, size %04lx, info %02x, other %02x, shndx %04lx\n",
(const char *)(symtab[i].name),
symtab[i].value, symtab[i].size,
symtab[i].info,
symtab[i].other,
- symtab[i].shndx)); */
...<truncated>...
hooks/post-receive
--
A pseudo Operating System for the Dreamcast.
|