Type names (uint32 -> u32, e.t.c.)

This commit is contained in:
Imbus 2024-05-24 11:26:40 +02:00
parent f5b93ef12f
commit 362d5adeb2
39 changed files with 485 additions and 489 deletions

View file

@ -32,10 +32,10 @@ char buf[BUFSZ];
void
copyin(char *s)
{
uint64 addrs[] = { 0x80000000LL, 0xffffffffffffffff };
u64 addrs[] = { 0x80000000LL, 0xffffffffffffffff };
for(int ai = 0; ai < 2; ai++){
uint64 addr = addrs[ai];
u64 addr = addrs[ai];
int fd = open("copyin1", O_CREATE|O_WRONLY);
if(fd < 0){
@ -76,10 +76,10 @@ copyin(char *s)
void
copyout(char *s)
{
uint64 addrs[] = { 0x80000000LL, 0xffffffffffffffff };
u64 addrs[] = { 0x80000000LL, 0xffffffffffffffff };
for(int ai = 0; ai < 2; ai++){
uint64 addr = addrs[ai];
u64 addr = addrs[ai];
int fd = open("README", 0);
if(fd < 0){
@ -117,10 +117,10 @@ copyout(char *s)
void
copyinstr1(char *s)
{
uint64 addrs[] = { 0x80000000LL, 0xffffffffffffffff };
u64 addrs[] = { 0x80000000LL, 0xffffffffffffffff };
for(int ai = 0; ai < 2; ai++){
uint64 addr = addrs[ai];
u64 addr = addrs[ai];
int fd = open((char *)addr, O_CREATE|O_WRONLY);
if(fd >= 0){
@ -199,11 +199,11 @@ void
copyinstr3(char *s)
{
sbrk(8192);
uint64 top = (uint64) sbrk(0);
u64 top = (u64) sbrk(0);
if((top % PGSIZE) != 0){
sbrk(PGSIZE - (top % PGSIZE));
}
top = (uint64) sbrk(0);
top = (u64) sbrk(0);
if(top % PGSIZE){
printf("oops\n");
exit(1);
@ -245,14 +245,14 @@ rwsbrk()
{
int fd, n;
uint64 a = (uint64) sbrk(8192);
u64 a = (u64) sbrk(8192);
if(a == 0xffffffffffffffffLL) {
printf("sbrk(rwsbrk) failed\n");
exit(1);
}
if ((uint64) sbrk(-8192) == 0xffffffffffffffffLL) {
if ((u64) sbrk(-8192) == 0xffffffffffffffffLL) {
printf("sbrk(rwsbrk) shrink failed\n");
exit(1);
}
@ -1397,7 +1397,7 @@ concreate(char *s)
int i, pid, n, fd;
char fa[N];
struct {
ushort inum;
u16 inum;
char name[DIRSIZ];
} de;
@ -2062,13 +2062,13 @@ sbrkmuch(char *s)
{
enum { BIG=100*1024*1024 };
char *c, *oldbrk, *a, *lastaddr, *p;
uint64 amt;
u64 amt;
oldbrk = sbrk(0);
// can one grow address space to something big?
a = sbrk(0);
amt = BIG - (uint64)a;
amt = BIG - (u64)a;
p = sbrk(amt);
if (p != a) {
printf("%s: sbrk test failed to grow big address space; enough phys mem?\n", s);
@ -2145,7 +2145,7 @@ kernmem(char *s)
void
MAXVAplus(char *s)
{
volatile uint64 a = MAXVA;
volatile u64 a = MAXVA;
for( ; a != 0; a <<= 1){
int pid;
pid = fork();
@ -2185,7 +2185,7 @@ sbrkfail(char *s)
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
if((pids[i] = fork()) == 0){
// allocate a lot of memory
sbrk(BIG - (uint64)sbrk(0));
sbrk(BIG - (u64)sbrk(0));
write(fds[1], "x", 1);
// sit around until killed
for(;;) sleep(1000);
@ -2267,10 +2267,10 @@ void
validatetest(char *s)
{
int hi;
uint64 p;
u64 p;
hi = 1100*1024;
for(p = 0; p <= (uint)hi; p += PGSIZE){
for(p = 0; p <= (u32)hi; p += PGSIZE){
// try to crash the kernel by passing in a bad string pointer
if(link("nosuchfile", (char*)p) != -1){
printf("%s: link should not succeed\n", s);
@ -2445,7 +2445,7 @@ textwrite(char *s)
}
// regression test. copyin(), copyout(), and copyinstr() used to cast
// the virtual page address to uint, which (with certain wild system
// the virtual page address to u32, which (with certain wild system
// call arguments) resulted in a kernel page faults.
void *big = (void*) 0xeaeb0b5b00002f5e;
void
@ -2471,7 +2471,7 @@ sbrkbugs(char *s)
exit(1);
}
if(pid == 0){
int sz = (uint64) sbrk(0);
int sz = (u64) sbrk(0);
// free all user memory; there used to be a bug that
// would not adjust p->sz correctly in this case,
// causing exit() to panic.
@ -2487,7 +2487,7 @@ sbrkbugs(char *s)
exit(1);
}
if(pid == 0){
int sz = (uint64) sbrk(0);
int sz = (u64) sbrk(0);
// set the break to somewhere in the very first
// page; there used to be a bug that would incorrectly
// free the first page.
@ -2503,7 +2503,7 @@ sbrkbugs(char *s)
}
if(pid == 0){
// set the break in the middle of a page.
sbrk((10*4096 + 2048) - (uint64)sbrk(0));
sbrk((10*4096 + 2048) - (u64)sbrk(0));
// reduce the break a bit, but not enough to
// cause a page to be freed. this used to cause
@ -2523,13 +2523,13 @@ sbrkbugs(char *s)
void
sbrklast(char *s)
{
uint64 top = (uint64) sbrk(0);
u64 top = (u64) sbrk(0);
if((top % 4096) != 0)
sbrk(4096 - (top % 4096));
sbrk(4096);
sbrk(10);
sbrk(-20);
top = (uint64) sbrk(0);
top = (u64) sbrk(0);
char *p = (char *) (top - 64);
p[0] = 'x';
p[1] = '\0';
@ -2789,7 +2789,7 @@ execout(char *s)
} else if(pid == 0){
// allocate all of memory.
while(1){
uint64 a = (uint64) sbrk(4096);
u64 a = (u64) sbrk(4096);
if(a == 0xffffffffffffffffLL)
break;
*(char*)(a + 4096 - 1) = 1;
@ -3005,7 +3005,7 @@ countfree()
close(fds[0]);
while(1){
uint64 a = (uint64) sbrk(4096);
u64 a = (u64) sbrk(4096);
if(a == 0xffffffffffffffff){
break;
}