amd64 fixes
This commit is contained in:
@ -20,7 +20,7 @@ static Block*
|
||||
_allocb(int size)
|
||||
{
|
||||
Block *b;
|
||||
ulong addr;
|
||||
uintptr addr;
|
||||
|
||||
if((b = mallocz(sizeof(Block)+size+Hdrspc, 0)) == nil)
|
||||
return nil;
|
||||
@ -31,13 +31,13 @@ _allocb(int size)
|
||||
b->flag = 0;
|
||||
|
||||
/* align start of data portion by rounding up */
|
||||
addr = (ulong)b;
|
||||
addr = (uintptr)b;
|
||||
addr = ROUND(addr + sizeof(Block), BLOCKALIGN);
|
||||
b->base = (uchar*)addr;
|
||||
|
||||
/* align end of data portion by rounding down */
|
||||
b->lim = ((uchar*)b) + sizeof(Block)+size+Hdrspc;
|
||||
addr = (ulong)(b->lim);
|
||||
addr = (uintptr)(b->lim);
|
||||
addr = addr & ~(BLOCKALIGN-1);
|
||||
b->lim = (uchar*)addr;
|
||||
|
||||
@ -60,7 +60,7 @@ allocb(int size)
|
||||
* Can still error out of here, though.
|
||||
*/
|
||||
if(up == nil)
|
||||
panic("allocb without up: %luX\n", getcallerpc(&size));
|
||||
panic("allocb without up: %p\n", getcallerpc(&size));
|
||||
if((b = _allocb(size)) == nil){
|
||||
panic("allocb: no memory for %d bytes\n", size);
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ decref(Ref *r)
|
||||
x = --r->ref;
|
||||
unlock(&r->lk);
|
||||
if(x < 0)
|
||||
panic("decref, pc=0x%lux", getcallerpc(&r));
|
||||
panic("decref, pc=0x%p", getcallerpc(&r));
|
||||
|
||||
return x;
|
||||
}
|
||||
@ -354,7 +354,7 @@ void
|
||||
cclose(Chan *c)
|
||||
{
|
||||
if(c->flag&CFREE)
|
||||
panic("cclose %lux", getcallerpc(&c));
|
||||
panic("cclose %p", getcallerpc(&c));
|
||||
|
||||
if(decref(&c->ref))
|
||||
return;
|
||||
|
@ -401,8 +401,8 @@ struct Proc
|
||||
int notepending; /* note issued but not acted on */
|
||||
int kp; /* true if a kernel process */
|
||||
|
||||
ulong rendtag; /* Tag for rendezvous */
|
||||
ulong rendval; /* Value for rendezvous */
|
||||
void* rendtag; /* Tag for rendezvous */
|
||||
void* rendval; /* Value for rendezvous */
|
||||
Proc *rendhash; /* Hash list for tag values */
|
||||
|
||||
int nerrlab;
|
||||
|
@ -179,4 +179,5 @@ int
|
||||
audiodevread(void *v, int n)
|
||||
{
|
||||
error("no reading");
|
||||
return -1;
|
||||
}
|
||||
|
@ -867,12 +867,17 @@ drawpoint(Point *p, uchar *a)
|
||||
p->y = BGLONG(a+1*4);
|
||||
}
|
||||
|
||||
#define isvgascreen(dst) 1
|
||||
|
||||
|
||||
Point
|
||||
drawchar(Memimage *dst, Point p, Memimage *src, Point *sp, DImage *font, int index, int op)
|
||||
drawchar(Memimage *dst, Memimage *rdst, Point p,
|
||||
Memimage *src, Point *sp, DImage *font, int index, int op)
|
||||
{
|
||||
FChar *fc;
|
||||
Rectangle r;
|
||||
Point sp1;
|
||||
static Memimage *tmp;
|
||||
|
||||
fc = &font->fchar[index];
|
||||
r.min.x = p.x+fc->left;
|
||||
@ -881,7 +886,31 @@ drawchar(Memimage *dst, Point p, Memimage *src, Point *sp, DImage *font, int ind
|
||||
r.max.y = r.min.y+(fc->maxy-fc->miny);
|
||||
sp1.x = sp->x+fc->left;
|
||||
sp1.y = sp->y+fc->miny;
|
||||
memdraw(dst, r, src, sp1, font->image, Pt(fc->minx, fc->miny), op);
|
||||
|
||||
/*
|
||||
* If we're drawing greyscale fonts onto a VGA screen,
|
||||
* it's very costly to read the screen memory to do the
|
||||
* alpha blending inside memdraw. If this is really a stringbg,
|
||||
* then rdst is the bg image (in main memory) which we can
|
||||
* refer to for the underlying dst pixels instead of reading dst
|
||||
* directly.
|
||||
*/
|
||||
if(1 || (isvgascreen(dst) && !isvgascreen(rdst) /*&& font->image->depth > 1*/)){
|
||||
if(tmp == nil || tmp->chan != dst->chan || Dx(tmp->r) < Dx(r) || Dy(tmp->r) < Dy(r)){
|
||||
if(tmp)
|
||||
freememimage(tmp);
|
||||
tmp = allocmemimage(Rect(0,0,Dx(r),Dy(r)), dst->chan);
|
||||
if(tmp == nil)
|
||||
goto fallback;
|
||||
}
|
||||
memdraw(tmp, Rect(0,0,Dx(r),Dy(r)), rdst, r.min, memopaque, ZP, S);
|
||||
memdraw(tmp, Rect(0,0,Dx(r),Dy(r)), src, sp1, font->image, Pt(fc->minx, fc->miny), op);
|
||||
memdraw(dst, r, tmp, ZP, memopaque, ZP, S);
|
||||
}else{
|
||||
fallback:
|
||||
memdraw(dst, r, src, sp1, font->image, Pt(fc->minx, fc->miny), op);
|
||||
}
|
||||
|
||||
p.x += fc->width;
|
||||
sp->x += fc->width;
|
||||
return p;
|
||||
@ -1873,6 +1902,7 @@ drawmesg(Client *client, void *av, int n)
|
||||
clipr = dst->clipr;
|
||||
dst->clipr = r;
|
||||
op = drawclientop(client);
|
||||
l = dst;
|
||||
if(*a == 'x'){
|
||||
/* paint background */
|
||||
l = drawimage(client, a+47);
|
||||
@ -1901,7 +1931,7 @@ drawmesg(Client *client, void *av, int n)
|
||||
dst->clipr = clipr;
|
||||
error(Eindex);
|
||||
}
|
||||
q = drawchar(dst, q, src, &sp, font, ci, op);
|
||||
q = drawchar(dst, l, q, src, &sp, font, ci, op);
|
||||
u += 2;
|
||||
}
|
||||
dst->clipr = clipr;
|
||||
|
@ -15,7 +15,7 @@ lfdchan(int fd)
|
||||
|
||||
c = newchan();
|
||||
c->type = devno('L', 0);
|
||||
c->aux = (void*)fd;
|
||||
c->aux = (void*)(uintptr)fd;
|
||||
c->name = newcname("fd");
|
||||
c->mode = ORDWR;
|
||||
c->qid.type = 0;
|
||||
@ -76,14 +76,14 @@ lfdopen(Chan *c, int omode)
|
||||
static void
|
||||
lfdclose(Chan *c)
|
||||
{
|
||||
close((int)c->aux);
|
||||
close((int)(uintptr)c->aux);
|
||||
}
|
||||
|
||||
static long
|
||||
lfdread(Chan *c, void *buf, long n, vlong off)
|
||||
{
|
||||
USED(off); /* can't pread on pipes */
|
||||
n = read((int)c->aux, buf, n);
|
||||
n = read((int)(uintptr)c->aux, buf, n);
|
||||
if(n < 0){
|
||||
iprint("error %d\n", errno);
|
||||
oserror();
|
||||
@ -96,7 +96,7 @@ lfdwrite(Chan *c, void *buf, long n, vlong off)
|
||||
{
|
||||
USED(off); /* can't pread on pipes */
|
||||
|
||||
n = write((int)c->aux, buf, n);
|
||||
n = write((int)(uintptr)c->aux, buf, n);
|
||||
if(n < 0){
|
||||
iprint("error %d\n", errno);
|
||||
oserror();
|
||||
|
@ -1037,7 +1037,7 @@ alloctag(void)
|
||||
|
||||
for(i = 0; i < NMASK; i++){
|
||||
v = mntalloc.tagmask[i];
|
||||
if(v == ~0UL)
|
||||
if(v == ~0)
|
||||
continue;
|
||||
for(j = 0; j < 1<<TAGSHIFT; j++)
|
||||
if((v & (1<<j)) == 0){
|
||||
|
@ -358,7 +358,7 @@ sslwstat(Chan *c, uchar *db, int n)
|
||||
|
||||
if(!emptystr(dir->uid))
|
||||
kstrdup(&s->user, dir->uid);
|
||||
if(dir->mode != ~0UL)
|
||||
if(dir->mode != ~0)
|
||||
s->perm = dir->mode;
|
||||
|
||||
free(dir);
|
||||
|
@ -224,7 +224,7 @@ static void put64(uchar *p, vlong x);
|
||||
static void put32(uchar *p, u32int);
|
||||
static void put24(uchar *p, int);
|
||||
static void put16(uchar *p, int);
|
||||
static u32int get32(uchar *p);
|
||||
/* static u32int get32(uchar *p); */
|
||||
static int get16(uchar *p);
|
||||
static void tlsSetState(TlsRec *tr, int new, int old);
|
||||
static void rcvAlert(TlsRec *tr, int err);
|
||||
@ -241,14 +241,18 @@ static char *tlsstate(int s);
|
||||
static void pdump(int, void*, char*);
|
||||
|
||||
static char *tlsnames[] = {
|
||||
[Qclonus] "clone",
|
||||
[Qencalgs] "encalgs",
|
||||
[Qhashalgs] "hashalgs",
|
||||
[Qdata] "data",
|
||||
[Qctl] "ctl",
|
||||
[Qhand] "hand",
|
||||
[Qstatus] "status",
|
||||
[Qstats] "stats",
|
||||
/* unused */ 0,
|
||||
/* topdir */ 0,
|
||||
/* protodir */ 0,
|
||||
"clone",
|
||||
"encalgs",
|
||||
"hashalgs",
|
||||
/* convdir */ 0,
|
||||
"data",
|
||||
"ctl",
|
||||
"hand",
|
||||
"status",
|
||||
"stats",
|
||||
};
|
||||
|
||||
static int convdir[] = { Qctl, Qdata, Qhand, Qstatus, Qstats };
|
||||
@ -2132,11 +2136,13 @@ put16(uchar *p, int x)
|
||||
p[1] = x;
|
||||
}
|
||||
|
||||
/*
|
||||
static u32int
|
||||
get32(uchar *p)
|
||||
{
|
||||
return (p[0]<<24)|(p[1]<<16)|(p[2]<<8)|p[3];
|
||||
}
|
||||
*/
|
||||
|
||||
static int
|
||||
get16(uchar *p)
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <pthread.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/select.h>
|
||||
#include <signal.h>
|
||||
#include <pwd.h>
|
||||
#include <errno.h>
|
||||
|
@ -96,7 +96,7 @@ padblock(Block *bp, int size)
|
||||
}
|
||||
|
||||
if(bp->next)
|
||||
panic("padblock 0x%luX", getcallerpc(&bp));
|
||||
panic("padblock 0x%p", getcallerpc(&bp));
|
||||
n = BLEN(bp);
|
||||
padblockcnt++;
|
||||
nbp = allocb(size+n);
|
||||
@ -110,7 +110,7 @@ padblock(Block *bp, int size)
|
||||
size = -size;
|
||||
|
||||
if(bp->next)
|
||||
panic("padblock 0x%luX", getcallerpc(&bp));
|
||||
panic("padblock 0x%p", getcallerpc(&bp));
|
||||
|
||||
if(bp->lim - bp->wp >= size)
|
||||
return bp;
|
||||
@ -1270,7 +1270,7 @@ qwrite(Queue *q, void *vp, int len)
|
||||
uchar *p = vp;
|
||||
|
||||
QDEBUG if(!islo())
|
||||
print("qwrite hi %lux\n", getcallerpc(&q));
|
||||
print("qwrite hi %p\n", getcallerpc(&q));
|
||||
|
||||
sofar = 0;
|
||||
do {
|
||||
|
@ -139,7 +139,7 @@ rdb(void)
|
||||
}
|
||||
|
||||
void
|
||||
setmalloctag(void *v, ulong tag)
|
||||
setmalloctag(void *v, uintptr tag)
|
||||
{
|
||||
USED(v);
|
||||
USED(tag);
|
||||
|
@ -1189,15 +1189,15 @@ rerrstr(char *buf, uint n)
|
||||
return strlen(buf);
|
||||
}
|
||||
|
||||
ulong
|
||||
_sysrendezvous(ulong arg0, ulong arg1)
|
||||
void*
|
||||
_sysrendezvous(void* arg0, void* arg1)
|
||||
{
|
||||
ulong tag, val;
|
||||
void *tag, *val;
|
||||
Proc *p, **l;
|
||||
|
||||
tag = arg0;
|
||||
l = &REND(up->rgrp, tag);
|
||||
up->rendval = ~0UL;
|
||||
l = &REND(up->rgrp, (uintptr)tag);
|
||||
up->rendval = (void*)~0;
|
||||
|
||||
lock(&up->rgrp->ref.lk);
|
||||
for(p = *l; p; p = p->rendhash) {
|
||||
@ -1228,15 +1228,15 @@ _sysrendezvous(ulong arg0, ulong arg1)
|
||||
return up->rendval;
|
||||
}
|
||||
|
||||
ulong
|
||||
sysrendezvous(ulong tag, ulong val)
|
||||
void*
|
||||
sysrendezvous(void *tag, void *val)
|
||||
{
|
||||
ulong n;
|
||||
void *n;
|
||||
|
||||
starterror();
|
||||
if(waserror()){
|
||||
_syserror();
|
||||
return -1;
|
||||
return (void*)~0;
|
||||
}
|
||||
n = _sysrendezvous(tag, val);
|
||||
enderror();
|
||||
|
Reference in New Issue
Block a user