aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhpa <hpa>2004-05-18 16:54:40 +0000
committerhpa <hpa>2004-05-18 16:54:40 +0000
commit76dab29d399d3cbcdc87e56b3ee90517628eaf60 (patch)
tree521dd2a1e0068725ebaee1eefb4ef9b71b9c9f47
parent21eb9bf82e3b12842ff88ef418731c313dcaf04a (diff)
downloadsyslinux-elf-76dab29d399d3cbcdc87e56b3ee90517628eaf60.tar.gz
syslinux-elf-76dab29d399d3cbcdc87e56b3ee90517628eaf60.tar.xz
syslinux-elf-76dab29d399d3cbcdc87e56b3ee90517628eaf60.zip
Clean up the assembly; remove menutest.csyslinux-2.10-pre3
-rw-r--r--menu/biosio.c25
-rw-r--r--menu/biosio.h2
-rw-r--r--menu/menutest.c79
3 files changed, 18 insertions, 88 deletions
diff --git a/menu/biosio.c b/menu/biosio.c
index 33f55937..55cdd01b 100644
--- a/menu/biosio.c
+++ b/menu/biosio.c
@@ -13,6 +13,13 @@
#include "string.h"
#include "biosio.h"
+/*
+ * Note: don't use "r" or "g" for 8-bit values. Some versions of gcc
+ * will actually try to generate x86-64 registers that way! Use
+ * "abcd" or "abcdmi", respectively. Newer gccs have the newer "q"
+ * and "Q" constraints, but older gccs don't know those.
+ */
+
/* BIOS Assisted output routines */
/* Print character and attribute at cursor */
@@ -44,7 +51,7 @@ static inline char asm_getdisppage(void)
asm("movb $0x0f,%%ah ; "
"int $0x10 ; "
- "movb %%bh,%0" : "=rm" (page) : : "eax", "ebp");
+ "movb %%bh,%0" : "=abcdm" (page) : : "eax", "ebp");
return page;
}
@@ -61,7 +68,7 @@ static inline void asm_getpos(char *row, char *col, char page)
"movb %%dh,%0 ; "
"movb %%dl,%1"
: "=m" (*row), "=m" (*col)
- : "g" (page)
+ : "abcdmi" (page)
: "eax", "ebx", "ecx", "edx");
}
@@ -75,7 +82,7 @@ static inline void asm_gotoxy(char row,char col, char page)
asm volatile("movb %1,%%bh ; "
"movb $0x02,%%ah ; "
"int $0x10"
- : : "d" ((row << 8) + col), "g" (page)
+ : : "d" ((row << 8) + col), "abcdmi" (page)
: "eax", "ebx");
}
@@ -108,7 +115,7 @@ unsigned char sleep(unsigned int msec)
void asm_beep()
{
// For a beep the page number (bh) does not matter, so set it to zero
- asm volatile("movb $0x0E07, %%ax;"
+ asm volatile("movw $0x0E07, %%ax;"
"xor %%bh,%%bh;"
"int $0x10"
: : : "eax","ebx");
@@ -127,17 +134,19 @@ static inline void asm_putchar(char x, char attr,char page)
"movw $0x1, %%cx;"
"int $0x10"
: "+a" (x)
- : "g" (page), "g" (attr)
+ : "abcdmi" (page), "acdmi" (attr)
: "ebx", "ecx", "ebp");
}
static inline void scrollup()
{
+ unsigned short dx = (getnumrows()<< 8) + getnumcols();
+
asm volatile("movw $0x0601, %%ax;"
"movb $0x07, %%bh;"
"xor %%cx, %%cx;"
"int $0x10"
- : "+d"((getnumrows()<< 8) + getnumcols())
+ : "+d" (dx)
: : "eax","ebx","ecx");
}
@@ -307,9 +316,9 @@ static inline unsigned char asm_checkkbdbuf()
asm volatile("movb $0x11, %%ah;"
"int $0x16 ;"
"setnz %0;"
- : "=r" (ans)
+ : "=abcdm" (ans)
:
- : "%eax");
+ : "eax");
return ans;
}
diff --git a/menu/biosio.h b/menu/biosio.h
index e9bd5046..c17cc8f4 100644
--- a/menu/biosio.h
+++ b/menu/biosio.h
@@ -49,7 +49,7 @@ static inline unsigned char readbiosb(unsigned short addr)
asm("movw %2,%%fs ; "
"movb %%fs:%1,%0"
- : "=r" (v)
+ : "=abcd" (v)
: "m" (*(unsigned char *)(unsigned int)addr),
"r" ((unsigned short)0));
return v;
diff --git a/menu/menutest.c b/menu/menutest.c
deleted file mode 100644
index 8dd70690..00000000
--- a/menu/menutest.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/* -*- c -*- ------------------------------------------------------------- *
- *
- * Copyright 2004 Murali Krishnan Ganapathy - All Rights Reserved
- *
- * This program 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, Inc., 53 Temple Place Ste 330,
- * Bostom MA 02111-1307, USA; either version 2 of the License, or
- * (at your option) any later version; incorporated herein by reference.
- *
- * ----------------------------------------------------------------------- */
-
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
-
-#include "menu.h"
-#include "biosio.h"
-#include "string.h"
-#include "syslinux.h"
-
-char ONE,TWO,THREE,FOUR,MAIN;
-
-int menumain(void)
-{
- t_menuitem * curr;
-
- // Choose the default title and setup default values for all attributes....
- init_menusystem(NULL);
-
- // Choose the default values for all attributes and char's
- // -1 means choose defaults (Actually the next 4 lines are not needed)
- //set_normal_attr (-1,-1,-1,-1);
- //set_status_info (-1,-1);
- //set_title_info (-1,-1);
- //set_misc_info(-1,-1,-1,-1);
-
- // menuindex = add_menu(" Menu Title ");
- // add_item("Item string","Status String",TYPE,"any string",NUM)
- // TYPE = OPT_RUN | OPT_EXITMENU | OPT_SUBMENU | OPT_CHECKBOX | OPT_INACTIVE
- // "any string" not used by the menu system, useful for storing kernel names
- // NUM = index of submenu if OPT_SUBMENU,
- // 0/1 default checked state if OPT_CHECKBOX
- // unused otherwise.
-
- FOUR = add_menu(" LEVEL 4 ");
- add_item("Exit to prompt", "Exit the menu system", OPT_EXITMENU, "exit", 0);
-
- THREE = add_menu(" 1234567890123456789012 ");
- add_item("GOTO LEVEL 4","Go one level up",OPT_SUBMENU,NULL,FOUR);
- add_item("Exit to prompt", "Exit the menu system", OPT_EXITMENU, "exit", 0);
-
- TWO = add_menu(" LEVEL 2 ");
- add_item("GOTO LEVEL 3","Go one level up",OPT_SUBMENU,NULL,THREE);
- add_item("Exit to prompt", "Exit the menu system", OPT_EXITMENU, "exit", 0);
-
- ONE = add_menu(" LEVEL 1 ");
- add_item("GOTO LEVEL 2","Go one level up",OPT_SUBMENU,NULL,TWO);
- add_item("Exit to prompt", "Exit the menu system", OPT_EXITMENU, "exit", 0);
-
- MAIN = add_menu(" Main Menu ");
- add_item("Begin Menu Depth Test","Only Allows Depth Of Two",OPT_SUBMENU,NULL,ONE);
- add_item("Exit to prompt", "Exit the menu system", OPT_EXITMENU, "exit", 0);
-
- curr = showmenus(MAIN); // Initial menu is the one with index MAIN
- if (curr)
- {
- if (curr->action == OPT_EXIT) return 0;
- if (curr->action == OPT_RUN)
- {
- if (syslinux) runcommand(curr->data);
- else csprint(curr->data);
- return 1;
- }
- csprint("Error in programming!");
- }
- return 0;
-}
-