diff --git a/mach/proto/mcg/data.c b/mach/proto/mcg/data.c index 0f79cb767..38525b724 100644 --- a/mach/proto/mcg/data.c +++ b/mach/proto/mcg/data.c @@ -1,6 +1,13 @@ #include "mcg.h" #include +#define IEEEFLOAT +#define FL_MSL_AT_LOW_ADDRESS 1 +#define FL_MSW_AT_LOW_ADDRESS 1 +#define FL_MSB_AT_LOW_ADDRESS 1 + +#include "con_float" + static struct symbol* pending; void data_label(const char* label) @@ -49,6 +56,24 @@ void data_int(arith data, size_t size, bool is_ro) fprintf(outputfile, "\t.data%d 0x%0*lld\n", size, size*2, data); } +void data_float(const char* data, size_t size, bool is_ro) +{ + unsigned char buffer[8]; + int i; + + emit_header(is_ro ? SECTION_ROM : SECTION_DATA); + assert((size == 4) || (size == 8)); + + if (float_cst(data, size, (char*) buffer)) + fatal("cannot parse floating point constant %s sz %d", data, size); + + fprintf(outputfile, "\t!float %s sz %d\n", data, size); + fprintf(outputfile, "\t.data1 0x%02x", buffer[0]); + for (i=1; i #include #include +#include "flt_arith.h" #include "em_arith.h" #include "em_label.h" #include "em.h" @@ -93,6 +94,7 @@ extern struct symbol* symbol_walk(symbol_walker_t* walker, void* user); extern void data_label(const char* name); extern void data_int(arith data, size_t size, bool is_ro); +extern void data_float(const char* data, size_t size, bool is_ro); extern void data_block(const uint8_t* data, size_t size, bool is_ro); extern void data_offset(const char* label, arith offset, bool is_ro); extern void data_bss(arith size, int init); diff --git a/mach/proto/mcg/parse_em.c b/mach/proto/mcg/parse_em.c index c49922ac8..9551ecd02 100644 --- a/mach/proto/mcg/parse_em.c +++ b/mach/proto/mcg/parse_em.c @@ -230,6 +230,12 @@ static void parse_pseu(void) break; } + case fco_ptyp: + { + data_float(em.em_string, em.em_size, ro); + break; + } + case str_ptyp: data_block(strdup(em.em_string), em.em_size, ro); break;