Re: CVS commit: src/lib/libperfuse
Matthias Scheler t...@zhadum.org.uk wrote: Can you please explain what is the difference between libperfuse and librefuse is? There is per instead of re in the name :-) Here is the explanation: http://mail-index.netbsd.org/tech-userlevel/2010/08/22/msg003843.html -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src/distrib/sets/lists/comp
On Mon, May 09, 2011 at 04:36:02PM +0200, Alistair Crooks wrote: I think get rid of the perfuse guard keyword - it may be that I misled people with my post to tech-userlevel, sorry, since the examples I used had the guard in place; however none of the other puffs-based entries use any guards so best to get rid of it. My fault: I did not ran yet another full build before integrating it. I will commit a fix ASAP. -- Emmanuel Dreyfus m...@netbsd.org
Re: CVS commit: [netbsd-5] src/sys/kern
Iain Hibbert plu...@rya-online.net wrote: This broke the build. I think it needs either revision 1.77 which introduced domain_sysctllog but that may introduce other complexities, or the attached patch which makes it use the local clog as per other instances.. My bad, I did not attached the right patch to the ticket pullup. Iain's patch is the right fix, and it is equivalent to the code I have been running and testing for weeks. iain --0-1025344845-1308502352=:1174 Content-Type: TEXT/PLAIN; charset=US-ASCII; name=diff Content-Transfer-Encoding: BASE64 Content-ID: alpine.neb.2.00.1106191752310.1...@galant.ukfsn.org Content-Description: Content-Disposition: attachment; filename=diff Index: uipc_domain.c === RCS file: /cvsroot/src/sys/kern/uipc_domain.c,v retrieving revision 1.76.12.1 diff -u -p -r1.76.12.1 uipc_domain.c --- uipc_domain.c 18 Jun 2011 16:42:03 - 1.76.12.1 +++ uipc_domain.c 19 Jun 2011 16:49:21 - @@ -496,7 +496,7 @@ SYSCTL_SETUP(sysctl_net_setup, sysctl n SYSCTL_DESCR(SOCK_SEQPACKET settings), NULL, 0, NULL, 0, CTL_NET, PF_LOCAL, SOCK_SEQPACKET, CTL_EOL); - sysctl_createv(domain_sysctllog, 0, NULL, NULL, + sysctl_createv(clog, 0, NULL, NULL, CTLFLAG_PERMANENT, CTLTYPE_NODE, dgram, SYSCTL_DESCR(SOCK_DGRAM settings), @@ -516,7 +516,7 @@ SYSCTL_SETUP(sysctl_net_setup, sysctl n block list), sysctl_unpcblist, 0, NULL, 0, CTL_NET, PF_LOCAL, SOCK_SEQPACKET, CTL_CREATE, CTL_EOL); - sysctl_createv(domain_sysctllog, 0, NULL, NULL, + sysctl_createv(clog, 0, NULL, NULL, CTLFLAG_PERMANENT, CTLTYPE_STRUCT, pcblist, SYSCTL_DESCR(SOCK_DGRAM protocol control block list), --0-1025344845-1308502352=:1174-- -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src
On Mon, Jul 04, 2011 at 11:09:56AM +0300, Jukka Ruohonen wrote: It does not seem right to import something to libc without documentation... FreeBSD did not document it, so I attempted to do it in xdr.3 (just committed) -- Emmanuel Dreyfus m...@netbsd.org
Re: CVS commit: src
matthew green m...@eterna.com.au wrote: /usr/src3/lib/libc/rpc/xdr_sizeof.c:112:12: error: cast from pointer to integer of different size /usr/src3/lib/libc/rpc/xdr_sizeof.c:124:18: error: cast to pointer from integer of different size Does that fix it at yours? --- xdr_sizeof.c.orig 2011-07-04 15:16:46.0 +0200 +++ xdr_sizeof.c2011-07-04 15:17:01.0 +0200 @@ -110,5 +110,5 @@ return (NULL); } - if (len (u_int)xdrs-x_base) { + if (len (u_int)(u_long)xdrs-x_base) { /* x_private was already allocated */ xdrs-x_handy += len; @@ -122,5 +122,5 @@ return (NULL); } - xdrs-x_base = (caddr_t) len; + xdrs-x_base = (caddr_t)(u_long) len; xdrs-x_handy += len; return ((int32_t *) xdrs-x_private); -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src
On Wed, Aug 10, 2011 at 08:59:48AM +, YAMAMOTO Takashi wrote: is extattr_namespace_access really necessary? uid-based priviledge check in userland is often a mistake. For now it duplicates the same simple access check as in kernel: system attributes are restricted to root. This is just a helper function, it is not exported. I immagine it could move to kernel when we introduce more namespaces with different acces semantics. But we are not there yet. -- Emmanuel Dreyfus m...@netbsd.org
Re: CVS commit: src/sys/kern
On Wed, Aug 17, 2011 at 11:19:02AM +0200, Martin Husemann wrote: shouldn't that be in a header file somewhere? Dunno - I just needed a quick build fix. Manu? Yes, there was a missing header, I just fixed it (and rolled back the prototype in vfs_syscalls.c). -- Emmanuel Dreyfus m...@netbsd.org
Re: CVS commit: src
NAKAJIMA Yoshihiro nakay...@leto.eonet.ne.jp wrote: Add futimens(2) and part of utimnsat(2) Isn't shlib_version bumped? Perhaps, but I must confess I do not know the rules for that. What are they? -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src
NAKAJIMA Yoshihiro nakay...@leto.eonet.ne.jp wrote: Because new function calls were added to libc. I think new APIs bring minor version bumping, under a NetBSD policy. Um, what should be done in distribs/sets/lists? Would s/libc.so.12.178/libc.so.12.179/ eveywhere be enough? -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src
tsugutomo.en...@jp.sony.com wrote: I guess something like following change is necessary so that when both tv_nsec is set to UTIME_NOW, 1) to perform same permission check as when NULL is passed to 2nd arg. 2) to set same value for both atime and mtime. I think you are right. -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src
NAKAJIMA Yoshihiro nakay...@leto.eonet.ne.jp wrote: Um, what should be done in distribs/sets/lists? Would s/libc.so.12.178/libc.so.12.179/ eveywhere be enough? I think so. One last concern: extended API set 2 support is not yet complete. Shouldn't we bump for once when it is done, instead of bumping for each system call added? -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src
matthew green m...@eterna.com.au wrote: ps. don't forgot to look at the sparc64/amd64/mips64 compat libs when bumping shlib versions. You mean in src/distrib/sets? -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src
David Laight da...@l8s.co.uk wrote: I'd have thought that these functions could be added 'hidded' to allow other developers (etc) to do further testing, then the version bumped when they are made visible by default. This is how I was planning to do it initially: bump once the extended API set 2 is complete and exposed. -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src/sys/fs/puffs
YAMAMOTO Takashi y...@mwd.biglobe.ne.jp wrote: This avoids deadlocks in the following situations: 1) when memory is low: ioflush waits the fileystem, the fielsystem waits for memory can you explain how it is a problem? As I understand, one way to free memory is to flush vnode backed pages to the backend storage. If ioflush calls VOP_FSYNC on a memory-starved userland filesystem, it will get stuck until the filesystem gets memory again, and while it is stuck, it does not help freeing memory. -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src/sys
On Fri, Sep 23, 2011 at 05:09:23AM +, YAMAMOTO Takashi wrote: Fix the build that was broken by struct lwp *updateproc reference in RUMP-visible code. Instead of checking that updateproc (aka ioflush, aka syncer) will not sleep in PUFFS code, I check for any kernel thread: after all none of them are designed to hang awaiting for a remote filesystem operation to complete. i don't think it's a good idea to restrict what kernel threads can do in this way. please revert. Can you imagine a situation where you would expect a kernel thread to sleep in a VFS call? If you do, then I can propose to add a L_NOWAITFS flag in struct lwp's l_flags. That way ioflush could be set to avoid sleeping in PUFFS code while other thread would remain the ability. Another approach is to add a flag to VOP_STRATEGY so that the caller can tell the filesystem whether it can wait or not. -- Emmanuel Dreyfus m...@netbsd.org
Re: CVS commit: src/sys/fs/puffs
YAMAMOTO Takashi y...@mwd.biglobe.ne.jp wrote: as i told you a few times, ioflush is not a thread to free memory. pagedaemon is. Sure ioflush do not directly free memory, but vnodes' dirty page use memory, don't they? If ioflush stops working, is pageadaemon able to pageout that kind of memory? please read ufs_bmaparray and grep uvm.pagedaemon_lwp in src/sys/kern/ to see what other filesystems do. i don't think this approach works for puffs because it's almost impossible to say in which cases an operation needs memory allocation to complete, though. It is indeed impossible, as we cannot know what the userland filesystem will do. -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src/sys/fs/puffs
YAMAMOTO Takashi y...@mwd.biglobe.ne.jp wrote: Sure ioflush do not directly free memory, but vnodes' dirty page use memory, don't they? If ioflush stops working, is pageadaemon able to pageout that kind of memory? pagedaemon flushes dirty pages by itself, yes. So this is not a problem to get ioflush traped forever awaiting for a VOP_FSYNC completion? There must be some drawback, otherwise ioflush would be useless. a possible solution would be local page recycling. ie. reserve some pages and put them onto a page queue dedicated for a given set of processes so that pages can be recycled in the set independently from the global queue. But we do not know how much memory the userland fileserver is going to require. We can have some reserves, but we must be ready to kill pigs if too much memory is retained by the fileserver. HEAD does it, but netbsd-5 prefers to hang. -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src/sys/fs/puffs
On Sat, Sep 24, 2011 at 03:31:02AM +, YAMAMOTO Takashi wrote: pagedaemon flushes dirty pages by itself, yes. I added a printf() at the beginning of puffs_vnop_strategy() to check for calls by kernel threads. Only ioflush calls puffs_vnop_strategy(), pagedaemon never goes there. This may explain why the system cannot cope with PUFFS and memory shortage. An interesting point: if I use PDPOLICY_CLOCKPRO, then pagedaemon does call puffs_vnop_strategy(), through the path below. I understand this is the way it is supposed to work: puffs_vnop_strategy VOP_STRATEGY genfs_do_io genfs_gop_write genfs_do_putpages genfs_putpages VOP_PUTPAGES (through pgo-pgo_put) uvm_pageout The system still gets stuck after a while, with glusterfsd sleeping forever in flt_noram1. ddb' show uvmexp shows 3 free pages, 509 paging. If I understand correctly, pagedaemon performs an asynchronous VOP_STRATEGY and count an operation stuck in the PUFFS filesystem as paging. It decides to do more work if uvmexp.free + uvmexp.paging gets too low. therefore with many PUFFS page forever in the paging count, pagedaemon will not help us. I have a patch that maintain a count of paging to remote filesystems (that is, the one that do not have MNT_LOCAL in struct mount mnt_flag), and substract it from uvmexp.paging when pagedaemon has to decide whether to send more pages to the swap. It seems to work fine, but the system hang with perfused awaiting for km_getwait2 (from sys_write/putter_fop_write) -- Emmanuel Dreyfus m...@netbsd.org
Re: CVS commit: src/sys/fs/puffs
YAMAMOTO Takashi y...@mwd.biglobe.ne.jp wrote: if it trapped forever, it's a bug and should be fixed. my point was that your change didn't fix the bug. blocking ioflush is merely a symptom. The problem with userland filesystems is that we may have little control as theses may be third pary programs. Should kernel threads trust theses processes in order to run as intended? One way to fix that may be to have one ioflush thread for each userland filesystem. That way a broken filesystem will not prevent ioflush from working for others. But we have hit similar problems with others kernel threads. -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src/sys/fs/puffs
On Wed, Oct 12, 2011 at 06:02:05AM +, YAMAMOTO Takashi wrote: One way to fix that may be to have one ioflush thread for each userland filesystem. That way a broken filesystem will not prevent ioflush from working for others. sure, it can be a good idea. I have a patch that does that, I will clean it up and post it. -- Emmanuel Dreyfus m...@netbsd.org
Re: CVS commit: src/sys/fs/puffs
Jukka Ruohonen jruoho...@iki.fi wrote: +#ifdef DIAGNOSTIC + KASSERT(curlwp != uvm.pagedaemon_lwp); +#endif Why pollute code with redundant #ifdefs? Right, I missed the point that KASSERT contains #ifdef DIAGNOSTIC. I will fix that tomorrow morning. -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src/lib/libperfuse
matthew green m...@eterna.com.au wrote: this seems like the wrong answer. if rlimits aren't enough, then the *user* should be increasing them, not the system. The problem is that we have no way to pass that as a mount option, and no way to evaluate how much memory will b e required. additionally, why does it have to have so much memory? surely most of it is a cache? can't it manage the size? Indeed it is cache. You cannot expect filesystems to let you control that. Speaking of FUSE it seems they will not let you do it since Linux data size is unlimited by default. -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src/sys/fs/puffs
David Holland dholland-sourcechan...@netbsd.org wrote: Di not call cache_enter with path components bigger than NCHNAMLEN, as it panics the kernel. This is wrong; you're reverting rmind's cleanup. I backed out the change. Will someone pullup the change to netbsd-6? -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src/sys/fs/puffs
David Holland dholland-sourcechan...@netbsd.org wrote: OTOH for netbsd-6 maybe a better patch would be to change cache_enter to return instead of asserting for long filenames. If nobody opposes, I can do that. -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src
Matt Thomas m...@3am-software.com wrote: Only those ports which reserve a register in mcontext for the TCB pointer should define _UC_TLSBASE. Otherwise _UC_TLSBASE has no meaning and thus should not be defined. Well, we have the choice between: - define it and keeep it unused - not define it add add #ifdef in libpthread and tests I chose the second alternative, an unused #ifdef for a simplier code -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src
On Tue, Sep 11, 2012 at 11:20:47PM -0700, Matt Thomas wrote: _UC_TLSBASE is an MD thing. iMO it is a MI interface with a MD implementation. It just says whether TLS is part of struct mcontext or not. The MD code can handle that in the kernel or in userland if that is possible. Defining it unconditionally bloats things. For instance, if _UC_TLSBASE isn't defined, pthread_setcontext doesn't need to do anything except call setcontext. That's a win. But do we have any port that are in this situation? I understand they all change the TLS pointer with setcontext. -- Emmanuel Dreyfus m...@netbsd.org
Re: CVS commit: src (_UC_TLSBASE)
On Wed, Sep 12, 2012 at 07:48:52AM -0700, Matt Thomas wrote: Actually, several don't. arm doesn't, mips doesn't, vax doesn't, m68k doesn't. They may be others. Are we talking about the same things? All these ports arlready did it conditionally on _UC_TLSBASE: src/sys/arch/arm/arm/sig_machdep.c: if ((flags _UC_TLSBASE) != 0) lwp_setprivate(l, (void *)(uintptr_t)mcp-_mc_tlsbase); src/sys/arch/mips/mips/cpu_subr.c: /* Restore the private thread context */ if (flags _UC_TLSBASE) { lwp_setprivate(l, (void *)(intptr_t)mcp-_mc_tlsbase); } src/sys/arch/vax/vax/machdep.c: if (flags _UC_TLSBASE) { void *tlsbase; error = copyin((void *)tf-tf_sp, tlsbase, sizeof(tlsbase)); if (error) { return error; } lwp_setprivate(l, tlsbase); tf-tf_sp += sizeof(tlsbase); } src/sys/arch/m68k/m68k/sig_machdep.c: if ((flags _UC_TLSBASE) != 0) lwp_setprivate(l, (void *)(uintptr_t)mcp-_mc_tlsbase); -- Emmanuel Dreyfus m...@netbsd.org
Re: CVS commit: src
David Holland dholl...@netbsd.org wrote: (Did you post the O_SEARCH changes for review? If so, I must have missed them.) No, I completely missed that it could be a problem. In any event please revert at least the O_SEARCH changes. Once the discussion of the semantics is finished, please post a new patch that implements the conclusion of the discussion and doesn't suffer from the points noted above. Well, as you said it is not exploitable, I'd rather wait for the discussion to settle before making changes again. Feel free to #ifdef notyet the lines if you are uncomfortable with them. -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src
Nick Hudson nick.hud...@gmx.co.uk wrote: Shouldn't this be #if (_POSIX_C_SOURCE - 0) = 200809L || (_XOPEN_SOURCE - 0 = 700) || \ defined(_INCOMPLETE_XOPEN_C063) || defined(_NETBSD_SOURCE) I suspect you are right. -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src
Matthias Drochner m.droch...@fz-juelich.de wrote: I've added (locally) #if defined(_NETBSD_SOURCE) #define _INCOMPLETE_XOPEN_C063 #endif Thank you fox the fix. -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src/lib
On Fri, Mar 22, 2013 at 11:24:35AM -0400, Thor Lancelot Simon wrote: And furthermore, there was no regression. One example was provided of an application (actually a PAM module) that now threw an error rather than happening to get lucky and silently working rather than failing. I was lucky, it worked reliabily on netbsd-5. It failed reliabily on netbsd-6. I call that a regression. The patch makes it working reliabily again, even for the unlucky. Joerg found the root cause of this problem -- a bug in glib -- and fixed it. The root of the problem is not in glib. The same bug just pop up again in pcsc-lite a few days ago. -- Emmanuel Dreyfus m...@netbsd.org
Re: CVS commit: src/sys
On Mon, Feb 03, 2014 at 08:57:06AM -0800, Paul Goyette wrote: Module Name:src Committed By: manu Date: Mon Feb 3 13:20:21 UTC 2014 Modified Files: src/sys/compat/netbsd32: netbsd32_netbsd.c src/sys/uvm: uvm_swap.c uvm_swap.h Log Message: Properly translate struct swapent for COMPAT_NETBSD32 with these changes, I'm getting Sorry, missing commit. Please update sys/compat/netbsd32/netbsd32.h to 1.99 -- Emmanuel Dreyfus m...@netbsd.org
Re: CVS commit: src/lib/libperfuse
On Date: Wed, 3 Sep 2014 18:43:34 +, David Holland wrote: On Wed, Sep 03, 2014 at 04:01:45PM +, Emmanuel Dreyfus wrote: Modified Files: src/lib/libperfuse: ops.c perfuse.c Log Message: Improve POSIX compliance of FUSE filesystems through PERUSE - access denied is EPERM and not EACCES wait, what? EACCES is when you lack permission for the parent directories. This errno is enforced by the LOOKUP method. If you have access to the directory but not to the object itself, you get EPERM, and this is enforced by the SETATTR method, which will not be called if you did not succeed LOOKUP first. Here is below what happens on NetBSD's FFS. The patch makes sure FUSE filesystem have the same correct behavior. # install -d -o root -m 700 /tmp/test # install -c -o root -m 644 /dev/null /tmp/test/file # su -m nobody -c 'chmod 666 /tmp/test/file' chmod: /tmp/test/file: Permission denied # grep 'Permission denied' /usr/include/sys/errno.h #define EACCES 13 /* Permission denied */ # chmod 755 /tmp/test # su -m nobody -c 'chmod 666 /tmp/test/file' chmod: /tmp/test/file: Operation not permitted # grep 'Operation not permitted' /usr/include/sys/errno.h #define EPERM 1 /* Operation not permitted */ The error was caught by POSIX filesystem regression test suite. If I am wrong then the test suite and FFS are wrong too, or I misunderstood something. Please Cc: me for the reply because I am not subscribed to this list. And your reply is needed even if you agree because I filled a pullup ticket (I did not see you reply), which is now stalled because of your objection: I now need your approval :-) -- Emmanuel Dreyfus m...@netbsd.org
Re: CVS commit: src/lib/libperfuse
David Holland dholland-sourcechan...@netbsd.org wrote: If you're sure that all the cases match ffs (which we believe to be correct on this stuff, modulo any kauth glitches) then I have no objection. It's just that most fs-level permission failures are supposed to be EACCES so I was alarmed. Please Cc: me for the reply because I am not subscribed to this list. And your reply is needed even if you agree because I filled a pullup ticket (I did not see you reply), which is now stalled because of your objection: I now need your approval :-) Ticket number? pullup-6 #1147 And I just posted pullup-7 #86 -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src
On Fri, May 29, 2015 at 04:26:33PM +0200, J. Hannken-Illjes wrote: With this change some programs fail with assertion pthread__tsd_destructors[key] != NULL failed file src/lib/libpthread/pthread_tsd.c, line 169, function pthread__add_specific Machine is amd64, 16 cores, KVM host. Among others gunzip fails. Reverting this commit removes the failure. I have seen that with older libc: setting breackpoints on pthread_key_create() and pthread_setspecific() shows that malloc() calls the later without calling the former, which is a bug. It worked before previously, pthread__tsd_destructors[] was not zero'ed and contained random data. I tested filling the array with non NULL random data and the assertion is not fired anymore. More recent libc did not seem to have the problem. How old is yours? Can you confirm the pthread_key_create()/pthread_setspecific() test? -- Emmanuel Dreyfus m...@netbsd.org
Re: CVS commit: src
Martin Husemann mar...@duskware.de wrote: I have no prove this is related, but the lib/librumpclient/t_exec:threxec test, which completed successfully in 3.551000s on my alpha last week, now times out after 300s. Do you have both two fixes from Christos? The initial change from me: http://mail-index.netbsd.org/source-changes/2015/05/29/msg066341.html Uses mmap() instead of malloc(): http://mail-index.netbsd.org/source-changes/2015/05/29/msg066353.html Second fix that use that odd _mmap() instead of mmap(): http://mail-index.netbsd.org/source-changes/2015/05/30/msg066379.html -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src
Martin Husemann mar...@duskware.de wrote: Right, the situation is considered sane now? Yes, works reliable on faster hardware - need to fix the test case someday. Good. I will still wait a bit more before sending the pullup request. Just in case... -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src
On Fri, Jul 24, 2015 at 03:51:44PM -0300, Jared McNeill wrote: I'm seeing this error on arm now with today's autobuild: http://nyftp.netbsd.org/pub/NetBSD-daily/HEAD/201507241030Z/evbarm-earmv7hf/ I am confused: how can it be caused by our pthread change from two months ago? -- Emmanuel Dreyfus m...@netbsd.org
Re: CVS commit: src
On Wed, Oct 19, 2016 at 04:19:43AM +1100, matthew green wrote: > i assume this is the cause of the build break: Yes, that passed on netbsd-6 but breaks with netbsd-7 toolchain. But Christos fixed it in the meantime. -- Emmanuel Dreyfus m...@netbsd.org
Re: CVS commit: src/sys/compat/linux/arch
Ryo ONODERA <ryo...@yk.rim.or.jp> wrote: > This commit breaks my kernel build. > It seems that this commit does not fit with -current's format. > Could you regenerate these files again? What error do you get? -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src/sys/compat/linux/arch
Ryo ONODERA <ryo...@yk.rim.or.jp> wrote: > This commit breaks my kernel build. > It seems that this commit does not fit with -current's format. > Could you regenerate these files again? I was running a build to reproduce the problem, when I noticed martin@ fixed it. -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src/sys/dev/usb
On Thu, Nov 08, 2018 at 02:46:43PM +1100, matthew green wrote: > this is kind of ugly, in that the base kernel knows all about > this device even if it isn't in my kernel. Well, quirks are ugly, this the way they are. I could move the descriptors to ugen.c, but you realized that we talk about 31 bytes, right? -- Emmanuel Dreyfus m...@netbsd.org
Re: CVS commit: src/sys/dev/usb
David H. Gutteridge wrote: > There's just a stray cast missing: I committed the fix. -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src/sys/kern
On Mon, Oct 01, 2018 at 09:34:47AM +0200, Manuel Bouyer wrote: > Yes, it's a bug, probably related to vndconfig'ing a file on the > same filesystem as /dev. I use vnconfig a lot myself and I've never seen > it. I think all you need is to have a domU with two block devices. On my test machine I need to loop on xl create; sleep 60; xl shutdown -w to get it, while other systems I have it 100% reproductible. -- Emmanuel Dreyfus m...@netbsd.org
Re: CVS commit: src/sys/kern
On Sun, Sep 30, 2018 at 11:13:11AM +0200, J. Hannken-Illjes wrote: > This change is wrong, there is no upper time limit for a successfull > file system suspension. Indeed, it can be infinite, as I experienced here: http://mail-index.netbsd.org/tech-kern/2018/09/21/msg024099.html A umount, vndconfig or fssconfig failing with EAGAIN is indeed bad, but I doubt you will advocate that freezing the whole system forever is better. I have machines where the above described scenario became 100% reproductible with the NetBSD 8.0 upgrade, this is just a shame. I will be happy to see you revert my workaround and replace it by a more approriate fix. -- Emmanuel Dreyfus m...@netbsd.org
Re: CVS commit: src/sys/kern
Manuel Bouyer wrote: > In any case, adding a workaround for a specific setup which can potentially > cause spurious failures for everyone is not appropriate. I agree with that, but it is the case here? Running with vnd backends on the root partition is not what I would call a specific setup, and it is not obvious the change can do actual harm. I agree a EAGAIN on unmount(2) as shutdown time would be a problem, but can it happen? /etc/rc.d/mountall calls umount -a after all processes using the filesystem have exit. What process would call fstrans_start() while umount tries to do a file suspension? -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src/sys/kern
Manuel Bouyer wrote: > You're the only one seeing this problem AFAIK Indeed, but I reproduced it on multiple machines. It appears 100% of the time on a busy server, and on a test machine I have a script that reliabily triggers it within a few minutes. Anyway, I am not sure we should disregard bugs on the basis on how often they appear. After all you raised very valid concerns about my changes, but we have no case of that problems acctually occuring yeet. I have been running three servers with the patch for a week and nothing wrong occured. Perhaps this is just because I do not tried shutting down a lot. > Returning EAGAIN without reason is harmfull. There is a reason: not doing so causes a deadlock. I agree the timeout value may be too short, but there should be an upper limit on how long we block any process from trying to enter fstrans_start(). Blocking any filesystem activity for seconds does not seems acceptable to me on a multiuser machine Perhaps we could timeout, unblock the processes that are waiting for us and that we are waiting for, and retry? Something like that? error = 0; while (! state_change_done(mp)) { error = cv_timedwait_sig(_count_cv, _lock, hz / 4); if (error == EWOULDBLOCK) { cv_broadcast(_state_cv); error = 0; } if (error) { new_state = fmi->fmi_state = FSTRANS_NORMAL; break; } } cv_broadcast(_state_cv); mutex_exit(_lock); -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src/sys/kern
On Thu, Oct 04, 2018 at 01:32:33PM +0200, Manuel Bouyer wrote: > borneo:/home/bouyer#umount /mnt > umount: /mnt: Resource temporarily unavailable Oh right, you should have said earlier that you actually observed a problem. I will back that out. -- Emmanuel Dreyfus m...@netbsd.org
CVS commit: src/lib/libperfuse
Module Name:src Committed By: manu Date: Sat Aug 10 07:08:12 UTC 2019 Modified Files: src/lib/libperfuse: ops.c Log Message: Rollback directory filehandle screening for FUSE lock operations libfuse has a different usage of filehandles for files and directories. A directory filehandle is valid only for directory operations such as OPENDIR, READDIR, RELEASEDIR, FSYNCDIR. Change of src/lib/libperfuse/ops.c 1.85-1.86 made sure filehandles of directories were only sent for that operations. However, the status of lock operations GETLK, SETLK, SETLKW was overlooked. The only FUSE filesystem I found using locks is GlusterFS, and it needs directory filehandles to be provided on lock operations, otherwise locking crashes the filesystem. Hence this change brings back filehandles for lock operations on directories. To generate a diff of this commit: cvs rdiff -u -r1.86 -r1.87 src/lib/libperfuse/ops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libperfuse
Module Name:src Committed By: manu Date: Sat Aug 10 07:08:12 UTC 2019 Modified Files: src/lib/libperfuse: ops.c Log Message: Rollback directory filehandle screening for FUSE lock operations libfuse has a different usage of filehandles for files and directories. A directory filehandle is valid only for directory operations such as OPENDIR, READDIR, RELEASEDIR, FSYNCDIR. Change of src/lib/libperfuse/ops.c 1.85-1.86 made sure filehandles of directories were only sent for that operations. However, the status of lock operations GETLK, SETLK, SETLKW was overlooked. The only FUSE filesystem I found using locks is GlusterFS, and it needs directory filehandles to be provided on lock operations, otherwise locking crashes the filesystem. Hence this change brings back filehandles for lock operations on directories. To generate a diff of this commit: cvs rdiff -u -r1.86 -r1.87 src/lib/libperfuse/ops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libperfuse/ops.c diff -u src/lib/libperfuse/ops.c:1.86 src/lib/libperfuse/ops.c:1.87 --- src/lib/libperfuse/ops.c:1.86 Sat Feb 9 02:22:45 2019 +++ src/lib/libperfuse/ops.c Sat Aug 10 07:08:11 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ops.c,v 1.86 2019/02/09 02:22:45 manu Exp $ */ +/* $NetBSD: ops.c,v 1.87 2019/08/10 07:08:11 manu Exp $ */ /*- * Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved. @@ -2976,24 +2976,15 @@ perfuse_node_advlock(struct puffs_usermo * expect one. E.g.: if we provide none, GlusterFS logs an error * "0-glusterfs-fuse: xl is NULL" * - * There is one exception with directories where filehandle - * is not included, because libfuse uses different filehandle - * in opendir/releasedir/readdir/fsyncdir compared to other - * operations. Who locks a directory anyway? - * * We need the read file handle if the file is open read only, * in order to support shared locks on read-only files. * NB: The kernel always sends advlock for read-only * files at exit time when the process used lock, see * sys_exit -> exit1 -> fd_free -> fd_close -> VOP_ADVLOCK */ - if (!PN_ISDIR(opc)) { - if ((fh = perfuse_get_fh(opc, FREAD)) == FUSE_UNKNOWN_FH) { - error = EBADF; - goto out; - } - } else { - fh = FUSE_UNKNOWN_FH; + if ((fh = perfuse_get_fh(opc, FREAD)) == FUSE_UNKNOWN_FH) { + error = EBADF; + goto out; } ps = puffs_getspecific(pu);
CVS commit: src/doc
Module Name:src Committed By: manu Date: Tue Aug 20 01:48:48 UTC 2019 Modified Files: src/doc: CHANGES Log Message: boot(8): GPT and RAIDframe support for x86 bootstrap [manu 20180818] To generate a diff of this commit: cvs rdiff -u -r1.2570 -r1.2571 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES diff -u src/doc/CHANGES:1.2570 src/doc/CHANGES:1.2571 --- src/doc/CHANGES:1.2570 Sun Aug 18 09:43:26 2019 +++ src/doc/CHANGES Tue Aug 20 01:48:48 2019 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2570 $> +# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2571 $> # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -30,3 +30,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0: ure(4), url(4), and urndis(4) drivers fixing many bugs and porting to NET_MPSAFE in the process. [mrg 20190814] usbnet(9): Port kue(4) and upl(4). [mrg 20190818] + boot(8): GPT and RAIDframe support for x86 bootstrap [manu 20180818]
CVS commit: src/doc
Module Name:src Committed By: manu Date: Tue Aug 20 01:48:48 UTC 2019 Modified Files: src/doc: CHANGES Log Message: boot(8): GPT and RAIDframe support for x86 bootstrap [manu 20180818] To generate a diff of this commit: cvs rdiff -u -r1.2570 -r1.2571 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/i386/stand
Module Name:src Committed By: manu Date: Sun Aug 18 02:18:25 UTC 2019 Modified Files: src/sys/arch/i386/stand/boot: boot2.c devopen.c devopen.h src/sys/arch/i386/stand/efiboot: boot.c devopen.c devopen.h efidisk.c src/sys/arch/i386/stand/lib: Makefile biosdisk.c biosdisk.h Log Message: Add GPT and RAIDframe support to bootloaders Classic BIOS (/boot) and EFI bootloaders can now name devices using the NAME=gpt_label syntax, or using raid partitions. Here are examples: boot NAME=root:/netbsd boot raid0e:/netbsd To generate a diff of this commit: cvs rdiff -u -r1.70 -r1.71 src/sys/arch/i386/stand/boot/boot2.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/i386/stand/boot/devopen.c cvs rdiff -u -r1.4 -r1.5 src/sys/arch/i386/stand/boot/devopen.h cvs rdiff -u -r1.13 -r1.14 src/sys/arch/i386/stand/efiboot/boot.c cvs rdiff -u -r1.5 -r1.6 src/sys/arch/i386/stand/efiboot/devopen.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/i386/stand/efiboot/devopen.h cvs rdiff -u -r1.7 -r1.8 src/sys/arch/i386/stand/efiboot/efidisk.c cvs rdiff -u -r1.45 -r1.46 src/sys/arch/i386/stand/lib/Makefile cvs rdiff -u -r1.49 -r1.50 src/sys/arch/i386/stand/lib/biosdisk.c cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/stand/lib/biosdisk.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/i386/stand
Module Name:src Committed By: manu Date: Sun Aug 18 02:18:25 UTC 2019 Modified Files: src/sys/arch/i386/stand/boot: boot2.c devopen.c devopen.h src/sys/arch/i386/stand/efiboot: boot.c devopen.c devopen.h efidisk.c src/sys/arch/i386/stand/lib: Makefile biosdisk.c biosdisk.h Log Message: Add GPT and RAIDframe support to bootloaders Classic BIOS (/boot) and EFI bootloaders can now name devices using the NAME=gpt_label syntax, or using raid partitions. Here are examples: boot NAME=root:/netbsd boot raid0e:/netbsd To generate a diff of this commit: cvs rdiff -u -r1.70 -r1.71 src/sys/arch/i386/stand/boot/boot2.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/i386/stand/boot/devopen.c cvs rdiff -u -r1.4 -r1.5 src/sys/arch/i386/stand/boot/devopen.h cvs rdiff -u -r1.13 -r1.14 src/sys/arch/i386/stand/efiboot/boot.c cvs rdiff -u -r1.5 -r1.6 src/sys/arch/i386/stand/efiboot/devopen.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/i386/stand/efiboot/devopen.h cvs rdiff -u -r1.7 -r1.8 src/sys/arch/i386/stand/efiboot/efidisk.c cvs rdiff -u -r1.45 -r1.46 src/sys/arch/i386/stand/lib/Makefile cvs rdiff -u -r1.49 -r1.50 src/sys/arch/i386/stand/lib/biosdisk.c cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/stand/lib/biosdisk.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/stand/boot/boot2.c diff -u src/sys/arch/i386/stand/boot/boot2.c:1.70 src/sys/arch/i386/stand/boot/boot2.c:1.71 --- src/sys/arch/i386/stand/boot/boot2.c:1.70 Tue Nov 14 09:55:41 2017 +++ src/sys/arch/i386/stand/boot/boot2.c Sun Aug 18 02:18:24 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: boot2.c,v 1.70 2017/11/14 09:55:41 maxv Exp $ */ +/* $NetBSD: boot2.c,v 1.71 2019/08/18 02:18:24 manu Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -79,6 +79,7 @@ #include #include #include +#include #include #include "devopen.h" @@ -104,11 +105,16 @@ static const char * const names[][2] = { #define NUMNAMES (sizeof(names)/sizeof(names[0])) #define DEFFILENAME names[0][0] +#ifndef NO_GPT +#define MAXDEVNAME 39 /* "NAME=" + 34 char part_name */ +#else #define MAXDEVNAME 16 +#endif static char *default_devname; static int default_unit, default_partition; static const char *default_filename; +static const char *default_part_name; char *sprint_bootsel(const char *); static void bootit(const char *, int); @@ -160,9 +166,15 @@ parsebootfile(const char *fname, char ** int *unit, int *partition, const char **file) { const char *col; + static char savedevname[MAXDEVNAME+1]; *fsname = "ufs"; - *devname = default_devname; + if (default_part_name == NULL) { + *devname = default_devname; + } else { + snprintf(savedevname, MAXDEVNAME, "NAME=%s", default_part_name); + *devname = savedevname; + } *unit = default_unit; *partition = default_partition; *file = default_filename; @@ -171,7 +183,6 @@ parsebootfile(const char *fname, char ** return 0; if ((col = strchr(fname, ':')) != NULL) { /* device given */ - static char savedevname[MAXDEVNAME+1]; int devlen; int u = 0, p = 0; int i = 0; @@ -180,6 +191,17 @@ parsebootfile(const char *fname, char ** if (devlen > MAXDEVNAME) return EINVAL; +#ifndef NO_GPT + if (strstr(fname, "NAME=") == fname) { + strlcpy(savedevname, fname, devlen + 1); + *devname = savedevname; + *unit = -1; + *partition = -1; + fname = col + 1; + goto out; + } +#endif + #define isvalidname(c) ((c) >= 'a' && (c) <= 'z') if (!isvalidname(fname[i])) return EINVAL; @@ -215,6 +237,7 @@ parsebootfile(const char *fname, char ** fname = col + 1; } +out: if (*fname) *file = fname; @@ -231,8 +254,11 @@ sprint_bootsel(const char *filename) if (parsebootfile(filename, , , , , ) == 0) { - snprintf(buf, sizeof(buf), "%s%d%c:%s", devname, unit, - 'a' + partition, file); + if (strstr(devname, "NAME=") == devname) + snprintf(buf, sizeof(buf), "%s:%s", devname, file); + else + snprintf(buf, sizeof(buf), "%s%d%c:%s", devname, unit, + 'a' + partition, file); return buf; } return "(invalid)"; @@ -319,7 +345,7 @@ boot2(int biosdev, uint64_t biossector) /* try to set default device to what BIOS tells us */ bios2dev(biosdev, biossector, _devname, _unit, - _partition); + _partition, _part_name); /* if the user types "boot" without filename */ default_filename = DEFFILENAME; @@ -401,13 +427,21 @@ command_help(char *arg) { printf("commands are:\n" - "boot [xdNx:][filename] [-12acdqsvxz]\n" + "boot [dev:][filename] [-12acdqsvxz]\n" +#ifndef NO_RAIDFRAME + " dev syntax is (hd|fd|cd|raid)[N[x]]\n" +#else + " dev syntax is (hd|fd|cd)[N[x]]n" +#endif +#ifndef NO_GPT + "or NAME=gpt_label\n" +#endif " (ex. \"hd0a:netbsd.old -s\")\n" - "pkboot [xdNx:][filename] [-12acdqsvxz]\n" + "pkboot [dev:][filename]
CVS commit: src/share/man/man8/man8.x86
Module Name:src Committed By: manu Date: Sun Aug 18 02:23:48 UTC 2019 Modified Files: src/share/man/man8/man8.x86: boot.8 Log Message: Document new GPT and RAIDframe capacity of bootstrap code While there, also document EFI setup and some bugs To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/share/man/man8/man8.x86/boot.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man8/man8.x86/boot.8 diff -u src/share/man/man8/man8.x86/boot.8:1.15 src/share/man/man8/man8.x86/boot.8:1.16 --- src/share/man/man8/man8.x86/boot.8:1.15 Wed May 15 17:35:02 2019 +++ src/share/man/man8/man8.x86/boot.8 Sun Aug 18 02:23:48 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: boot.8,v 1.15 2019/05/15 17:35:02 maxv Exp $ +.\" $NetBSD: boot.8,v 1.16 2019/08/18 02:23:48 manu Exp $ .\" .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -60,6 +60,11 @@ bootstrap .Nx from the system .Tn BIOS +.It efiboot +bootstrap +.Nx +from the system +.Tn UEFI .It Xr x86/dosboot 8 bootstrap .Nx @@ -175,12 +180,31 @@ input of these commands: .It Ic boot Oo Va device : Oc Ns Oo Va filename Oc Oo Fl 1234abcdmqsvxz Oc The default .Va device -will be set to the disk that the boot loader was -loaded from. +will be set to the disk from which the boot loader was loaded. The +partition is set to the first match in this list: +.Bl -enum -compact +.It +The first +.Xr gpt 8 +partition with the +.Va bootme +attribute set. +.It +The partition from which the boot loader was loaded from, if that +can be detected. +.It +The first partition with a filesystem that could be bootable. +.It +The first partition. +.El To boot from an alternate disk, the full name of the device should be given at the prompt. .Va device is of the form +.Va NAME=partition_label +when booting from a +.Xr gpt 8 +partitionned disk. Otherwise, the syntax is .Xo Va xd .Op Va N Ns Op Va x .Xc @@ -192,8 +216,8 @@ is the unit number, and .Va x is the partition letter. .Pp -The following list of supported devices may vary from installation to -installation: +In the later case, the following list of supported devices may +vary from installation to installation: .Pp .Bl -hang -compact .It hd @@ -203,6 +227,22 @@ lookalike controller(s), and SCSI disks on SCSI controllers recognized by the BIOS. .It fd Floppy drives as numbered by the BIOS. +.It cd +CD-ROM drives as numbered by the BIOS. +.It raid +RAIDframe configured from hard disks recognized by the BIOS. +Only RAID level 1 sets are supported by bootstrap code. If +the RAID is partitionned, the first partition is used, or the +first +.Xr gpt 8 +partition that has the +.Va bootme +attribute set. Inner RAIDframe partition can also be +given to the +.Ic dev +command using he +.Va NAME=partiton_label +syntax. .El .Pp The default @@ -700,6 +740,33 @@ the .Nx partition by .Xr installboot 8 . +.It Pa /usr/mdec/bootia32.efi +.It Pa /usr/mdec/bootx64.efi +.Tn UEFI +bootstraps for +.Nx Ns /i386 +and +.Nx Ns /amd64 , +which should be copied to the +.Pa /efi/boot +directory in a +.Tn FAT +formatted partition of type +.Tn EFI +(Either +.Xr mbr 8 +and +.Xr gpt 8 , +see the +.Sx BUGS +section). +.Nx +.Tn UEFI +bootstrap reads its configuration from the +.Pa /efi/netBSD/boot.cfg +file in the +.Tn EFI +partition. .El .Sh SEE ALSO .Xr ddb 4 , @@ -756,3 +823,44 @@ is derived from the field of the .Nx disklabel (if it is a hard disk). +.Pp +.Ic multiboot +is not supported by +.Tn UEFI +bootstrap code. +.Pp +.Tn UEFI +implementation are supposed to support either +.Xr mbr 8 +or +.Xr gpt 8 +partitionning, but some do not handle the later. +.Tn UEFI +Booting +from a +.Xr gpt 8 +partitionned disk is still possible in this case, by adding +an overlapping +.Tn EFI +partition in the protective +.Xr mbr 8 +block. This can be achieved using the following commands +(you must adapt the hard disk and +.Tn EFI +partition start end size to fit your setup): +.Dl Ic dd if=/dev/rwd0d bs=512 count=1 of=mbr +.Dl Ic fdisk -FIfaui1s 4/34/32768 -c /usr/mdec/mbr mbr +.Dl Ic dd if=mbr bs=512 count=1 of=/dev/rwd0d conv=notrunc +The resulting +.Xr mbr 8 +partition table will look like this: +.Bd -unfilled -offset indent +0: GPT Protective MBR (sysid 238) +start 1, size 2097151 (1024 MB, Cyls 0-130/138/8) +PBR is not bootable: Bad magic number (0x) +1: Primary DOS with 16 bit FAT <32M (sysid 4) +start 34, size 32768 (16 MB, Cyls 0/0/35-2/10/42), Active +2: +3: +.Ed +
CVS commit: src/share/man/man8/man8.x86
Module Name:src Committed By: manu Date: Sun Aug 18 02:23:48 UTC 2019 Modified Files: src/share/man/man8/man8.x86: boot.8 Log Message: Document new GPT and RAIDframe capacity of bootstrap code While there, also document EFI setup and some bugs To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/share/man/man8/man8.x86/boot.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/i386/stand
Module Name:src Committed By: manu Date: Mon Sep 2 06:10:24 UTC 2019 Modified Files: src/sys/arch/i386/stand/boot: boot2.c src/sys/arch/i386/stand/efiboot: boot.c devopen.c Log Message: Make sure devices names are copied including last byte Fix from M. Levinson. To generate a diff of this commit: cvs rdiff -u -r1.71 -r1.72 src/sys/arch/i386/stand/boot/boot2.c cvs rdiff -u -r1.14 -r1.15 src/sys/arch/i386/stand/efiboot/boot.c cvs rdiff -u -r1.6 -r1.7 src/sys/arch/i386/stand/efiboot/devopen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/stand/boot/boot2.c diff -u src/sys/arch/i386/stand/boot/boot2.c:1.71 src/sys/arch/i386/stand/boot/boot2.c:1.72 --- src/sys/arch/i386/stand/boot/boot2.c:1.71 Sun Aug 18 02:18:24 2019 +++ src/sys/arch/i386/stand/boot/boot2.c Mon Sep 2 06:10:24 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: boot2.c,v 1.71 2019/08/18 02:18:24 manu Exp $ */ +/* $NetBSD: boot2.c,v 1.72 2019/09/02 06:10:24 manu Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -172,7 +172,8 @@ parsebootfile(const char *fname, char ** if (default_part_name == NULL) { *devname = default_devname; } else { - snprintf(savedevname, MAXDEVNAME, "NAME=%s", default_part_name); + snprintf(savedevname, sizeof(savedevname), + "NAME=%s", default_part_name); *devname = savedevname; } *unit = default_unit; Index: src/sys/arch/i386/stand/efiboot/boot.c diff -u src/sys/arch/i386/stand/efiboot/boot.c:1.14 src/sys/arch/i386/stand/efiboot/boot.c:1.15 --- src/sys/arch/i386/stand/efiboot/boot.c:1.14 Sun Aug 18 02:18:24 2019 +++ src/sys/arch/i386/stand/efiboot/boot.c Mon Sep 2 06:10:24 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: boot.c,v 1.14 2019/08/18 02:18:24 manu Exp $ */ +/* $NetBSD: boot.c,v 1.15 2019/09/02 06:10:24 manu Exp $ */ /*- * Copyright (c) 2016 Kimihiro Nonaka @@ -130,7 +130,8 @@ parsebootfile(const char *fname, char ** if (default_part_name == NULL) { *devname = default_devname; } else { - snprintf(savedevname, MAXDEVNAME, "NAME=%s", default_part_name); + snprintf(savedevname, sizeof(savedevname), + "NAME=%s", default_part_name); *devname = savedevname; } *unit = default_unit; Index: src/sys/arch/i386/stand/efiboot/devopen.c diff -u src/sys/arch/i386/stand/efiboot/devopen.c:1.6 src/sys/arch/i386/stand/efiboot/devopen.c:1.7 --- src/sys/arch/i386/stand/efiboot/devopen.c:1.6 Sun Aug 18 02:18:24 2019 +++ src/sys/arch/i386/stand/efiboot/devopen.c Mon Sep 2 06:10:24 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: devopen.c,v 1.6 2019/08/18 02:18:24 manu Exp $ */ +/* $NetBSD: devopen.c,v 1.7 2019/09/02 06:10:24 manu Exp $ */ /*- * Copyright (c) 2005 The NetBSD Foundation, Inc. @@ -100,7 +100,8 @@ bios2dev(int biosdev, daddr_t sector, ch (void)biosdisk_findpartition(biosdev, sector, partition, part_name); if (*part_name != NULL) { - snprintf(savedevname, MAXDEVNAME, "NAME=%s", *part_name); + snprintf(savedevname, sizeof(savedevname), + "NAME=%s", *part_name); *devname = savedevname; } }
CVS commit: src/sys/arch/i386/stand
Module Name:src Committed By: manu Date: Mon Sep 2 06:10:24 UTC 2019 Modified Files: src/sys/arch/i386/stand/boot: boot2.c src/sys/arch/i386/stand/efiboot: boot.c devopen.c Log Message: Make sure devices names are copied including last byte Fix from M. Levinson. To generate a diff of this commit: cvs rdiff -u -r1.71 -r1.72 src/sys/arch/i386/stand/boot/boot2.c cvs rdiff -u -r1.14 -r1.15 src/sys/arch/i386/stand/efiboot/boot.c cvs rdiff -u -r1.6 -r1.7 src/sys/arch/i386/stand/efiboot/devopen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/acpi
Module Name:src Committed By: manu Date: Thu Sep 12 00:52:22 UTC 2019 Modified Files: src/sys/arch/x86/acpi: acpi_machdep.c Log Message: Attempt to obtain ACPI RSDP from the hypervisor for Xen PV There are three possible way of obtaining the ACPI RSDP - From Extended BIOS Data Area (EBDA) when kernel or Xen was booted from BIOS bootstrap - From EFI SystemTable when kernel is booted from EFI bootstrap - When Xen is booted from EFI bootstrap, EBDA is not mapped, and EFI SystemTable is not passed to the kernel. The only way to go is to obtain ACPI RSDP trhough an hypercall. Note: EFI bootstrap support for booting Xen has not yet been committed. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/arch/x86/acpi/acpi_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/acpi/acpi_machdep.c diff -u src/sys/arch/x86/acpi/acpi_machdep.c:1.26 src/sys/arch/x86/acpi/acpi_machdep.c:1.27 --- src/sys/arch/x86/acpi/acpi_machdep.c:1.26 Wed May 1 07:26:28 2019 +++ src/sys/arch/x86/acpi/acpi_machdep.c Thu Sep 12 00:52:22 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_machdep.c,v 1.26 2019/05/01 07:26:28 mlelstv Exp $ */ +/* $NetBSD: acpi_machdep.c,v 1.27 2019/09/12 00:52:22 manu Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.26 2019/05/01 07:26:28 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.27 2019/09/12 00:52:22 manu Exp $"); #include #include @@ -100,8 +100,61 @@ acpi_md_OsGetRootPointer(void) ACPI_PHYSICAL_ADDRESS PhysicalAddress; ACPI_STATUS Status; -#ifndef XENPV - /* If EFI is available, attempt to use it to locate the ACPI table. */ +#ifdef XENPV + /* + * Obtain the ACPI RSDP from the hypervisor. + * This is the only way to go if Xen booted from EFI: the + * Extended BIOS Data Area (EBDA) is not mapped, and Xen + * does not pass an EFI SystemTable to the kernel. + */ +struct xen_platform_op op = { +.cmd = XENPF_firmware_info, +.u.firmware_info = { +.type = XEN_FW_EFI_INFO, +.index = XEN_FW_EFI_CONFIG_TABLE +} +}; +union xenpf_efi_info *info = _info.u.efi_info; + +if (HYPERVISOR_platform_op() == 0) { + struct efi_cfgtbl *ct; + int i; + + ct = AcpiOsMapMemory(info->cfg.addr, + sizeof(*ct) * info->cfg.nent); + + for (i = 0; i < info->cfg.nent; i++) { + if (memcmp([i].ct_uuid, + _UUID_ACPI20, sizeof(EFI_UUID_ACPI20)) == 0) { +PhysicalAddress = +(ACPI_PHYSICAL_ADDRESS)ct[i].ct_data; +if (PhysicalAddress) + goto out; + + } + } + + for (i = 0; i < info->cfg.nent; i++) { + if (memcmp([i].ct_uuid, + _UUID_ACPI10, sizeof(EFI_UUID_ACPI10)) == 0) { +PhysicalAddress = +(ACPI_PHYSICAL_ADDRESS)ct[i].ct_data; +if (PhysicalAddress) + goto out; + + } + } +out: + AcpiOsUnmapMemory(ct, sizeof(*ct) * info->cfg.nent); + + if (PhysicalAddress) + return PhysicalAddress; + } +#else + /* + * Get the ACPI RSDP from EFI SystemTable. This works when the + * kernel was loaded from EFI bootloader. + */ if (efi_probe()) { PhysicalAddress = efi_getcfgtblpa(_UUID_ACPI20); if (!PhysicalAddress) @@ -111,6 +164,11 @@ acpi_md_OsGetRootPointer(void) } #endif + /* + * Find ACPI RSDP from Extended BIOS Data Area (EBDA). This + * works when the kernel was started from BIOS bootloader, + * or for Xen PV when Xen was started from BIOS bootloader. + */ Status = AcpiFindRootPointer(); if (ACPI_FAILURE(Status)) PhysicalAddress = 0;
CVS commit: src/sys/arch/x86/acpi
Module Name:src Committed By: manu Date: Thu Sep 12 00:52:22 UTC 2019 Modified Files: src/sys/arch/x86/acpi: acpi_machdep.c Log Message: Attempt to obtain ACPI RSDP from the hypervisor for Xen PV There are three possible way of obtaining the ACPI RSDP - From Extended BIOS Data Area (EBDA) when kernel or Xen was booted from BIOS bootstrap - From EFI SystemTable when kernel is booted from EFI bootstrap - When Xen is booted from EFI bootstrap, EBDA is not mapped, and EFI SystemTable is not passed to the kernel. The only way to go is to obtain ACPI RSDP trhough an hypercall. Note: EFI bootstrap support for booting Xen has not yet been committed. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/arch/x86/acpi/acpi_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/kern
Module Name:src Committed By: manu Date: Mon Sep 16 00:01:17 UTC 2019 Modified Files: src/sys/kern: kern_subr.c Log Message: Accept root device specification as NAME=label To generate a diff of this commit: cvs rdiff -u -r1.226 -r1.227 src/sys/kern/kern_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/kern
Module Name:src Committed By: manu Date: Mon Sep 16 00:01:17 UTC 2019 Modified Files: src/sys/kern: kern_subr.c Log Message: Accept root device specification as NAME=label To generate a diff of this commit: cvs rdiff -u -r1.226 -r1.227 src/sys/kern/kern_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/kern_subr.c diff -u src/sys/kern/kern_subr.c:1.226 src/sys/kern/kern_subr.c:1.227 --- src/sys/kern/kern_subr.c:1.226 Sun Sep 15 23:59:33 2019 +++ src/sys/kern/kern_subr.c Mon Sep 16 00:01:16 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_subr.c,v 1.226 2019/09/15 23:59:33 manu Exp $ */ +/* $NetBSD: kern_subr.c,v 1.227 2019/09/16 00:01:16 manu Exp $ */ /*- * Copyright (c) 1997, 1998, 1999, 2002, 2007, 2008 The NetBSD Foundation, Inc. @@ -79,7 +79,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.226 2019/09/15 23:59:33 manu Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.227 2019/09/16 00:01:16 manu Exp $"); #include "opt_ddb.h" #include "opt_md.h" @@ -691,13 +691,18 @@ getdisk(const char *str, int len, int de static const char * getwedgename(const char *name, int namelen) { - const char *wpfx = "wedge:"; - const int wpfxlen = strlen(wpfx); + const char *wpfx1 = "wedge:"; + const char *wpfx2 = "NAME="; + const int wpfx1len = strlen(wpfx1); + const int wpfx2len = strlen(wpfx2); - if (namelen < wpfxlen || strncmp(name, wpfx, wpfxlen) != 0) - return NULL; + if (namelen > wpfx1len && strncmp(name, wpfx1, wpfx1len) == 0) + return name + wpfx1len; + + if (namelen > wpfx2len && strncasecmp(name, wpfx2, wpfx2len) == 0) + return name + wpfx2len; - return name + wpfxlen; + return NULL; } static device_t
CVS commit: src/sys/arch/i386/stand/lib
Module Name:src Committed By: manu Date: Sun Sep 15 23:55:26 UTC 2019 Modified Files: src/sys/arch/i386/stand/lib: exec_multiboot2.c Log Message: Remove debug define. It remained there unseen because it was misspelled! To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/lib/exec_multiboot2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/stand/lib/exec_multiboot2.c diff -u src/sys/arch/i386/stand/lib/exec_multiboot2.c:1.1 src/sys/arch/i386/stand/lib/exec_multiboot2.c:1.2 --- src/sys/arch/i386/stand/lib/exec_multiboot2.c:1.1 Fri Sep 13 02:19:46 2019 +++ src/sys/arch/i386/stand/lib/exec_multiboot2.c Sun Sep 15 23:55:26 2019 @@ -1,5 +1,4 @@ -/* $NetBSD: exec_multiboot2.c,v 1.1 2019/09/13 02:19:46 manu Exp $ */ -#define MULTIBBOT2_DEBUG +/* $NetBSD: exec_multiboot2.c,v 1.2 2019/09/15 23:55:26 manu Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc.
CVS commit: src/sys/arch/i386/stand/lib
Module Name:src Committed By: manu Date: Sun Sep 15 23:55:26 UTC 2019 Modified Files: src/sys/arch/i386/stand/lib: exec_multiboot2.c Log Message: Remove debug define. It remained there unseen because it was misspelled! To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/lib/exec_multiboot2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/kern
Module Name:src Committed By: manu Date: Sun Sep 15 23:59:33 UTC 2019 Modified Files: src/sys/kern: kern_subr.c Log Message: Rollback change to accept NAME=label root device specification As suggested by Michael van Elst, the operation should be done int getwedgename() To generate a diff of this commit: cvs rdiff -u -r1.225 -r1.226 src/sys/kern/kern_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/kern
Module Name:src Committed By: manu Date: Sun Sep 15 23:59:33 UTC 2019 Modified Files: src/sys/kern: kern_subr.c Log Message: Rollback change to accept NAME=label root device specification As suggested by Michael van Elst, the operation should be done int getwedgename() To generate a diff of this commit: cvs rdiff -u -r1.225 -r1.226 src/sys/kern/kern_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/kern_subr.c diff -u src/sys/kern/kern_subr.c:1.225 src/sys/kern/kern_subr.c:1.226 --- src/sys/kern/kern_subr.c:1.225 Fri Sep 13 01:33:20 2019 +++ src/sys/kern/kern_subr.c Sun Sep 15 23:59:33 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_subr.c,v 1.225 2019/09/13 01:33:20 manu Exp $ */ +/* $NetBSD: kern_subr.c,v 1.226 2019/09/15 23:59:33 manu Exp $ */ /*- * Copyright (c) 1997, 1998, 1999, 2002, 2007, 2008 The NetBSD Foundation, Inc. @@ -79,7 +79,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.225 2019/09/13 01:33:20 manu Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.226 2019/09/15 23:59:33 manu Exp $"); #include "opt_ddb.h" #include "opt_md.h" @@ -229,16 +229,6 @@ setroot(device_t bootdv, int bootpartiti */ setroot_nfs(bootdv); - - /* - * Try to lookup by wedge label name - */ - if (bootdv == NULL && rootspec != NULL && - strncmp(rootspec, "NAME=", 5) == 0) { - if ((bootdv = dkwedge_find_by_wname(rootspec + 5)) != NULL) - rootspec = bootdv->dv_xname; - } - /* * If no bootdv was found by MD code and no * root specified ask the user.
CVS commit: src/share/man/man8/man8.x86
Module Name:src Committed By: manu Date: Mon Sep 16 01:57:58 UTC 2019 Modified Files: src/share/man/man8/man8.x86: boot.8 Log Message: Remove obsoeolete BUGS note that UEFI bootloader does not support multiboot To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/share/man/man8/man8.x86/boot.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/share/man/man8/man8.x86
Module Name:src Committed By: manu Date: Mon Sep 16 01:57:58 UTC 2019 Modified Files: src/share/man/man8/man8.x86: boot.8 Log Message: Remove obsoeolete BUGS note that UEFI bootloader does not support multiboot To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/share/man/man8/man8.x86/boot.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man8/man8.x86/boot.8 diff -u src/share/man/man8/man8.x86/boot.8:1.19 src/share/man/man8/man8.x86/boot.8:1.20 --- src/share/man/man8/man8.x86/boot.8:1.19 Fri Sep 13 07:11:04 2019 +++ src/share/man/man8/man8.x86/boot.8 Mon Sep 16 01:57:58 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: boot.8,v 1.19 2019/09/13 07:11:04 wiz Exp $ +.\" $NetBSD: boot.8,v 1.20 2019/09/16 01:57:58 manu Exp $ .\" .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -826,11 +826,6 @@ field of the .Nx disklabel (if it is a hard disk). .Pp -.Ic multiboot -is not supported by -.Tn UEFI -bootstrap code. -.Pp .Tn UEFI implementation are supposed to support either .Xr mbr 8
CVS commit: src/share/man/man8/man8.x86
Module Name:src Committed By: manu Date: Fri Sep 13 01:34:19 UTC 2019 Modified Files: src/share/man/man8/man8.x86: boot.8 Log Message: Document that bootdev option accepts device specification as NAME=label To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/share/man/man8/man8.x86/boot.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man8/man8.x86/boot.8 diff -u src/share/man/man8/man8.x86/boot.8:1.17 src/share/man/man8/man8.x86/boot.8:1.18 --- src/share/man/man8/man8.x86/boot.8:1.17 Sun Aug 18 08:12:36 2019 +++ src/share/man/man8/man8.x86/boot.8 Fri Sep 13 01:34:19 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: boot.8,v 1.17 2019/08/18 08:12:36 wiz Exp $ +.\" $NetBSD: boot.8,v 1.18 2019/09/13 01:34:19 manu Exp $ .\" .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -436,7 +436,11 @@ being separated with spaces .It Ic bootdev Ns = Ns Ar dev Po or Ic root Ns = Ns Ar dev Pc Override the default boot device. .Ar dev -can be a unit name +is of the form +.Va NAME=partition_label +for +.Xr gpt 8 +partitionned disks. It can also be a unit name .Po Dq wd0 .Pc , or an interface name
CVS commit: src/sys/kern
Module Name:src Committed By: manu Date: Fri Sep 13 01:33:20 UTC 2019 Modified Files: src/sys/kern: kern_subr.c Log Message: Accept root device specification as NAME=label To generate a diff of this commit: cvs rdiff -u -r1.224 -r1.225 src/sys/kern/kern_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/share/man/man8/man8.x86
Module Name:src Committed By: manu Date: Fri Sep 13 01:34:19 UTC 2019 Modified Files: src/share/man/man8/man8.x86: boot.8 Log Message: Document that bootdev option accepts device specification as NAME=label To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/share/man/man8/man8.x86/boot.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/doc
Module Name:src Committed By: manu Date: Fri Sep 13 02:23:31 UTC 2019 Modified Files: src/doc: CHANGES Log Message: boot(8): multiboot 2 support, Xen can now boot from EFI To generate a diff of this commit: cvs rdiff -u -r1.2580 -r1.2581 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/doc
Module Name:src Committed By: manu Date: Fri Sep 13 02:23:31 UTC 2019 Modified Files: src/doc: CHANGES Log Message: boot(8): multiboot 2 support, Xen can now boot from EFI To generate a diff of this commit: cvs rdiff -u -r1.2580 -r1.2581 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES diff -u src/doc/CHANGES:1.2580 src/doc/CHANGES:1.2581 --- src/doc/CHANGES:1.2580 Sun Sep 8 20:57:16 2019 +++ src/doc/CHANGES Fri Sep 13 02:23:31 2019 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2580 $> +# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2581 $> # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -39,3 +39,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0: dhcpcd(8): Import dhcpcd-8.0.4 [roy 20190904] bind: Import version 9.14.5. [christos 20190905] resolvconf(8): Import openresolv-3.9.2 [roy 20190908] + boot(8): multiboot 2 support, Xen can now boot from EFI [manu 20190913]
CVS commit: src/sys/kern
Module Name:src Committed By: manu Date: Fri Sep 13 01:33:20 UTC 2019 Modified Files: src/sys/kern: kern_subr.c Log Message: Accept root device specification as NAME=label To generate a diff of this commit: cvs rdiff -u -r1.224 -r1.225 src/sys/kern/kern_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/kern_subr.c diff -u src/sys/kern/kern_subr.c:1.224 src/sys/kern/kern_subr.c:1.225 --- src/sys/kern/kern_subr.c:1.224 Sun Aug 18 06:28:42 2019 +++ src/sys/kern/kern_subr.c Fri Sep 13 01:33:20 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_subr.c,v 1.224 2019/08/18 06:28:42 mlelstv Exp $ */ +/* $NetBSD: kern_subr.c,v 1.225 2019/09/13 01:33:20 manu Exp $ */ /*- * Copyright (c) 1997, 1998, 1999, 2002, 2007, 2008 The NetBSD Foundation, Inc. @@ -79,7 +79,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.224 2019/08/18 06:28:42 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.225 2019/09/13 01:33:20 manu Exp $"); #include "opt_ddb.h" #include "opt_md.h" @@ -229,6 +229,16 @@ setroot(device_t bootdv, int bootpartiti */ setroot_nfs(bootdv); + + /* + * Try to lookup by wedge label name + */ + if (bootdv == NULL && rootspec != NULL && + strncmp(rootspec, "NAME=", 5) == 0) { + if ((bootdv = dkwedge_find_by_wname(rootspec + 5)) != NULL) + rootspec = bootdv->dv_xname; + } + /* * If no bootdv was found by MD code and no * root specified ask the user.
CVS commit: src/sys/arch/i386
Module Name:src Committed By: manu Date: Fri Sep 13 02:19:46 UTC 2019 Modified Files: src/sys/arch/i386/include: Makefile src/sys/arch/i386/stand/boot: Makefile.boot src/sys/arch/i386/stand/dosboot: Makefile src/sys/arch/i386/stand/efiboot: Makefile.efiboot boot.c efiboot.c efiboot.h eficons.c efimemory.c src/sys/arch/i386/stand/efiboot/bootia32: Makefile efibootia32.c src/sys/arch/i386/stand/efiboot/bootx64: Makefile efibootx64.c src/sys/arch/i386/stand/lib: Makefile biosdisk.c biosdisk.h bootinfo_memmap.c exec.c libi386.h multiboot.S pread.c src/sys/arch/i386/stand/netboot: Makefile.netboot src/sys/arch/i386/stand/pxeboot: Makefile Added Files: src/sys/arch/i386/include: multiboot2.h src/sys/arch/i386/stand/efiboot/bootia32: multiboot32.S src/sys/arch/i386/stand/efiboot/bootx64: multiboot64.S src/sys/arch/i386/stand/lib: exec_multiboot1.c exec_multiboot2.c Log Message: Add multiboot 2 support to x86 bootloaders multiboot 2 is required to boot Xen on an EFI system. This also require a kernel patch for properly discovering the ACPI RSDP, which is available after 20190912, in src/sys/arch/x86/acpi/acpi_machdep.c 1.26-1.28 There are a few missing bit in this multiboot 2 implementation (which are unused by Xen): - Header tags Address, Freambuffer, and Relocatable are ignored - Tags APM and Network are not provided - Tags ACPI old and ACP new are only provided for ACPI boot - Tag boot device does not provides the subpart (BSD disklabel partition) Notes: - multiboot2 is disabled in dosboot, otherwise the binary gets too big and build fails. - in src/sys/arch/i386/stand/efiboot, consinit() is renamed as efi_consinit() to avoid prototype conflicts in src/sys/sys/systm.h To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/sys/arch/i386/include/Makefile cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/include/multiboot2.h cvs rdiff -u -r1.72 -r1.73 src/sys/arch/i386/stand/boot/Makefile.boot cvs rdiff -u -r1.31 -r1.32 src/sys/arch/i386/stand/dosboot/Makefile cvs rdiff -u -r1.15 -r1.16 src/sys/arch/i386/stand/efiboot/Makefile.efiboot \ src/sys/arch/i386/stand/efiboot/boot.c cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/stand/efiboot/efiboot.c cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/stand/efiboot/efiboot.h cvs rdiff -u -r1.6 -r1.7 src/sys/arch/i386/stand/efiboot/eficons.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/i386/stand/efiboot/efimemory.c cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/efiboot/bootia32/Makefile cvs rdiff -u -r1.4 -r1.5 \ src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/stand/efiboot/bootia32/multiboot32.S cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/efiboot/bootx64/Makefile cvs rdiff -u -r1.4 -r1.5 src/sys/arch/i386/stand/efiboot/bootx64/efibootx64.c cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/stand/efiboot/bootx64/multiboot64.S cvs rdiff -u -r1.46 -r1.47 src/sys/arch/i386/stand/lib/Makefile cvs rdiff -u -r1.51 -r1.52 src/sys/arch/i386/stand/lib/biosdisk.c cvs rdiff -u -r1.11 -r1.12 src/sys/arch/i386/stand/lib/biosdisk.h cvs rdiff -u -r1.5 -r1.6 src/sys/arch/i386/stand/lib/bootinfo_memmap.c cvs rdiff -u -r1.73 -r1.74 src/sys/arch/i386/stand/lib/exec.c cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/stand/lib/exec_multiboot1.c \ src/sys/arch/i386/stand/lib/exec_multiboot2.c cvs rdiff -u -r1.44 -r1.45 src/sys/arch/i386/stand/lib/libi386.h cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/lib/multiboot.S cvs rdiff -u -r1.7 -r1.8 src/sys/arch/i386/stand/lib/pread.c cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/stand/netboot/Makefile.netboot cvs rdiff -u -r1.25 -r1.26 src/sys/arch/i386/stand/pxeboot/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/i386
Module Name:src Committed By: manu Date: Fri Sep 13 02:19:46 UTC 2019 Modified Files: src/sys/arch/i386/include: Makefile src/sys/arch/i386/stand/boot: Makefile.boot src/sys/arch/i386/stand/dosboot: Makefile src/sys/arch/i386/stand/efiboot: Makefile.efiboot boot.c efiboot.c efiboot.h eficons.c efimemory.c src/sys/arch/i386/stand/efiboot/bootia32: Makefile efibootia32.c src/sys/arch/i386/stand/efiboot/bootx64: Makefile efibootx64.c src/sys/arch/i386/stand/lib: Makefile biosdisk.c biosdisk.h bootinfo_memmap.c exec.c libi386.h multiboot.S pread.c src/sys/arch/i386/stand/netboot: Makefile.netboot src/sys/arch/i386/stand/pxeboot: Makefile Added Files: src/sys/arch/i386/include: multiboot2.h src/sys/arch/i386/stand/efiboot/bootia32: multiboot32.S src/sys/arch/i386/stand/efiboot/bootx64: multiboot64.S src/sys/arch/i386/stand/lib: exec_multiboot1.c exec_multiboot2.c Log Message: Add multiboot 2 support to x86 bootloaders multiboot 2 is required to boot Xen on an EFI system. This also require a kernel patch for properly discovering the ACPI RSDP, which is available after 20190912, in src/sys/arch/x86/acpi/acpi_machdep.c 1.26-1.28 There are a few missing bit in this multiboot 2 implementation (which are unused by Xen): - Header tags Address, Freambuffer, and Relocatable are ignored - Tags APM and Network are not provided - Tags ACPI old and ACP new are only provided for ACPI boot - Tag boot device does not provides the subpart (BSD disklabel partition) Notes: - multiboot2 is disabled in dosboot, otherwise the binary gets too big and build fails. - in src/sys/arch/i386/stand/efiboot, consinit() is renamed as efi_consinit() to avoid prototype conflicts in src/sys/sys/systm.h To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/sys/arch/i386/include/Makefile cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/include/multiboot2.h cvs rdiff -u -r1.72 -r1.73 src/sys/arch/i386/stand/boot/Makefile.boot cvs rdiff -u -r1.31 -r1.32 src/sys/arch/i386/stand/dosboot/Makefile cvs rdiff -u -r1.15 -r1.16 src/sys/arch/i386/stand/efiboot/Makefile.efiboot \ src/sys/arch/i386/stand/efiboot/boot.c cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/stand/efiboot/efiboot.c cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/stand/efiboot/efiboot.h cvs rdiff -u -r1.6 -r1.7 src/sys/arch/i386/stand/efiboot/eficons.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/i386/stand/efiboot/efimemory.c cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/efiboot/bootia32/Makefile cvs rdiff -u -r1.4 -r1.5 \ src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/stand/efiboot/bootia32/multiboot32.S cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/efiboot/bootx64/Makefile cvs rdiff -u -r1.4 -r1.5 src/sys/arch/i386/stand/efiboot/bootx64/efibootx64.c cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/stand/efiboot/bootx64/multiboot64.S cvs rdiff -u -r1.46 -r1.47 src/sys/arch/i386/stand/lib/Makefile cvs rdiff -u -r1.51 -r1.52 src/sys/arch/i386/stand/lib/biosdisk.c cvs rdiff -u -r1.11 -r1.12 src/sys/arch/i386/stand/lib/biosdisk.h cvs rdiff -u -r1.5 -r1.6 src/sys/arch/i386/stand/lib/bootinfo_memmap.c cvs rdiff -u -r1.73 -r1.74 src/sys/arch/i386/stand/lib/exec.c cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/stand/lib/exec_multiboot1.c \ src/sys/arch/i386/stand/lib/exec_multiboot2.c cvs rdiff -u -r1.44 -r1.45 src/sys/arch/i386/stand/lib/libi386.h cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/lib/multiboot.S cvs rdiff -u -r1.7 -r1.8 src/sys/arch/i386/stand/lib/pread.c cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/stand/netboot/Makefile.netboot cvs rdiff -u -r1.25 -r1.26 src/sys/arch/i386/stand/pxeboot/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/include/Makefile diff -u src/sys/arch/i386/include/Makefile:1.49 src/sys/arch/i386/include/Makefile:1.50 --- src/sys/arch/i386/include/Makefile:1.49 Thu Jul 12 10:46:44 2018 +++ src/sys/arch/i386/include/Makefile Fri Sep 13 02:19:45 2019 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.49 2018/07/12 10:46:44 maxv Exp $ +# $NetBSD: Makefile,v 1.50 2019/09/13 02:19:45 manu Exp $ INCSDIR= /usr/include/i386 @@ -15,7 +15,7 @@ INCS= ansi.h aout_machdep.h apmvar.h asm joystick.h \ kcore.h \ limits.h lock.h \ - math.h mcontext.h mutex.h mtrr.h multiboot.h \ + math.h mcontext.h mutex.h mtrr.h multiboot.h multiboot2.h \ param.h pcb.h pio.h pmap.h proc.h profile.h psl.h \ pte.h ptrace.h \ reg.h rwlock.h \ Index: src/sys/arch/i386/stand/boot/Makefile.boot diff -u src/sys/arch/i386/stand/boot/Makefile.boot:1.72 src/sys/arch/i386/stand/boot/Makefile.boot:1.73 --- src/sys/arch/i386/stand/boot/Makefile.boot:1.72 Wed Jul 25 23:45:32 2018 +++ src/sys/arch/i386/stand/boot/Makefile.boot Fri Sep 13 02:19:45 2019 @@ -1,4 +1,4 @@ -# $NetBSD:
CVS commit: src/sys/arch/i386/stand/lib
Module Name:src Committed By: manu Date: Thu Aug 1 13:11:03 UTC 2019 Modified Files: src/sys/arch/i386/stand/lib: bootinfo_biosgeom.c Log Message: Fix buffer overflow in BIOS disk geometry collect for bootinfo This spares a boot-time panic on iMac with fusion drive, which feature both a hard drive and a solid-state drive. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/i386/stand/lib/bootinfo_biosgeom.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/stand/lib/bootinfo_biosgeom.c diff -u src/sys/arch/i386/stand/lib/bootinfo_biosgeom.c:1.23 src/sys/arch/i386/stand/lib/bootinfo_biosgeom.c:1.24 --- src/sys/arch/i386/stand/lib/bootinfo_biosgeom.c:1.23 Tue Jan 24 11:09:14 2017 +++ src/sys/arch/i386/stand/lib/bootinfo_biosgeom.c Thu Aug 1 13:11:03 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: bootinfo_biosgeom.c,v 1.23 2017/01/24 11:09:14 nonaka Exp $ */ +/* $NetBSD: bootinfo_biosgeom.c,v 1.24 2019/08/01 13:11:03 manu Exp $ */ /* * Copyright (c) 1997 @@ -60,6 +60,7 @@ void bi_getbiosgeom(void) { struct btinfo_biosgeom *bibg; + size_t bibg_len = sizeof(*bibg); int i, j, nvalid; int nhd; unsigned int cksum; @@ -72,8 +73,8 @@ bi_getbiosgeom(void) printf("nhd %d\n", nhd); #endif - bibg = alloc(sizeof(struct btinfo_biosgeom) - + (nhd - 1) * sizeof(struct bi_biosgeom_entry)); + bibg_len += nhd * sizeof(struct bi_biosgeom_entry); + bibg = alloc(bibg_len); if (bibg == NULL) return; @@ -175,6 +176,8 @@ bi_getbiosgeom(void) bibg->num = nvalid; - BI_ADD(bibg, BTINFO_BIOSGEOM, sizeof(struct btinfo_biosgeom) - + nvalid * sizeof(struct bi_biosgeom_entry)); + if (nvalid < nhd) + bibg_len -= (nhd - nvalid) * sizeof(struct bi_biosgeom_entry); + + BI_ADD(bibg, BTINFO_BIOSGEOM, bibg_len); }
CVS commit: src/sys/arch/i386/stand/lib
Module Name:src Committed By: manu Date: Thu Aug 1 13:11:03 UTC 2019 Modified Files: src/sys/arch/i386/stand/lib: bootinfo_biosgeom.c Log Message: Fix buffer overflow in BIOS disk geometry collect for bootinfo This spares a boot-time panic on iMac with fusion drive, which feature both a hard drive and a solid-state drive. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/i386/stand/lib/bootinfo_biosgeom.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/i386/stand/efiboot/bootia32
Module Name:src Committed By: manu Date: Tue Sep 24 00:47:46 UTC 2019 Modified Files: src/sys/arch/i386/stand/efiboot/bootia32: multiboot32.S Log Message: Fix multiboot32 argument usage To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 \ src/sys/arch/i386/stand/efiboot/bootia32/multiboot32.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/stand/efiboot/bootia32/multiboot32.S diff -u src/sys/arch/i386/stand/efiboot/bootia32/multiboot32.S:1.1 src/sys/arch/i386/stand/efiboot/bootia32/multiboot32.S:1.2 --- src/sys/arch/i386/stand/efiboot/bootia32/multiboot32.S:1.1 Fri Sep 13 02:19:45 2019 +++ src/sys/arch/i386/stand/efiboot/bootia32/multiboot32.S Tue Sep 24 00:47:46 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: multiboot32.S,v 1.1 2019/09/13 02:19:45 manu Exp $ */ +/* $NetBSD: multiboot32.S,v 1.2 2019/09/24 00:47:46 manu Exp $ */ #include #include @@ -16,12 +16,12 @@ _C_LABEL(multiboot32_size): .p2align 4,,15 /* - * multiboot32(entry 8(%esp), multiboot2_info 12(%esp), magic 16(%esp)) + * multiboot32(entry 4(%esp), multiboot2_info 8(%esp), magic 12(%esp)) */ ENTRY(multiboot32_start) start: -movl16(%esp),%eax -movl12(%esp),%ebx -movl8(%esp),%edx +movl12(%esp),%eax +movl8(%esp),%ebx +movl4(%esp),%edx jmp*%edx multiboot32_end:
CVS commit: src/sys/arch/i386/stand/efiboot/bootia32
Module Name:src Committed By: manu Date: Tue Sep 24 00:47:46 UTC 2019 Modified Files: src/sys/arch/i386/stand/efiboot/bootia32: multiboot32.S Log Message: Fix multiboot32 argument usage To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 \ src/sys/arch/i386/stand/efiboot/bootia32/multiboot32.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/arch (multiboot2 support)
Paul Goyette wrote: > This commit seems to have broken amd64 booting! When booting into > a qemu environment (as set up by misc/py-anita), it just hangs while > printing the "progress numbers with the spinny cursor". Others on > irc/icb have indicated an immediate crash. I rolled back the change to sys/arch/amd64/conf/kern.ldscript, this should fix BIOS boot. -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src/sys/arch (multiboot2 support)
Paul Goyette wrote: > This commit seems to have broken amd64 booting! When booting into > a qemu environment (as set up by misc/py-anita), it just hangs while > printing the "progress numbers with the spinny cursor". Others on > irc/icb have indicated an immediate crash. > > Seems like non-efi booting is borked. This is caused by sys/arch/amd64/conf/kern.ldscript 1.27-1.28 I will fix that within a few hours. -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
CVS commit: src/sys/arch/x86/include
Module Name:src Committed By: manu Date: Fri Oct 18 00:54:48 UTC 2019 Modified Files: src/sys/arch/x86/include: efi.h Log Message: Add UEFI boot services and I/O method protoypes To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/x86/include/efi.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/include/efi.h diff -u src/sys/arch/x86/include/efi.h:1.8 src/sys/arch/x86/include/efi.h:1.9 --- src/sys/arch/x86/include/efi.h:1.8 Sun Oct 22 00:59:28 2017 +++ src/sys/arch/x86/include/efi.h Fri Oct 18 00:54:48 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: efi.h,v 1.8 2017/10/22 00:59:28 maya Exp $ */ +/* $NetBSD: efi.h,v 1.9 2019/10/18 00:54:48 manu Exp $ */ /*- * Copyright (c) 2004 Marcel Moolenaar @@ -63,6 +63,12 @@ enum efi_reset { typedef uint16_t efi_char; typedef unsigned long efi_status; +#if defined(__amd64__) +typedef uint64_t uintn; +#elif defined(__i386__) +typedef uint32_t uintn; +#endif + struct efi_cfgtbl { struct uuid ct_uuid; void *ct_data; @@ -149,6 +155,133 @@ struct efi_rt { efi_char *); }; +typedef uintn efi_tpl; +typedef void *efi_event; +typedef void (*efi_event_notify)(efi_event, void *); +typedef void *efi_handle; +typedef struct { + uint8_t type; + uint8_t subtype; + uint8_t ldnegth[2]; +} efi_device_path; + +struct efi_bs { + struct efi_tblhdr bs_hdr; +#define EFI_BS_SIG 0x56524553544f4f42UL + efi_tpl (*bs_raisetpl)(efi_tpl); + void(*bs_restoretpl)(efi_tpl); + efi_status (*bs_allocatepages)(uint32_t, uint32_t, + uintn, paddr_t *); + efi_status (*bs_freepages)(paddr_t, uintn); + efi_status (*bs_getmemorymap)(uintn *, struct efi_md *, + uintn *, uintn *, uint32_t *); + efi_status (*bs_allocatepool)(uint32_t, uintn, void **); + efi_status (*bs_freepool)(void *); + efi_status (*bs_createevent)(uint32_t, efi_tpl, efi_event_notify, + void *, efi_event *); + efi_status (*bs_settimer)(efi_event, uint32_t, uint64_t); + efi_status (*bs_waitforevent)(uintn, efi_event *, uintn *); + efi_status (*bs_signalevent)(efi_event); + efi_status (*bs_closeevent)(efi_event); + efi_status (*bs_checkevent)(efi_event); + efi_status (*bs_installprotocolinterface)(efi_handle *, + struct uuid *, uint32_t, void *); + efi_status (*bs_reinstallprotocolinterface)(efi_handle *, + struct uuid *, void *, void *); + efi_status (*bs_uninstallprotocolinterface)(efi_handle *, + struct uuid *, void *); + efi_status (*bs_handleprotocol)(efi_handle, + struct uuid *, void **); + efi_status (*bs_pchandleprotocol)(efi_handle, + struct uuid *, void **); + efi_status (*bs_registerprotocolnotify)(struct uuid *, efi_event, + void **); + efi_status (*bs_locatehandle)(uint32_t, struct uuid *, void *, + uintn *, efi_handle *); + efi_status (*bs_locatedevicepath)(struct uuid *, efi_device_path **, + efi_handle *); + efi_status (*bs_installconfigurationtable)(struct uuid *, void *); + efi_status (*bs_loadimage)(uint8_t, efi_handle, efi_device_path *, + void *, uintn, efi_handle *); + efi_status (*bs_startimage)(efi_handle, uintn *, efi_char **); + efi_status (*bs_exit)(efi_handle, efi_status, uintn, efi_char *); + efi_status (*bs_unloadimage)(efi_handle); + efi_status (*bs_exitbootservices)(efi_handle, uintn); + efi_status (*bs_getnextmonotoniccount)(uint64_t *); + efi_status (*bs_stall)(uintn); + efi_status (*bs_setwatchdogtimer)(uintn, uint64_t, + uintn, efi_char *); + efi_status (*bs_connectcontroller)(efi_handle, efi_handle *, + efi_device_path *, uint8_t); + efi_status (*bs_disconnectcontroller)(efi_handle, efi_handle, + efi_handle); + efi_status (*bs_openprotocol)(efi_handle, struct uuid *, void **, + efi_handle, efi_handle, uint32_t); + efi_status (*bs_closeprotocol)(efi_handle, struct uuid *, + efi_handle, efi_handle); + efi_status (*bs_openprotocolinformation)(efi_handle, efi_handle, + uint32_t, uint32_t); + efi_status (*bs_protocolsperhandle)(efi_handle, + struct uuid ***, uintn *); + efi_status (*bs_locatehandlebuffer)(uint32_t, struct uuid *, + void *, uintn *, efi_handle **); + efi_status (*bs_locateprotocol)(struct uuid *, void *, void **); + efi_status (*bs_installmultipleprotocolinterfaces)(efi_handle *, + ...); + efi_status (*bs_uninstallmultipleprotocolinterfaces)(efi_handle, + ...); + efi_status (*bs_calculatecrc32)(void *, uintn, uint32_t *); + efi_status
CVS commit: src/sys/arch/x86/include
Module Name:src Committed By: manu Date: Fri Oct 18 00:54:48 UTC 2019 Modified Files: src/sys/arch/x86/include: efi.h Log Message: Add UEFI boot services and I/O method protoypes To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/x86/include/efi.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/x86
Module Name:src Committed By: manu Date: Fri Oct 18 00:56:25 UTC 2019 Modified Files: src/sys/arch/x86/x86: efi.c Log Message: Fix EFI system table mapping in virtual space Previous version was annoted as untested, and indeed it did not work. New version uses the same approach as for ACPI table mapping. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/x86/x86/efi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/i386
Module Name:src Committed By: manu Date: Fri Oct 18 01:00:25 UTC 2019 Modified Files: src/sys/arch/i386/i386: machdep.c src/sys/arch/i386/pci: piixpcib.c Log Message: Make sure no bioscall is issued when booting off UEFI system To generate a diff of this commit: cvs rdiff -u -r1.821 -r1.822 src/sys/arch/i386/i386/machdep.c cvs rdiff -u -r1.22 -r1.23 src/sys/arch/i386/pci/piixpcib.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/i386/machdep.c diff -u src/sys/arch/i386/i386/machdep.c:1.821 src/sys/arch/i386/i386/machdep.c:1.822 --- src/sys/arch/i386/i386/machdep.c:1.821 Sat Oct 12 06:31:03 2019 +++ src/sys/arch/i386/i386/machdep.c Fri Oct 18 01:00:24 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.821 2019/10/12 06:31:03 maxv Exp $ */ +/* $NetBSD: machdep.c,v 1.822 2019/10/18 01:00:24 manu Exp $ */ /* * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009, 2017 @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.821 2019/10/12 06:31:03 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.822 2019/10/18 01:00:24 manu Exp $"); #include "opt_beep.h" #include "opt_compat_freebsd.h" @@ -119,6 +119,8 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v #include +#include + #include #include #include @@ -1368,10 +1370,15 @@ init386(paddr_t first_avail) init386_ksyms(); #if NMCA > 0 - /* check for MCA bus, needed to be done before ISA stuff - if + /* + * check for MCA bus, needed to be done before ISA stuff - if * MCA is detected, ISA needs to use level triggered interrupts - * by default */ - mca_busprobe(); + * by default + * And we do not search for MCA using bioscall() on EFI systems + * that lacks it (they lack MCA too, anyway). + */ + if (lookup_bootinfo(BTINFO_EFI) == NULL) + mca_busprobe(); #endif #ifdef XENPV Index: src/sys/arch/i386/pci/piixpcib.c diff -u src/sys/arch/i386/pci/piixpcib.c:1.22 src/sys/arch/i386/pci/piixpcib.c:1.23 --- src/sys/arch/i386/pci/piixpcib.c:1.22 Mon Jul 11 11:31:49 2016 +++ src/sys/arch/i386/pci/piixpcib.c Fri Oct 18 01:00:25 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: piixpcib.c,v 1.22 2016/07/11 11:31:49 msaitoh Exp $ */ +/* $NetBSD: piixpcib.c,v 1.23 2019/10/18 01:00:25 manu Exp $ */ /*- * Copyright (c) 2004, 2006 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: piixpcib.c,v 1.22 2016/07/11 11:31:49 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: piixpcib.c,v 1.23 2019/10/18 01:00:25 manu Exp $"); #include #include @@ -195,6 +195,12 @@ piixpcib_int15_gsic_call(int *sig, int * { struct bioscallregs regs; + /* No bioscall with EFI */ + if (lookup_bootinfo(BTINFO_EFI) != NULL) { + *sig = *smicmd = *cmd = *smidata = *flags = -1; + return; + } + memset(, 0, sizeof(struct bioscallregs)); regs.EAX = 0xe980; /* IST support */ regs.EDX = PIIXPCIB_GSIC;
CVS commit: src/sys/arch/i386
Module Name:src Committed By: manu Date: Fri Oct 18 01:00:25 UTC 2019 Modified Files: src/sys/arch/i386/i386: machdep.c src/sys/arch/i386/pci: piixpcib.c Log Message: Make sure no bioscall is issued when booting off UEFI system To generate a diff of this commit: cvs rdiff -u -r1.821 -r1.822 src/sys/arch/i386/i386/machdep.c cvs rdiff -u -r1.22 -r1.23 src/sys/arch/i386/pci/piixpcib.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/x86
Module Name:src Committed By: manu Date: Fri Oct 18 00:56:25 UTC 2019 Modified Files: src/sys/arch/x86/x86: efi.c Log Message: Fix EFI system table mapping in virtual space Previous version was annoted as untested, and indeed it did not work. New version uses the same approach as for ACPI table mapping. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/x86/x86/efi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/x86/efi.c diff -u src/sys/arch/x86/x86/efi.c:1.19 src/sys/arch/x86/x86/efi.c:1.20 --- src/sys/arch/x86/x86/efi.c:1.19 Mon Dec 3 19:46:43 2018 +++ src/sys/arch/x86/x86/efi.c Fri Oct 18 00:56:25 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: efi.c,v 1.19 2018/12/03 19:46:43 cherry Exp $ */ +/* $NetBSD: efi.c,v 1.20 2019/10/18 00:56:25 manu Exp $ */ /*- * Copyright (c) 2016 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: efi.c,v 1.19 2018/12/03 19:46:43 cherry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: efi.c,v 1.20 2019/10/18 00:56:25 manu Exp $"); #include #include @@ -37,6 +37,8 @@ __KERNEL_RCSID(0, "$NetBSD: efi.c,v 1.19 #include #include +#include +#include #include #include @@ -73,21 +75,19 @@ static vaddr_t efi_getva(paddr_t pa) { vaddr_t va; + int rv; #ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS if (mm_md_direct_mapped_phys(pa, )) return va; #endif - /* XXX This code path is not tested. */ - va = uvm_km_alloc(kernel_map, PAGE_SIZE, 0, - UVM_KMF_VAONLY | UVM_KMF_WAITVA); - if (va == 0) { + rv = _x86_memio_map(x86_bus_space_mem, pa, + PAGE_SIZE, 0, (bus_space_handle_t *)); + if (rv != 0) { aprint_debug("efi: unable to allocate va\n"); return 0; } - pmap_kenter_pa(va, pa, VM_PROT_READ, 0); - pmap_update(pmap_kernel()); return va; } @@ -107,10 +107,8 @@ efi_relva(paddr_t pa, vaddr_t va) } #endif - /* XXX This code path is not tested. */ - pmap_kremove(va, PAGE_SIZE); - pmap_update(pmap_kernel()); - uvm_km_free(kernel_map, va, PAGE_SIZE, UVM_KMF_VAONLY); + (void)_x86_memio_unmap(x86_bus_space_mem, (bus_space_handle_t)va, + PAGE_SIZE, NULL); } /*
CVS commit: src/sys/arch/i386/stand/lib
Module Name:src Committed By: manu Date: Fri Oct 18 01:04:24 UTC 2019 Modified Files: src/sys/arch/i386/stand/lib: exec_multiboot1.c Log Message: Fix multiboot1 header detection Specification states it must be must be longword (32-bit) aligned To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/lib/exec_multiboot1.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/stand/lib/exec_multiboot1.c diff -u src/sys/arch/i386/stand/lib/exec_multiboot1.c:1.1 src/sys/arch/i386/stand/lib/exec_multiboot1.c:1.2 --- src/sys/arch/i386/stand/lib/exec_multiboot1.c:1.1 Fri Sep 13 02:19:46 2019 +++ src/sys/arch/i386/stand/lib/exec_multiboot1.c Fri Oct 18 01:04:24 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: exec_multiboot1.c,v 1.1 2019/09/13 02:19:46 manu Exp $ */ +/* $NetBSD: exec_multiboot1.c,v 1.2 2019/10/18 01:04:24 manu Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -126,7 +126,7 @@ probe_multiboot1(const char *path) if (readen < sizeof(struct multiboot_header)) goto out; - for (i = 0; i < readen; i += 8) { + for (i = 0; i < readen; i += 4) { struct multiboot_header *mbh; mbh = (struct multiboot_header *)(buf + i);
CVS commit: src/sys/arch/i386/stand/lib
Module Name:src Committed By: manu Date: Fri Oct 18 01:04:24 UTC 2019 Modified Files: src/sys/arch/i386/stand/lib: exec_multiboot1.c Log Message: Fix multiboot1 header detection Specification states it must be must be longword (32-bit) aligned To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/lib/exec_multiboot1.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/i386/stand/lib
Module Name:src Committed By: manu Date: Fri Oct 18 01:09:47 UTC 2019 Modified Files: src/sys/arch/i386/stand/lib: exec_multiboot1.c libi386.h Log Message: Add kernel symbols for multiboot1 To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/lib/exec_multiboot1.c cvs rdiff -u -r1.45 -r1.46 src/sys/arch/i386/stand/lib/libi386.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/stand/lib/exec_multiboot1.c diff -u src/sys/arch/i386/stand/lib/exec_multiboot1.c:1.2 src/sys/arch/i386/stand/lib/exec_multiboot1.c:1.3 --- src/sys/arch/i386/stand/lib/exec_multiboot1.c:1.2 Fri Oct 18 01:04:24 2019 +++ src/sys/arch/i386/stand/lib/exec_multiboot1.c Fri Oct 18 01:09:46 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: exec_multiboot1.c,v 1.2 2019/10/18 01:04:24 manu Exp $ */ +/* $NetBSD: exec_multiboot1.c,v 1.3 2019/10/18 01:09:46 manu Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -42,6 +42,80 @@ extern struct btinfo_modulelist *btinfo_modulelist; +void +ksyms_addr_set(void *ehdr, void *shdr, void *symbase) +{ + int class; + Elf32_Ehdr *ehdr32 = NULL; + Elf64_Ehdr *ehdr64 = NULL; + uint64_t shnum; + int i; + + class = ((Elf_Ehdr *)ehdr)->e_ident[EI_CLASS]; + +switch (class) { +case ELFCLASS32: +ehdr32 = (Elf32_Ehdr *)ehdr; +shnum = ehdr32->e_shnum; +break; +case ELFCLASS64: +ehdr64 = (Elf64_Ehdr *)ehdr; +shnum = ehdr64->e_shnum; +break; +default: + panic("Unexpected ELF class"); + break; +} + + for (i = 0; i < shnum; i++) { + Elf64_Shdr *shdrp64 = NULL; + Elf32_Shdr *shdrp32 = NULL; + uint64_t shtype, shaddr, shsize, shoffset; + + switch(class) { + case ELFCLASS64: + shdrp64 = &((Elf64_Shdr *)shdr)[i]; + shtype = shdrp64->sh_type; + shaddr = shdrp64->sh_addr; + shsize = shdrp64->sh_size; + shoffset = shdrp64->sh_offset; + break; + case ELFCLASS32: + shdrp32 = &((Elf32_Shdr *)shdr)[i]; + shtype = shdrp32->sh_type; + shaddr = shdrp32->sh_addr; + shsize = shdrp32->sh_size; + shoffset = shdrp32->sh_offset; + break; + default: + panic("Unexpected ELF class"); + break; + } + + if (shtype != SHT_SYMTAB && shtype != SHT_STRTAB) + continue; + + if (shaddr != 0 || shsize == 0) + continue; + + shaddr = (uint64_t)(uintptr_t)(symbase + shoffset); + + switch(class) { + case ELFCLASS64: + shdrp64->sh_addr = shaddr; + break; + case ELFCLASS32: + shdrp32->sh_addr = shaddr; + break; + default: + panic("Unexpected ELF class"); + break; + } + } + + return; +} + static int exec_multiboot1(struct multiboot_package *mbp) { @@ -85,6 +159,38 @@ exec_multiboot1(struct multiboot_package mbi->mi_mods_addr = vtophys(mbm); } + if (mbp->mbp_marks[MARK_SYM] != 0) { + Elf32_Ehdr ehdr; + void *shbuf; + size_t shlen; + u_long shaddr; + + pvbcopy((void *)mbp->mbp_marks[MARK_SYM], , sizeof(ehdr)); + + if (memcmp(_ident, ELFMAG, SELFMAG) != 0) + goto skip_ksyms; + + shaddr = mbp->mbp_marks[MARK_SYM] + ehdr.e_shoff; + + shlen = ehdr.e_shnum * ehdr.e_shentsize; + shbuf = alloc(shlen); + + pvbcopy((void *)shaddr, shbuf, shlen); + ksyms_addr_set(, shbuf, + (void *)(KERNBASE + mbp->mbp_marks[MARK_SYM])); + vpbcopy(shbuf, (void *)shaddr, shlen); + + dealloc(shbuf, shlen); + + mbi->mi_elfshdr_num = ehdr.e_shnum; + mbi->mi_elfshdr_size = ehdr.e_shentsize; + mbi->mi_elfshdr_addr = shaddr; + mbi->mi_elfshdr_shndx = ehdr.e_shstrndx; + + mbi->mi_flags |= MULTIBOOT_INFO_HAS_ELF_SYMS; + } +skip_ksyms: + #ifdef DEBUG printf("Start @ 0x%lx [%ld=0x%lx-0x%lx]...\n", mbp->mbp_marks[MARK_ENTRY], Index: src/sys/arch/i386/stand/lib/libi386.h diff -u src/sys/arch/i386/stand/lib/libi386.h:1.45 src/sys/arch/i386/stand/lib/libi386.h:1.46 --- src/sys/arch/i386/stand/lib/libi386.h:1.45 Fri Sep 13 02:19:46 2019 +++ src/sys/arch/i386/stand/lib/libi386.h Fri Oct 18 01:09:46 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: libi386.h,v 1.45 2019/09/13 02:19:46 manu Exp $ */ +/* $NetBSD: libi386.h,v 1.46 2019/10/18 01:09:46 manu Exp $ */ /* * Copyright (c) 1996 @@ -171,4 +171,8 @@ void module_add_split(const char *, uint struct btinfo_framebuffer; void framebuffer_configure(struct btinfo_framebuffer *); +void ksyms_addr_set(void *, void *, void *); + +void ksyms_addr_set(void *, void *, void *); + #endif /* __I386_STAND_LIBI386_H__ */
CVS commit: src/sys/arch/i386/stand/lib
Module Name:src Committed By: manu Date: Fri Oct 18 01:09:47 UTC 2019 Modified Files: src/sys/arch/i386/stand/lib: exec_multiboot1.c libi386.h Log Message: Add kernel symbols for multiboot1 To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/lib/exec_multiboot1.c cvs rdiff -u -r1.45 -r1.46 src/sys/arch/i386/stand/lib/libi386.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/i386/stand/lib
Module Name:src Committed By: manu Date: Fri Oct 18 01:15:54 UTC 2019 Modified Files: src/sys/arch/i386/stand/lib: exec_multiboot2.c Log Message: Fix kernel symbols for multiboot2 Previous version just provided the ELF section table, which is correct as far as the multiboot 2 specification is concerned. But in order to retreive kernel symboles, the NetBSD kernelneeds symbol table and string table sections to be loaded in memory, and have an address set in the section table. Requires change: Add kernel symbols for multiboot1 src/sys/arch/i386/stand/lib/exec_multiboot1.c 1.2 - 1.3 src/sys/arch/i386/stand/lib/libi386.h 1.45 - 1.46 To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/lib/exec_multiboot2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/stand/lib/exec_multiboot2.c diff -u src/sys/arch/i386/stand/lib/exec_multiboot2.c:1.2 src/sys/arch/i386/stand/lib/exec_multiboot2.c:1.3 --- src/sys/arch/i386/stand/lib/exec_multiboot2.c:1.2 Sun Sep 15 23:55:26 2019 +++ src/sys/arch/i386/stand/lib/exec_multiboot2.c Fri Oct 18 01:15:54 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: exec_multiboot2.c,v 1.2 2019/09/15 23:55:26 manu Exp $ */ +/* $NetBSD: exec_multiboot2.c,v 1.3 2019/10/18 01:15:54 manu Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -976,9 +976,10 @@ mbi_elf_sections(struct multiboot_packag size_t len = 0; struct multiboot_tag_elf_sections *mbt = buf; Elf_Ehdr ehdr; + int class; Elf32_Ehdr *ehdr32 = NULL; Elf64_Ehdr *ehdr64 = NULL; - uint32_t shnum, shentsize, shstrndx, shoff; + uint64_t shnum, shentsize, shstrndx, shoff; size_t shdr_len; if (mbp->mbp_marks[MARK_SYM] == 0) @@ -992,7 +993,9 @@ mbi_elf_sections(struct multiboot_packag if (memcmp(_ident, ELFMAG, SELFMAG) != 0) goto out; - switch (ehdr.e_ident[EI_CLASS]) { + class = ehdr.e_ident[EI_CLASS]; + + switch (class) { case ELFCLASS32: ehdr32 = (Elf32_Ehdr *) shnum = ehdr32->e_shnum; @@ -1017,8 +1020,7 @@ mbi_elf_sections(struct multiboot_packag len = sizeof(*mbt) + shdr_len; if (mbt) { - int fd = -1; - int ret = -1; + char *shdr = (char *)mbp->mbp_marks[MARK_SYM] + shoff; mbt->type = MULTIBOOT_TAG_TYPE_ELF_SECTIONS; mbt->size = len; @@ -1026,26 +1028,16 @@ mbi_elf_sections(struct multiboot_packag mbt->entsize = shentsize; mbt->shndx = shstrndx; - if ((fd = open(mbp->mbp_file, 0)) == -1) - goto out_read; - - if (lseek(fd, shoff, SEEK_SET) != shoff) - goto out_read; - - if (read(fd, mbt + 1, shdr_len) != shdr_len) - goto out_read; + pvbcopy((void *)shdr, mbt + 1, shdr_len); - ret = 0; -out_read: - if (fd != -1) - close(fd); - - if (ret != 0) { - printf("Error reading ELF sections from %s\n", - mbp->mbp_file); - len = 0; - } + /* + * Adjust sh_addr for symtab and strtab + * section that have been loaded. + */ + ksyms_addr_set(, mbt + 1, + (void *)mbp->mbp_marks[MARK_SYM]); } + out: return roundup(len, MULTIBOOT_TAG_ALIGN); }
CVS commit: src/sys/arch/i386/stand/lib
Module Name:src Committed By: manu Date: Fri Oct 18 01:15:54 UTC 2019 Modified Files: src/sys/arch/i386/stand/lib: exec_multiboot2.c Log Message: Fix kernel symbols for multiboot2 Previous version just provided the ELF section table, which is correct as far as the multiboot 2 specification is concerned. But in order to retreive kernel symboles, the NetBSD kernelneeds symbol table and string table sections to be loaded in memory, and have an address set in the section table. Requires change: Add kernel symbols for multiboot1 src/sys/arch/i386/stand/lib/exec_multiboot1.c 1.2 - 1.3 src/sys/arch/i386/stand/lib/libi386.h 1.45 - 1.46 To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/lib/exec_multiboot2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/i386/i386
Module Name:src Committed By: manu Date: Fri Oct 18 01:19:00 UTC 2019 Modified Files: src/sys/arch/i386/i386: multiboot.c Log Message: Fix multiboot1 kernel symbol load ELF_Shdr's sh_type field is a value, not a flag field To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/i386/i386/multiboot.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/i386/multiboot.c diff -u src/sys/arch/i386/i386/multiboot.c:1.24 src/sys/arch/i386/i386/multiboot.c:1.25 --- src/sys/arch/i386/i386/multiboot.c:1.24 Thu Nov 8 06:23:48 2018 +++ src/sys/arch/i386/i386/multiboot.c Fri Oct 18 01:19:00 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: multiboot.c,v 1.24 2018/11/08 06:23:48 msaitoh Exp $ */ +/* $NetBSD: multiboot.c,v 1.25 2019/10/18 01:19:00 manu Exp $ */ /*- * Copyright (c) 2005, 2006 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: multiboot.c,v 1.24 2018/11/08 06:23:48 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: multiboot.c,v 1.25 2019/10/18 01:19:00 manu Exp $"); #include "opt_multiboot.h" @@ -302,14 +302,14 @@ copy_syms(struct multiboot_info *mi) shdrp = &((Elf32_Shdr *)mi->mi_elfshdr_addr)[i]; - if ((shdrp->sh_type & SHT_SYMTAB) && + if ((shdrp->sh_type == SHT_SYMTAB) && shdrp->sh_link != SHN_UNDEF) { Elf32_Shdr *shdrp2; shdrp2 = &((Elf32_Shdr *)mi->mi_elfshdr_addr) [shdrp->sh_link]; - if (shdrp2->sh_type & SHT_STRTAB) { + if (shdrp2->sh_type == SHT_STRTAB) { symtabp = shdrp; strtabp = shdrp2; }
CVS commit: src/sys/arch/i386/i386
Module Name:src Committed By: manu Date: Fri Oct 18 01:19:00 UTC 2019 Modified Files: src/sys/arch/i386/i386: multiboot.c Log Message: Fix multiboot1 kernel symbol load ELF_Shdr's sh_type field is a value, not a flag field To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/i386/i386/multiboot.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/i386/stand/lib
Module Name:src Committed By: manu Date: Fri Oct 18 01:24:51 UTC 2019 Modified Files: src/sys/arch/i386/stand/lib: libi386.h Log Message: Remove prototype added twice by mistake To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/sys/arch/i386/stand/lib/libi386.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/stand/lib/libi386.h diff -u src/sys/arch/i386/stand/lib/libi386.h:1.46 src/sys/arch/i386/stand/lib/libi386.h:1.47 --- src/sys/arch/i386/stand/lib/libi386.h:1.46 Fri Oct 18 01:09:46 2019 +++ src/sys/arch/i386/stand/lib/libi386.h Fri Oct 18 01:24:51 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: libi386.h,v 1.46 2019/10/18 01:09:46 manu Exp $ */ +/* $NetBSD: libi386.h,v 1.47 2019/10/18 01:24:51 manu Exp $ */ /* * Copyright (c) 1996 @@ -173,6 +173,4 @@ void framebuffer_configure(struct btinfo void ksyms_addr_set(void *, void *, void *); -void ksyms_addr_set(void *, void *, void *); - #endif /* __I386_STAND_LIBI386_H__ */
CVS commit: src/sys/arch/i386/stand/lib
Module Name:src Committed By: manu Date: Fri Oct 18 01:24:51 UTC 2019 Modified Files: src/sys/arch/i386/stand/lib: libi386.h Log Message: Remove prototype added twice by mistake To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/sys/arch/i386/stand/lib/libi386.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch
Module Name:src Committed By: manu Date: Fri Oct 18 01:38:28 UTC 2019 Modified Files: src/sys/arch/i386/conf: files.i386 src/sys/arch/i386/i386: locore.S machdep.c multiboot.c src/sys/arch/i386/include: multiboot.h Added Files: src/sys/arch/x86/x86: multiboot2.c Log Message: Multiboot2 kernel support for i386 That implementation works either with BIOS or UEFI bootstrap This requires the following kernel changes: Add UEFI boot services and I/O method protoypes src/sys/arch/x86/include/efi.h 1.8 - 1.9 Fix EFI system table mapping in virtual space src/sys/arch/x86/x86/efi.c 1.19 - 1.20 Make sure no bioscall is issued when booting off UEFI system src/sys/arch/i386/i386/machdep.c 1.821 - 1.822 src/sys/arch/i386/pci/piixpcib.c 1.22 - 1.23 And the following bootstrap changes: Add kernel symbols for multiboot1 src/sys/arch/i386/stand/lib/exec_multiboot1.c 1.2 - 1.3 src/sys/arch/i386/stand/lib/libi386.h 1.45 - 1.47 Fix kernel symbols for multiboot2 src/sys/arch/i386/stand/lib/exec_multiboot2.c 1.2 - 1.3 To generate a diff of this commit: cvs rdiff -u -r1.400 -r1.401 src/sys/arch/i386/conf/files.i386 cvs rdiff -u -r1.172 -r1.173 src/sys/arch/i386/i386/locore.S cvs rdiff -u -r1.822 -r1.823 src/sys/arch/i386/i386/machdep.c cvs rdiff -u -r1.25 -r1.26 src/sys/arch/i386/i386/multiboot.c cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/include/multiboot.h cvs rdiff -u -r0 -r1.1 src/sys/arch/x86/x86/multiboot2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/conf/files.i386 diff -u src/sys/arch/i386/conf/files.i386:1.400 src/sys/arch/i386/conf/files.i386:1.401 --- src/sys/arch/i386/conf/files.i386:1.400 Fri Feb 15 08:54:01 2019 +++ src/sys/arch/i386/conf/files.i386 Fri Oct 18 01:38:28 2019 @@ -1,4 +1,4 @@ -# $NetBSD: files.i386,v 1.400 2019/02/15 08:54:01 nonaka Exp $ +# $NetBSD: files.i386,v 1.401 2019/10/18 01:38:28 manu Exp $ # # new style config file for i386 architecture # @@ -51,6 +51,7 @@ defparam opt_beep.h BEEP_ONHALT_PERIOD defflag opt_multiboot.h MULTIBOOT obsolete defparam MULTIBOOT_SYMTAB_SPACE file arch/i386/i386/multiboot.c multiboot +file arch/x86/x86/multiboot2.c multiboot file arch/i386/i386/autoconf.c file arch/i386/i386/aout_machdep.c exec_aout Index: src/sys/arch/i386/i386/locore.S diff -u src/sys/arch/i386/i386/locore.S:1.172 src/sys/arch/i386/i386/locore.S:1.173 --- src/sys/arch/i386/i386/locore.S:1.172 Sat Oct 12 06:31:03 2019 +++ src/sys/arch/i386/i386/locore.S Fri Oct 18 01:38:28 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.172 2019/10/12 06:31:03 maxv Exp $ */ +/* $NetBSD: locore.S,v 1.173 2019/10/18 01:38:28 manu Exp $ */ /* * Copyright-o-rama! @@ -128,7 +128,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.172 2019/10/12 06:31:03 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.173 2019/10/18 01:38:28 manu Exp $"); #include "opt_copy_symtab.h" #include "opt_ddb.h" @@ -346,12 +346,52 @@ _C_LABEL(Multiboot_Header): .long MULTIBOOT_HEADER_FLAGS .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) + .align 8 + .globl Multiboot2_Header +_C_LABEL(Multiboot2_Header): + .long MULTIBOOT2_HEADER_MAGIC + .long MULTIBOOT2_ARCHITECTURE_I386 + .long Multiboot2_Header_end - Multiboot2_Header + .long -(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT2_ARCHITECTURE_I386 \ + + (Multiboot2_Header_end - Multiboot2_Header)) + + .long 1 /* MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST */ + .long 12 /* sizeof(multiboot_header_tag_information_request) */ + /* + sizeof(uint32_t) * requests */ + .long 4 /* MULTIBOOT_TAG_TYPE_BASIC_MEMINFO */ + .long 0 /* pad for 8 bytes alignment */ + + .long 8 /* MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI32 */ + .long 12 /* sizeof(struct multiboot_tag_efi32) */ + .long efi_multiboot2_loader - KERNBASE + .long 0 /* pad for 8 bytes alignment */ + +#if notyet + /* + * Could be used to get an early console for debug, + * but this is broken. + */ + .long 7 /* MULTIBOOT_HEADER_TAG_EFI_BS */ + .long 8 /* sizeof(struct multiboot_tag) */ +#endif + + .long 0 /* MULTIBOOT_HEADER_TAG_END */ + .long 8 /* sizeof(struct multiboot_tag) */ + .globl Multiboot2_Header_end +_C_LABEL(Multiboot2_Header_end): + 1: /* Check if we are being executed by a Multiboot-compliant boot * loader. */ cmpl $MULTIBOOT_INFO_MAGIC,%eax - jne 1f + je multiboot1_loader + + cmpl $MULTIBOOT2_BOOTLOADER_MAGIC,%eax + je multiboot2_loader + jmp 1f + +multiboot1_loader: /* * Indeed, a multiboot-compliant boot loader executed us. We switch * to the temporary stack, and copy the received Multiboot information @@ -361,10 +401,187 @@ _C_LABEL(Multiboot_Header): */ movl $_RELOC(tmpstk),%esp pushl %ebx /* Address of Multiboot information */ - call _C_LABEL(multiboot_pre_reloc) + call _C_LABEL(multiboot1_pre_reloc) addl $4,%esp jmp 2f + +efi_multiboot2_loader: + /* + * EFI32 multiboot2 entry
CVS commit: src/sys/arch
Module Name:src Committed By: manu Date: Fri Oct 18 01:38:28 UTC 2019 Modified Files: src/sys/arch/i386/conf: files.i386 src/sys/arch/i386/i386: locore.S machdep.c multiboot.c src/sys/arch/i386/include: multiboot.h Added Files: src/sys/arch/x86/x86: multiboot2.c Log Message: Multiboot2 kernel support for i386 That implementation works either with BIOS or UEFI bootstrap This requires the following kernel changes: Add UEFI boot services and I/O method protoypes src/sys/arch/x86/include/efi.h 1.8 - 1.9 Fix EFI system table mapping in virtual space src/sys/arch/x86/x86/efi.c 1.19 - 1.20 Make sure no bioscall is issued when booting off UEFI system src/sys/arch/i386/i386/machdep.c 1.821 - 1.822 src/sys/arch/i386/pci/piixpcib.c 1.22 - 1.23 And the following bootstrap changes: Add kernel symbols for multiboot1 src/sys/arch/i386/stand/lib/exec_multiboot1.c 1.2 - 1.3 src/sys/arch/i386/stand/lib/libi386.h 1.45 - 1.47 Fix kernel symbols for multiboot2 src/sys/arch/i386/stand/lib/exec_multiboot2.c 1.2 - 1.3 To generate a diff of this commit: cvs rdiff -u -r1.400 -r1.401 src/sys/arch/i386/conf/files.i386 cvs rdiff -u -r1.172 -r1.173 src/sys/arch/i386/i386/locore.S cvs rdiff -u -r1.822 -r1.823 src/sys/arch/i386/i386/machdep.c cvs rdiff -u -r1.25 -r1.26 src/sys/arch/i386/i386/multiboot.c cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/include/multiboot.h cvs rdiff -u -r0 -r1.1 src/sys/arch/x86/x86/multiboot2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.