Hi,
actually, the changes in vbetool are quite small (and the last hunk is
actually reverting a fix we had for quite some time, so i'd skip this one
unless Matthew tells me that the fix is no longer needed).
This is the patch without the moving from
vbetool/x86emu to
libx86emu/
I can also send a complete diff, but it is >100k, even bzip2'ed.
Personally, i'd trust Matthew that he fixed x86emu and did not make
it worse :-)
Any objections?
Note: this patch will not compile right now, you'll need to unpack libx86
into ./libx86 inside the suspend source.
Index: Makefile
===================================================================
RCS file: /cvsroot/suspend/suspend/Makefile,v
retrieving revision 1.51
diff -u -p -r1.51 Makefile
--- Makefile 15 Feb 2007 09:37:17 -0000 1.51
+++ Makefile 5 Mar 2007 10:23:57 -0000
@@ -16,7 +16,7 @@ CFLAGS := -O2 -Wall
ARCH:=$(shell uname -m)
-CC_FLAGS=-I/usr/local/include -DS2RAM $(CFLAGS)
+CC_FLAGS=-I/usr/local/include -Ilibx86/ -DS2RAM $(CFLAGS)
LD_FLAGS=-L/usr/local/lib
BINARIES=s2disk s2both s2ram swap-offset resume
@@ -29,11 +29,11 @@ S2RAM_LD_FLAGS = $(LD_FLAGS) -lpci -lz
SWSUSP_LD_FLAGS = $(LD_FLAGS)
ifeq ($(ARCH), x86_64)
-S2RAM_OBJ+=vbetool/thunk.o vbetool/x86emu/libx86emu.a
-else
-S2RAM_OBJ+=vbetool/lrmi.o
+LIBX86_MAKE = BACKEND=x86emu
endif
+S2RAM_OBJ+=libx86/libx86.a
+
ifndef CONFIG_RESUME_DYN
STATIC_LD_FLAGS = -static
endif
@@ -76,12 +76,14 @@ endif
all: $(BINARIES)
clean:
- rm -f $(BINARIES) suspend-keygen suspend.keys *.o vbetool/*.o
vbetool/x86emu/*.o vbetool/x86emu/*.a
+ make -C libx86 clean
+ rm -f $(BINARIES) suspend-keygen suspend.keys *.o vbetool/*.o
#### Rules for objects
-vbetool/x86emu/libx86emu.a:
- make -C vbetool/x86emu -f makefile.linux
+libx86/libx86.a:
+ ln -sf lrmi.h libx86/libx86.h
+ make -C libx86 $(LIBX86_MAKE) static
s2ram-both.o: s2ram.c s2ram.h whitelist.c
$(CC) $(CC_FLAGS) -DCONFIG_BOTH -c $< -o $@
@@ -97,7 +99,7 @@ config.o vt.o bootsplash.o splash.o spla
$(CC) $(CC_FLAGS) -c $< -o $@
# Simple object without header
-vbetool/lrmi.o vbetool/thunk.o dmidecode.o radeontool.o : %.o: %.c
+libx86/lrmi.o libx86/thunk.o dmidecode.o radeontool.o : %.o: %.c
$(CC) $(CC_FLAGS) -c $< -o $@
Index: s2ram.c
===================================================================
RCS file: /cvsroot/suspend/suspend/s2ram.c,v
retrieving revision 1.50
diff -u -p -r1.50 s2ram.c
--- s2ram.c 2 Feb 2007 12:10:27 -0000 1.50
+++ s2ram.c 5 Mar 2007 10:23:58 -0000
@@ -291,7 +291,7 @@ void s2ram_resume(void)
if (vbe_mode >= 0) {
vbetool_init();
printf("Calling set_vbe_mode\n");
- set_vbe_mode(vbe_mode);
+ do_set_mode(vbe_mode, 0);
}
if (flags & RADEON_OFF) {
printf("Calling radeon_cmd_light(1)\n");
Index: vbetool/Makefile.am
===================================================================
RCS file: /cvsroot/suspend/suspend/vbetool/Makefile.am,v
retrieving revision 1.2
diff -u -p -r1.2 Makefile.am
--- vbetool/Makefile.am 19 Jul 2006 07:38:07 -0000 1.2
+++ vbetool/Makefile.am 5 Mar 2007 10:24:04 -0000
@@ -2,20 +2,11 @@ AUTOMAKE_OPTIONS = foreign
sbin_PROGRAMS = vbetool
-SUBDIRS = x86emu
-
-if WITH_X86EMU
-x86 = thunk.c x86-common.c
-vbetool_LDADD = x86emu/libx86emu.a /usr/lib/libpci.a
-else
-x86 = lrmi.c x86-common.c
-x86lib = ""
-vbetool_LDADD = /usr/lib/libpci.a
-endif
+vbetool_LDADD = $(libdir)/libpci.a
man_MANS = vbetool.1
vbetool_SOURCES = vbetool.c $(x86)
-noinst_HEADERS = include/lrmi.h vbetool.h
+noinst_HEADERS = vbetool.h
EXTRA_DIST = vbetool.1 LRMI
@@ -23,4 +14,4 @@ maintainer-clean-local:
$(RM) Makefile.in aclocal.m4 config.h.in stamp-h.in configure
AM_CFLAGS = -g -Wall -pedantic -std=gnu99
-AM_LDFLAGS =
+AM_LDFLAGS = -lz -lx86
Index: vbetool/vbetool.c
===================================================================
RCS file: /cvsroot/suspend/suspend/vbetool/vbetool.c,v
retrieving revision 1.8
diff -u -p -r1.8 vbetool.c
--- vbetool/vbetool.c 6 Oct 2006 15:23:37 -0000 1.8
+++ vbetool/vbetool.c 5 Mar 2007 10:24:04 -0000
@@ -8,10 +8,10 @@ This program is released under the terms
version 2
*/
-#include <stdlib.h>
#include <pci/pci.h>
#include <assert.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/ioctl.h>
@@ -21,7 +21,7 @@ version 2
#include <sys/stat.h>
#include <errno.h>
-#include "include/lrmi.h"
+#include <libx86.h>
#include "vbetool.h"
#define access_ptr_register(reg_frame,reg) (reg_frame -> reg)
@@ -54,9 +54,12 @@ void vbetool_init(void)
#ifndef S2RAM
int main(int argc, char *argv[])
{
+ /* Don't bother checking for privilege if they only want usage() */
if (argc < 2)
goto usage;
+
vbetool_init();
+
if (!strcmp(argv[1], "vbestate")) {
/* VBE save/restore tends to break when done underneath X */
int err = check_console();
@@ -117,7 +120,7 @@ int main(int argc, char *argv[])
return disable_vga();
}
} else if (!strcmp(argv[1], "vbefp")) {
- if (!strcmp(argv[2], "id")) {
+ if (!strcmp(argv[2], "id") || !strcmp(argv[2], "panelid")) {
return do_get_panel_id(0);
} else if (!strcmp(argv[2], "panelsize")) {
return do_get_panel_id(1);
@@ -379,11 +382,6 @@ int do_set_mode (int mode, int vga) {
return 0;
}
-void set_vbe_mode(int mode)
-{
- do_set_mode(mode, 0);
-}
-
int do_get_panel_brightness() {
reg_frame regs;
int error;
@@ -524,7 +522,7 @@ int do_get_panel_id(int just_dimensions)
r.edi = (unsigned long)(id-LRMI_base_addr()) & 0xf;
if(sizeof(struct panel_id) != 32)
- return fprintf(stderr, "oops: panel_id, sizeof struct panel_id != 32, it's
%d...\n", sizeof(struct panel_id)), 7;
+ return fprintf(stderr, "oops: panel_id, sizeof struct panel_id != 32, it's
%ld...\n", sizeof(struct panel_id)), 7;
if(real_mode_int(0x10, &r))
return fprintf(stderr, "Can't get panel id (vm86 failure)\n"), 8;
Index: vbetool/vbetool.h
===================================================================
RCS file: /cvsroot/suspend/suspend/vbetool/vbetool.h,v
retrieving revision 1.4
diff -u -p -r1.4 vbetool.h
--- vbetool/vbetool.h 20 Jul 2006 08:42:06 -0000 1.4
+++ vbetool/vbetool.h 5 Mar 2007 10:24:04 -0000
@@ -20,4 +20,3 @@ void vbetool_init(void);
char *__save_state(int *);
void restore_state_from(char *);
int __get_mode(void);
-void set_vbe_mode(int);
Index: vbetool/x86-common.c
===================================================================
RCS file: /cvsroot/suspend/suspend/vbetool/x86-common.c,v
retrieving revision 1.2
diff -u -p -r1.2 x86-common.c
--- vbetool/x86-common.c 9 Aug 2006 16:53:52 -0000 1.2
+++ vbetool/x86-common.c 5 Mar 2007 10:24:04 -0000
@@ -33,8 +33,8 @@ OTHER DEALINGS IN THE SOFTWARE.
#include "include/lrmi.h"
-#define REAL_MEM_BASE ((void *)0x1000)
-#define REAL_MEM_SIZE 0xa0000
+#define REAL_MEM_BASE ((void *)0x10000)
+#define REAL_MEM_SIZE 0x90000
#define REAL_MEM_BLOCKS 0x100
struct mem_block {
-----
Again, i'd skip the latest hunk (x86-common.c) for now.
Our diff to vbetool-1.0 is pretty small:
Only in /tmp/packages/vbetool/vbetool-1.0/: aclocal.m4
Only in /tmp/packages/vbetool/vbetool-1.0/: config.guess
Only in /tmp/packages/vbetool/vbetool-1.0/: config.sub
Only in /tmp/packages/vbetool/vbetool-1.0/: configure
Only in vbetool/: CVS
Only in /tmp/packages/vbetool/vbetool-1.0/: debian
Only in /tmp/packages/vbetool/vbetool-1.0/: depcomp
Only in vbetool/include: CVS
Only in /tmp/packages/vbetool/vbetool-1.0/: install-sh
Only in /tmp/packages/vbetool/vbetool-1.0/: Makefile.in
Only in /tmp/packages/vbetool/vbetool-1.0/: missing
Only in /tmp/packages/vbetool/vbetool-1.0/: mkinstalldirs
diff -rup /tmp/packages/vbetool/vbetool-1.0/vbetool.c vbetool/vbetool.c
--- /tmp/packages/vbetool/vbetool-1.0/vbetool.c 2007-03-03 02:49:59.000000000
+0100
+++ vbetool/vbetool.c 2007-03-05 10:49:18.000000000 +0100
@@ -36,19 +36,19 @@ version 2
static struct pci_access *pacc;
-int vbetool_init (void) {
+void vbetool_init(void)
+{
if (!LRMI_init()) {
fprintf(stderr, "Failed to initialise LRMI (Linux Real-Mode
Interface).\n");
exit(1);
}
-
+
ioperm(0, 1024, 1);
iopl(3);
-
+
pacc = pci_alloc();
pacc->numeric_ids = 1;
pci_init(pacc);
- return 0;
}
#ifndef S2RAM
@@ -172,7 +172,7 @@ int do_vbe_service(unsigned int AX, unsi
}
if (!function_sup) {
- fprintf(stderr, "Function not supported\n");
+ fprintf(stderr, "Function not supported?\n");
return -3;
}
@@ -444,12 +444,18 @@ int do_set_panel_brightness(int brightne
return 0;
}
-int do_get_mode() {
+int __get_mode()
+{
reg_frame regs;
int error;
memset(®s, 0, sizeof(regs));
error = do_vbe_service(0x4f03, 0, ®s);
+ return error;
+}
+
+int do_get_mode() {
+ int error = __get_mode();
if (error<0) {
return error;
diff -rup /tmp/packages/vbetool/vbetool-1.0/vbetool.h vbetool/vbetool.h
--- /tmp/packages/vbetool/vbetool-1.0/vbetool.h 2007-03-03 02:50:00.000000000
+0100
+++ vbetool/vbetool.h 2007-03-05 11:15:41.000000000 +0100
@@ -16,4 +16,7 @@ int check_console(void);
int enable_vga(void);
int disable_vga(void);
int do_get_panel_id();
-
+void vbetool_init(void);
+char *__save_state(int *);
+void restore_state_from(char *);
+int __get_mode(void);
Only in vbetool/: x86emu
--
Stefan Seyfried
"Any ideas, John?"
"Well, surrounding them's out."
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Suspend-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/suspend-devel