From owner-freebsd-hackers Thu Aug 5 21:36:17 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.rdc1.sfba.home.com (ha1.rdc1.sfba.home.com [24.0.0.66]) by hub.freebsd.org (Postfix) with ESMTP id E3ED914EDE for ; Thu, 5 Aug 1999 21:36:13 -0700 (PDT) (envelope-from adsharma@c62443-a.frmt1.sfba.home.com) Received: from c62443-a.frmt1.sfba.home.com ([24.0.69.165]) by mail.rdc1.sfba.home.com (InterMail v4.01.01.00 201-229-111) with ESMTP id <19990806043558.ICRQ8807.mail.rdc1.sfba.home.com@c62443-a.frmt1.sfba.home.com> for ; Thu, 5 Aug 1999 21:35:58 -0700 Received: (from adsharma@localhost) by c62443-a.frmt1.sfba.home.com (8.9.3/8.9.3) id XAA01865 for freebsd-hackers@freebsd.org; Thu, 5 Aug 1999 23:35:54 -0700 Date: Thu, 5 Aug 1999 23:35:54 -0700 From: Arun Sharma To: freebsd-hackers@freebsd.org Subject: Excessive assembly code ? Message-ID: <19990805233554.A1698@home.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.5i Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Taking a quick look at /usr/src/sys/i386: find . -name *.s | xargs wc -l 44 ./svr4/svr4_locore.s 216 ./apm/apm_setup.s 24 ./linux/linux_locore.s 461 ./isa/apic_ipl.s 1057 ./isa/apic_vector.s 168 ./isa/icu_ipl.s 224 ./isa/icu_vector.s 387 ./isa/ipl.s 113 ./isa/vector.s 59 ./i386/bioscall.s 340 ./i386/exception.s 192 ./i386/globals.s 1000 ./i386/locore.s 319 ./i386/mpboot.s 555 ./i386/mplock.s 310 ./i386/simplelock.s 1636 ./i386/support.s 833 ./i386/swtch.s 190 ./i386/vm86bios.s 8128 total I wonder if so much assembly code is really necessary for FreeBSD. One argument for minimal usage of assembly code is that it is easier to code non trivial algorithms in C. One such example is the scheduler. Since the decision about which process is going to run next is decided in assembly code, it is restricted to a relatively dumb algorithm of scanning the runqs and picking one. If the mechanism (i.e nuts and bolts of the context switch) is coded in assembly and the policy (which process to pick next) is done in C, the code would be much more maintainable, IMO. How do people feel about it here ? -Arun To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message