Skip to content

Commit

Permalink
platform flag
Browse files Browse the repository at this point in the history
  • Loading branch information
xerub committed Nov 24, 2019
1 parent b1e830e commit fd934a0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
13 changes: 11 additions & 2 deletions ldid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ struct CodeDirectory {
uint32_t codeLimit;
uint8_t hashSize;
uint8_t hashType;
uint8_t spare1;
uint8_t platform;
uint8_t pageSize;
uint32_t spare2;
} _packed;
Expand Down Expand Up @@ -774,6 +774,8 @@ int main(int argc, const char *argv[]) {
uint32_t flag_CPUType(_not(uint32_t));
uint32_t flag_CPUSubtype(_not(uint32_t));

uint32_t platform(0);

const char *flag_I(NULL);

bool timeh(false);
Expand Down Expand Up @@ -827,6 +829,13 @@ int main(int argc, const char *argv[]) {
}
break;

case 'P': {
char *arge;
const char *argp = argv[argi] + 2;
platform = strtoul(argp, &arge, 0);
_assert(arge > argp && *arge == '\0');
} break;

case 's':
_assert(!flag_S);
flag_s = true;
Expand Down Expand Up @@ -1255,7 +1264,7 @@ int main(int argc, const char *argv[]) {
directory->codeLimit = Swap(data);
directory->hashSize = 0x14;
directory->hashType = 0x01;
directory->spare1 = 0x00;
directory->platform = platform;
directory->pageSize = 0x0c;
directory->spare2 = Swap(uint32_t(0));

Expand Down
13 changes: 11 additions & 2 deletions ldid2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ struct CodeDirectory {
uint32_t codeLimit;
uint8_t hashSize;
uint8_t hashType;
uint8_t spare1;
uint8_t platform;
uint8_t pageSize;
uint32_t spare2;
} _packed;
Expand Down Expand Up @@ -774,6 +774,8 @@ int main(int argc, const char *argv[]) {
uint32_t flag_CPUType(_not(uint32_t));
uint32_t flag_CPUSubtype(_not(uint32_t));

uint32_t platform(0);

const char *flag_I(NULL);

bool timeh(false);
Expand Down Expand Up @@ -827,6 +829,13 @@ int main(int argc, const char *argv[]) {
}
break;

case 'P': {
char *arge;
const char *argp = argv[argi] + 2;
platform = strtoul(argp, &arge, 0);
_assert(arge > argp && *arge == '\0');
} break;

case 's':
_assert(!flag_S);
flag_s = true;
Expand Down Expand Up @@ -1255,7 +1264,7 @@ int main(int argc, const char *argv[]) {
directory->codeLimit = Swap(data);
directory->hashSize = 0x20;
directory->hashType = 0x02;
directory->spare1 = 0x00;
directory->platform = platform;
directory->pageSize = 0x0c;
directory->spare2 = Swap(uint32_t(0));

Expand Down

0 comments on commit fd934a0

Please sign in to comment.