ref: 6f6df11db70363d600a30960b7c7f00076e22664
parent: c78d4c4ce70f09dd6a37f0327dfdccab68b7a490
author: cinap_lenrek <[email protected]>
date: Sun Aug 13 15:19:55 EDT 2017
vmx: pass multiboot framebuffer info to kernel
--- a/sys/src/cmd/vmx/ksetup.c
+++ b/sys/src/cmd/vmx/ksetup.c
@@ -14,6 +14,8 @@
extern char **bootmod;
extern int cmdlinen;
extern char **cmdlinev;
+extern VgaMode *curmode, textmode;
+extern uintptr fbaddr, fbsz;
static int elf64;
@@ -180,7 +182,29 @@
p[6] = gpa(modp);
modp += len + 7 & -8;
}
-
+
+ if(curmode != nil && curmode != &textmode){
+ int i, o, n;
+ u16int r, g, b;
+
+ o = 0;
+ r = g = b = 0;
+ for(i = 0; i < 4; i++){
+ n = curmode->chan >> 8*i & 0xf;
+ if(n == 0) continue;
+ switch(curmode->chan >> 4 + 8*i & 0xf){
+ case CRed: r = o | n<<8; break;
+ case CGreen: g = o | n<<8; break;
+ case CBlue: b = o | n<<8; break;
+ }
+ o += n;
+ }
+ p[0] |= 1<<12;
+ pack(&p[22], "viiiisss", (u64int)fbaddr,
+ curmode->hbytes, curmode->w, curmode->h,
+ chantodepth(curmode->chan) | 1<<8, r, g, b);
+ }
+
USED(modp);
rset(RPC, entry);
rset(RAX, 0x2badb002);
@@ -560,8 +584,6 @@
{
int i, s, p;
u32int r, g, b, a, m;
- extern VgaMode *curmode, textmode;
- extern uintptr fbaddr, fbsz;
if(curmode == nil || curmode == &textmode) return;
p = r = g = b = a = 0;