Added sys_readbios.

Changed pci_dev_name and pci_slot_name to use safecopies.
Mae it possible to disable the use of safecopies in kputc for debugging.
This commit is contained in:
Philip Homburg 2006-07-10 12:17:16 +00:00
parent d7174ec0ab
commit 73e5de6354
5 changed files with 53 additions and 9 deletions

View file

@ -41,6 +41,7 @@ libsys_FILES=" \
sys_nice.c \
sys_out.c \
sys_physcopy.c \
sys_readbios.c \
sys_safecopy.c \
sys_vsafecopy.c \
sys_sdevio.c \

View file

@ -16,15 +16,26 @@ u16_t did;
static char name[80]; /* We need a better interface for this */
int r;
cp_grant_id_t gid;
message m;
m.m_type= BUSC_PCI_DEV_NAME;
m.m1_i1= vid;
m.m1_i2= did;
m.m1_i3= sizeof(name);
m.m1_p1= name;
gid= cpf_grant_direct(pci_procnr, (vir_bytes)name, sizeof(name),
CPF_WRITE);
if (gid == -1)
{
printf("pci_dev_name: cpf_grant_direct failed: %d\n",
errno);
return NULL;
}
m.m_type= BUSC_PCI_DEV_NAME_S;
m.m7_i1= vid;
m.m7_i2= did;
m.m7_i3= sizeof(name);
m.m7_i4= gid;
r= sendrec(pci_procnr, &m);
cpf_revoke(gid);
if (r != 0)
panic("pci", "pci_dev_name: can't talk to PCI", r);

View file

@ -15,14 +15,25 @@ int devind;
static char name[80]; /* We need a better interface for this */
int r;
cp_grant_id_t gid;
message m;
m.m_type= BUSC_PCI_SLOT_NAME;
gid= cpf_grant_direct(pci_procnr, (vir_bytes)name, sizeof(name),
CPF_WRITE);
if (gid == -1)
{
printf("pci_dev_name: cpf_grant_direct failed: %d\n",
errno);
return NULL;
}
m.m_type= BUSC_PCI_SLOT_NAME_S;
m.m1_i1= devind;
m.m1_i2= sizeof(name);
m.m1_p1= name;
m.m1_i3= gid;
r= sendrec(pci_procnr, &m);
cpf_revoke(gid);
if (r != 0)
panic("pci", "pci_slot_name: can't talk to PCI", r);
@ -32,8 +43,6 @@ int devind;
name[sizeof(name)-1]= '\0'; /* Make sure that the string is NUL
* terminated.
*/
printf("pci_slot_name: got name %s\n", name);
return name;
}

15
lib/syslib/sys_readbios.c Normal file
View file

@ -0,0 +1,15 @@
#include "syslib.h"
PUBLIC int sys_readbios(address, buf, size)
phys_bytes address; /* Absolute memory address */
void *buf; /* Buffer to store the results */
size_t size; /* Amount of data to read */
{
/* Read data from BIOS locations */
message m;
m.RDB_SIZE = size;
m.RDB_ADDR = address;
m.RDB_BUF = buf;
return(_taskcall(SYSTASK, SYS_READBIOS, &m));
}

View file

@ -11,6 +11,8 @@
static char print_buf[80]; /* output is buffered here */
int kputc_use_private_grants= 0;
/*===========================================================================*
* kputc *
*===========================================================================*/
@ -28,6 +30,12 @@ int c;
static cp_grant_id_t printgrants[PRINTPROCS];
int p;
if (kputc_use_private_grants)
{
for (p= 0; p<PRINTPROCS; p++)
printgrants[p]= GRANT_INVALID;
firstprint= 0;
}
if(firstprint) {
for(p = 0; procs[p] != NONE; p++) {
printgrants[p] = GRANT_INVALID;