]> Joshua Wise's Git repositories - netwatch.git/commitdiff
cleanup
authorJacob Potter <jdpotter@andrew.cmu.edu>
Fri, 12 Sep 2008 21:22:56 +0000 (17:22 -0400)
committerJacob Potter <jdpotter@andrew.cmu.edu>
Fri, 12 Sep 2008 21:22:56 +0000 (17:22 -0400)
13 files changed:
.gitignore [new file with mode: 0644]
aseg/Makefile
aseg/counter.c
elfload/.gitignore [new file with mode: 0644]
grubload/.gitignore [new file with mode: 0644]
grubload/Makefile
grubload/loader.c
grubload/multiboot_c.c
include/elf.h
include/stdint.h [new file with mode: 0644]
pci/pci-linux.c
pci/pci-raw.c [moved from pci/pci-smm.c with 96% similarity]
pci/pci.h [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..64c574e
--- /dev/null
@@ -0,0 +1,3 @@
+*.o
+*.bin
+*.elf
index 28a09de27b7d6f03774e0fb4929e6e09353ead3a..079c3a500537d71fb20b141e177109404df3203b 100644 (file)
@@ -1,6 +1,6 @@
 CC=gcc
 CFLAGS=-I../include -nostdlib -nostdinc -fno-builtin
-OBJS=counter.o ../pci/pci-smm.o ../lib/minilib.o ../lib/console.o
+OBJS=counter.o ../pci/pci-raw.o ../lib/minilib.o ../lib/console.o
 
 all: aseg.elf
 
@@ -12,3 +12,6 @@ aseg.o: aseg.bin
 
 aseg.elf: aseg.lds aseg.o $(OBJS)
        ld -o aseg.elf -T aseg.lds $(OBJS)
+
+clean:
+       rm -f $(OBJS) aseg.elf aseg.bin aseg.o
index 7fe4cefe535f49ba40e64147aca002aa5a3c6f85..2c82f086316b0209e4476007e681525a7827ac8d 100644 (file)
@@ -1,5 +1,4 @@
 #include <io.h>
-#include <minilib.h>
 
 unsigned int counter = 0;
 unsigned long pcisave;
diff --git a/elfload/.gitignore b/elfload/.gitignore
new file mode 100644 (file)
index 0000000..955951e
--- /dev/null
@@ -0,0 +1 @@
+loader
diff --git a/grubload/.gitignore b/grubload/.gitignore
new file mode 100644 (file)
index 0000000..0647739
--- /dev/null
@@ -0,0 +1 @@
+multiboot
index 3cd15a73a831b5abeee1a05db86cf4526d9dc348..e9fa1dfd07e74877623356a826c1254637088d24 100644 (file)
@@ -1,4 +1,4 @@
-OBJS=multiboot_c.o multiboot_asm.o realmode.o loader.o ../pci/pci-smm.o ../lib/minilib.o ../lib/console.o
+OBJS=multiboot_c.o multiboot_asm.o realmode.o loader.o ../pci/pci-raw.o ../lib/minilib.o ../lib/console.o
 CC=gcc
 CFLAGS=-nostdlib -I../include -I. -fno-builtin -nostdinc
 
@@ -12,3 +12,6 @@ realmode.bin: realmode.asm
 
 realmode.o: realmode.bin
        objcopy -I binary -B i386 -O elf32-i386 realmode.bin realmode.o
+
+clean:
+       rm -f $(OBJS)
index 4ecba2ab26c0c934c514edefba7198a899bae40b..ee9fc00729ea16d066215960baf4cfb00ec43da7 100644 (file)
@@ -1,5 +1,4 @@
-#include "minilib.h"
-#include "../include/elf.h"
+#include <elf.h>
 
 static const unsigned char elf_ident[4] = { 0x7F, 'E', 'L', 'F' }; 
 
index ad421b4b713f6aa24a46c30e7a32c07b8e5a7c4f..572c3fd3ee6d80cb86ad3b8764b64badf6df601e 100644 (file)
@@ -24,11 +24,11 @@ struct mod_info
 
 void c_start(unsigned int magic, struct mb_info *wee)
 {
-       unsigned short *grubptr = 0x7CFE;
+       unsigned short *grubptr = (unsigned short *)0x7CFE;
        unsigned char smramc;
        int i;
        
-       void (*realmode)() = 0x4000;
+       void (*realmode)() = (void (*)()) 0x4000;
        
        puts("Magic is: ");
        puthex(magic);
index 0d5abbd0f72edd850c80994fc2ccc4ed76c28e91..7240b699cfc5ce1d42d6a5ca191afd3b493aee76 100644 (file)
@@ -21,9 +21,7 @@
 #ifndef _ELF_H
 #define        _ELF_H 1
 
-#ifndef MINILIB
 #include <stdint.h>
-#endif
 
 /* Standard ELF types.  */
 
diff --git a/include/stdint.h b/include/stdint.h
new file mode 100644 (file)
index 0000000..dbe4222
--- /dev/null
@@ -0,0 +1,27 @@
+#ifndef _STDINT_H
+#define _STDINT_H
+
+#ifndef __i386__
+# ifndef __x86_64__
+#  error this stdint.h expects either __i386__ or __x86_64__ to be defined
+# endif
+#endif
+
+typedef signed char    int8_t;
+typedef unsigned char  uint8_t;
+
+typedef signed short   int16_t;
+typedef unsigned short uint16_t;
+
+typedef signed int     int32_t;
+typedef unsigned int   uint32_t;
+
+#ifdef __x86_64__
+typedef signed long    int64_t;
+typedef unsigned long  uint64_t;
+#else
+typedef signed long long       int64_t;
+typedef unsigned long long     uint64_t;
+#endif
+
+#endif
index 11c23753996cebb0353192a8383545ef3806771f..8880069f7e26cf2e112256cb205d2603949ab850 100644 (file)
@@ -4,6 +4,8 @@
 #include <stdio.h>
 #include <inttypes.h>
 
+#include "pci.h"
+
 static int _open(int bus, int slot, int fn)
 {
        char fname[512];
similarity index 96%
rename from pci/pci-smm.c
rename to pci/pci-raw.c
index 117a8b5d3d4c3e5df8271475ad359c9533510452..4747ffdffe82853283af3fe807cce528559a7ac5 100644 (file)
@@ -1,5 +1,6 @@
 #include <io.h>
-#include <inttypes.h>
+#include <stdint.h>
+#include "pci.h"
 
 static void __pci_config(int bus, int slot, int fn, int addr)
 {
diff --git a/pci/pci.h b/pci/pci.h
new file mode 100644 (file)
index 0000000..729f9c0
--- /dev/null
+++ b/pci/pci.h
@@ -0,0 +1,17 @@
+#ifndef PCI_H
+#define PCI_H
+
+/* General PCI functions. This is implemented by pci-linux.c and pci-raw.c; the
+ * former uses Linux's /proc/bus/pci interface for access from userspace, while
+ * the latter accesses the PCI hardware directly.
+ */
+
+void pci_write32(int bus, int slot, int fn, int addr, uint32_t data);
+void pci_write16(int bus, int slot, int fn, int addr, uint16_t data);
+void pci_write8(int bus, int slot, int fn, int addr, uint8_t data);
+
+uint32_t pci_read32(int bus, int slot, int fn, int addr);
+uint16_t pci_read16(int bus, int slot, int fn, int addr);
+uint8_t pci_read8(int bus, int slot, int fn, int addr);
+
+#endif
This page took 0.036698 seconds and 4 git commands to generate.