I'm guessing nobody has tried compiling it with 64bit userspace?
Patch makes it compile cleanly and stops a "SEGV instead of working" issue.
I also added a few checks for errors on system calls.
can you add a signed-off-by?
thanks
ron
On 4/9/07, Jeremy Jackson jerj@coplanar.net wrote:
I'm guessing nobody has tried compiling it with 64bit userspace?
Patch makes it compile cleanly and stops a "SEGV instead of working" issue.
I also added a few checks for errors on system calls.
-- Jeremy Jackson jerj@coplanar.net Email/Jabber/Google Talk/MSN (519)489-4903 Coplanar Networks http://www.coplanar.net
-- linuxbios mailing list linuxbios@linuxbios.org http://www.linuxbios.org/mailman/listinfo/linuxbios
I'm guessing nobody has tried compiling it with 64bit userspace?
Patch makes it compile cleanly and stops a "SEGV instead of working" issue.
I also added a few checks for errors on system calls.
Signed-off-by: Jeremy Jackson jerj@coplanar.net
applied with some changes to 2602
* Jeremy Jackson jerj@coplanar.net [070411 17:39]:
I'm guessing nobody has tried compiling it with 64bit userspace?
Patch makes it compile cleanly and stops a "SEGV instead of working" issue.
I also added a few checks for errors on system calls.
Signed-off-by: Jeremy Jackson jerj@coplanar.net
-- Jeremy Jackson jerj@coplanar.net Email/Jabber/Google Talk/MSN (519)489-4903 Coplanar Networks http://www.coplanar.net
Index: getpir/checksum.c
--- getpir/checksum.c (revision 2601) +++ getpir/checksum.c (working copy) @@ -1,4 +1,4 @@ -#include <arch/pirq_routing.h> +#include "arch/pirq_routing.h"
#include "checksum.h"
Index: getpir/code_gen.c
--- getpir/code_gen.c (revision 2601) +++ getpir/code_gen.c (working copy) @@ -1,12 +1,13 @@ #include <stdio.h> -#include <arch/pirq_routing.h> +#include <stdlib.h> +#include "arch/pirq_routing.h"
static char *preamble[] = { "/* This file was generated by getpir.c, do not modify! \n (but if you do, please run checkpir on it to verify)\n", " * Contains the IRQ Routing Table dumped directly from your memory, which BIOS sets up\n", " *\n", " * Documentation at : http://www.microsoft.com/hwdev/busbios/PCIIRQ.HTM%5Cn*/%5Cn%5Cn",
- "#include <arch/pirq_routing.h>\n\n",
- "#include "arch/pirq_routing.h"\n\n", "const struct irq_routing_table intel_irq_routing_table = {\n", "\tPIRQ_SIGNATURE, /* u32 signature */\n", "\tPIRQ_VERSION, /* u16 version */\n",
Index: getpir/checkpir.c
--- getpir/checkpir.c (revision 2601) +++ getpir/checkpir.c (working copy) @@ -4,7 +4,7 @@ */
#include <stdio.h> -#include <arch/pirq_routing.h> +#include "arch/pirq_routing.h"
#include "checksum.h"
Index: getpir/getpir.c
--- getpir/getpir.c (revision 2601) +++ getpir/getpir.c (working copy) @@ -1,12 +1,16 @@ /* getpir.c : This software is released under GPL For Linuxbios use only Aug 26 2001 , Nikolai Vladychevski, niko@isl.net.mx
- 2007.04.09 Jeremy Jackson jerj@coplanar.net
- updated for amd64 and general 64 bit portability
*/
#include <stdio.h> +#include <stdlib.h> #include <sys/mman.h> +#include <string.h>
-#include <arch/pirq_routing.h> +#include "arch/pirq_routing.h"
#define O_RDONLY 0x00
@@ -17,14 +21,18 @@
ptr = mmap(0, 0x10000, PROT_READ, MAP_SHARED, fd_mem, (off_t) 0xf0000);
if (ptr < 0) {
perror("mmap failed");
exit(1);
}
rt = (struct irq_routing_table *) memmem(ptr, 0xFFFF, signature, 4);
if (rt != NULL) {
printf("Found PCI IRQ Routing table signature at 0x%04x of system memory\n",
} else {printf("Found PCI IRQ Routing table signature $PIR at 0x%04x of system memory\n", (char *) rt - ptr + 0xf0000);
printf("No PCI IRQ Routing table signature in the memory\n");
exit(1); } return rt;printf("No PCI IRQ Routing table signature found in memory\n");
@@ -36,10 +44,13 @@ struct irq_routing_table *rt;
if (getuid()) {
perror("Run me as root, I need access to /dev/mem");
fprintf(stderr, "Run me as root, or probably can't access /dev/mem\n");
- }
- fd_mem = open("/dev/mem", O_RDONLY);
- if (fd_mem < 0) {
exit(1); }perror("opening /dev/mem");
fd_mem = open("/dev/mem", O_RDONLY);
printf("Probing PIRQ table in memory\n"); rt = probe_table(fd_mem);
Index: getpir/Makefile
--- getpir/Makefile (revision 2601) +++ getpir/Makefile (working copy) @@ -1,26 +1,29 @@ # change to the path of your linuxbios tree -#LINUXBIOSROOT=/home/rminnich/src//freebios/ LINUXBIOSROOT=../..
+# we're using -iquote with these so they don't collide +# some LinuxBIOS headers with system ones INCLUDEPATH=$(LINUXBIOSROOT)/src/arch/i386/include INCLUDE2=$(LINUXBIOSROOT)/src/include +# boy does 64bit and memmem() mess up without -D_GNU_SOURCE +CFLAGS="-D_GNU_SOURCE"
getpir: getpir.c checksum.o code_gen.o
- gcc -o getpir -I$(INCLUDEPATH) -I$(INCLUDE2) getpir.c checksum.o code_gen.o
- gcc $(CFLAGS) -o getpir -iquote$(INCLUDEPATH) -iquote$(INCLUDE2) getpir.c checksum.o code_gen.o
code_gen.o: code_gen.c
- gcc -c -I$(INCLUDEPATH) -I$(INCLUDE2) code_gen.c
- gcc $(CFLAGS) -c -iquote$(INCLUDEPATH) -iquote$(INCLUDE2) code_gen.c
all: getpir checkpir
checkpir: checkpir.c checksum.o irq_tables.o
- gcc -o checkpir -I$(INCLUDEPATH) -I$(INCLUDE2) irq_tables.o checksum.o checkpir.c
- gcc $(CFLAGS) -o checkpir -iquote$(INCLUDEPATH) -iquote$(INCLUDE2) irq_tables.o checksum.o checkpir.c
checksum.o: checksum.c
- gcc -c -I$(INCLUDEPATH) -I$(INCLUDE2) checksum.c
- gcc $(CFLAGS) -c -iquote$(INCLUDEPATH) -iquote$(INCLUDE2) checksum.c
irq_tables.o: irq_tables.c
- gcc -c -I$(INCLUDEPATH) -I$(INCLUDE2) irq_tables.c
- gcc $(CFLAGS) -c -iquote$(INCLUDEPATH) -iquote$(INCLUDE2) irq_tables.c
clean: rm -f getpir checkpir *.o *~
-- linuxbios mailing list linuxbios@linuxbios.org http://www.linuxbios.org/mailman/listinfo/linuxbios