From owner-svn-src-user@FreeBSD.ORG Tue Dec 30 14:50:05 2014 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8418DD48; Tue, 30 Dec 2014 14:50:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6526B15C9; Tue, 30 Dec 2014 14:50:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBUEo5BO074571; Tue, 30 Dec 2014 14:50:05 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBUEo4rg074564; Tue, 30 Dec 2014 14:50:04 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201412301450.sBUEo4rg074564@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Tue, 30 Dec 2014 14:50:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r276410 - user/nwhitehorn/kboot/powerpc/kboot X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Dec 2014 14:50:05 -0000 Author: nwhitehorn Date: Tue Dec 30 14:50:03 2014 New Revision: 276410 URL: https://svnweb.freebsd.org/changeset/base/276410 Log: Port to Linux. Modified: user/nwhitehorn/kboot/powerpc/kboot/host_syscall.S user/nwhitehorn/kboot/powerpc/kboot/host_syscall.h user/nwhitehorn/kboot/powerpc/kboot/hostcons.c user/nwhitehorn/kboot/powerpc/kboot/hostdisk.c user/nwhitehorn/kboot/powerpc/kboot/main.c Modified: user/nwhitehorn/kboot/powerpc/kboot/host_syscall.S ============================================================================== --- user/nwhitehorn/kboot/powerpc/kboot/host_syscall.S Tue Dec 30 12:47:44 2014 (r276409) +++ user/nwhitehorn/kboot/powerpc/kboot/host_syscall.S Tue Dec 30 14:50:03 2014 (r276410) @@ -11,13 +11,17 @@ ENTRY(host_write) blr ENTRY(host_seek) - li %r0, 478 # SYS_lseek + li %r0, 19 # SYS_lseek sc blr ENTRY(host_open) li %r0, 5 # SYS_open sc + bso 1f + blr +1: + li %r3, 0 blr ENTRY(host_close) @@ -26,17 +30,17 @@ ENTRY(host_close) blr ENTRY(host_mmap) - li %r0, 477 # SYS_mmap + li %r0, 90 # SYS_mmap sc blr ENTRY(host_gettimeofday) - li %r0, 116 # SYS_gettimeofday + li %r0, 78 # SYS_gettimeofday sc blr ENTRY(host_select) - li %r0, 93 # SYS_select + li %r0, 82 # SYS_select sc blr Modified: user/nwhitehorn/kboot/powerpc/kboot/host_syscall.h ============================================================================== --- user/nwhitehorn/kboot/powerpc/kboot/host_syscall.h Tue Dec 30 12:47:44 2014 (r276409) +++ user/nwhitehorn/kboot/powerpc/kboot/host_syscall.h Tue Dec 30 14:50:03 2014 (r276410) @@ -1,5 +1,5 @@ /*- - * Copyright (C) 2010 Nathan Whitehorn + * Copyright (C) 2014 Nathan Whitehorn * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,11 +32,11 @@ 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, uint64_t offset, int whence); +ssize_t host_seek(int fd, int 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, off_t); -#define host_getmem(size) host_mmap(0, size, 3 /* RW */, 0x1000 /* ANON */, -1, 0); +void *host_mmap(void *addr, size_t len, int prot, int flags, int fd, int); +#define host_getmem(size) host_mmap(0, size, 3 /* RW */, 0x22 /* ANON */, -1, 0); struct host_timeval { int tv_sec; int tv_usec; Modified: user/nwhitehorn/kboot/powerpc/kboot/hostcons.c ============================================================================== --- user/nwhitehorn/kboot/powerpc/kboot/hostcons.c Tue Dec 30 12:47:44 2014 (r276409) +++ user/nwhitehorn/kboot/powerpc/kboot/hostcons.c Tue Dec 30 14:50:03 2014 (r276410) @@ -59,6 +59,7 @@ hostcons_init(int arg) { /* XXX: set nonblocking */ + /* tcsetattr(~(ICANON | ECHO)) */ return (0); } Modified: user/nwhitehorn/kboot/powerpc/kboot/hostdisk.c ============================================================================== --- user/nwhitehorn/kboot/powerpc/kboot/hostdisk.c Tue Dec 30 12:47:44 2014 (r276409) +++ user/nwhitehorn/kboot/powerpc/kboot/hostdisk.c Tue Dec 30 14:50:03 2014 (r276410) @@ -40,7 +40,7 @@ static int hostdisk_ioctl(struct open_fi static void hostdisk_print(int verbose); struct devsw hostdisk = { - "a", + "s", DEVT_DISK, hostdisk_init, hostdisk_strategy, @@ -96,7 +96,7 @@ hostdisk_open(struct open_file *f, ...) desc->d_unit = host_open(path, O_RDONLY, 0); free(path); - if (desc->d_unit < 0) + if (desc->d_unit <= 0) return (ENOENT); return (0); Modified: user/nwhitehorn/kboot/powerpc/kboot/main.c ============================================================================== --- user/nwhitehorn/kboot/powerpc/kboot/main.c Tue Dec 30 12:47:44 2014 (r276409) +++ user/nwhitehorn/kboot/powerpc/kboot/main.c Tue Dec 30 14:50:03 2014 (r276410) @@ -93,6 +93,7 @@ main(int argc, const char **argv) { void *heapbase; const size_t heapsize = 15*1024*1024; + const char *bootdev = argv[1]; /* * Set the heap to one page after the end of the loader. @@ -105,7 +106,7 @@ main(int argc, const char **argv) */ cons_probe(); - printf("Boot device: %s\n", argv[1]); + printf("Boot device: %s\n", bootdev); archsw.arch_getdev = kboot_getdev; archsw.arch_copyin = kboot_copyin; @@ -117,8 +118,8 @@ main(int argc, const char **argv) printf("%s, Revision %s\n", bootprog_name, bootprog_rev); printf("(%s, %s)\n", bootprog_maker, bootprog_date); - setenv("currdev", argv[1], 1); - setenv("loaddev", argv[1], 1); + setenv("currdev", bootdev, 1); + setenv("loaddev", bootdev, 1); setenv("LINES", "24", 1); interact(NULL); /* doesn't return */ @@ -281,6 +282,7 @@ kboot_autoload(void) void _start(int argc, const char **argv, char **env) { - main(argc, argv); + register volatile void **sp asm("r1"); + main((int)sp[0], (const char **)&sp[1]); }