summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2003-04-30 21:03:16 +0000
committerpeter <peter@FreeBSD.org>2003-04-30 21:03:16 +0000
commit75662965c88e08c2d07c456c641688450362da80 (patch)
treec2d46f9e7237fa254b5ecebcecfa51b7655e8e66 /lib
parent409ee51dc226a370f2407a87479bd9a900419dbe (diff)
downloadFreeBSD-src-75662965c88e08c2d07c456c641688450362da80.zip
FreeBSD-src-75662965c88e08c2d07c456c641688450362da80.tar.gz
Teach libdisk that AMD64 works just like i386
Diffstat (limited to 'lib')
-rw-r--r--lib/libdisk/chunk.c4
-rw-r--r--lib/libdisk/create_chunk.c4
-rw-r--r--lib/libdisk/disk.c8
-rw-r--r--lib/libdisk/libdisk.h5
-rw-r--r--lib/libdisk/rules.c1
5 files changed, 14 insertions, 8 deletions
diff --git a/lib/libdisk/chunk.c b/lib/libdisk/chunk.c
index 25c3646..e41796b 100644
--- a/lib/libdisk/chunk.c
+++ b/lib/libdisk/chunk.c
@@ -239,6 +239,7 @@ Add_Chunk(struct disk *d, long offset, u_long size, const char *name,
/* PLATFORM POLICY BEGIN ------------------------------------- */
switch(platform) {
case p_i386:
+ case p_amd64:
switch (type) {
case fat:
case mbr:
@@ -317,7 +318,8 @@ Add_Chunk(struct disk *d, long offset, u_long size, const char *name,
if (platform == p_sparc64) {
offset = Prev_Cyl_Aligned(d, offset);
size = Next_Cyl_Aligned(d, size);
- } else if (platform == p_i386 || platform == p_pc98) {
+ } else if (platform == p_i386 || platform == p_pc98 ||
+ platform == p_amd64) {
if (type != freebsd)
break;
if (!(flags & CHUNK_ALIGN))
diff --git a/lib/libdisk/create_chunk.c b/lib/libdisk/create_chunk.c
index 330ccc8..d8e35e8 100644
--- a/lib/libdisk/create_chunk.c
+++ b/lib/libdisk/create_chunk.c
@@ -138,7 +138,7 @@ int
Fixup_Names(struct disk *d)
{
struct chunk *c1, *c2;
-#if defined(__i386__) || defined(__ia64__)
+#if defined(__i386__) || defined(__ia64__) || defined(__amd64__)
struct chunk *c3;
int j;
#endif
@@ -149,7 +149,7 @@ Fixup_Names(struct disk *d)
continue;
if (strcmp(c2->name, "X"))
continue;
-#if defined(__i386__) || defined(__ia64__)
+#if defined(__i386__) || defined(__ia64__) || defined(__amd64__)
c2->oname = malloc(12);
if (!c2->oname)
return -1;
diff --git a/lib/libdisk/disk.c b/lib/libdisk/disk.c
index 9b013a39..c750c2b 100644
--- a/lib/libdisk/disk.c
+++ b/lib/libdisk/disk.c
@@ -56,6 +56,8 @@ const enum platform platform =
p_ia64
#elif defined(__ppc__)
p_ppc
+#elif defined(__amd64__)
+ p_amd64
#else
IHAVENOIDEA
#endif
@@ -391,7 +393,7 @@ Debug_Disk(struct disk *d)
#if defined(PC98)
printf(" boot1=%p, boot2=%p, bootipl=%p, bootmenu=%p\n",
d->boot1, d->boot2, d->bootipl, d->bootmenu);
-#elif defined(__i386__)
+#elif defined(__i386__) || defined(__amd64__)
printf(" boot1=%p, boot2=%p, bootmgr=%p\n",
d->boot1, d->boot2, d->bootmgr);
#elif defined(__alpha__)
@@ -427,7 +429,7 @@ Free_Disk(struct disk *d)
if (d->boot1)
free(d->boot1);
#endif
-#if defined(__i386__)
+#if defined(__i386__) || defined(__amd64__)
if (d->boot2)
free(d->boot2);
#endif
@@ -556,7 +558,7 @@ Set_Boot_Mgr(struct disk *d, const u_char *b, const size_t s)
int
Set_Boot_Blocks(struct disk *d, const u_char *b1, const u_char *b2)
{
-#if defined(__i386__)
+#if defined(__i386__) || defined(__amd64__)
if (d->boot1)
free(d->boot1);
d->boot1 = malloc(512);
diff --git a/lib/libdisk/libdisk.h b/lib/libdisk/libdisk.h
index 785b25a..c988adc 100644
--- a/lib/libdisk/libdisk.h
+++ b/lib/libdisk/libdisk.h
@@ -27,7 +27,8 @@ enum platform {
p_pc98,
p_sparc64,
p_ia64,
- p_ppc
+ p_ppc,
+ p_amd64
};
extern const enum platform platform;
@@ -69,7 +70,7 @@ struct disk {
#if !defined(__ia64__)
u_char *boot1;
#endif
-#if defined(__i386__) /* the i386 needs extra help... */
+#if defined(__i386__) || defined(__amd64__) /* the i386 needs extra help... */
u_char *boot2;
#endif
struct chunk *chunks;
diff --git a/lib/libdisk/rules.c b/lib/libdisk/rules.c
index 8592be9..30e24a7 100644
--- a/lib/libdisk/rules.c
+++ b/lib/libdisk/rules.c
@@ -242,6 +242,7 @@ Check_Chunk(const struct disk *d, const struct chunk *c, char *msg)
switch (platform) {
case p_i386:
+ case p_amd64:
Rule_000(d, c, msg);
Rule_001(d, c, msg);
Rule_002(d, c, msg);
OpenPOWER on IntegriCloud