diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-12-20 17:28:05 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-12-20 17:28:05 +0000 |
commit | 3fe7071bd3f80acfac22944aad3d6849d0bcba3f (patch) | |
tree | ad15538da9f3725ac2c8070cd415a5691c87cb3d | |
parent | 23a0f7512c0b55c34b6d26ceffd093556d2e007f (diff) |
skip the perfect hash for now since it wastes a lot of kernel memory,
and fails to fit onto the floppies. for now, do a linear search, but
someone should sort the instructions and use bsearch; ok marco
-rw-r--r-- | sys/dev/acpi/dsdt.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/sys/dev/acpi/dsdt.c b/sys/dev/acpi/dsdt.c index 9ca87a9314c..db7224f12b3 100644 --- a/sys/dev/acpi/dsdt.c +++ b/sys/dev/acpi/dsdt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsdt.c,v 1.69 2006/12/18 18:36:05 deraadt Exp $ */ +/* $OpenBSD: dsdt.c,v 1.70 2006/12/20 17:28:04 deraadt Exp $ */ /* * Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org> * @@ -110,12 +110,7 @@ struct aml_value *aml_global_lock; struct acpi_softc *dsdt_softc; /* Perfect hash function for valid AML bytecodes */ -#define HASH_OFF 6904 -#define HASH_SIZE 179 -#define HASH_KEY(k) (((k) ^ HASH_OFF) % HASH_SIZE) - -#define HASH_MAGIC(v) (0xC0DE0000L + (v)) -#define HTE(v,f...) [ HASH_KEY(v) ] { HASH_MAGIC(v), f } +#define HTE(v,a,b...) { v,a,b } struct aml_value *aml_parsenamed(struct aml_scope *, int, struct aml_value *); struct aml_value *aml_parsenamedscope(struct aml_scope *, int, struct aml_value *); @@ -314,11 +309,11 @@ void _aml_die(const char *fn, int line, const char *fmt, ...) struct aml_opcode * aml_findopcode(int opcode) { - struct aml_opcode *tab; + int i; - tab = &aml_table[HASH_KEY(opcode)]; - if (tab->opcode == HASH_MAGIC(opcode)) - return tab; + for (i = 0; i < sizeof(aml_table) / sizeof(aml_table[0]); i++) + if (aml_table[i].opcode == opcode) + return &aml_table[i]; return NULL; } |