summaryrefslogtreecommitdiffstats
path: root/util/romcc
diff options
context:
space:
mode:
authorEric Biederman <ebiederm@xmission.com>2004-03-11 15:01:31 +0000
committerEric Biederman <ebiederm@xmission.com>2004-03-11 15:01:31 +0000
commit5cd81730ecef18690f92d193b0381c103a5b3d9b (patch)
treef4d2755177561691661f8d945081df67bcc9cd1a /util/romcc
parentf31d5542f6e193595da0f66aea68602910984861 (diff)
downloadcoreboot-5cd81730ecef18690f92d193b0381c103a5b3d9b.tar.gz
coreboot-5cd81730ecef18690f92d193b0381c103a5b3d9b.tar.bz2
coreboot-5cd81730ecef18690f92d193b0381c103a5b3d9b.zip
- Moved hlt() to it's own header.
- Reworked pnp superio device support. Now complete superio support is less than 100 lines. - Added support for hard coding resource assignments in Config.lb - Minor bug fixes to romcc - Initial support for catching the x86 processor BIST error codes. I've only seen this trigger once in production during a very suspcious reset but... - added raminit_test to test the code paths in raminit.c for the Opteron - Removed the IORESOURCE_SET bit and added IORESOURCE_ASSIGNED and IORESOURCE_STORED so we can tell what we have really done. - Added generic AGP/IOMMU setting code to x86 - Added an implementation of memmove and removed reserved identifiers from memcpy - Added minimal support for booting on pre b3 stepping K8 cores - Moved the checksum on amd8111 boards because our default location was on top of extended RTC registers - On the Hdama added support for enabling i2c hub so we can get at the temperature sensors. Not that i2c bus was implemented well enough to make that useful. - Redid the Opteron port so we should only need one reset and most of memory initialization is done in cpu_fixup. This is much, much faster. - Attempted to make the VGA IO region assigment work. The code seems to work now... - Redid the error handling in amdk8/raminit.c to distinguish between a bad value and a smbus error, and moved memory clearing out to cpufixup. - Removed CONFIG_KEYBOARD as it was useless. See pc87360/superio.c for how to setup a legacy keyboard properly. - Reworked the register values for standard hardware, moving the defintions from chip.h into the headers of the initialization routines. This is much saner and is actually implemented. - Made the hdama port an under clockers BIOS. I debuged so many interesting problems. - On amd8111_lpc added setup of architectural/legacy hardware - Enabled PCI error reporting as much as possible. - Enhanded build_opt_tbl to generate a header of the cmos option locations so that romcc compiled code can query the cmos options. - In romcc gracefully handle function names that degenerate into function pointers - Bumped the version to 1.1.6 as we are getting closer to 2.0 TODO finish optimizing the HT links of non dual boards TODO make all Opteron board work again TODO convert all superio devices to use the new helpers TODO convert the via/epia to freebios2 conventions TODO cpu fixup/setup by cpu type git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1390 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/romcc')
-rw-r--r--util/romcc/Makefile7
-rw-r--r--util/romcc/romcc.c33
-rw-r--r--util/romcc/tests/fail_test6.c11
-rw-r--r--util/romcc/tests/fail_test7.c10
-rw-r--r--util/romcc/tests/fail_test8.c10
5 files changed, 58 insertions, 13 deletions
diff --git a/util/romcc/Makefile b/util/romcc/Makefile
index e8dd0a96792f..75fb56c01f73 100644
--- a/util/romcc/Makefile
+++ b/util/romcc/Makefile
@@ -1,5 +1,5 @@
-VERSION:=0.37
-RELEASE_DATE:=21 October 2003
+VERSION:=0.38
+RELEASE_DATE:=18 December 2003
PACKAGE:=romcc
@@ -108,6 +108,9 @@ FAIL_TESTS = \
fail_test3.c \
fail_test4.c \
fail_test5.c \
+ fail_test6.c \
+ fail_test7.c \
+ fail_test8.c \
TEST_SRCS:=$(patsubst %, tests/%, $(TESTS))
TEST_ASM:=$(patsubst %.c, tests/%.S, $(TESTS))
diff --git a/util/romcc/romcc.c b/util/romcc/romcc.c
index d460cfb54867..ff7aee669b12 100644
--- a/util/romcc/romcc.c
+++ b/util/romcc/romcc.c
@@ -1579,7 +1579,7 @@ static unsigned short triple_sizes(struct compile_state *state,
rhs = rhs_wanted;
lhs = 0;
if ((type->type & TYPE_MASK) == TYPE_STRUCT) {
- lhs = type->left->elements;
+ lhs = type->elements;
}
}
else if (op == OP_VAL_VEC) {
@@ -4822,7 +4822,8 @@ static int is_stable(struct compile_state *state, struct triple *def)
if ((def->op == OP_ADECL) ||
(def->op == OP_SDECL) ||
(def->op == OP_DEREF) ||
- (def->op == OP_BLOBCONST)) {
+ (def->op == OP_BLOBCONST) ||
+ (def->op == OP_LIST)) {
ret = 1;
}
else if (def->op == OP_DOT) {
@@ -4930,6 +4931,9 @@ static struct triple *do_mk_addr_expr(struct compile_state *state,
RHS(expr, 0),
int_const(state, &ulong_type, offset));
}
+ else if (expr->op == OP_LIST) {
+ error(state, 0, "Function addresses not supported");
+ }
if (!result) {
internal_error(state, expr, "cannot take address of expression");
}
@@ -4951,8 +4955,9 @@ static struct triple *mk_deref_expr(
return triple(state, OP_DEREF, base_type, expr, 0);
}
-static struct triple *array_to_pointer(struct compile_state *state, struct triple *def)
+static struct triple *lvalue_conversion(struct compile_state *state, struct triple *def)
{
+ /* Tranform an array to a pointer to the first element */
if ((def->type->type & TYPE_MASK) == TYPE_ARRAY) {
struct type *type;
type = new_type(
@@ -4971,6 +4976,10 @@ static struct triple *array_to_pointer(struct compile_state *state, struct tripl
def = triple(state, OP_COPY, type, def, 0);
}
}
+ /* Transform a function to a pointer to it */
+ else if ((def->type->type & TYPE_MASK) == TYPE_FUNCTION) {
+ def = mk_addr_expr(state, def, 0);
+ }
return def;
}
@@ -5010,15 +5019,12 @@ static struct triple *read_expr(struct compile_state *state, struct triple *def)
if (!def) {
return 0;
}
+#warning "CHECK_ME is this the only place I need to do lvalue conversions?"
+ /* Transform lvalues into something we can read */
+ def = lvalue_conversion(state, def);
if (!is_stable(state, def)) {
return def;
}
- /* Tranform an array to a pointer to the first element */
-
-#warning "CHECK_ME is this the right place to transform arrays to pointers?"
- if ((def->type->type & TYPE_MASK) == TYPE_ARRAY) {
- return array_to_pointer(state, def);
- }
if (is_in_reg(state, def)) {
op = OP_READ;
} else {
@@ -8268,7 +8274,11 @@ static struct triple *expr(struct compile_state *state)
static void expr_statement(struct compile_state *state, struct triple *first)
{
if (peek(state) != TOK_SEMI) {
- flatten(state, first, expr(state));
+ /* lvalue conversions always apply except when certaion operators
+ * are applied so the values so apply them here as I know no more
+ * operators will be applied.
+ */
+ flatten(state, first, lvalue_conversion(state, expr(state)));
}
eat(state, TOK_SEMI);
}
@@ -9650,7 +9660,7 @@ static struct triple *initializer(
((result->type->type & TYPE_MASK) == TYPE_ARRAY) &&
(type->type & TYPE_MASK) != TYPE_ARRAY)
{
- result = array_to_pointer(state, result);
+ result = lvalue_conversion(state, result);
}
if (!is_init_compatible(state, type, result->type)) {
error(state, 0, "Incompatible types in initializer");
@@ -18548,6 +18558,7 @@ static void print_const(struct compile_state *state,
case TYPE_UINT:
case TYPE_LONG:
case TYPE_ULONG:
+ case TYPE_POINTER:
fprintf(fp, ".int %lu\n",
(unsigned long)(ins->u.cval));
break;
diff --git a/util/romcc/tests/fail_test6.c b/util/romcc/tests/fail_test6.c
new file mode 100644
index 000000000000..cc7bcf52c60f
--- /dev/null
+++ b/util/romcc/tests/fail_test6.c
@@ -0,0 +1,11 @@
+
+
+static void hlt(void)
+{
+}
+
+static void main(void)
+{
+ void *foo;
+ foo = hlt;
+}
diff --git a/util/romcc/tests/fail_test7.c b/util/romcc/tests/fail_test7.c
new file mode 100644
index 000000000000..e7a0db93d339
--- /dev/null
+++ b/util/romcc/tests/fail_test7.c
@@ -0,0 +1,10 @@
+
+
+static void hlt(void)
+{
+}
+
+static void main(void)
+{
+ &hlt;
+}
diff --git a/util/romcc/tests/fail_test8.c b/util/romcc/tests/fail_test8.c
new file mode 100644
index 000000000000..10ade55f7518
--- /dev/null
+++ b/util/romcc/tests/fail_test8.c
@@ -0,0 +1,10 @@
+
+
+static void hlt(void)
+{
+}
+
+static void main(void)
+{
+ hlt;
+}