svn commit: r278020 - head/sys/boot/powerpc/kboot
Nathan Whitehorn
nwhitehorn at FreeBSD.org
Sun Feb 1 02:02:52 UTC 2015
Author: nwhitehorn
Date: Sun Feb 1 02:02:50 2015
New Revision: 278020
URL: https://svnweb.freebsd.org/changeset/base/278020
Log:
Allow this to work with disks greater than 4 GB and with names not beginning
with "s".
Modified:
head/sys/boot/powerpc/kboot/host_syscall.S
head/sys/boot/powerpc/kboot/host_syscall.h
head/sys/boot/powerpc/kboot/hostdisk.c
Modified: head/sys/boot/powerpc/kboot/host_syscall.S
==============================================================================
--- head/sys/boot/powerpc/kboot/host_syscall.S Sun Feb 1 01:53:59 2015 (r278019)
+++ head/sys/boot/powerpc/kboot/host_syscall.S Sun Feb 1 02:02:50 2015 (r278020)
@@ -1,3 +1,8 @@
+/*
+ *
+ * $FreeBSD$
+ */
+
#include <machine/asm.h>
ENTRY(host_read)
@@ -16,7 +21,10 @@ ENTRY(host_write)
blr
ENTRY(host_seek)
- li %r0, 19 # SYS_lseek
+ mr %r4,%r5
+ mr %r5,%r6
+ mr %r6,%r7
+ li %r0, 140 # SYS_llseek
sc
blr
Modified: head/sys/boot/powerpc/kboot/host_syscall.h
==============================================================================
--- head/sys/boot/powerpc/kboot/host_syscall.h Sun Feb 1 01:53:59 2015 (r278019)
+++ head/sys/boot/powerpc/kboot/host_syscall.h Sun Feb 1 02:02:50 2015 (r278020)
@@ -32,7 +32,7 @@
ssize_t host_read(int fd, void *buf, size_t nbyte);
ssize_t host_write(int fd, const void *buf, size_t nbyte);
-ssize_t host_seek(int fd, int offset, int whence);
+ssize_t host_seek(int fd, int64_t offset, int whence);
int host_open(char *path, int flags, int mode);
int host_close(int fd);
void *host_mmap(void *addr, size_t len, int prot, int flags, int fd, int);
Modified: head/sys/boot/powerpc/kboot/hostdisk.c
==============================================================================
--- head/sys/boot/powerpc/kboot/hostdisk.c Sun Feb 1 01:53:59 2015 (r278019)
+++ head/sys/boot/powerpc/kboot/hostdisk.c Sun Feb 1 02:02:50 2015 (r278020)
@@ -40,7 +40,7 @@ static int hostdisk_ioctl(struct open_fi
static void hostdisk_print(int verbose);
struct devsw hostdisk = {
- "s",
+ "/dev",
DEVT_DISK,
hostdisk_init,
hostdisk_strategy,
@@ -67,8 +67,10 @@ hostdisk_strategy(void *devdata, int fla
pos = dblk * 512;
- if (host_seek(desc->d_unit, pos, 0) < 0)
+ if (host_seek(desc->d_unit, pos, 0) < 0) {
+ printf("Seek error\n");
return (EIO);
+ }
n = host_read(desc->d_unit, buf, size);
if (n < 0)
@@ -82,22 +84,19 @@ static int
hostdisk_open(struct open_file *f, ...)
{
struct devdesc *desc;
- char *path;
va_list vl;
va_start(vl, f);
desc = va_arg(vl, struct devdesc *);
va_end(vl);
- path = malloc(strlen((char *)(desc->d_opendata)) + 6);
- strcpy(path, "/dev/");
- strcat(path, (char *)(desc->d_opendata));
+ desc->d_unit = host_open(desc->d_opendata, O_RDONLY, 0);
- desc->d_unit = host_open(path, O_RDONLY, 0);
- free(path);
-
- if (desc->d_unit <= 0)
+ if (desc->d_unit <= 0) {
+ printf("hostdisk_open: couldn't open %s: %d\n",
+ desc->d_opendata, desc->d_unit);
return (ENOENT);
+ }
return (0);
}
More information about the svn-src-all
mailing list