summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-extended/libx86-1
diff options
context:
space:
mode:
authorRoy Li <rongqing.li@windriver.com>2016-01-20 14:05:41 +0800
committerMartin Jansa <Martin.Jansa@gmail.com>2016-02-01 15:58:04 +0100
commit4497ee43493efc3b7ff19f1afe703e77be78b322 (patch)
tree40f63fab480c684663048f5691cbd72e3e28836e /meta-oe/recipes-extended/libx86-1
parent8404784b3505d905ca52ada9a49afb93a1cd765c (diff)
downloadmeta-openembedded-4497ee43493efc3b7ff19f1afe703e77be78b322.tar.gz
libx86-1: port a patch to make it work
port a patch from libx86-1.1-21.fc23.src.rpm, and make libx86-1 be able to work and assume zero which return by LRMI_common_init is valid address Signed-off-by: Roy Li <rongqing.li@windriver.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-oe/recipes-extended/libx86-1')
-rw-r--r--meta-oe/recipes-extended/libx86-1/libx86-1.1/0001-assume-zero-is-valid-address.patch26
-rw-r--r--meta-oe/recipes-extended/libx86-1/libx86-1.1/libx86-mmap-offset.patch190
-rw-r--r--meta-oe/recipes-extended/libx86-1/libx86-1_1.1.bb6
3 files changed, 221 insertions, 1 deletions
diff --git a/meta-oe/recipes-extended/libx86-1/libx86-1.1/0001-assume-zero-is-valid-address.patch b/meta-oe/recipes-extended/libx86-1/libx86-1.1/0001-assume-zero-is-valid-address.patch
new file mode 100644
index 000000000..7a46301de
--- /dev/null
+++ b/meta-oe/recipes-extended/libx86-1/libx86-1.1/0001-assume-zero-is-valid-address.patch
@@ -0,0 +1,26 @@
1assume zero is valid address
2
3Upstream-Status: Pending
4
5Signed-off-by: Roy Li <rongqing.li@windriver.com>
6---
7 thunk.c | 3 ---
8 1 file changed, 3 deletions(-)
9
10diff --git a/thunk.c b/thunk.c
11index 796e88b..6121ea1 100644
12--- a/thunk.c
13+++ b/thunk.c
14@@ -141,9 +141,6 @@ int LRMI_init() {
15
16 mmap_addr = LRMI_common_init(1);
17
18- if (!mmap_addr)
19- return 0;
20-
21 X86EMU_pioFuncs pioFuncs = {
22 (&x_inb),
23 (&x_inw),
24--
251.9.1
26
diff --git a/meta-oe/recipes-extended/libx86-1/libx86-1.1/libx86-mmap-offset.patch b/meta-oe/recipes-extended/libx86-1/libx86-1.1/libx86-mmap-offset.patch
new file mode 100644
index 000000000..843acc886
--- /dev/null
+++ b/meta-oe/recipes-extended/libx86-1/libx86-1.1/libx86-mmap-offset.patch
@@ -0,0 +1,190 @@
1Upstream-Statue: Pending
2[from ftp://195.220.108.108/linux/fedora/linux/development/rawhide/source/SRPMS/l/libx86-1.1-21.fc23.src.rpm]
3
4diff -ur libx86-1.1/lrmi.c libx86-1.1.hack/lrmi.c
5--- libx86-1.1/lrmi.c 2006-10-30 15:10:16.000000000 -0500
6+++ libx86-1.1.hack/lrmi.c 2009-10-26 15:55:42.000000000 -0400
7@@ -136,7 +136,7 @@
8 if (context.ready)
9 return 1;
10
11- if (!LRMI_common_init())
12+ if (!LRMI_common_init(0))
13 return 0;
14
15 /*
16diff -ur libx86-1.1/thunk.c libx86-1.1.hack/thunk.c
17--- libx86-1.1/thunk.c 2008-04-02 20:48:00.000000000 -0400
18+++ libx86-1.1.hack/thunk.c 2009-10-26 16:05:39.000000000 -0400
19@@ -139,11 +139,11 @@
20 int i;
21 X86EMU_intrFuncs intFuncs[256];
22
23- if (!LRMI_common_init())
24+ mmap_addr = LRMI_common_init(1);
25+
26+ if (!mmap_addr)
27 return 0;
28
29- mmap_addr = 0;
30-
31 X86EMU_pioFuncs pioFuncs = {
32 (&x_inb),
33 (&x_inw),
34@@ -169,10 +169,10 @@
35 X86_ESP = 0xFFF9;
36 memset (stack, 0, 64*1024);
37
38- *((char *)0) = 0x4f; /* Make sure that we end up jumping back to a
39- halt instruction */
40+ *mmap_addr = 0x4f; /* Make sure that we end up jumping back to a
41+ halt instruction */
42
43- M.mem_base = 0;
44+ M.mem_base = (unsigned long)mmap_addr;
45 M.mem_size = 1024*1024;
46
47 return 1;
48diff -ur libx86-1.1/x86-common.c libx86-1.1.hack/x86-common.c
49--- libx86-1.1/x86-common.c 2008-05-16 12:56:23.000000000 -0400
50+++ libx86-1.1.hack/x86-common.c 2009-10-26 16:03:21.000000000 -0400
51@@ -45,14 +45,15 @@
52 static struct {
53 int ready;
54 int count;
55+ void *offset;
56 struct mem_block blocks[REAL_MEM_BLOCKS];
57 } mem_info = { 0 };
58
59 static int
60-real_mem_init(void)
61+real_mem_init(int high_page)
62 {
63 void *m;
64- int fd_zero;
65+ int fd_zero, flags = MAP_SHARED;
66
67 if (mem_info.ready)
68 return 1;
69@@ -63,9 +64,12 @@
70 return 0;
71 }
72
73+ if (!high_page)
74+ flags |= MAP_FIXED;
75+
76 m = mmap((void *)REAL_MEM_BASE, REAL_MEM_SIZE,
77- PROT_READ | PROT_WRITE | PROT_EXEC,
78- MAP_FIXED | MAP_SHARED, fd_zero, 0);
79+ PROT_READ | PROT_WRITE | PROT_EXEC,
80+ flags, fd_zero, 0);
81
82 if (m == (void *)-1) {
83 perror("mmap /dev/zero");
84@@ -76,6 +80,7 @@
85 close(fd_zero);
86
87 mem_info.ready = 1;
88+ mem_info.offset = m;
89 mem_info.count = 1;
90 mem_info.blocks[0].size = REAL_MEM_SIZE;
91 mem_info.blocks[0].free = 1;
92@@ -87,7 +92,7 @@
93 real_mem_deinit(void)
94 {
95 if (mem_info.ready) {
96- munmap((void *)REAL_MEM_BASE, REAL_MEM_SIZE);
97+ munmap(mem_info.offset, REAL_MEM_SIZE);
98 mem_info.ready = 0;
99 }
100 }
101@@ -119,7 +124,7 @@
102 LRMI_alloc_real(int size)
103 {
104 int i;
105- char *r = (char *)REAL_MEM_BASE;
106+ char *r = (char *)mem_info.offset;
107
108 if (!mem_info.ready)
109 return NULL;
110@@ -151,7 +156,7 @@
111 LRMI_free_real(void *m)
112 {
113 int i;
114- char *r = (char *)REAL_MEM_BASE;
115+ char *r = (char *)mem_info.offset;
116
117 if (!mem_info.ready)
118 return;
119@@ -200,13 +205,15 @@
120 return *(unsigned short *)(i * 4);
121 }
122
123-int LRMI_common_init(void)
124+void *LRMI_common_init(int high_page)
125 {
126- void *m;
127+ void *m, *offset;
128 int fd_mem;
129
130- if (!real_mem_init())
131- return 0;
132+ if (!real_mem_init(high_page))
133+ return NULL;
134+
135+ offset = mem_info.offset - REAL_MEM_BASE;
136
137 /*
138 Map the Interrupt Vectors (0x0 - 0x400) + BIOS data (0x400 - 0x502)
139@@ -217,33 +224,33 @@
140 if (fd_mem == -1) {
141 real_mem_deinit();
142 perror("open /dev/mem");
143- return 0;
144+ return NULL;
145 }
146
147- m = mmap((void *)0, 0x502,
148- PROT_READ | PROT_WRITE | PROT_EXEC,
149- MAP_FIXED | MAP_SHARED, fd_mem, 0);
150+ m = mmap(offset, 0x502,
151+ PROT_READ | PROT_WRITE | PROT_EXEC,
152+ MAP_FIXED | MAP_SHARED, fd_mem, 0);
153
154 if (m == (void *)-1) {
155 close(fd_mem);
156 real_mem_deinit();
157 perror("mmap /dev/mem");
158- return 0;
159+ return NULL;
160 }
161
162- m = mmap((void *)0xa0000, 0x100000 - 0xa0000,
163+ m = mmap(offset+0xa0000, 0x100000 - 0xa0000,
164 PROT_READ | PROT_WRITE | PROT_EXEC,
165 MAP_FIXED | MAP_SHARED, fd_mem, 0xa0000);
166
167 if (m == (void *)-1) {
168- munmap((void *)0, 0x502);
169+ munmap(offset, 0x502);
170 close(fd_mem);
171 real_mem_deinit();
172 perror("mmap /dev/mem");
173- return 0;
174+ return NULL;
175 }
176
177 close(fd_mem);
178
179- return 1;
180+ return offset;
181 }
182diff -ur libx86-1.1/x86-common.h libx86-1.1.hack/x86-common.h
183--- libx86-1.1/x86-common.h 2006-09-07 18:44:27.000000000 -0400
184+++ libx86-1.1.hack/x86-common.h 2009-10-26 16:01:19.000000000 -0400
185@@ -40,4 +40,4 @@
186
187 void *LRMI_alloc_real(int size);
188 void LRMI_free_real(void *m);
189-int LRMI_common_init(void);
190+void *LRMI_common_init(int high_page);
diff --git a/meta-oe/recipes-extended/libx86-1/libx86-1_1.1.bb b/meta-oe/recipes-extended/libx86-1/libx86-1_1.1.bb
index 7551e7dca..20c152cb4 100644
--- a/meta-oe/recipes-extended/libx86-1/libx86-1_1.1.bb
+++ b/meta-oe/recipes-extended/libx86-1/libx86-1_1.1.bb
@@ -7,7 +7,11 @@ LICENSE = "MIT & BSD-3-Clause"
7SECTION = "libs" 7SECTION = "libs"
8LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=633af6c02e6f624d4c472d970a2aca53" 8LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=633af6c02e6f624d4c472d970a2aca53"
9 9
10SRC_URI = "http://www.codon.org.uk/~mjg59/libx86/downloads/${BPN}-${PV}.tar.gz" 10SRC_URI = "http://www.codon.org.uk/~mjg59/libx86/downloads/${BPN}-${PV}.tar.gz \
11 file://libx86-mmap-offset.patch \
12 file://0001-assume-zero-is-valid-address.patch \
13"
14
11SRC_URI[md5sum] = "41bee1f8e22b82d82b5f7d7ba51abc2a" 15SRC_URI[md5sum] = "41bee1f8e22b82d82b5f7d7ba51abc2a"
12SRC_URI[sha256sum] = "5bf13104cb327472b5cb65643352a9138646becacc06763088d83001d832d048" 16SRC_URI[sha256sum] = "5bf13104cb327472b5cb65643352a9138646becacc06763088d83001d832d048"
13 17