OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Mar 29, 2024 9:45 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Errors while using far pointer in c Using gcc on linux
PostPosted: Wed Jun 07, 2017 8:09 am 
Offline
Member
Member

Joined: Sat Apr 29, 2017 6:56 am
Posts: 26
I had to use far pointers in Kernel , when i using the far pointer to test i coded to test the following code before using in my kernel . Getting errors.

#include <stdio.h>

int main(){
int a=50;
int far* b;
b=&a;
printf("%Fp",b);

return 0;
}
test.c: In function ‘main’:
test.c:5:13: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
int far* b;
^
test.c:5:15: error: ‘b’ undeclared (first use in this function)
int far* b;
^
test.c:5:15: note: each undeclared identifier is reported only once for each function it appears in


Top
 Profile  
 
 Post subject: Re: Errors while using far pointer in c Using gcc on linux
PostPosted: Wed Jun 07, 2017 8:22 am 
Offline
Member
Member

Joined: Tue May 13, 2014 3:02 am
Posts: 280
Location: Private, UK
GCC, being a compiler for a 32/64-bit "flat" memory model, doesn't support "far" pointers. "Far" and "near" pointers only make sense in segmented memory arrangements.

Ideally, your kernel would be in 32/64-bit mode with a flat memory model before you even start running C code...

_________________
Image


Top
 Profile  
 
 Post subject: Re: Errors while using far pointer in c Using gcc on linux
PostPosted: Thu Jun 08, 2017 12:39 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4591
Location: Chichester, UK
Just use a different processor.

https://gcc.gnu.org/onlinedocs/gcc/Name ... paces.html


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot] and 166 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group