From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1LfygK-00044F-B4 for mharc-grub-devel@gnu.org; Sat, 07 Mar 2009 10:43:20 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LfygG-0003xH-6P for grub-devel@gnu.org; Sat, 07 Mar 2009 10:43:16 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LfygD-0003sA-Dw for grub-devel@gnu.org; Sat, 07 Mar 2009 10:43:15 -0500 Received: from [199.232.76.173] (port=33744 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LfygC-0003rl-Vv for grub-devel@gnu.org; Sat, 07 Mar 2009 10:43:13 -0500 Received: from mail-fx0-f172.google.com ([209.85.220.172]:47525) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LfygC-0001lp-9X for grub-devel@gnu.org; Sat, 07 Mar 2009 10:43:12 -0500 Received: by fxm20 with SMTP id 20so667372fxm.42 for ; Sat, 07 Mar 2009 07:43:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type; bh=f/Ki1t89SSsU8AIm54W/7atIneAhv4e6nJ92k4s5BJw=; b=MPOX8hw4xC6UUVzZ/A8joKRpzTFmcdpsAkc9/TDGYfgRstcAcESptgIOWaSQNbD+AA KRVKkcDZeJ7of1sgB+eplA1WoJbKJqSu0nUhLTx2Nq1SAEiGjDWH0DVaTYNwKomTVyOY J57x8NwXdairOwe2xrlAI6Yr8ixB/nKV8wCiE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; b=Zy4d7pvcdKTaGzP+XaM0ynJ5XFhPK51r8dsEsyBXnzH845lNJns+P3uxWIoz/h/GWJ KUZOSYdZGSJ6DYb/t8drRGzlcrBbGO3piXtCEi2tmdgY4+EqDguI0AQQt2vWcteMjXxf iTszVYZaHL5xjmNiQ4U/dEtfWzEkLJKCIERhA= Received: by 10.86.51.10 with SMTP id y10mr2750879fgy.9.1236440590167; Sat, 07 Mar 2009 07:43:10 -0800 (PST) Received: from ?192.168.1.25? (181-74.0-85.cust.bluewin.ch [85.0.74.181]) by mx.google.com with ESMTPS id 4sm1120714fge.54.2009.03.07.07.43.09 (version=SSLv3 cipher=RC4-MD5); Sat, 07 Mar 2009 07:43:09 -0800 (PST) Message-ID: <49B29605.4020802@gmail.com> Date: Sat, 07 Mar 2009 16:43:01 +0100 From: phcoder User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: The development of GRUB 2 Content-Type: multipart/mixed; boundary="------------070809090500060409060206" X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Interrupt testing X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Mar 2009 15:43:17 -0000 This is a multi-part message in MIME format. --------------070809090500060409060206 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hello. Here is a trivial patch for testing which interrupts are and which aren't handled by BIOS. Can be used as a simple but not reliable test for boot viruses -- Regards Vladimir 'phcoder' Serbinenko --------------070809090500060409060206 Content-Type: text/x-patch; name="inttest.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="inttest.diff" Index: conf/i386-pc.rmk =================================================================== --- conf/i386-pc.rmk (revision 2021) +++ conf/i386-pc.rmk (working copy) @@ -172,3 +181,3 @@ vbe.mod vbetest.mod vbeinfo.mod play.mod serial.mod \ ata.mod vga.mod memdisk.mod pci.mod lspci.mod \ aout.mod _bsd.mod bsd.mod pxe.mod pxecmd.mod datetime.mod date.mod \ datehook.mod lsmmap.mod ata_pthru.mod hdparm.mod \ - usb.mod uhci.mod ohci.mod usbtest.mod usbms.mod usb_keyboard.mod + usb.mod uhci.mod ohci.mod usbtest.mod usbms.mod usb_keyboard.mod \ + inttest.mod +# For inttest.mod. +inttest_mod_SOURCES = commands/i386/pc/inttest.c +inttest_mod_CFLAGS = $(COMMON_CFLAGS) -Werror +inttest_mod_LDFLAGS = $(COMMON_LDFLAGS) Index: ChangeLog =================================================================== --- ChangeLog (revision 2021) +++ ChangeLog (working copy) @@ -1,3 +1,10 @@ +2009-03-07 Vladimir Serbinenko + + Interrupt tests + + * commands/i386/pc/inttest.c: new file + * conf/i386-pc.rmk: new module inttest.mod + 2009-03-07 Bean * loader/i386/efi/linux.c (grub_rescue_cmd_initrd): Fix a bug in initrd Index: commands/i386/pc/inttest.c =================================================================== --- commands/i386/pc/inttest.c (revision 0) +++ commands/i386/pc/inttest.c (revision 0) @@ -0,0 +1,85 @@ +/* inttest.c - simple interrupt testing */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2009 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#include +#include +#include +#include +#include +#include + +static grub_err_t +grub_cmd_intreport (struct grub_arg_list *state __attribute__ ((unused)), + int argc __attribute__ ((unused)), + char **args __attribute__ ((unused))) +{ + grub_uint32_t *vects = 0; + int i; + for (i = 0; i < 0x100; i++) + if(((vects[i] >> 16) + ((vects[i] & 0xffff) >> 4)) >= 0xc000) + grub_printf("int %xh in BIOS %x:%x\n", + i, vects[i]>>16, vects[i]&0xffff); + else + grub_printf("int %xh not in BIOS %x:%x\n", + i, vects[i]>>16, vects[i]&0xffff); + return GRUB_ERR_NONE; +} + +static grub_err_t +grub_cmd_inttest (struct grub_arg_list *state __attribute__ ((unused)), + int argc __attribute__ ((unused)), + char **args __attribute__ ((unused))) +{ + grub_uint32_t *vects = 0; + int i; + for (i = 0; i <= 0x1c; i++) + if(((vects[i] >> 16) + ((vects[i] & 0xffff) >> 4)) < 0xc000) + return grub_error (GRUB_ERR_TEST_FAILURE, "interrupt %xh isn't in BIOS", + i); + if(((vects[0x4a] >> 16) + ((vects[0x4a] & 0xffff) >> 4)) < 0xc000) + return grub_error (GRUB_ERR_TEST_FAILURE, "interrupt 4ah isn't in BIOS", + i); + if(((vects[0x70] >> 16) + ((vects[0x70] & 0xffff) >> 4)) < 0xc000) + return grub_error (GRUB_ERR_TEST_FAILURE, "interrupt 70h isn't in BIOS", + i); + + return GRUB_ERR_NONE; +} + +GRUB_MOD_INIT(intreport) +{ + (void)mod; /* To stop warning. */ + grub_register_command ("intreport", grub_cmd_intreport, + GRUB_COMMAND_FLAG_BOTH, + "intreport", + "Report which interrupts are and which aren't in BIOS", + 0); + grub_register_command ("inttest", grub_cmd_inttest, + GRUB_COMMAND_FLAG_BOTH, + "inttest", + "Test that commonly used interrupts are in BIOS", + 0); + +} + +GRUB_MOD_FINI(intreport) +{ + grub_unregister_command ("intreport"); + grub_unregister_command ("inttest"); +} --------------070809090500060409060206--