ACPI AML decompiler w/ CFG recovery and structured pseudocode
29

Configure Feed

Select the types of activity you want to include in your feed.

tobi / test / t_js.c
1.5 kB 47 lines
1#include "t.h" 2 3#include "js.h" 4#include "p.h" 5 6int t_js(void) { 7 uint8_t data[] = {0x08,'S','T','R','0',0x0d,'a','"','b','\\','c',0x00,0xfe}; 8 tobi_parse_result r; 9 T_CHECK(tobi_parse(data, sizeof(data), 0, &r)); 10 char *s = tobi_js_emit(&r); 11 T_STR(s, "\"kind\":\"root\""); 12 T_STR(s, "\"checksum_sum\":0"); 13 T_STR(s, "\"checksum_valid\":false"); 14 T_STR(s, "\"namespace\":["); 15 T_STR(s, "\"path\":\"\\\\STR0\""); 16 T_STR(s, "\"kind\":\"name\""); 17 T_STR(s, "a\\\"b\\\\c"); 18 T_STR(s, "\"raw_opcode\":254"); 19 T_CHECK(strstr(s, ",}") == NULL); 20 T_CHECK(strstr(s, ",]") == NULL); 21 free(s); 22 tobi_parse_result_free(&r); 23 24 uint8_t res[] = {0x11,0x05,0x0a,0x02,0x79,0x00}; 25 T_CHECK(tobi_parse(res, sizeof(res), 0, &r)); 26 s = tobi_js_emit(&r); 27 T_STR(s, "\"kind\":\"resource\""); 28 T_STR(s, "\"name\":\"EndTag\""); 29 T_STR(s, "\"string\":\"checksum=0x0\""); 30 T_CHECK(strstr(s, ",}") == NULL); 31 T_CHECK(strstr(s, ",]") == NULL); 32 free(s); 33 tobi_parse_result_free(&r); 34 35 uint8_t fld[] = {0x5b,0x80,'R','E','G','0',0x01,0x0a,0x10,0x0a,0x04,0x5b,0x81,0x0b,'R','E','G','0',0x00,'F','L','D','0',0x08}; 36 T_CHECK(tobi_parse(fld, sizeof(fld), 0, &r)); 37 s = tobi_js_emit(&r); 38 T_STR(s, "\"target\":\"\\\\REG0\""); 39 T_STR(s, "\"bit_offset\":0"); 40 T_STR(s, "\"bit_length\":8"); 41 T_STR(s, "\"access_type\":0"); 42 T_CHECK(strstr(s, ",}") == NULL); 43 T_CHECK(strstr(s, ",]") == NULL); 44 free(s); 45 tobi_parse_result_free(&r); 46 return 0; 47}